desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'Get all access keys associated with an account.
:type user_name: string
:param user_name: The username of the user
:type marker: string
:param marker: Use this only when paginating results and only
in follow-up request after you\'ve received a response
where the results are truncated. Set this to the value of
the Mar... | def get_all_access_keys(self, user_name, marker=None, max_items=None):
| params = {'UserName': user_name}
if marker:
params['Marker'] = marker
if max_items:
params['MaxItems'] = max_items
return self.get_response('ListAccessKeys', params, list_marker='AccessKeyMetadata')
|
'Create a new AWS Secret Access Key and corresponding AWS Access Key ID
for the specified user. The default status for new keys is Active
If the user_name is not specified, the user_name is determined
implicitly based on the AWS Access Key ID used to sign the request.
:type user_name: string
:param user_name: The user... | def create_access_key(self, user_name=None):
| params = {'UserName': user_name}
return self.get_response('CreateAccessKey', params)
|
'Changes the status of the specified access key from Active to Inactive
or vice versa. This action can be used to disable a user\'s key as
part of a key rotation workflow.
If the user_name is not specified, the user_name is determined
implicitly based on the AWS Access Key ID used to sign the request.
:type access_key... | def update_access_key(self, access_key_id, status, user_name=None):
| params = {'AccessKeyId': access_key_id, 'Status': status}
if user_name:
params['UserName'] = user_name
return self.get_response('UpdateAccessKey', params)
|
'Delete an access key associated with a user.
If the user_name is not specified, it is determined implicitly based
on the AWS Access Key ID used to sign the request.
:type access_key_id: string
:param access_key_id: The ID of the access key to be deleted.
:type user_name: string
:param user_name: The username of the us... | def delete_access_key(self, access_key_id, user_name=None):
| params = {'AccessKeyId': access_key_id}
if user_name:
params['UserName'] = user_name
return self.get_response('DeleteAccessKey', params)
|
'Get all signing certificates associated with an account.
If the user_name is not specified, it is determined implicitly based
on the AWS Access Key ID used to sign the request.
:type marker: string
:param marker: Use this only when paginating results and only
in follow-up request after you\'ve received a response
wher... | def get_all_signing_certs(self, marker=None, max_items=None, user_name=None):
| params = {}
if marker:
params['Marker'] = marker
if max_items:
params['MaxItems'] = max_items
if user_name:
params['UserName'] = user_name
return self.get_response('ListSigningCertificates', params, list_marker='Certificates')
|
'Change the status of the specified signing certificate from
Active to Inactive or vice versa.
If the user_name is not specified, it is determined implicitly based
on the AWS Access Key ID used to sign the request.
:type cert_id: string
:param cert_id: The ID of the signing certificate
:type status: string
:param statu... | def update_signing_cert(self, cert_id, status, user_name=None):
| params = {'CertificateId': cert_id, 'Status': status}
if user_name:
params['UserName'] = user_name
return self.get_response('UpdateSigningCertificate', params)
|
'Uploads an X.509 signing certificate and associates it with
the specified user.
If the user_name is not specified, it is determined implicitly based
on the AWS Access Key ID used to sign the request.
:type cert_body: string
:param cert_body: The body of the signing certificate.
:type user_name: string
:param user_name... | def upload_signing_cert(self, cert_body, user_name=None):
| params = {'CertificateBody': cert_body}
if user_name:
params['UserName'] = user_name
return self.get_response('UploadSigningCertificate', params, verb='POST')
|
'Delete a signing certificate associated with a user.
If the user_name is not specified, it is determined implicitly based
on the AWS Access Key ID used to sign the request.
:type user_name: string
:param user_name: The username of the user
:type cert_id: string
:param cert_id: The ID of the certificate.'
| def delete_signing_cert(self, cert_id, user_name=None):
| params = {'CertificateId': cert_id}
if user_name:
params['UserName'] = user_name
return self.get_response('DeleteSigningCertificate', params)
|
'Lists the server certificates that have the specified path prefix.
If none exist, the action returns an empty list.
:type path_prefix: string
:param path_prefix: If provided, only certificates whose paths match
the provided prefix will be returned.
:type marker: string
:param marker: Use this only when paginating resu... | def list_server_certs(self, path_prefix='/', marker=None, max_items=None):
| params = {}
if path_prefix:
params['PathPrefix'] = path_prefix
if marker:
params['Marker'] = marker
if max_items:
params['MaxItems'] = max_items
return self.get_response('ListServerCertificates', params, list_marker='ServerCertificateMetadataList')
|
'Updates the name and/or the path of the specified server certificate.
:type cert_name: string
:param cert_name: The name of the server certificate that you want
to update.
:type new_cert_name: string
:param new_cert_name: The new name for the server certificate.
Include this only if you are updating the
server certifi... | def update_server_cert(self, cert_name, new_cert_name=None, new_path=None):
| params = {'ServerCertificateName': cert_name}
if new_cert_name:
params['NewServerCertificateName'] = new_cert_name
if new_path:
params['NewPath'] = new_path
return self.get_response('UpdateServerCertificate', params)
|
'Uploads a server certificate entity for the AWS Account.
The server certificate entity includes a public key certificate,
a private key, and an optional certificate chain, which should
all be PEM-encoded.
:type cert_name: string
:param cert_name: The name for the server certificate. Do not
include the path in this val... | def upload_server_cert(self, cert_name, cert_body, private_key, cert_chain=None, path=None):
| params = {'ServerCertificateName': cert_name, 'CertificateBody': cert_body, 'PrivateKey': private_key}
if cert_chain:
params['CertificateChain'] = cert_chain
if path:
params['Path'] = path
return self.get_response('UploadServerCertificate', params, verb='POST')
|
'Retrieves information about the specified server certificate.
:type cert_name: string
:param cert_name: The name of the server certificate you want
to retrieve information about.'
| def get_server_certificate(self, cert_name):
| params = {'ServerCertificateName': cert_name}
return self.get_response('GetServerCertificate', params)
|
'Delete the specified server certificate.
:type cert_name: string
:param cert_name: The name of the server certificate you want
to delete.'
| def delete_server_cert(self, cert_name):
| params = {'ServerCertificateName': cert_name}
return self.get_response('DeleteServerCertificate', params)
|
'Get all MFA devices associated with an account.
:type user_name: string
:param user_name: The username of the user
:type marker: string
:param marker: Use this only when paginating results and only
in follow-up request after you\'ve received a response
where the results are truncated. Set this to the value of
the Mar... | def get_all_mfa_devices(self, user_name, marker=None, max_items=None):
| params = {'UserName': user_name}
if marker:
params['Marker'] = marker
if max_items:
params['MaxItems'] = max_items
return self.get_response('ListMFADevices', params, list_marker='MFADevices')
|
'Enables the specified MFA device and associates it with the
specified user.
:type user_name: string
:param user_name: The username of the user
:type serial_number: string
:param serial_number: The serial number which uniquely identifies
the MFA device.
:type auth_code_1: string
:param auth_code_1: An authentication co... | def enable_mfa_device(self, user_name, serial_number, auth_code_1, auth_code_2):
| params = {'UserName': user_name, 'SerialNumber': serial_number, 'AuthenticationCode1': auth_code_1, 'AuthenticationCode2': auth_code_2}
return self.get_response('EnableMFADevice', params)
|
'Deactivates the specified MFA device and removes it from
association with the user.
:type user_name: string
:param user_name: The username of the user
:type serial_number: string
:param serial_number: The serial number which uniquely identifies
the MFA device.'
| def deactivate_mfa_device(self, user_name, serial_number):
| params = {'UserName': user_name, 'SerialNumber': serial_number}
return self.get_response('DeactivateMFADevice', params)
|
'Syncronizes the specified MFA device with the AWS servers.
:type user_name: string
:param user_name: The username of the user
:type serial_number: string
:param serial_number: The serial number which uniquely identifies
the MFA device.
:type auth_code_1: string
:param auth_code_1: An authentication code emitted by the... | def resync_mfa_device(self, user_name, serial_number, auth_code_1, auth_code_2):
| params = {'UserName': user_name, 'SerialNumber': serial_number, 'AuthenticationCode1': auth_code_1, 'AuthenticationCode2': auth_code_2}
return self.get_response('ResyncMFADevice', params)
|
'Retrieves the login profile for the specified user.
:type user_name: string
:param user_name: The username of the user'
| def get_login_profiles(self, user_name):
| params = {'UserName': user_name}
return self.get_response('GetLoginProfile', params)
|
'Creates a login profile for the specified user, give the user the
ability to access AWS services and the AWS Management Console.
:type user_name: string
:param user_name: The name of the user
:type password: string
:param password: The new password for the user'
| def create_login_profile(self, user_name, password):
| params = {'UserName': user_name, 'Password': password}
return self.get_response('CreateLoginProfile', params)
|
'Deletes the login profile associated with the specified user.
:type user_name: string
:param user_name: The name of the user to delete.'
| def delete_login_profile(self, user_name):
| params = {'UserName': user_name}
return self.get_response('DeleteLoginProfile', params)
|
'Resets the password associated with the user\'s login profile.
:type user_name: string
:param user_name: The name of the user
:type password: string
:param password: The new password for the user'
| def update_login_profile(self, user_name, password):
| params = {'UserName': user_name, 'Password': password}
return self.get_response('UpdateLoginProfile', params)
|
'Creates a new alias for the AWS account.
For more information on account id aliases, please see
http://goo.gl/ToB7G
:type alias: string
:param alias: The alias to attach to the account.'
| def create_account_alias(self, alias):
| params = {'AccountAlias': alias}
return self.get_response('CreateAccountAlias', params)
|
'Deletes an alias for the AWS account.
For more information on account id aliases, please see
http://goo.gl/ToB7G
:type alias: string
:param alias: The alias to remove from the account.'
| def delete_account_alias(self, alias):
| params = {'AccountAlias': alias}
return self.get_response('DeleteAccountAlias', params)
|
'Get the alias for the current account.
This is referred to in the docs as list_account_aliases,
but it seems you can only have one account alias currently.
For more information on account id aliases, please see
http://goo.gl/ToB7G'
| def get_account_alias(self):
| return self.get_response('ListAccountAliases', {}, list_marker='AccountAliases')
|
'Get the URL where IAM users can use their login profile to sign in
to this account\'s console.
:type service: string
:param service: Default service to go to in the console.'
| def get_signin_url(self, service='ec2'):
| alias = self.get_account_alias()
if (not alias):
raise Exception('No alias associated with this account. Please use iam.create_account_alias() first.')
resp = alias.get('list_account_aliases_response', {})
result = resp.get('list_account_aliases_result', {})
al... |
'Get the alias for the current account.
This is referred to in the docs as list_account_aliases,
but it seems you can only have one account alias currently.
For more information on account id aliases, please see
http://goo.gl/ToB7G'
| def get_account_summary(self):
| return self.get_object('GetAccountSummary', {}, SummaryMap)
|
'Adds the specified role to the specified instance profile.
:type instance_profile_name: string
:param instance_profile_name: Name of the instance profile to update.
:type role_name: string
:param role_name: Name of the role to add.'
| def add_role_to_instance_profile(self, instance_profile_name, role_name):
| return self.get_response('AddRoleToInstanceProfile', {'InstanceProfileName': instance_profile_name, 'RoleName': role_name})
|
'Creates a new instance profile.
:type instance_profile_name: string
:param instance_profile_name: Name of the instance profile to create.
:type path: string
:param path: The path to the instance profile.'
| def create_instance_profile(self, instance_profile_name, path=None):
| params = {'InstanceProfileName': instance_profile_name}
if (path is not None):
params['Path'] = path
return self.get_response('CreateInstanceProfile', params)
|
'Creates a new role for your AWS account.
The policy grants permission to an EC2 instance to assume the role.
The policy is URL-encoded according to RFC 3986. Currently, only EC2
instances can assume roles.
:type role_name: string
:param role_name: Name of the role to create.
:type assume_role_policy_document: ``string... | def create_role(self, role_name, assume_role_policy_document=None, path=None):
| params = {'RoleName': role_name, 'AssumeRolePolicyDocument': self._build_policy(assume_role_policy_document)}
if (path is not None):
params['Path'] = path
return self.get_response('CreateRole', params)
|
'Deletes the specified instance profile. The instance profile must not
have an associated role.
:type instance_profile_name: string
:param instance_profile_name: Name of the instance profile to delete.'
| def delete_instance_profile(self, instance_profile_name):
| return self.get_response('DeleteInstanceProfile', {'InstanceProfileName': instance_profile_name})
|
'Deletes the specified role. The role must not have any policies
attached.
:type role_name: string
:param role_name: Name of the role to delete.'
| def delete_role(self, role_name):
| return self.get_response('DeleteRole', {'RoleName': role_name})
|
'Deletes the specified policy associated with the specified role.
:type role_name: string
:param role_name: Name of the role associated with the policy.
:type policy_name: string
:param policy_name: Name of the policy to delete.'
| def delete_role_policy(self, role_name, policy_name):
| return self.get_response('DeleteRolePolicy', {'RoleName': role_name, 'PolicyName': policy_name})
|
'Retrieves information about the specified instance profile, including
the instance profile\'s path, GUID, ARN, and role.
:type instance_profile_name: string
:param instance_profile_name: Name of the instance profile to get
information about.'
| def get_instance_profile(self, instance_profile_name):
| return self.get_response('GetInstanceProfile', {'InstanceProfileName': instance_profile_name})
|
'Retrieves information about the specified role, including the role\'s
path, GUID, ARN, and the policy granting permission to EC2 to assume
the role.
:type role_name: string
:param role_name: Name of the role associated with the policy.'
| def get_role(self, role_name):
| return self.get_response('GetRole', {'RoleName': role_name})
|
'Retrieves the specified policy document for the specified role.
:type role_name: string
:param role_name: Name of the role associated with the policy.
:type policy_name: string
:param policy_name: Name of the policy to get.'
| def get_role_policy(self, role_name, policy_name):
| return self.get_response('GetRolePolicy', {'RoleName': role_name, 'PolicyName': policy_name})
|
'Lists the instance profiles that have the specified path prefix. If
there are none, the action returns an empty list.
:type path_prefix: string
:param path_prefix: The path prefix for filtering the results. For
example: /application_abc/component_xyz/, which would get all
instance profiles whose path starts with
/appl... | def list_instance_profiles(self, path_prefix=None, marker=None, max_items=None):
| params = {}
if (path_prefix is not None):
params['PathPrefix'] = path_prefix
if (marker is not None):
params['Marker'] = marker
if (max_items is not None):
params['MaxItems'] = max_items
return self.get_response('ListInstanceProfiles', params, list_marker='InstanceProfiles')
|
'Lists the instance profiles that have the specified associated role. If
there are none, the action returns an empty list.
:type role_name: string
:param role_name: The name of the role to list instance profiles for.
:type marker: string
:param marker: Use this parameter only when paginating results, and
only in a subs... | def list_instance_profiles_for_role(self, role_name, marker=None, max_items=None):
| params = {'RoleName': role_name}
if (marker is not None):
params['Marker'] = marker
if (max_items is not None):
params['MaxItems'] = max_items
return self.get_response('ListInstanceProfilesForRole', params, list_marker='InstanceProfiles')
|
'Lists the names of the policies associated with the specified role. If
there are none, the action returns an empty list.
:type role_name: string
:param role_name: The name of the role to list policies for.
:type marker: string
:param marker: Use this parameter only when paginating results, and
only in a subsequent req... | def list_role_policies(self, role_name, marker=None, max_items=None):
| params = {'RoleName': role_name}
if (marker is not None):
params['Marker'] = marker
if (max_items is not None):
params['MaxItems'] = max_items
return self.get_response('ListRolePolicies', params, list_marker='PolicyNames')
|
'Lists the roles that have the specified path prefix. If there are none,
the action returns an empty list.
:type path_prefix: string
:param path_prefix: The path prefix for filtering the results.
:type marker: string
:param marker: Use this parameter only when paginating results, and
only in a subsequent request after ... | def list_roles(self, path_prefix=None, marker=None, max_items=None):
| params = {}
if (path_prefix is not None):
params['PathPrefix'] = path_prefix
if (marker is not None):
params['Marker'] = marker
if (max_items is not None):
params['MaxItems'] = max_items
return self.get_response('ListRoles', params, list_marker='Roles')
|
'Adds (or updates) a policy document associated with the specified role.
:type role_name: string
:param role_name: Name of the role to associate the policy with.
:type policy_name: string
:param policy_name: Name of the policy document.
:type policy_document: string
:param policy_document: The policy document.'
| def put_role_policy(self, role_name, policy_name, policy_document):
| return self.get_response('PutRolePolicy', {'RoleName': role_name, 'PolicyName': policy_name, 'PolicyDocument': policy_document})
|
'Removes the specified role from the specified instance profile.
:type instance_profile_name: string
:param instance_profile_name: Name of the instance profile to update.
:type role_name: string
:param role_name: Name of the role to remove.'
| def remove_role_from_instance_profile(self, instance_profile_name, role_name):
| return self.get_response('RemoveRoleFromInstanceProfile', {'InstanceProfileName': instance_profile_name, 'RoleName': role_name})
|
'Updates the policy that grants an entity permission to assume a role.
Currently, only an Amazon EC2 instance can assume a role.
:type role_name: string
:param role_name: Name of the role to update.
:type policy_document: string
:param policy_document: The policy that grants an entity permission to
assume the role.'
| def update_assume_role_policy(self, role_name, policy_document):
| return self.get_response('UpdateAssumeRolePolicy', {'RoleName': role_name, 'PolicyDocument': policy_document})
|
'Creates an IAM entity to describe an identity provider (IdP)
that supports SAML 2.0.
The SAML provider that you create with this operation can be
used as a principal in a role\'s trust policy to establish a
trust relationship between AWS and a SAML identity provider.
You can create an IAM role that supports Web-based ... | def create_saml_provider(self, saml_metadata_document, name):
| params = {'SAMLMetadataDocument': saml_metadata_document, 'Name': name}
return self.get_response('CreateSAMLProvider', params)
|
'Lists the SAML providers in the account.
This operation requires `Signature Version 4`_.'
| def list_saml_providers(self):
| return self.get_response('ListSAMLProviders', {}, list_marker='SAMLProviderList')
|
'Returns the SAML provider metadocument that was uploaded when
the provider was created or updated.
This operation requires `Signature Version 4`_.
:type saml_provider_arn: string
:param saml_provider_arn: The Amazon Resource Name (ARN) of the SAML
provider to get information about.'
| def get_saml_provider(self, saml_provider_arn):
| params = {'SAMLProviderArn': saml_provider_arn}
return self.get_response('GetSAMLProvider', params)
|
'Updates the metadata document for an existing SAML provider.
This operation requires `Signature Version 4`_.
:type saml_provider_arn: string
:param saml_provider_arn: The Amazon Resource Name (ARN) of the SAML
provider to update.
:type saml_metadata_document: string
:param saml_metadata_document: An XML document gener... | def update_saml_provider(self, saml_provider_arn, saml_metadata_document):
| params = {'SAMLMetadataDocument': saml_metadata_document, 'SAMLProviderArn': saml_provider_arn}
return self.get_response('UpdateSAMLProvider', params)
|
'Deletes a SAML provider.
Deleting the provider does not update any roles that reference
the SAML provider as a principal in their trust policies. Any
attempt to assume a role that references a SAML provider that
has been deleted will fail.
This operation requires `Signature Version 4`_.
:type saml_provider_arn: string... | def delete_saml_provider(self, saml_provider_arn):
| params = {'SAMLProviderArn': saml_provider_arn}
return self.get_response('DeleteSAMLProvider', params)
|
'Generates a credential report for an account
A new credential report can only be generated every 4 hours. If one
hasn\'t been generated in the last 4 hours then get_credential_report
will error when called'
| def generate_credential_report(self):
| params = {}
return self.get_response('GenerateCredentialReport', params)
|
'Retrieves a credential report for an account
A report must have been generated in the last 4 hours to succeed.
The report is returned as a base64 encoded blob within the response.'
| def get_credential_report(self):
| params = {}
return self.get_response('GetCredentialReport', params)
|
'Creates a new virtual MFA device for the AWS account.
After creating the virtual MFA, use enable-mfa-device to
attach the MFA device to an IAM user.
:type path: string
:param path: The path for the virtual MFA device.
:type device_name: string
:param device_name: The name of the virtual MFA device.
Used with path to u... | def create_virtual_mfa_device(self, path, device_name):
| params = {'Path': path, 'VirtualMFADeviceName': device_name}
return self.get_response('CreateVirtualMFADevice', params)
|
'Returns the password policy for the AWS account.'
| def get_account_password_policy(self):
| params = {}
return self.get_response('GetAccountPasswordPolicy', params)
|
'Delete the password policy currently set for the AWS account.'
| def delete_account_password_policy(self):
| params = {}
return self.get_response('DeleteAccountPasswordPolicy', params)
|
'Update the password policy for the AWS account.
Notes: unset parameters will be reset to Amazon default settings!
Most of the password policy settings are enforced the next time your users
change their passwords. When you set minimum length and character type
requirements, they are enforced the next time your users ch... | def update_account_password_policy(self, allow_users_to_change_password=None, hard_expiry=None, max_password_age=None, minimum_password_length=None, password_reuse_prevention=None, require_lowercase_characters=None, require_numbers=None, require_symbols=None, require_uppercase_characters=None):
| params = {}
if ((allow_users_to_change_password is not None) and (type(allow_users_to_change_password) is bool)):
params['AllowUsersToChangePassword'] = str(allow_users_to_change_password).lower()
if ((hard_expiry is not None) and (type(allow_users_to_change_password) is bool)):
params['Hard... |
'Create a policy.
:type policy_name: string
:param policy_name: The name of the new policy
:type policy_document string
:param policy_document: The document of the new policy
:type path: string
:param path: The path in which the policy will be created.
Defaults to /.
:type description: string
:param path: A description... | def create_policy(self, policy_name, policy_document, path='/', description=None):
| params = {'PolicyName': policy_name, 'PolicyDocument': policy_document, 'Path': path}
if (description is not None):
params['Description'] = str(description)
return self.get_response('CreatePolicy', params)
|
'Create a policy version.
:type policy_arn: string
:param policy_arn: The ARN of the policy
:type policy_document string
:param policy_document: The document of the new policy version
:type set_as_default: bool
:param set_as_default: Sets the policy version as default
Defaults to None.'
| def create_policy_version(self, policy_arn, policy_document, set_as_default=None):
| params = {'PolicyArn': policy_arn, 'PolicyDocument': policy_document}
if (type(set_as_default) == bool):
params['SetAsDefault'] = str(set_as_default).lower()
return self.get_response('CreatePolicyVersion', params)
|
'Delete a policy.
:type policy_arn: string
:param policy_arn: The ARN of the policy to delete'
| def delete_policy(self, policy_arn):
| params = {'PolicyArn': policy_arn}
return self.get_response('DeletePolicy', params)
|
'Delete a policy version.
:type policy_arn: string
:param policy_arn: The ARN of the policy to delete a version from
:type version_id: string
:param version_id: The id of the version to delete'
| def delete_policy_version(self, policy_arn, version_id):
| params = {'PolicyArn': policy_arn, 'VersionId': version_id}
return self.get_response('DeletePolicyVersion', params)
|
'Get policy information.
:type policy_arn: string
:param policy_arn: The ARN of the policy to get information for'
| def get_policy(self, policy_arn):
| params = {'PolicyArn': policy_arn}
return self.get_response('GetPolicy', params)
|
'Get policy information.
:type policy_arn: string
:param policy_arn: The ARN of the policy to get information for a
specific version
:type version_id: string
:param version_id: The id of the version to get information for'
| def get_policy_version(self, policy_arn, version_id):
| params = {'PolicyArn': policy_arn, 'VersionId': version_id}
return self.get_response('GetPolicyVersion', params)
|
'List policies of account.
:type marker: string
:param marker: A marker used for pagination (received from previous
accesses)
:type max_items: int
:param max_items: Send only max_items; allows paginations
:type only_attached: bool
:param only_attached: Send only policies attached to other resources
:type path_prefix: s... | def list_policies(self, marker=None, max_items=None, only_attached=None, path_prefix=None, scope=None):
| params = {}
if (path_prefix is not None):
params['PathPrefix'] = path_prefix
if (marker is not None):
params['Marker'] = marker
if (max_items is not None):
params['MaxItems'] = max_items
if (type(only_attached) == bool):
params['OnlyAttached'] = str(only_attached).low... |
'List policy versions.
:type policy_arn: string
:param policy_arn: The ARN of the policy to get versions of
:type marker: string
:param marker: A marker used for pagination (received from previous
accesses)
:type max_items: int
:param max_items: Send only max_items; allows paginations'
| def list_policy_versions(self, policy_arn, marker=None, max_items=None):
| params = {'PolicyArn': policy_arn}
if (marker is not None):
params['Marker'] = marker
if (max_items is not None):
params['MaxItems'] = max_items
return self.get_response('ListPolicyVersions', params, list_marker='Versions')
|
'Set default policy version.
:type policy_arn: string
:param policy_arn: The ARN of the policy to set the default version
for
:type version_id: string
:param version_id: The id of the version to set as default'
| def set_default_policy_version(self, policy_arn, version_id):
| params = {'PolicyArn': policy_arn, 'VersionId': version_id}
return self.get_response('SetDefaultPolicyVersion', params)
|
':type policy_arn: string
:param policy_arn: The ARN of the policy to get entities for
:type marker: string
:param marker: A marker used for pagination (received from previous
accesses)
:type max_items: int
:param max_items: Send only max_items; allows paginations
:type path_prefix: string
:param path_prefix: Send only... | def list_entities_for_policy(self, policy_arn, path_prefix=None, marker=None, max_items=None, entity_filter=None):
| params = {'PolicyArn': policy_arn}
if (marker is not None):
params['Marker'] = marker
if (max_items is not None):
params['MaxItems'] = max_items
if (path_prefix is not None):
params['PathPrefix'] = path_prefix
if (entity_filter is not None):
params['EntityFilter'] = e... |
':type policy_arn: string
:param policy_arn: The ARN of the policy to attach
:type group_name: string
:param group_name: Group to attach the policy to'
| def attach_group_policy(self, policy_arn, group_name):
| params = {'PolicyArn': policy_arn, 'GroupName': group_name}
return self.get_response('AttachGroupPolicy', params)
|
':type policy_arn: string
:param policy_arn: The ARN of the policy to attach
:type role_name: string
:param role_name: Role to attach the policy to'
| def attach_role_policy(self, policy_arn, role_name):
| params = {'PolicyArn': policy_arn, 'RoleName': role_name}
return self.get_response('AttachRolePolicy', params)
|
':type policy_arn: string
:param policy_arn: The ARN of the policy to attach
:type user_name: string
:param user_name: User to attach the policy to'
| def attach_user_policy(self, policy_arn, user_name):
| params = {'PolicyArn': policy_arn, 'UserName': user_name}
return self.get_response('AttachUserPolicy', params)
|
':type policy_arn: string
:param policy_arn: The ARN of the policy to detach
:type group_name: string
:param group_name: Group to detach the policy from'
| def detach_group_policy(self, policy_arn, group_name):
| params = {'PolicyArn': policy_arn, 'GroupName': group_name}
return self.get_response('DetachGroupPolicy', params)
|
':type policy_arn: string
:param policy_arn: The ARN of the policy to detach
:type role_name: string
:param role_name: Role to detach the policy from'
| def detach_role_policy(self, policy_arn, role_name):
| params = {'PolicyArn': policy_arn, 'RoleName': role_name}
return self.get_response('DetachRolePolicy', params)
|
':type policy_arn: string
:param policy_arn: The ARN of the policy to detach
:type user_name: string
:param user_name: User to detach the policy from'
| def detach_user_policy(self, policy_arn, user_name):
| params = {'PolicyArn': policy_arn, 'UserName': user_name}
return self.get_response('DetachUserPolicy', params)
|
'Add an AWS API-compatible parameter list to a dictionary.
:type params: dict
:param params: The parameter dictionary
:type items: list
:param items: Items to be included in the list
:type label: string
:param label: The parameter list\'s name'
| def _build_list_params(self, params, items, label):
| if isinstance(items, six.string_types):
items = [items]
for i in range(1, (len(items) + 1)):
params[('%s.%d' % (label, i))] = items[(i - 1)]
|
'Make a call to the SES API.
:type action: string
:param action: The API method to use (e.g. SendRawEmail)
:type params: dict
:param params: Parameters that will be sent as POST data with the API
call.'
| def _make_request(self, action, params=None):
| ct = 'application/x-www-form-urlencoded; charset=UTF-8'
headers = {'Content-Type': ct}
params = (params or {})
params['Action'] = action
for (k, v) in params.items():
if isinstance(v, six.text_type):
params[k] = v.encode('utf-8')
response = super(SESConnection, self).make_... |
'Handle raising the correct exception, depending on the error. Many
errors share the same HTTP response code, meaning we have to get really
kludgey and do string searches to figure out what went wrong.'
| def _handle_error(self, response, body):
| boto.log.error(('%s %s' % (response.status, response.reason)))
boto.log.error(('%s' % body))
if ('Address blacklisted.' in body):
ExceptionToRaise = ses_exceptions.SESAddressBlacklistedError
exc_reason = 'Address blacklisted.'
elif ('Email address is not verified.' i... |
'Composes an email message based on input data, and then immediately
queues the message for sending.
:type source: string
:param source: The sender\'s email address.
:type subject: string
:param subject: The subject of the message: A short summary of the
content, which will appear in the recipient\'s inbox.
:type body:... | def send_email(self, source, subject, body, to_addresses, cc_addresses=None, bcc_addresses=None, format='text', reply_addresses=None, return_path=None, text_body=None, html_body=None):
| format = format.lower().strip()
if (body is not None):
if (format == 'text'):
if (text_body is not None):
raise Warning("You've passed in both a body and a text_body; please choose one or the other.")
text_body = body
... |
'Sends an email message, with header and content specified by the
client. The SendRawEmail action is useful for sending multipart MIME
emails, with attachments or inline content. The raw text of the message
must comply with Internet email standards; otherwise, the message
cannot be sent.
:type source: string
:param sou... | def send_raw_email(self, raw_message, source=None, destinations=None):
| if isinstance(raw_message, six.text_type):
raw_message = raw_message.encode('utf-8')
params = {'RawMessage.Data': base64.b64encode(raw_message)}
if source:
params['Source'] = source
if destinations:
self._build_list_params(params, destinations, 'Destinations.member')
return s... |
'Fetch a list of the email addresses that have been verified.
:rtype: dict
:returns: A ListVerifiedEmailAddressesResponse structure. Note that
keys must be unicode strings.'
| def list_verified_email_addresses(self):
| return self._make_request('ListVerifiedEmailAddresses')
|
'Fetches the user\'s current activity limits.
:rtype: dict
:returns: A GetSendQuotaResponse structure. Note that keys must be
unicode strings.'
| def get_send_quota(self):
| return self._make_request('GetSendQuota')
|
'Fetches the user\'s sending statistics. The result is a list of data
points, representing the last two weeks of sending activity.
Each data point in the list contains statistics for a 15-minute
interval.
:rtype: dict
:returns: A GetSendStatisticsResponse structure. Note that keys must be
unicode strings.'
| def get_send_statistics(self):
| return self._make_request('GetSendStatistics')
|
'Deletes the specified email address from the list of verified
addresses.
:type email_adddress: string
:param email_address: The email address to be removed from the list of
verified addreses.
:rtype: dict
:returns: A DeleteVerifiedEmailAddressResponse structure. Note that
keys must be unicode strings.'
| def delete_verified_email_address(self, email_address):
| return self._make_request('DeleteVerifiedEmailAddress', {'EmailAddress': email_address})
|
'Verifies an email address. This action causes a confirmation email
message to be sent to the specified address.
:type email_adddress: string
:param email_address: The email address to be verified.
:rtype: dict
:returns: A VerifyEmailAddressResponse structure. Note that keys must
be unicode strings.'
| def verify_email_address(self, email_address):
| return self._make_request('VerifyEmailAddress', {'EmailAddress': email_address})
|
'Returns a set of DNS records, or tokens, that must be published in the
domain name\'s DNS to complete the DKIM verification process. These
tokens are DNS ``CNAME`` records that point to DKIM public keys hosted
by Amazon SES. To complete the DKIM verification process, these tokens
must be published in the domain\'s DNS... | def verify_domain_dkim(self, domain):
| return self._make_request('VerifyDomainDkim', {'Domain': domain})
|
'Enables or disables DKIM signing of email sent from an identity.
* If Easy DKIM signing is enabled for a domain name identity (e.g.,
* ``example.com``),
then Amazon SES will DKIM-sign all email sent by addresses under that
domain name (e.g., ``user@example.com``)
* If Easy DKIM signing is enabled for an email address,... | def set_identity_dkim_enabled(self, identity, dkim_enabled):
| return self._make_request('SetIdentityDkimEnabled', {'Identity': identity, 'DkimEnabled': ('true' if dkim_enabled else 'false')})
|
'Get attributes associated with a list of verified identities.
Given a list of verified identities (email addresses and/or domains),
returns a structure describing identity notification attributes.
:type identities: list
:param identities: A list of verified identities (email addresses
and/or domains).'
| def get_identity_dkim_attributes(self, identities):
| params = {}
self._build_list_params(params, identities, 'Identities.member')
return self._make_request('GetIdentityDkimAttributes', params)
|
'Returns a list containing all of the identities (email addresses
and domains) for a specific AWS Account, regardless of
verification status.
:rtype: dict
:returns: A ListIdentitiesResponse structure. Note that
keys must be unicode strings.'
| def list_identities(self):
| return self._make_request('ListIdentities')
|
'Given a list of identities (email addresses and/or domains),
returns the verification status and (for domain identities)
the verification token for each identity.
:type identities: list of strings or string
:param identities: List of identities.
:rtype: dict
:returns: A GetIdentityVerificationAttributesResponse struct... | def get_identity_verification_attributes(self, identities):
| params = {}
self._build_list_params(params, identities, 'Identities.member')
return self._make_request('GetIdentityVerificationAttributes', params)
|
'Verifies a domain.
:type domain: string
:param domain: The domain to be verified.
:rtype: dict
:returns: A VerifyDomainIdentityResponse structure. Note that
keys must be unicode strings.'
| def verify_domain_identity(self, domain):
| return self._make_request('VerifyDomainIdentity', {'Domain': domain})
|
'Verifies an email address. This action causes a confirmation
email message to be sent to the specified address.
:type email_adddress: string
:param email_address: The email address to be verified.
:rtype: dict
:returns: A VerifyEmailIdentityResponse structure. Note that keys must
be unicode strings.'
| def verify_email_identity(self, email_address):
| return self._make_request('VerifyEmailIdentity', {'EmailAddress': email_address})
|
'Deletes the specified identity (email address or domain) from
the list of verified identities.
:type identity: string
:param identity: The identity to be deleted.
:rtype: dict
:returns: A DeleteIdentityResponse structure. Note that keys must
be unicode strings.'
| def delete_identity(self, identity):
| return self._make_request('DeleteIdentity', {'Identity': identity})
|
'Sets an SNS topic to publish bounce or complaint notifications for
emails sent with the given identity as the Source. Publishing to topics
may only be disabled when feedback forwarding is enabled.
:type identity: string
:param identity: An email address or domain name.
:type notification_type: string
:param notificati... | def set_identity_notification_topic(self, identity, notification_type, sns_topic=None):
| params = {'Identity': identity, 'NotificationType': notification_type}
if sns_topic:
params['SnsTopic'] = sns_topic
return self._make_request('SetIdentityNotificationTopic', params)
|
'Enables or disables SES feedback notification via email.
Feedback forwarding may only be disabled when both complaint and
bounce topics are set.
:type identity: string
:param identity: An email address or domain name.
:type forwarding_enabled: bool
:param forwarding_enabled: Specifies whether or not to enable feedback... | def set_identity_feedback_forwarding_enabled(self, identity, forwarding_enabled=True):
| return self._make_request('SetIdentityFeedbackForwardingEnabled', {'Identity': identity, 'ForwardingEnabled': ('true' if forwarding_enabled else 'false')})
|
'Returns the number of connections in the pool for this host.
Some of the connections may still be in use, and may not be
ready to be returned by get().'
| def size(self):
| return len(self.queue)
|
'Adds a connection to the pool, along with the time it was
added.'
| def put(self, conn):
| self.queue.append((conn, time.time()))
|
'Returns the next connection in this pool that is ready to be
reused. Returns None if there aren\'t any.'
| def get(self):
| self.clean()
for _ in range(len(self.queue)):
(conn, _) = self.queue.pop(0)
if self._conn_ready(conn):
return conn
else:
self.put(conn)
return None
|
'There is a nice state diagram at the top of http_client.py. It
indicates that once the response headers have been read (which
_mexe does before adding the connection to the pool), a
response is attached to the connection, and it stays there
until it\'s done reading. This isn\'t entirely true: even after
the client i... | def _conn_ready(self, conn):
| if ON_APP_ENGINE:
return False
else:
response = getattr(conn, '_HTTPConnection__response', None)
return ((response is None) or response.isclosed())
|
'Get rid of stale connections.'
| def clean(self):
| while ((len(self.queue) > 0) and self._pair_stale(self.queue[0])):
self.queue.pop(0)
|
'Returns true of the (connection,time) pair is too old to be
used.'
| def _pair_stale(self, pair):
| (_conn, return_time) = pair
now = time.time()
return ((return_time + ConnectionPool.STALE_DURATION) < now)
|
'Returns the number of connections in the pool.'
| def size(self):
| return sum((pool.size() for pool in self.host_to_pool.values()))
|
'Gets a connection from the pool for the named host. Returns
None if there is no connection that can be reused. It\'s the caller\'s
responsibility to call close() on the connection when it\'s no longer
needed.'
| def get_http_connection(self, host, port, is_secure):
| self.clean()
with self.mutex:
key = (host, port, is_secure)
if (key not in self.host_to_pool):
return None
return self.host_to_pool[key].get()
|
'Adds a connection to the pool of connections that can be
reused for the named host.'
| def put_http_connection(self, host, port, is_secure, conn):
| with self.mutex:
key = (host, port, is_secure)
if (key not in self.host_to_pool):
self.host_to_pool[key] = HostConnectionPool()
self.host_to_pool[key].put(conn)
|
'Clean up the stale connections in all of the pools, and then
get rid of empty pools. Pools clean themselves every time a
connection is fetched; this cleaning takes care of pools that
aren\'t being used any more, so nothing is being gotten from
them.'
| def clean(self):
| with self.mutex:
now = time.time()
if ((self.last_clean_time + self.CLEAN_INTERVAL) < now):
to_remove = []
for (host, pool) in self.host_to_pool.items():
pool.clean()
if (pool.size() == 0):
to_remove.append(host)
... |
'Represents an HTTP request.
:type method: string
:param method: The HTTP method name, \'GET\', \'POST\', \'PUT\' etc.
:type protocol: string
:param protocol: The http protocol used, \'http\' or \'https\'.
:type host: string
:param host: Host to which the request is addressed. eg. abc.com
:type port: int
:param port: p... | def __init__(self, method, protocol, host, port, path, auth_path, params, headers, body):
| self.method = method
self.protocol = protocol
self.host = host
self.port = port
self.path = path
if (auth_path is None):
auth_path = path
self.auth_path = auth_path
self.params = params
if (headers and ('Transfer-Encoding' in headers) and (headers['Transfer-Encoding'] == 'chu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.