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
1541542 . Setting the environment variable `STACKIT_SERVICE_ACCOUNT_TOKEN`
1551553 . Setting it in the credentials file (see above)
156156
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+
157180## Reporting issues
158181
159182If 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__(
3232 private_key_path = None ,
3333 credentials_file_path = None ,
3434 custom_endpoint = None ,
35+ custom_token_endpoint = None ,
3536 custom_http_session = None ,
3637 custom_auth = None ,
3738 server_index = None ,
3839 ) -> None :
3940 environment_variables = EnvironmentVariables ()
4041 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
4243 self .service_account_token = (
4344 environment_variables .service_account_token if service_account_token is None else service_account_token
4445 )
You can’t perform that action at this time.
0 commit comments