Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
language: python
python:
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
env:
- PYTHONPATH=$PYTHONPATH:$TRAVIS_BUILD_DIR
# command to install dependencies
install:
- pip install coverage
- pip install requests
- pip install alibabacloud-tea
# command to run tests
script:
Expand Down
14 changes: 14 additions & 0 deletions alibabacloud_credentials/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,17 @@ def get_type(self):
@attribute_error_return_none
def get_bearer_token(self):
return self.cloud_credential.bearer_token


class AioClient(Client):
@attribute_error_return_none
async def get_access_key_id(self):
return self.cloud_credential.get_access_key_id()

@attribute_error_return_none
async def get_access_key_secret(self):
return self.cloud_credential.get_access_key_secret()

@attribute_error_return_none
async def get_security_token(self):
return self.cloud_credential.get_security_token()
131 changes: 124 additions & 7 deletions alibabacloud_credentials/models.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,138 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel


class Config(TeaModel):
def __init__(self, type='', access_key_id='', access_key_secret='', role_arn='', role_session_name='',
public_key_id='', role_name='', private_key_file='', bearer_token='', security_token='', host='',
timeout=1000, connect_timeout=1000, proxy=''):
self.type = type
"""
Model for initing credential
"""
def __init__(
self,
access_key_id: str = '',
access_key_secret: str = '',
security_token: str = '',
bearer_token: str = '',
duration_seconds: int = '',
role_arn: str = '',
policy: str = '',
role_session_expiration: int = '',
role_session_name: str = '',
public_key_id: str = '',
private_key_file: str = '',
role_name: str = '',
type: str = '',
host: str = '',
timeout: int = 1000,
connect_timeout: int = 1000,
proxy: str = '',
):
# accesskey id
self.access_key_id = access_key_id
# accesskey secret
self.access_key_secret = access_key_secret
# security token
self.security_token = security_token
# bearer token
self.bearer_token = bearer_token
# duration seconds
self.duration_seconds = duration_seconds
# role arn
self.role_arn = role_arn
# policy
self.policy = policy
# role session expiration
self.role_session_expiration = role_session_expiration
# role session name
self.role_session_name = role_session_name
# publicKey id
self.public_key_id = public_key_id
self.role_name = role_name
# privateKey file
self.private_key_file = private_key_file
self.bearer_token = bearer_token
self.security_token = security_token
# role name
self.role_name = role_name
# credential type
self.type = type
self.host = host
self.timeout = timeout
self.connect_timeout = connect_timeout
self.proxy = proxy

def validate(self):
pass

def to_map(self):
result = dict()
if self.access_key_id is not None:
result['accessKeyId'] = self.access_key_id
if self.access_key_secret is not None:
result['accessKeySecret'] = self.access_key_secret
if self.security_token is not None:
result['securityToken'] = self.security_token
if self.bearer_token is not None:
result['bearerToken'] = self.bearer_token
if self.duration_seconds is not None:
result['durationSeconds'] = self.duration_seconds
if self.role_arn is not None:
result['roleArn'] = self.role_arn
if self.policy is not None:
result['policy'] = self.policy
if self.role_session_expiration is not None:
result['roleSessionExpiration'] = self.role_session_expiration
if self.role_session_name is not None:
result['roleSessionName'] = self.role_session_name
if self.public_key_id is not None:
result['publicKeyId'] = self.public_key_id
if self.private_key_file is not None:
result['privateKeyFile'] = self.private_key_file
if self.role_name is not None:
result['roleName'] = self.role_name
if self.type is not None:
result['type'] = self.type
if self.host is not None:
result['host'] = self.host
if self.timeout is not None:
result['timeout'] = self.timeout
if self.connect_timeout is not None:
result['connectTimeout'] = self.connect_timeout
if self.proxy is not None:
result['proxy'] = self.proxy
return result

def from_map(self, m: dict = None):
m = m or dict()
if m.get('accessKeyId') is not None:
self.access_key_id = m.get('accessKeyId')
if m.get('accessKeySecret') is not None:
self.access_key_secret = m.get('accessKeySecret')
if m.get('securityToken') is not None:
self.security_token = m.get('securityToken')
if m.get('bearerToken') is not None:
self.bearer_token = m.get('bearerToken')
if m.get('durationSeconds') is not None:
self.duration_seconds = m.get('durationSeconds')
if m.get('roleArn') is not None:
self.role_arn = m.get('roleArn')
if m.get('policy') is not None:
self.policy = m.get('policy')
if m.get('roleSessionExpiration') is not None:
self.role_session_expiration = m.get('roleSessionExpiration')
if m.get('roleSessionName') is not None:
self.role_session_name = m.get('roleSessionName')
if m.get('publicKeyId') is not None:
self.public_key_id = m.get('publicKeyId')
if m.get('privateKeyFile') is not None:
self.private_key_file = m.get('privateKeyFile')
if m.get('roleName') is not None:
self.role_name = m.get('roleName')
if m.get('type') is not None:
self.type = m.get('type')
if m.get('host') is not None:
self.host = m.get('host')
if m.get('timeout') is not None:
self.timeout = m.get('timeout')
if m.get('connectTimeout') is not None:
self.connect_timeout = m.get('connectTimeout')
if m.get('proxy') is not None:
self.proxy = m.get('proxy')
return self
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
under the License.
"""

import sys
import os
from setuptools import setup, find_packages

Expand Down Expand Up @@ -48,18 +47,17 @@
'keywords': ["alibabacloud", "sdk", "tea"],
'packages': find_packages(exclude=["tests*"]),
'platforms': 'any',
'python_requires': '>=3.6',
'install_requires': ['alibabacloud-tea'],
'classifiers': (
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Software Development',
)
}
Expand Down