File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,29 @@ Using this flow is less secure since the token is long-lived. You can provide th
154
154
2 . Setting the environment variable `STACKIT_SERVICE_ACCOUNT_TOKEN`
155
155
3 . Setting it in the credentials file (see above)
156
156
157
+ ## Using custom endpoints
158
+
159
+ The example below shows how to use the STACKIT Python SDK in custom STACKIT environments.
160
+
161
+ ```python
162
+ from stackit.iaas.api.default_api import DefaultApi
163
+ from stackit.core.configuration import Configuration
164
+
165
+ project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
166
+
167
+ # Create a new API client that uses custom authentication and service endpoints
168
+ config = Configuration(
169
+ service_account_key_path="/home/bob/.stackit/sa_key.json",
170
+ custom_token_endpoint="https://service-account.api.qa.stackit.cloud/token",
171
+ custom_endpoint="https://iaas.api.eu01.qa.stackit.cloud",
172
+ )
173
+ client = DefaultApi(config)
174
+
175
+ print(client.list_project_nics(
176
+ project_id=project_id,
177
+ ))
178
+ ```
179
+
157
180
## Reporting issues
158
181
159
182
If you encounter any issues or have suggestions for improvements, please open an issue in the repository or create a ticket in the [ STACKIT Help Center] ( https://support.stackit.cloud/ ) .
Original file line number Diff line number Diff line change @@ -32,13 +32,14 @@ def __init__(
32
32
private_key_path = None ,
33
33
credentials_file_path = None ,
34
34
custom_endpoint = None ,
35
+ custom_token_endpoint = None ,
35
36
custom_http_session = None ,
36
37
custom_auth = None ,
37
38
server_index = None ,
38
39
) -> None :
39
40
environment_variables = EnvironmentVariables ()
40
41
self .region = region if region else environment_variables .region
41
- self .token_endpoint = environment_variables .token_baseurl
42
+ self .token_endpoint = custom_token_endpoint if custom_token_endpoint else environment_variables .token_baseurl
42
43
self .service_account_token = (
43
44
environment_variables .service_account_token if service_account_token is None else service_account_token
44
45
)
You can’t perform that action at this time.
0 commit comments