Skip to content

Commit 0568556

Browse files
committed
chore: restructure token managers into a directory
1 parent 3e73ce2 commit 0568556

File tree

11 files changed

+27
-9
lines changed

11 files changed

+27
-9
lines changed

ibm_cloud_sdk_core/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838

3939
from .base_service import BaseService
4040
from .detailed_response import DetailedResponse
41-
from .iam_token_manager import IAMTokenManager
42-
from .jwt_token_manager import JWTTokenManager
43-
from .cp4d_token_manager import CP4DTokenManager
41+
from .token_managers.iam_token_manager import IAMTokenManager
42+
from .token_managers.jwt_token_manager import JWTTokenManager
43+
from .token_managers.cp4d_token_manager import CP4DTokenManager
4444
from .api_exception import ApiException
4545
from .utils import datetime_to_string, string_to_datetime, read_external_sources
4646
from .utils import datetime_to_string_list, string_to_datetime_list

ibm_cloud_sdk_core/authenticators/cp4d_authenticator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from requests import Request
2020

2121
from .authenticator import Authenticator
22-
from ..cp4d_token_manager import CP4DTokenManager
22+
from ..token_managers.cp4d_token_manager import CP4DTokenManager
2323
from ..utils import has_bad_first_or_last_char
2424

2525

ibm_cloud_sdk_core/authenticators/iam_authenticator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from typing import Dict, Optional
1818

1919
from .iam_request_based_authenticator import IAMRequestBasedAuthenticator
20-
from ..iam_token_manager import IAMTokenManager
20+
from ..token_managers.iam_token_manager import IAMTokenManager
2121
from ..utils import has_bad_first_or_last_char
2222

2323
class IAMAuthenticator(IAMRequestBasedAuthenticator):

ibm_cloud_sdk_core/base_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
cleanup_values, read_external_sources, strip_extra_slashes)
3434
from .detailed_response import DetailedResponse
3535
from .api_exception import ApiException
36-
from .token_manager import TokenManager
36+
from .token_managers.token_manager import TokenManager
3737

3838
# Uncomment this to enable http debugging
3939
# import http.client as http_client
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# coding: utf-8
2+
3+
# Copyright 2021 IBM All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.

ibm_cloud_sdk_core/cp4d_token_manager.py renamed to ibm_cloud_sdk_core/token_managers/cp4d_token_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import json
1818
from typing import Dict, Optional
19+
1920
from .jwt_token_manager import JWTTokenManager
2021

2122

ibm_cloud_sdk_core/iam_request_based_token_manager.py renamed to ibm_cloud_sdk_core/token_managers/iam_request_based_token_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from .jwt_token_manager import JWTTokenManager
2020

21+
2122
class IAMRequestBasedTokenManager(JWTTokenManager):
2223
"""The IamRequestBasedTokenManager class contains code relevant to any token manager that
2324
interacts with the IAM service to manage a token. It stores information relevant to all

ibm_cloud_sdk_core/iam_token_manager.py renamed to ibm_cloud_sdk_core/token_managers/iam_token_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from .iam_request_based_token_manager import IAMRequestBasedTokenManager
2020

21+
2122
class IAMTokenManager(IAMRequestBasedTokenManager):
2223
"""The IAMTokenManager takes an api key and performs the necessary interactions with
2324
the IAM token service to obtain and store a suitable bearer token. Additionally, the IAMTokenManager

ibm_cloud_sdk_core/jwt_token_manager.py renamed to ibm_cloud_sdk_core/token_managers/jwt_token_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
import jwt
2121
import requests
22-
from .api_exception import ApiException
2322
from .token_manager import TokenManager
23+
from ..api_exception import ApiException
2424

2525

2626
# pylint: disable=too-many-instance-attributes

ibm_cloud_sdk_core/token_manager.py renamed to ibm_cloud_sdk_core/token_managers/token_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import time
2222
import requests
2323

24-
from .api_exception import ApiException
24+
from ..api_exception import ApiException
2525

2626

2727
# pylint: disable=too-many-instance-attributes

test/test_token_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import pytest
2222

2323
from ibm_cloud_sdk_core import ApiException
24-
from ibm_cloud_sdk_core.token_manager import TokenManager
24+
from ibm_cloud_sdk_core.token_managers.token_manager import TokenManager
2525

2626

2727
class MockTokenManager(TokenManager):

0 commit comments

Comments
 (0)