Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif os.environ.get('ALIYUN_ACCESS_KEY_ID') is not None and os.environ.get('ALIYUN_ACCESS_KEY_SECRET') is not None:
access_key_credential = credentials.AccessKeyCredential(os.environ.get('ALIYUN_ACCESS_KEY_ID'),
os.environ.get('ALIYUN_ACCESS_KEY_SECRET'))
return access_key_signer.AccessKeySigner(access_key_credential)
elif cred['credential'] is not None:
credential = cred['credential']
if isinstance(credential, credentials.AccessKeyCredential):
return access_key_signer.AccessKeySigner(credential)
elif isinstance(credential, credentials.StsTokenCredential):
return sts_token_signer.StsTokenSigner(credential)
elif isinstance(credential, credentials.RamRoleArnCredential):
return ram_role_arn_signer.RamRoleArnSigner(credential, do_action_api)
elif isinstance(credential, credentials.EcsRamRoleCredential):
return ecs_ram_role_singer.EcsRamRoleSigner(credential)
elif isinstance(credential, credentials.RsaKeyPairCredential):
return rsa_key_pair_signer.RsaKeyPairSigner(credential, region_id, debug)
elif cred['public_key_id'] is not None and cred['private_key'] is not None:
logging.info("'AcsClient(regionId, pub_key_id, pri_key)' is deprecated")
rsa_key_pair_credential = credentials.RsaKeyPairCredential(cred['public_key_id'], cred['private_key'],
cred['session_period'], region_id, debug)
return rsa_key_pair_signer.RsaKeyPairSigner(rsa_key_pair_credential)
else:
raise exceptions.ClientException(error_code.SDK_INVALID_CREDENTIAL,
error_msg.get_msg('SDK_INVALID_CREDENTIAL'))
credential = cred['credential']
if isinstance(credential, credentials.AccessKeyCredential):
return access_key_signer.AccessKeySigner(credential)
elif isinstance(credential, credentials.StsTokenCredential):
return sts_token_signer.StsTokenSigner(credential)
elif isinstance(credential, credentials.RamRoleArnCredential):
return ram_role_arn_signer.RamRoleArnSigner(credential, do_action_api)
elif isinstance(credential, credentials.EcsRamRoleCredential):
return ecs_ram_role_singer.EcsRamRoleSigner(credential)
elif isinstance(credential, credentials.RsaKeyPairCredential):
return rsa_key_pair_signer.RsaKeyPairSigner(credential, region_id, debug)
elif cred['public_key_id'] is not None and cred['private_key'] is not None:
logging.info("'AcsClient(regionId, pub_key_id, pri_key)' is deprecated")
rsa_key_pair_credential = credentials.RsaKeyPairCredential(cred['public_key_id'], cred['private_key'],
cred['session_period'], region_id, debug)
return rsa_key_pair_signer.RsaKeyPairSigner(rsa_key_pair_credential)
else:
raise exceptions.ClientException(error_code.SDK_INVALID_CREDENTIAL,
error_msg.get_msg('SDK_INVALID_CREDENTIAL'))