Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9580dea

Browse files
authored
chore(sdk): add support for custom auth endpoint and add example (#1272)
1 parent8d13395 commit9580dea

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
##Release (2025-XX-YY)
2+
-`core`:[v0.2.0](core/CHANGELOG.md#v020-2025-06-12)
3+
-**Feature:** Allow setting custom token endpoint url in configuration
24
-`iaas`:[v0.5.3](services/iaas/CHANGELOG.md#v053-2025-06-12)
35
- Increase max length of description from 127 to 255 for
46
- Security groups:`BaseSecurityGroupRule`,`CreateSecurityGroupPayload`,`CreateSecurityGroupRulePayload`,`SecurityGroup`,`SecurityGroupRule`,`UpdateSecurityGroupPayload`

‎README.md‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
[![CD Workflow](https://github.com/stackitcloud/stackit-sdk-python/actions/workflows/cd.yaml/badge.svg)](https://github.com/stackitcloud/stackit-sdk-python/actions/workflows/cd.yaml)
44
[![Dependency-Updater](https://github.com/stackitcloud/stackit-sdk-python/actions/workflows/dependency-checker.yaml/badge.svg)](https://github.com/stackitcloud/stackit-sdk-python/actions/workflows/dependency-checker.yaml)
55

6-
>ⓘ INFO: The STACKIT Python SDK is in beta and in active development.
6+
>[!NOTE]
7+
>The STACKIT Python SDK is in beta and in active development.
78
89
#Overview
910

@@ -154,6 +155,29 @@ Using this flow is less secure since the token is long-lived. You can provide th
154155
2. Setting the environment variable `STACKIT_SERVICE_ACCOUNT_TOKEN`
155156
3. Setting it in the credentials file (see above)
156157

158+
## Using custom endpoints
159+
160+
The example below shows how to use the STACKIT Python SDK in custom STACKIT environments.
161+
162+
```python
163+
from stackit.iaas.api.default_api import DefaultApi
164+
from stackit.core.configuration import Configuration
165+
166+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
167+
168+
# Create a new API client that uses custom authentication and service endpoints
169+
config = Configuration(
170+
service_account_key_path="/home/bob/.stackit/sa_key.json",
171+
custom_token_endpoint="https://service-account.api.stackit.cloud/token",
172+
custom_endpoint="https://iaas.api.eu01.stackit.cloud",
173+
)
174+
client = DefaultApi(config)
175+
176+
print(client.list_project_nics(
177+
project_id=project_id,
178+
))
179+
```
180+
157181
##Reporting issues
158182

159183
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/).

‎core/CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
##v0.2.0 (2025-06-12)
2+
-**Feature:** Allow setting custom token endpoint url in configuration
3+
14
##v0.1.0 (2024-12-04)
25

36
- The core module offers functionality, such as authorization and configuration, to be used together with the Python SDK service modules

‎core/pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "stackit-core"
33

44
[tool.poetry]
55
name ="stackit-core"
6-
version ="v0.1.0"
6+
version ="v0.2.0"
77
authors = ["STACKIT Developer Tools <developer-tools@stackit.cloud>"]
88
description ="Core functionality for the STACKIT SDK for Python"
99
readme ="README.md"

‎core/src/stackit/core/configuration.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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=regionifregionelseenvironment_variables.region
41-
self.token_endpoint=environment_variables.token_baseurl
42+
self.token_endpoint=custom_token_endpointifcustom_token_endpointelseenvironment_variables.token_baseurl
4243
self.service_account_token= (
4344
environment_variables.service_account_tokenifservice_account_tokenisNoneelseservice_account_token
4445
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp