desc
stringlengths
3
26.7k
decl
stringlengths
11
7.89k
bodies
stringlengths
8
553k
'Checks to see if the Session Token is expired or not. By default it will check to see if the Session Token is expired as of the moment the method is called. However, you can supply an optional parameter which is the number of seconds of offset into the future for the check. For example, if you supply a value of 5, ...
def is_expired(self, time_offset_seconds=0):
now = datetime.datetime.utcnow() if time_offset_seconds: now = (now + datetime.timedelta(seconds=time_offset_seconds)) ts = boto.utils.parse_ts(self.expiration) delta = (ts - now) return (delta.total_seconds() <= 0)
'Generates predictions for a group of observations. The observations to process exist in one or more data files referenced by a `DataSource`. This operation creates a new `BatchPrediction`, and uses an `MLModel` and the data files referenced by the `DataSource` as information sources. `CreateBatchPrediction` is an asyn...
def create_batch_prediction(self, batch_prediction_id, ml_model_id, batch_prediction_data_source_id, output_uri, batch_prediction_name=None):
params = {'BatchPredictionId': batch_prediction_id, 'MLModelId': ml_model_id, 'BatchPredictionDataSourceId': batch_prediction_data_source_id, 'OutputUri': output_uri} if (batch_prediction_name is not None): params['BatchPredictionName'] = batch_prediction_name return self.make_request(action='Create...
'Creates a `DataSource` object from an ` Amazon Relational Database Service`_ (Amazon RDS). A `DataSource` references data that can be used to perform CreateMLModel, CreateEvaluation, or CreateBatchPrediction operations. `CreateDataSourceFromRDS` is an asynchronous operation. In response to `CreateDataSourceFromRDS`, A...
def create_data_source_from_rds(self, data_source_id, rds_data, role_arn, data_source_name=None, compute_statistics=None):
params = {'DataSourceId': data_source_id, 'RDSData': rds_data, 'RoleARN': role_arn} if (data_source_name is not None): params['DataSourceName'] = data_source_name if (compute_statistics is not None): params['ComputeStatistics'] = compute_statistics return self.make_request(action='Create...
'Creates a `DataSource` from `Amazon Redshift`_. A `DataSource` references data that can be used to perform either CreateMLModel, CreateEvaluation or CreateBatchPrediction operations. `CreateDataSourceFromRedshift` is an asynchronous operation. In response to `CreateDataSourceFromRedshift`, Amazon Machine Learning (Ama...
def create_data_source_from_redshift(self, data_source_id, data_spec, role_arn, data_source_name=None, compute_statistics=None):
params = {'DataSourceId': data_source_id, 'DataSpec': data_spec, 'RoleARN': role_arn} if (data_source_name is not None): params['DataSourceName'] = data_source_name if (compute_statistics is not None): params['ComputeStatistics'] = compute_statistics return self.make_request(action='Crea...
'Creates a `DataSource` object. A `DataSource` references data that can be used to perform CreateMLModel, CreateEvaluation, or CreateBatchPrediction operations. `CreateDataSourceFromS3` is an asynchronous operation. In response to `CreateDataSourceFromS3`, Amazon Machine Learning (Amazon ML) immediately returns and set...
def create_data_source_from_s3(self, data_source_id, data_spec, data_source_name=None, compute_statistics=None):
params = {'DataSourceId': data_source_id, 'DataSpec': data_spec} if (data_source_name is not None): params['DataSourceName'] = data_source_name if (compute_statistics is not None): params['ComputeStatistics'] = compute_statistics return self.make_request(action='CreateDataSourceFromS3', ...
'Creates a new `Evaluation` of an `MLModel`. An `MLModel` is evaluated on a set of observations associated to a `DataSource`. Like a `DataSource` for an `MLModel`, the `DataSource` for an `Evaluation` contains values for the Target Variable. The `Evaluation` compares the predicted result for each observation to the act...
def create_evaluation(self, evaluation_id, ml_model_id, evaluation_data_source_id, evaluation_name=None):
params = {'EvaluationId': evaluation_id, 'MLModelId': ml_model_id, 'EvaluationDataSourceId': evaluation_data_source_id} if (evaluation_name is not None): params['EvaluationName'] = evaluation_name return self.make_request(action='CreateEvaluation', body=json.dumps(params))
'Creates a new `MLModel` using the data files and the recipe as information sources. An `MLModel` is nearly immutable. Users can only update the `MLModelName` and the `ScoreThreshold` in an `MLModel` without creating a new `MLModel`. `CreateMLModel` is an asynchronous operation. In response to `CreateMLModel`, Amazon M...
def create_ml_model(self, ml_model_id, ml_model_type, training_data_source_id, ml_model_name=None, parameters=None, recipe=None, recipe_uri=None):
params = {'MLModelId': ml_model_id, 'MLModelType': ml_model_type, 'TrainingDataSourceId': training_data_source_id} if (ml_model_name is not None): params['MLModelName'] = ml_model_name if (parameters is not None): params['Parameters'] = parameters if (recipe is not None): params[...
'Creates a real-time endpoint for the `MLModel`. The endpoint contains the URI of the `MLModel`; that is, the location to send real-time prediction requests for the specified `MLModel`. :type ml_model_id: string :param ml_model_id: The ID assigned to the `MLModel` during creation.'
def create_realtime_endpoint(self, ml_model_id):
params = {'MLModelId': ml_model_id} return self.make_request(action='CreateRealtimeEndpoint', body=json.dumps(params))
'Assigns the DELETED status to a `BatchPrediction`, rendering it unusable. After using the `DeleteBatchPrediction` operation, you can use the GetBatchPrediction operation to verify that the status of the `BatchPrediction` changed to DELETED. The result of the `DeleteBatchPrediction` operation is irreversible. :type bat...
def delete_batch_prediction(self, batch_prediction_id):
params = {'BatchPredictionId': batch_prediction_id} return self.make_request(action='DeleteBatchPrediction', body=json.dumps(params))
'Assigns the DELETED status to a `DataSource`, rendering it unusable. After using the `DeleteDataSource` operation, you can use the GetDataSource operation to verify that the status of the `DataSource` changed to DELETED. The results of the `DeleteDataSource` operation are irreversible. :type data_source_id: string :pa...
def delete_data_source(self, data_source_id):
params = {'DataSourceId': data_source_id} return self.make_request(action='DeleteDataSource', body=json.dumps(params))
'Assigns the `DELETED` status to an `Evaluation`, rendering it unusable. After invoking the `DeleteEvaluation` operation, you can use the GetEvaluation operation to verify that the status of the `Evaluation` changed to `DELETED`. The results of the `DeleteEvaluation` operation are irreversible. :type evaluation_id: str...
def delete_evaluation(self, evaluation_id):
params = {'EvaluationId': evaluation_id} return self.make_request(action='DeleteEvaluation', body=json.dumps(params))
'Assigns the DELETED status to an `MLModel`, rendering it unusable. After using the `DeleteMLModel` operation, you can use the GetMLModel operation to verify that the status of the `MLModel` changed to DELETED. The result of the `DeleteMLModel` operation is irreversible. :type ml_model_id: string :param ml_model_id: A ...
def delete_ml_model(self, ml_model_id):
params = {'MLModelId': ml_model_id} return self.make_request(action='DeleteMLModel', body=json.dumps(params))
'Deletes a real time endpoint of an `MLModel`. :type ml_model_id: string :param ml_model_id: The ID assigned to the `MLModel` during creation.'
def delete_realtime_endpoint(self, ml_model_id):
params = {'MLModelId': ml_model_id} return self.make_request(action='DeleteRealtimeEndpoint', body=json.dumps(params))
'Returns a list of `BatchPrediction` operations that match the search criteria in the request. :type filter_variable: string :param filter_variable: Use one of the following variables to filter a list of `BatchPrediction`: + `CreatedAt` - Sets the search criteria to the `BatchPrediction` creation date. + `Status` - Set...
def describe_batch_predictions(self, filter_variable=None, eq=None, gt=None, lt=None, ge=None, le=None, ne=None, prefix=None, sort_order=None, next_token=None, limit=None):
params = {} if (filter_variable is not None): params['FilterVariable'] = filter_variable if (eq is not None): params['EQ'] = eq if (gt is not None): params['GT'] = gt if (lt is not None): params['LT'] = lt if (ge is not None): params['GE'] = ge if (le ...
'Returns a list of `DataSource` that match the search criteria in the request. :type filter_variable: string :param filter_variable: Use one of the following variables to filter a list of `DataSource`: + `CreatedAt` - Sets the search criteria to `DataSource` creation dates. + `Status` - Sets the search criteria to `Dat...
def describe_data_sources(self, filter_variable=None, eq=None, gt=None, lt=None, ge=None, le=None, ne=None, prefix=None, sort_order=None, next_token=None, limit=None):
params = {} if (filter_variable is not None): params['FilterVariable'] = filter_variable if (eq is not None): params['EQ'] = eq if (gt is not None): params['GT'] = gt if (lt is not None): params['LT'] = lt if (ge is not None): params['GE'] = ge if (le ...
'Returns a list of `DescribeEvaluations` that match the search criteria in the request. :type filter_variable: string :param filter_variable: Use one of the following variable to filter a list of `Evaluation` objects: + `CreatedAt` - Sets the search criteria to the `Evaluation` creation date. + `Status` - Sets the sear...
def describe_evaluations(self, filter_variable=None, eq=None, gt=None, lt=None, ge=None, le=None, ne=None, prefix=None, sort_order=None, next_token=None, limit=None):
params = {} if (filter_variable is not None): params['FilterVariable'] = filter_variable if (eq is not None): params['EQ'] = eq if (gt is not None): params['GT'] = gt if (lt is not None): params['LT'] = lt if (ge is not None): params['GE'] = ge if (le ...
'Returns a list of `MLModel` that match the search criteria in the request. :type filter_variable: string :param filter_variable: Use one of the following variables to filter a list of `MLModel`: + `CreatedAt` - Sets the search criteria to `MLModel` creation date. + `Status` - Sets the search criteria to `MLModel` stat...
def describe_ml_models(self, filter_variable=None, eq=None, gt=None, lt=None, ge=None, le=None, ne=None, prefix=None, sort_order=None, next_token=None, limit=None):
params = {} if (filter_variable is not None): params['FilterVariable'] = filter_variable if (eq is not None): params['EQ'] = eq if (gt is not None): params['GT'] = gt if (lt is not None): params['LT'] = lt if (ge is not None): params['GE'] = ge if (le ...
'Returns a `BatchPrediction` that includes detailed metadata, status, and data file information for a `Batch Prediction` request. :type batch_prediction_id: string :param batch_prediction_id: An ID assigned to the `BatchPrediction` at creation.'
def get_batch_prediction(self, batch_prediction_id):
params = {'BatchPredictionId': batch_prediction_id} return self.make_request(action='GetBatchPrediction', body=json.dumps(params))
'Returns a `DataSource` that includes metadata and data file information, as well as the current status of the `DataSource`. `GetDataSource` provides results in normal or verbose format. The verbose format adds the schema description and the list of files pointed to by the DataSource to the normal format. :type data_so...
def get_data_source(self, data_source_id, verbose=None):
params = {'DataSourceId': data_source_id} if (verbose is not None): params['Verbose'] = verbose return self.make_request(action='GetDataSource', body=json.dumps(params))
'Returns an `Evaluation` that includes metadata as well as the current status of the `Evaluation`. :type evaluation_id: string :param evaluation_id: The ID of the `Evaluation` to retrieve. The evaluation of each `MLModel` is recorded and cataloged. The ID provides the means to access the information.'
def get_evaluation(self, evaluation_id):
params = {'EvaluationId': evaluation_id} return self.make_request(action='GetEvaluation', body=json.dumps(params))
'Returns an `MLModel` that includes detailed metadata, and data source information as well as the current status of the `MLModel`. `GetMLModel` provides results in normal or verbose format. :type ml_model_id: string :param ml_model_id: The ID assigned to the `MLModel` at creation. :type verbose: boolean :param verbose:...
def get_ml_model(self, ml_model_id, verbose=None):
params = {'MLModelId': ml_model_id} if (verbose is not None): params['Verbose'] = verbose return self.make_request(action='GetMLModel', body=json.dumps(params))
'Generates a prediction for the observation using the specified `MLModel`. Not all response parameters will be populated because this is dependent on the type of requested model. :type ml_model_id: string :param ml_model_id: A unique identifier of the `MLModel`. :type record: map :param record: A map of variable name-v...
def predict(self, ml_model_id, record, predict_endpoint):
predict_host = urlsplit(predict_endpoint).hostname if (predict_host is None): predict_host = predict_endpoint params = {'MLModelId': ml_model_id, 'Record': record, 'PredictEndpoint': predict_host} return self.make_request(action='Predict', body=json.dumps(params), host=predict_host)
'Updates the `BatchPredictionName` of a `BatchPrediction`. You can use the GetBatchPrediction operation to view the contents of the updated data element. :type batch_prediction_id: string :param batch_prediction_id: The ID assigned to the `BatchPrediction` during creation. :type batch_prediction_name: string :param bat...
def update_batch_prediction(self, batch_prediction_id, batch_prediction_name):
params = {'BatchPredictionId': batch_prediction_id, 'BatchPredictionName': batch_prediction_name} return self.make_request(action='UpdateBatchPrediction', body=json.dumps(params))
'Updates the `DataSourceName` of a `DataSource`. You can use the GetDataSource operation to view the contents of the updated data element. :type data_source_id: string :param data_source_id: The ID assigned to the `DataSource` during creation. :type data_source_name: string :param data_source_name: A new user-supplied ...
def update_data_source(self, data_source_id, data_source_name):
params = {'DataSourceId': data_source_id, 'DataSourceName': data_source_name} return self.make_request(action='UpdateDataSource', body=json.dumps(params))
'Updates the `EvaluationName` of an `Evaluation`. You can use the GetEvaluation operation to view the contents of the updated data element. :type evaluation_id: string :param evaluation_id: The ID assigned to the `Evaluation` during creation. :type evaluation_name: string :param evaluation_name: A new user-supplied nam...
def update_evaluation(self, evaluation_id, evaluation_name):
params = {'EvaluationId': evaluation_id, 'EvaluationName': evaluation_name} return self.make_request(action='UpdateEvaluation', body=json.dumps(params))
'Updates the `MLModelName` and the `ScoreThreshold` of an `MLModel`. You can use the GetMLModel operation to view the contents of the updated data element. :type ml_model_id: string :param ml_model_id: The ID assigned to the `MLModel` during creation. :type ml_model_name: string :param ml_model_name: A user-supplied na...
def update_ml_model(self, ml_model_id, ml_model_name=None, score_threshold=None):
params = {'MLModelId': ml_model_id} if (ml_model_name is not None): params['MLModelName'] = ml_model_name if (score_threshold is not None): params['ScoreThreshold'] = score_threshold return self.make_request(action='UpdateMLModel', body=json.dumps(params))
'Creates a display name for a customer master key. An alias can be used to identify a key and should be unique. The console enforces a one-to-one mapping between the alias and a key. An alias name can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). An alias must start with th...
def create_alias(self, alias_name, target_key_id):
params = {'AliasName': alias_name, 'TargetKeyId': target_key_id} return self.make_request(action='CreateAlias', body=json.dumps(params))
'Adds a grant to a key to specify who can access the key and under what conditions. Grants are alternate permission mechanisms to key policies. If absent, access to the key is evaluated based on IAM policies attached to the user. By default, grants do not expire. Grants can be listed, retired, or revoked as indicated b...
def create_grant(self, key_id, grantee_principal, retiring_principal=None, operations=None, constraints=None, grant_tokens=None):
params = {'KeyId': key_id, 'GranteePrincipal': grantee_principal} if (retiring_principal is not None): params['RetiringPrincipal'] = retiring_principal if (operations is not None): params['Operations'] = operations if (constraints is not None): params['Constraints'] = constraints...
'Creates a customer master key. Customer master keys can be used to encrypt small amounts of data (less than 4K) directly, but they are most commonly used to encrypt or envelope data keys that are then used to encrypt customer data. For more information about data keys, see GenerateDataKey and GenerateDataKeyWithoutPla...
def create_key(self, policy=None, description=None, key_usage=None):
params = {} if (policy is not None): params['Policy'] = policy if (description is not None): params['Description'] = description if (key_usage is not None): params['KeyUsage'] = key_usage return self.make_request(action='CreateKey', body=json.dumps(params))
'Decrypts ciphertext. Ciphertext is plaintext that has been previously encrypted by using the Encrypt function. :type ciphertext_blob: blob :param ciphertext_blob: Ciphertext including metadata. :type encryption_context: map :param encryption_context: The encryption context. If this was specified in the Encrypt functio...
def decrypt(self, ciphertext_blob, encryption_context=None, grant_tokens=None):
if (not isinstance(ciphertext_blob, six.binary_type)): raise TypeError(('Value of argument ``ciphertext_blob`` must be of type %s.' % six.binary_type)) ciphertext_blob = base64.b64encode(ciphertext_blob) params = {'CiphertextBlob': ciphertext_blob.decode('utf-8')} if (enc...
'Deletes the specified alias. :type alias_name: string :param alias_name: The alias to be deleted.'
def delete_alias(self, alias_name):
params = {'AliasName': alias_name} return self.make_request(action='DeleteAlias', body=json.dumps(params))
'Provides detailed information about the specified customer master key. :type key_id: string :param key_id: Unique identifier of the customer master key to be described. This can be an ARN, an alias, or a globally unique identifier.'
def describe_key(self, key_id):
params = {'KeyId': key_id} return self.make_request(action='DescribeKey', body=json.dumps(params))
'Marks a key as disabled, thereby preventing its use. :type key_id: string :param key_id: Unique identifier of the customer master key to be disabled. This can be an ARN, an alias, or a globally unique identifier.'
def disable_key(self, key_id):
params = {'KeyId': key_id} return self.make_request(action='DisableKey', body=json.dumps(params))
'Disables rotation of the specified key. :type key_id: string :param key_id: Unique identifier of the customer master key for which rotation is to be disabled. This can be an ARN, an alias, or a globally unique identifier.'
def disable_key_rotation(self, key_id):
params = {'KeyId': key_id} return self.make_request(action='DisableKeyRotation', body=json.dumps(params))
'Marks a key as enabled, thereby permitting its use. You can have up to 25 enabled keys at one time. :type key_id: string :param key_id: Unique identifier of the customer master key to be enabled. This can be an ARN, an alias, or a globally unique identifier.'
def enable_key(self, key_id):
params = {'KeyId': key_id} return self.make_request(action='EnableKey', body=json.dumps(params))
'Enables rotation of the specified customer master key. :type key_id: string :param key_id: Unique identifier of the customer master key for which rotation is to be enabled. This can be an ARN, an alias, or a globally unique identifier.'
def enable_key_rotation(self, key_id):
params = {'KeyId': key_id} return self.make_request(action='EnableKeyRotation', body=json.dumps(params))
'Encrypts plaintext into ciphertext by using a customer master key. :type key_id: string :param key_id: Unique identifier of the customer master. This can be an ARN, an alias, or the Key ID. :type plaintext: blob :param plaintext: Data to be encrypted. :type encryption_context: map :param encryption_context: Name:value...
def encrypt(self, key_id, plaintext, encryption_context=None, grant_tokens=None):
if (not isinstance(plaintext, six.binary_type)): raise TypeError(('Value of argument ``plaintext`` must be of type %s.' % six.binary_type)) plaintext = base64.b64encode(plaintext) params = {'KeyId': key_id, 'Plaintext': plaintext.decode('utf-8')} if (encryption_context is...
'Generates a secure data key. Data keys are used to encrypt and decrypt data. They are wrapped by customer master keys. :type key_id: string :param key_id: Unique identifier of the key. This can be an ARN, an alias, or a globally unique identifier. :type encryption_context: map :param encryption_context: Name/value pai...
def generate_data_key(self, key_id, encryption_context=None, number_of_bytes=None, key_spec=None, grant_tokens=None):
params = {'KeyId': key_id} if (encryption_context is not None): params['EncryptionContext'] = encryption_context if (number_of_bytes is not None): params['NumberOfBytes'] = number_of_bytes if (key_spec is not None): params['KeySpec'] = key_spec if (grant_tokens is not None): ...
'Returns a key wrapped by a customer master key without the plaintext copy of that key. To retrieve the plaintext, see GenerateDataKey. :type key_id: string :param key_id: Unique identifier of the key. This can be an ARN, an alias, or a globally unique identifier. :type encryption_context: map :param encryption_context...
def generate_data_key_without_plaintext(self, key_id, encryption_context=None, key_spec=None, number_of_bytes=None, grant_tokens=None):
params = {'KeyId': key_id} if (encryption_context is not None): params['EncryptionContext'] = encryption_context if (key_spec is not None): params['KeySpec'] = key_spec if (number_of_bytes is not None): params['NumberOfBytes'] = number_of_bytes if (grant_tokens is not None): ...
'Generates an unpredictable byte string. :type number_of_bytes: integer :param number_of_bytes: Integer that contains the number of bytes to generate. Common values are 128, 256, 512, 1024 and so on. The current limit is 1024 bytes.'
def generate_random(self, number_of_bytes=None):
params = {} if (number_of_bytes is not None): params['NumberOfBytes'] = number_of_bytes response = self.make_request(action='GenerateRandom', body=json.dumps(params)) if (response.get('Plaintext') is not None): response['Plaintext'] = base64.b64decode(response['Plaintext'].encode('utf-8'...
'Retrieves a policy attached to the specified key. :type key_id: string :param key_id: Unique identifier of the key. This can be an ARN, an alias, or a globally unique identifier. :type policy_name: string :param policy_name: String that contains the name of the policy. Currently, this must be "default". Policy names c...
def get_key_policy(self, key_id, policy_name):
params = {'KeyId': key_id, 'PolicyName': policy_name} return self.make_request(action='GetKeyPolicy', body=json.dumps(params))
'Retrieves a Boolean value that indicates whether key rotation is enabled for the specified key. :type key_id: string :param key_id: Unique identifier of the key. This can be an ARN, an alias, or a globally unique identifier.'
def get_key_rotation_status(self, key_id):
params = {'KeyId': key_id} return self.make_request(action='GetKeyRotationStatus', body=json.dumps(params))
'Lists all of the key aliases in the account. :type limit: integer :param limit: Specify this parameter when paginating results to indicate the maximum number of aliases you want in each response. If there are additional aliases beyond the maximum you specify, the `Truncated` response element will be set to `true.` :ty...
def list_aliases(self, limit=None, marker=None):
params = {} if (limit is not None): params['Limit'] = limit if (marker is not None): params['Marker'] = marker return self.make_request(action='ListAliases', body=json.dumps(params))
'List the grants for a specified key. :type key_id: string :param key_id: Unique identifier of the key. This can be an ARN, an alias, or a globally unique identifier. :type limit: integer :param limit: Specify this parameter only when paginating results to indicate the maximum number of grants you want listed in the re...
def list_grants(self, key_id, limit=None, marker=None):
params = {'KeyId': key_id} if (limit is not None): params['Limit'] = limit if (marker is not None): params['Marker'] = marker return self.make_request(action='ListGrants', body=json.dumps(params))
'Retrieves a list of policies attached to a key. :type key_id: string :param key_id: Unique identifier of the key. This can be an ARN, an alias, or a globally unique identifier. :type limit: integer :param limit: Specify this parameter only when paginating results to indicate the maximum number of policies you want lis...
def list_key_policies(self, key_id, limit=None, marker=None):
params = {'KeyId': key_id} if (limit is not None): params['Limit'] = limit if (marker is not None): params['Marker'] = marker return self.make_request(action='ListKeyPolicies', body=json.dumps(params))
'Lists the customer master keys. :type limit: integer :param limit: Specify this parameter only when paginating results to indicate the maximum number of keys you want listed in the response. If there are additional keys beyond the maximum you specify, the `Truncated` response element will be set to `true.` :type marke...
def list_keys(self, limit=None, marker=None):
params = {} if (limit is not None): params['Limit'] = limit if (marker is not None): params['Marker'] = marker return self.make_request(action='ListKeys', body=json.dumps(params))
'Attaches a policy to the specified key. :type key_id: string :param key_id: Unique identifier of the key. This can be an ARN, an alias, or a globally unique identifier. :type policy_name: string :param policy_name: Name of the policy to be attached. Currently, the only supported name is "default". :type policy: string...
def put_key_policy(self, key_id, policy_name, policy):
params = {'KeyId': key_id, 'PolicyName': policy_name, 'Policy': policy} return self.make_request(action='PutKeyPolicy', body=json.dumps(params))
'Encrypts data on the server side with a new customer master key without exposing the plaintext of the data on the client side. The data is first decrypted and then encrypted. This operation can also be used to change the encryption context of a ciphertext. :type ciphertext_blob: blob :param ciphertext_blob: Ciphertext...
def re_encrypt(self, ciphertext_blob, destination_key_id, source_encryption_context=None, destination_encryption_context=None, grant_tokens=None):
if (not isinstance(ciphertext_blob, six.binary_type)): raise TypeError(('Value of argument ``ciphertext_blob`` must be of type %s.' % six.binary_type)) ciphertext_blob = base64.b64encode(ciphertext_blob) params = {'CiphertextBlob': ciphertext_blob, 'DestinationKeyId': destina...
'Retires a grant. You can retire a grant when you\'re done using it to clean up. You should revoke a grant when you intend to actively deny operations that depend on it. :type grant_token: string :param grant_token: Token that identifies the grant to be retired.'
def retire_grant(self, grant_token):
params = {'GrantToken': grant_token} return self.make_request(action='RetireGrant', body=json.dumps(params))
'Revokes a grant. You can revoke a grant to actively deny operations that depend on it. :type key_id: string :param key_id: Unique identifier of the key associated with the grant. :type grant_id: string :param grant_id: Identifier of the grant to be revoked.'
def revoke_grant(self, key_id, grant_id):
params = {'KeyId': key_id, 'GrantId': grant_id} return self.make_request(action='RevokeGrant', body=json.dumps(params))
':type key_id: string :param key_id: :type description: string :param description:'
def update_key_description(self, key_id, description):
params = {'KeyId': key_id, 'Description': description} return self.make_request(action='UpdateKeyDescription', body=json.dumps(params))
'Deletes the specific dataset. The dataset will be deleted permanently, and the action can\'t be undone. Datasets that this dataset was merged with will no longer report the merge. Any consequent operation on this dataset will result in a ResourceNotFoundException. :type identity_pool_id: string :param identity_pool_id...
def delete_dataset(self, identity_pool_id, identity_id, dataset_name):
uri = '/identitypools/{0}/identities/{1}/datasets/{2}'.format(identity_pool_id, identity_id, dataset_name) return self.make_request('DELETE', uri, expected_status=200)
'Gets metadata about a dataset by identity and dataset name. The credentials used to make this API call need to have access to the identity data. With Amazon Cognito Sync, each identity has access only to its own data. You should use Amazon Cognito Identity service to retrieve the credentials necessary to make this API...
def describe_dataset(self, identity_pool_id, identity_id, dataset_name):
uri = '/identitypools/{0}/identities/{1}/datasets/{2}'.format(identity_pool_id, identity_id, dataset_name) return self.make_request('GET', uri, expected_status=200)
'Gets usage details (for example, data storage) about a particular identity pool. :type identity_pool_id: string :param identity_pool_id: A name-spaced GUID (for example, us- east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.'
def describe_identity_pool_usage(self, identity_pool_id):
uri = '/identitypools/{0}'.format(identity_pool_id) return self.make_request('GET', uri, expected_status=200)
'Gets usage information for an identity, including number of datasets and data usage. :type identity_pool_id: string :param identity_pool_id: A name-spaced GUID (for example, us- east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region. :type identity_id: string ...
def describe_identity_usage(self, identity_pool_id, identity_id):
uri = '/identitypools/{0}/identities/{1}'.format(identity_pool_id, identity_id) return self.make_request('GET', uri, expected_status=200)
'Gets the configuration settings of an identity pool. :type identity_pool_id: string :param identity_pool_id: A name-spaced GUID (for example, us- east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. This is the ID of the pool for which to return a configuration.'
def get_identity_pool_configuration(self, identity_pool_id):
uri = '/identitypools/{0}/configuration'.format(identity_pool_id) return self.make_request('GET', uri, expected_status=200)
'Lists datasets for an identity. The credentials used to make this API call need to have access to the identity data. With Amazon Cognito Sync, each identity has access only to its own data. You should use Amazon Cognito Identity service to retrieve the credentials necessary to make this API call. :type identity_pool_i...
def list_datasets(self, identity_pool_id, identity_id, next_token=None, max_results=None):
uri = '/identitypools/{0}/identities/{1}/datasets'.format(identity_pool_id, identity_id) params = {} headers = {} query_params = {} if (next_token is not None): query_params['nextToken'] = next_token if (max_results is not None): query_params['maxResults'] = max_results retur...
'Gets a list of identity pools registered with Cognito. :type next_token: string :param next_token: A pagination token for obtaining the next page of results. :type max_results: integer :param max_results: The maximum number of results to be returned.'
def list_identity_pool_usage(self, next_token=None, max_results=None):
uri = '/identitypools' params = {} headers = {} query_params = {} if (next_token is not None): query_params['nextToken'] = next_token if (max_results is not None): query_params['maxResults'] = max_results return self.make_request('GET', uri, expected_status=200, data=json.dum...
'Gets paginated records, optionally changed after a particular sync count for a dataset and identity. The credentials used to make this API call need to have access to the identity data. With Amazon Cognito Sync, each identity has access only to its own data. You should use Amazon Cognito Identity service to retrieve t...
def list_records(self, identity_pool_id, identity_id, dataset_name, last_sync_count=None, next_token=None, max_results=None, sync_session_token=None):
uri = '/identitypools/{0}/identities/{1}/datasets/{2}/records'.format(identity_pool_id, identity_id, dataset_name) params = {} headers = {} query_params = {} if (last_sync_count is not None): query_params['lastSyncCount'] = last_sync_count if (next_token is not None): query_param...
'Registers a device to receive push sync notifications. :type identity_pool_id: string :param identity_pool_id: A name-spaced GUID (for example, us- east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. Here, the ID of the pool that the identity belongs to. :type identity_id: string :param identity_id...
def register_device(self, identity_pool_id, identity_id, platform, token):
uri = '/identitypools/{0}/identity/{1}/device'.format(identity_pool_id, identity_id) params = {'Platform': platform, 'Token': token} headers = {} query_params = {} return self.make_request('POST', uri, expected_status=200, data=json.dumps(params), headers=headers, params=query_params)
'Sets the necessary configuration for push sync. :type identity_pool_id: string :param identity_pool_id: A name-spaced GUID (for example, us- east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. This is the ID of the pool to modify. :type push_sync: dict :param push_sync: Configuration options to be ...
def set_identity_pool_configuration(self, identity_pool_id, push_sync=None):
uri = '/identitypools/{0}/configuration'.format(identity_pool_id) params = {} headers = {} query_params = {} if (push_sync is not None): params['PushSync'] = push_sync return self.make_request('POST', uri, expected_status=200, data=json.dumps(params), headers=headers, params=query_params...
'Subscribes to receive notifications when a dataset is modified by another device. :type identity_pool_id: string :param identity_pool_id: A name-spaced GUID (for example, us- east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which the identity belongs. :type identity_id: str...
def subscribe_to_dataset(self, identity_pool_id, identity_id, dataset_name, device_id):
uri = '/identitypools/{0}/identities/{1}/datasets/{2}/subscriptions/{3}'.format(identity_pool_id, identity_id, dataset_name, device_id) return self.make_request('POST', uri, expected_status=200)
'Unsubscribe from receiving notifications when a dataset is modified by another device. :type identity_pool_id: string :param identity_pool_id: A name-spaced GUID (for example, us- east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which this identity belongs. :type identity_i...
def unsubscribe_from_dataset(self, identity_pool_id, identity_id, dataset_name, device_id):
uri = '/identitypools/{0}/identities/{1}/datasets/{2}/subscriptions/{3}'.format(identity_pool_id, identity_id, dataset_name, device_id) return self.make_request('DELETE', uri, expected_status=200)
'Posts updates to records and add and delete records for a dataset and user. The credentials used to make this API call need to have access to the identity data. With Amazon Cognito Sync, each identity has access only to its own data. You should use Amazon Cognito Identity service to retrieve the credentials necessary ...
def update_records(self, identity_pool_id, identity_id, dataset_name, sync_session_token, device_id=None, record_patches=None, client_context=None):
uri = '/identitypools/{0}/identities/{1}/datasets/{2}'.format(identity_pool_id, identity_id, dataset_name) params = {'SyncSessionToken': sync_session_token} headers = {} query_params = {} if (device_id is not None): params['DeviceId'] = device_id if (record_patches is not None): ...
'Creates a new identity pool. The identity pool is a store of user identity information that is specific to your AWS account. The limit on identity pools is 60 per account. :type identity_pool_name: string :param identity_pool_name: A string that you provide. :type allow_unauthenticated_identities: boolean :param allow...
def create_identity_pool(self, identity_pool_name, allow_unauthenticated_identities, supported_login_providers=None, developer_provider_name=None, open_id_connect_provider_ar_ns=None):
params = {'IdentityPoolName': identity_pool_name, 'AllowUnauthenticatedIdentities': allow_unauthenticated_identities} if (supported_login_providers is not None): params['SupportedLoginProviders'] = supported_login_providers if (developer_provider_name is not None): params['DeveloperProviderN...
'Deletes a user pool. Once a pool is deleted, users will not be able to authenticate with the pool. :type identity_pool_id: string :param identity_pool_id: An identity pool ID in the format REGION:GUID.'
def delete_identity_pool(self, identity_pool_id):
params = {'IdentityPoolId': identity_pool_id} return self.make_request(action='DeleteIdentityPool', body=json.dumps(params))
'Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users. :type identity_pool_id: string :param identity_pool_id: An identity pool ID in the format REGION:GUID.'
def describe_identity_pool(self, identity_pool_id):
params = {'IdentityPoolId': identity_pool_id} return self.make_request(action='DescribeIdentityPool', body=json.dumps(params))
'Generates (or retrieves) a Cognito ID. Supplying multiple logins will create an implicit linked account. :type account_id: string :param account_id: A standard AWS account ID (9+ digits). :type identity_pool_id: string :param identity_pool_id: An identity pool ID in the format REGION:GUID. :type logins: map :param log...
def get_id(self, account_id, identity_pool_id, logins=None):
params = {'AccountId': account_id, 'IdentityPoolId': identity_pool_id} if (logins is not None): params['Logins'] = logins return self.make_request(action='GetId', body=json.dumps(params))
'Gets an OpenID token, using a known Cognito ID. This known Cognito ID is returned by GetId. You can optionally add additional logins for the identity. Supplying multiple logins creates an implicit link. The OpenId token is valid for 15 minutes. :type identity_id: string :param identity_id: A unique identifier in the f...
def get_open_id_token(self, identity_id, logins=None):
params = {'IdentityId': identity_id} if (logins is not None): params['Logins'] = logins return self.make_request(action='GetOpenIdToken', body=json.dumps(params))
'Registers (or retrieves) a Cognito `IdentityId` and an OpenID Connect token for a user authenticated by your backend authentication process. Supplying multiple logins will create an implicit linked account. You can only specify one developer provider as part of the `Logins` map, which is linked to the identity pool. T...
def get_open_id_token_for_developer_identity(self, identity_pool_id, logins, identity_id=None, token_duration=None):
params = {'IdentityPoolId': identity_pool_id, 'Logins': logins} if (identity_id is not None): params['IdentityId'] = identity_id if (token_duration is not None): params['TokenDuration'] = token_duration return self.make_request(action='GetOpenIdTokenForDeveloperIdentity', body=json.dumps...
'Lists the identities in a pool. :type identity_pool_id: string :param identity_pool_id: An identity pool ID in the format REGION:GUID. :type max_results: integer :param max_results: The maximum number of identities to return. :type next_token: string :param next_token: A pagination token.'
def list_identities(self, identity_pool_id, max_results, next_token=None):
params = {'IdentityPoolId': identity_pool_id, 'MaxResults': max_results} if (next_token is not None): params['NextToken'] = next_token return self.make_request(action='ListIdentities', body=json.dumps(params))
'Lists all of the Cognito identity pools registered for your account. :type max_results: integer :param max_results: The maximum number of identities to return. :type next_token: string :param next_token: A pagination token.'
def list_identity_pools(self, max_results, next_token=None):
params = {'MaxResults': max_results} if (next_token is not None): params['NextToken'] = next_token return self.make_request(action='ListIdentityPools', body=json.dumps(params))
'Retrieves the `IdentityID` associated with a `DeveloperUserIdentifier` or the list of `DeveloperUserIdentifier`s associated with an `IdentityId` for an existing identity. Either `IdentityID` or `DeveloperUserIdentifier` must not be null. If you supply only one of these values, the other value will be searched in the d...
def lookup_developer_identity(self, identity_pool_id, identity_id=None, developer_user_identifier=None, max_results=None, next_token=None):
params = {'IdentityPoolId': identity_pool_id} if (identity_id is not None): params['IdentityId'] = identity_id if (developer_user_identifier is not None): params['DeveloperUserIdentifier'] = developer_user_identifier if (max_results is not None): params['MaxResults'] = max_result...
'Merges two users having different `IdentityId`s, existing in the same identity pool, and identified by the same developer provider. You can use this action to request that discrete users be merged and identified as a single user in the Cognito environment. Cognito associates the given source user ( `SourceUserIdentifi...
def merge_developer_identities(self, source_user_identifier, destination_user_identifier, developer_provider_name, identity_pool_id):
params = {'SourceUserIdentifier': source_user_identifier, 'DestinationUserIdentifier': destination_user_identifier, 'DeveloperProviderName': developer_provider_name, 'IdentityPoolId': identity_pool_id} return self.make_request(action='MergeDeveloperIdentities', body=json.dumps(params))
'Unlinks a `DeveloperUserIdentifier` from an existing identity. Unlinked developer users will be considered new identities next time they are seen. If, for a given Cognito identity, you remove all federated identities as well as the developer user identifier, the Cognito identity becomes inaccessible. :type identity_id...
def unlink_developer_identity(self, identity_id, identity_pool_id, developer_provider_name, developer_user_identifier):
params = {'IdentityId': identity_id, 'IdentityPoolId': identity_pool_id, 'DeveloperProviderName': developer_provider_name, 'DeveloperUserIdentifier': developer_user_identifier} return self.make_request(action='UnlinkDeveloperIdentity', body=json.dumps(params))
'Unlinks a federated identity from an existing account. Unlinked logins will be considered new identities next time they are seen. Removing the last linked login will make this identity inaccessible. :type identity_id: string :param identity_id: A unique identifier in the format REGION:GUID. :type logins: map :param lo...
def unlink_identity(self, identity_id, logins, logins_to_remove):
params = {'IdentityId': identity_id, 'Logins': logins, 'LoginsToRemove': logins_to_remove} return self.make_request(action='UnlinkIdentity', body=json.dumps(params))
'Updates a user pool. :type identity_pool_id: string :param identity_pool_id: An identity pool ID in the format REGION:GUID. :type identity_pool_name: string :param identity_pool_name: A string that you provide. :type allow_unauthenticated_identities: boolean :param allow_unauthenticated_identities: TRUE if the identit...
def update_identity_pool(self, identity_pool_id, identity_pool_name, allow_unauthenticated_identities, supported_login_providers=None, developer_provider_name=None, open_id_connect_provider_ar_ns=None):
params = {'IdentityPoolId': identity_pool_id, 'IdentityPoolName': identity_pool_name, 'AllowUnauthenticatedIdentities': allow_unauthenticated_identities} if (supported_login_providers is not None): params['SupportedLoginProviders'] = supported_login_providers if (developer_provider_name is not None)...
'Connect to this Region\'s endpoint. Returns an connection object pointing to the endpoint associated with this region. You may pass any of the arguments accepted by the connection class\'s constructor as keyword arguments and they will be passed along to the connection object. :rtype: Connection object :return: The co...
def connect(self, **kw_params):
if self.connection_cls: return self.connection_cls(host=self.endpoint, **kw_params)
'Utility method to handle calls to IAM and parsing of responses.'
def get_response(self, action, params, path='/', parent=None, verb='POST', list_marker='Set'):
if (not parent): parent = self response = self.make_request(action, params, path, verb) body = response.read() boto.log.debug(body) if (response.status == 200): if body: e = boto.jsonresponse.Element(list_marker=list_marker, pythonize_name=True) h = boto.jsonr...
'List the groups that have the specified path prefix. :type path_prefix: string :param path_prefix: If provided, only groups whose paths match the provided prefix will be returned. :type marker: string :param marker: Use this only when paginating results and only in follow-up request after you\'ve received a response w...
def get_all_groups(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('ListGroups', params, list_marker='Groups')
'Return a list of users that are in the specified group. :type group_name: string :param group_name: The name of the group whose information should be returned. :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...
def get_group(self, group_name, marker=None, max_items=None):
params = {'GroupName': group_name} if marker: params['Marker'] = marker if max_items: params['MaxItems'] = max_items return self.get_response('GetGroup', params, list_marker='Users')
'Create a group. :type group_name: string :param group_name: The name of the new group :type path: string :param path: The path to the group (Optional). Defaults to /.'
def create_group(self, group_name, path='/'):
params = {'GroupName': group_name, 'Path': path} return self.get_response('CreateGroup', params)
'Delete a group. The group must not contain any Users or have any attached policies :type group_name: string :param group_name: The name of the group to delete.'
def delete_group(self, group_name):
params = {'GroupName': group_name} return self.get_response('DeleteGroup', params)
'Updates name and/or path of the specified group. :type group_name: string :param group_name: The name of the new group :type new_group_name: string :param new_group_name: If provided, the name of the group will be changed to this name. :type new_path: string :param new_path: If provided, the path of the group will be ...
def update_group(self, group_name, new_group_name=None, new_path=None):
params = {'GroupName': group_name} if new_group_name: params['NewGroupName'] = new_group_name if new_path: params['NewPath'] = new_path return self.get_response('UpdateGroup', params)
'Add a user to a group :type group_name: string :param group_name: The name of the group :type user_name: string :param user_name: The to be added to the group.'
def add_user_to_group(self, group_name, user_name):
params = {'GroupName': group_name, 'UserName': user_name} return self.get_response('AddUserToGroup', params)
'Remove a user from a group. :type group_name: string :param group_name: The name of the group :type user_name: string :param user_name: The user to remove from the group.'
def remove_user_from_group(self, group_name, user_name):
params = {'GroupName': group_name, 'UserName': user_name} return self.get_response('RemoveUserFromGroup', params)
'Adds or updates the specified policy document for the specified group. :type group_name: string :param group_name: The name of the group the policy is associated with. :type policy_name: string :param policy_name: The policy document to get. :type policy_json: string :param policy_json: The policy document.'
def put_group_policy(self, group_name, policy_name, policy_json):
params = {'GroupName': group_name, 'PolicyName': policy_name, 'PolicyDocument': policy_json} return self.get_response('PutGroupPolicy', params, verb='POST')
'List the names of the policies associated with the specified group. :type group_name: string :param group_name: The name of the group the policy is associated with. :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 result...
def get_all_group_policies(self, group_name, marker=None, max_items=None):
params = {'GroupName': group_name} if marker: params['Marker'] = marker if max_items: params['MaxItems'] = max_items return self.get_response('ListGroupPolicies', params, list_marker='PolicyNames')
'Retrieves the specified policy document for the specified group. :type group_name: string :param group_name: The name of the group the policy is associated with. :type policy_name: string :param policy_name: The policy document to get.'
def get_group_policy(self, group_name, policy_name):
params = {'GroupName': group_name, 'PolicyName': policy_name} return self.get_response('GetGroupPolicy', params, verb='POST')
'Deletes the specified policy document for the specified group. :type group_name: string :param group_name: The name of the group the policy is associated with. :type policy_name: string :param policy_name: The policy document to delete.'
def delete_group_policy(self, group_name, policy_name):
params = {'GroupName': group_name, 'PolicyName': policy_name} return self.get_response('DeleteGroupPolicy', params, verb='POST')
'List the users that have the specified path prefix. :type path_prefix: string :param path_prefix: If provided, only users whose paths match the provided prefix will be returned. :type marker: string :param marker: Use this only when paginating results and only in follow-up request after you\'ve received a response whe...
def get_all_users(self, path_prefix='/', marker=None, max_items=None):
params = {'PathPrefix': path_prefix} if marker: params['Marker'] = marker if max_items: params['MaxItems'] = max_items return self.get_response('ListUsers', params, list_marker='Users')
'Create a user. :type user_name: string :param user_name: The name of the new user :type path: string :param path: The path in which the user will be created. Defaults to /.'
def create_user(self, user_name, path='/'):
params = {'UserName': user_name, 'Path': path} return self.get_response('CreateUser', params)
'Delete a user including the user\'s path, GUID and ARN. 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 name of the user to delete.'
def delete_user(self, user_name):
params = {'UserName': user_name} return self.get_response('DeleteUser', params)
'Retrieve information about the specified user. 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 name of the user to retrieve. If not specified, defaults to user making request.'
def get_user(self, user_name=None):
params = {} if user_name: params['UserName'] = user_name return self.get_response('GetUser', params)
'Updates name and/or path of the specified user. :type user_name: string :param user_name: The name of the user :type new_user_name: string :param new_user_name: If provided, the username of the user will be changed to this username. :type new_path: string :param new_path: If provided, the path of the user will be chan...
def update_user(self, user_name, new_user_name=None, new_path=None):
params = {'UserName': user_name} if new_user_name: params['NewUserName'] = new_user_name if new_path: params['NewPath'] = new_path return self.get_response('UpdateUser', params)
'List the names of the policies associated with the specified user. :type user_name: string :param user_name: The name of the user the policy is associated with. :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 ar...
def get_all_user_policies(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('ListUserPolicies', params, list_marker='PolicyNames')
'Adds or updates the specified policy document for the specified user. :type user_name: string :param user_name: The name of the user the policy is associated with. :type policy_name: string :param policy_name: The policy document to get. :type policy_json: string :param policy_json: The policy document.'
def put_user_policy(self, user_name, policy_name, policy_json):
params = {'UserName': user_name, 'PolicyName': policy_name, 'PolicyDocument': policy_json} return self.get_response('PutUserPolicy', params, verb='POST')
'Retrieves the specified policy document for the specified user. :type user_name: string :param user_name: The name of the user the policy is associated with. :type policy_name: string :param policy_name: The policy document to get.'
def get_user_policy(self, user_name, policy_name):
params = {'UserName': user_name, 'PolicyName': policy_name} return self.get_response('GetUserPolicy', params, verb='POST')
'Deletes the specified policy document for the specified user. :type user_name: string :param user_name: The name of the user the policy is associated with. :type policy_name: string :param policy_name: The policy document to delete.'
def delete_user_policy(self, user_name, policy_name):
params = {'UserName': user_name, 'PolicyName': policy_name} return self.get_response('DeleteUserPolicy', params, verb='POST')
'List the groups that a specified user belongs to. :type user_name: string :param user_name: The name of the user to list groups for. :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 th...
def get_groups_for_user(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('ListGroupsForUser', params, list_marker='Groups')