Python SDK for IDaaS AKless Adapter — obtain STS temporary credentials through IDaaS PAM to access Tencent Cloud services without SecretKey
Project description
idaas-python-akless-tencent-adapter
English | 简体中文
Python SDK for the IDaaS (Identity as a Service) AKless Adapter — obtain STS temporary credentials through IDaaS PAM (Privileged Access Management) to access Tencent Cloud services without SecretKey.
Features
- AK-Free Authentication: No long-term SecretKey required. Uses OIDC Token to obtain STS temporary credentials via IDaaS PAM, reducing the risk of credential leakage
- Multi-SDK Adaptation: Provides credential provider adapters for multiple Tencent Cloud official SDKs, including Tencent Cloud SDK and COS SDK
- Auto Credential Refresh: Built-in credential caching and expiration-based auto-refresh mechanism to ensure seamless credential rotation
- Easy Integration: Factory class provides one-line credential provider creation, minimizing integration cost
Requirements
- Python >= 3.9
- Dependencies:
- cloud-idaas-core >= 0.0.5-beta
Installation
pip install cloud-idaas-akless-tencent-adapter
Prerequisites
This SDK depends on cloud-idaas-core. You need to complete the IDaaS Core SDK initialization before using this adapter.
-
Install and configure
cloud-idaas-core. See cloud-idaas-core README for details. -
In the configuration file, set the
scopeto the IDaaS PAM built-in scope:{ "scope": "urn:cloud:idaas:pam|cloud_account_role:obtain_access_credential" }
-
Complete the IDaaS Core SDK initialization:
from cloud_idaas.core import IDaaSCredentialProviderFactory IDaaSCredentialProviderFactory.init()
Quick Start
The simplest way to use this SDK is through the IDaaSPamAklessCredentialFactory factory class:
from cloud_idaas.core import IDaaSCredentialProviderFactory
from cloud_idaas.adapter.tencentcloud.pam import IDaaSPamAklessCredentialFactory
# 1. Initialize IDaaS Core SDK
IDaaSCredentialProviderFactory.init()
# 2. Create Tencent Cloud credentials provider
credentials_provider = IDaaSPamAklessCredentialFactory.get_tencent_cloud_credentials_provider(
role_arn="your-role-arn"
)
# 3. Get credentials
credential = credentials_provider.get_credentials()
print(credential.secretId)
print(credential.secretKey)
print(credential.token)
Usage Examples
Tencent Cloud SDK (tencentcloud-sdk-python)
from tencentcloud.cvm.v20170312 import cvm_client
from cloud_idaas.core import IDaaSCredentialProviderFactory
from cloud_idaas.adapter.tencentcloud.pam import IDaaSPamAklessCredentialFactory
# Initialize
IDaaSCredentialProviderFactory.init()
# Create Tencent Cloud credentials provider
credentials_provider = IDaaSPamAklessCredentialFactory.get_tencent_cloud_credentials_provider(
role_arn="your-role-arn"
)
# Get credentials and use with Tencent Cloud SDK
credential = credentials_provider.get_credentials()
client = cvm_client.CvmClient(credential, "ap-guangzhou")
COS (cos-python-sdk-v5)
from qcloud_cos import CosS3Client
from cloud_idaas.core import IDaaSCredentialProviderFactory
from cloud_idaas.adapter.tencentcloud.pam import IDaaSPamAklessCredentialFactory
# Initialize
IDaaSCredentialProviderFactory.init()
# Create COS credentials provider
cos_provider = IDaaSPamAklessCredentialFactory.get_cos_credential_provider(
role_arn="your-role-arn"
)
# Use with COS SDK
cos_config = cos_provider.get_cos_config(region="ap-guangzhou")
cos_client = CosS3Client(cos_config)
API Reference
IDaaSPamAklessCredentialFactory
Factory class providing static methods to create credential providers.
| Method | Return Type | Description |
|---|---|---|
get_tencent_cloud_credentials_provider(role_arn) |
IDaaSPamTencentCloudCredentialsProvider |
Create a Tencent Cloud credentials provider |
get_cos_credential_provider(role_arn) |
IDaaSPamTencentCloudCOSCredentialsProvider |
Create a COS SDK credentials provider |
Environment Variables
| Variable | Description |
|---|---|
CLOUD_IDAAS_CONFIG_PATH |
IDaaS configuration file path |
TENCENT_CLOUD_ROLE_ARN |
Fallback for the cloud-account role ARN |
TENCENT_CLOUD_OIDC_TOKEN_FILE |
Path to an OIDC token file (used when no oidc_token_provider is given) |
Support & Feedback
- Email: cloudidaas@list.alibaba-inc.com
- Issues: For questions or suggestions, please submit an Issue
License
This project is licensed under the Apache License 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cloud_idaas_akless_tencent_adapter-0.0.1b0.tar.gz.
File metadata
- Download URL: cloud_idaas_akless_tencent_adapter-0.0.1b0.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14ecb5f767ee533ccaaee25260a5e0475ecc89c80c791a31ad734af2013a8037
|
|
| MD5 |
788c9ddf76a746dfcfae57a0aa247317
|
|
| BLAKE2b-256 |
f72e661b511ed173a9ff54003f197f64c9bd92b178024d85f56120c496321b30
|
Provenance
The following attestation bundles were made for cloud_idaas_akless_tencent_adapter-0.0.1b0.tar.gz:
Publisher:
publish.yml on cloud-idaas/idaas-python-akless-tencent-adapter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloud_idaas_akless_tencent_adapter-0.0.1b0.tar.gz -
Subject digest:
14ecb5f767ee533ccaaee25260a5e0475ecc89c80c791a31ad734af2013a8037 - Sigstore transparency entry: 2217089333
- Sigstore integration time:
-
Permalink:
cloud-idaas/idaas-python-akless-tencent-adapter@baa817e4f28dceb2049b0c8a7f0b379ab5521e39 -
Branch / Tag:
refs/tags/v0.0.1b0_1 - Owner: https://github.com/cloud-idaas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@baa817e4f28dceb2049b0c8a7f0b379ab5521e39 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cloud_idaas_akless_tencent_adapter-0.0.1b0-py3-none-any.whl.
File metadata
- Download URL: cloud_idaas_akless_tencent_adapter-0.0.1b0-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34d687c52a1c567cf67027fea1b5c467b89db455494c5cffd558bc793886ee8e
|
|
| MD5 |
b0a4644ba47221ee1b9d7394dee0a170
|
|
| BLAKE2b-256 |
e78e7b106f30a6fef0bd195649e46a3f3cff5d9120904fedd85c1075e0b4692a
|
Provenance
The following attestation bundles were made for cloud_idaas_akless_tencent_adapter-0.0.1b0-py3-none-any.whl:
Publisher:
publish.yml on cloud-idaas/idaas-python-akless-tencent-adapter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloud_idaas_akless_tencent_adapter-0.0.1b0-py3-none-any.whl -
Subject digest:
34d687c52a1c567cf67027fea1b5c467b89db455494c5cffd558bc793886ee8e - Sigstore transparency entry: 2217089358
- Sigstore integration time:
-
Permalink:
cloud-idaas/idaas-python-akless-tencent-adapter@baa817e4f28dceb2049b0c8a7f0b379ab5521e39 -
Branch / Tag:
refs/tags/v0.0.1b0_1 - Owner: https://github.com/cloud-idaas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@baa817e4f28dceb2049b0c8a7f0b379ab5521e39 -
Trigger Event:
push
-
Statement type: