AWS IoT

2015/10/07 - AWS IoT - 39 new api methods

ListPrincipalThings (new) Link ¶

Lists the things associated with the specified principal.

Request Syntax

client.list_principal_things(
    nextToken='string',
    maxResults=123,
    principal='string'
)
type nextToken

string

param nextToken

type maxResults

integer

param maxResults

type principal

string

param principal

[REQUIRED]

The principal.

rtype

dict

returns

Response Syntax

{
    'things': [
        'string',
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    The output from the ListPrincipalThings operation.

    • things (list) --

      The things.

      • (string) --

    • nextToken (string) --

      A token used to retrieve the next value.

DeleteTopicRule (new) Link ¶

Deletes the specified rule.

Request Syntax

client.delete_topic_rule(
    ruleName='string'
)
type ruleName

string

param ruleName

[REQUIRED]

The name of the rule.

returns

None

CreateThing (new) Link ¶

Creates a thing in the thing registry.

Request Syntax

client.create_thing(
    thingName='string',
    attributePayload={
        'attributes': {
            'string': 'string'
        }
    }
)
type thingName

string

param thingName

[REQUIRED]

The name of the thing.

type attributePayload

dict

param attributePayload

The attribute payload. Which consists of up to 3 name/value pairs in a JSON document. For example: {"attributes":{"string1":"string2”}}

  • attributes (dict) --

    A JSON string containing up to three key-value pair in JSON format.

    For example: {"attributes":{"string1":"string2”}}

    • (string) --

      • (string) --

rtype

dict

returns

Response Syntax

{
    'thingName': 'string',
    'thingArn': 'string'
}

Response Structure

  • (dict) --

    The output of the CreateThing operation.

    • thingName (string) --

      The name of the thing.

    • thingArn (string) --

      The thing ARN.

ListThings (new) Link ¶

Lists your things. You can pass an AttributeName and/or AttributeValue to filter your things. For example: "ListThings where AttributeName=Color and AttributeValue=Red"

Request Syntax

client.list_things(
    nextToken='string',
    maxResults=123,
    attributeName='string',
    attributeValue='string'
)
type nextToken

string

param nextToken

The token for the next value.

type maxResults

integer

param maxResults

The maximum number of results.

type attributeName

string

param attributeName

The attribute name.

type attributeValue

string

param attributeValue

The attribute value.

rtype

dict

returns

Response Syntax

{
    'things': [
        {
            'thingName': 'string',
            'attributes': {
                'string': 'string'
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    The output from the ListThings operation.

    • things (list) --

      The things.

      • (dict) --

        Describes a thing attribute.

        • thingName (string) --

          The name of the thing.

        • attributes (dict) --

          The attributes.

          • (string) --

            • (string) --

    • nextToken (string) --

      A token used to retrieve the next value.

GetPolicyVersion (new) Link ¶

Gets information about the specified policy version.

Request Syntax

client.get_policy_version(
    policyName='string',
    policyVersionId='string'
)
type policyName

string

param policyName

[REQUIRED]

The name of the policy.

type policyVersionId

string

param policyVersionId

[REQUIRED]

The policy version ID.

rtype

dict

returns

Response Syntax

{
    'policyArn': 'string',
    'policyName': 'string',
    'policyDocument': 'string',
    'policyVersionId': 'string',
    'isDefaultVersion': True|False
}

Response Structure

  • (dict) --

    The output from the GetPolicyVersion operation.

    • policyArn (string) --

      The policy ARN.

    • policyName (string) --

      The policy name.

    • policyDocument (string) --

      The JSON document that describes the policy.

    • policyVersionId (string) --

      The policy version ID.

    • isDefaultVersion (boolean) --

      Specifies whether the policy version is the default.

DeleteThing (new) Link ¶

Deletes the specified thing from the Thing Registry.

Request Syntax

client.delete_thing(
    thingName='string'
)
type thingName

string

param thingName

[REQUIRED]

The thing name.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    The output of the DeleteThing operation.

DeleteCertificate (new) Link ¶

Deletes the specified certificate.

A certificate cannot be deleted if it has a policy attached to it. To delete a certificate, first detach all policies using the DetachPrincipalPolicy operation.

In addition, a certificate cannot be deleted if it is in ACTIVE status. To delete a certificate, first change the status to INACTIVE using the UpdateCertificate operation.

Request Syntax

client.delete_certificate(
    certificateId='string'
)
type certificateId

string

param certificateId

[REQUIRED]

The ID of the certificate.

returns

None

ReplaceTopicRule (new) Link ¶

Replaces the specified rule. You must specify all parameters for the new rule.

Request Syntax

client.replace_topic_rule(
    ruleName='string',
    topicRulePayload={
        'sql': 'string',
        'description': 'string',
        'actions': [
            {
                'dynamoDB': {
                    'tableName': 'string',
                    'roleArn': 'string',
                    'hashKeyField': 'string',
                    'hashKeyValue': 'string',
                    'rangeKeyField': 'string',
                    'rangeKeyValue': 'string',
                    'payloadField': 'string'
                },
                'lambda': {
                    'functionArn': 'string'
                },
                'sns': {
                    'targetArn': 'string',
                    'roleArn': 'string'
                },
                'sqs': {
                    'roleArn': 'string',
                    'queueUrl': 'string',
                    'useBase64': True|False
                },
                'kinesis': {
                    'roleArn': 'string',
                    'streamName': 'string',
                    'partitionKey': 'string'
                },
                'republish': {
                    'roleArn': 'string',
                    'topic': 'string'
                },
                's3': {
                    'roleArn': 'string',
                    'bucketName': 'string',
                    'key': 'string'
                },
                'firehose': {
                    'roleArn': 'string',
                    'deliveryStreamName': 'string'
                }
            },
        ],
        'ruleDisabled': True|False
    }
)
type ruleName

string

param ruleName

[REQUIRED]

The name of the rule.

type topicRulePayload

dict

param topicRulePayload

[REQUIRED]

The rule payload.

  • sql (string) -- [REQUIRED]

    The SQL statement used to query the topic. For more information, see AWS IoT SQL Reference in the AWS IoT Developer Guide .

  • description (string) --

    The description of the rule.

  • actions (list) -- [REQUIRED]

    The actions associated with the rule.

    • (dict) --

      Describes the actions associated with a rule.

      • dynamoDB (dict) --

        Write to a DynamoDB table.

        • tableName (string) -- [REQUIRED]

          The name of the DynamoDB table.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

        • hashKeyField (string) -- [REQUIRED]

          The hash key name.

        • hashKeyValue (string) -- [REQUIRED]

          The hash key value.

        • rangeKeyField (string) -- [REQUIRED]

          The range key name.

        • rangeKeyValue (string) -- [REQUIRED]

          The range key value.

        • payloadField (string) --

          The action payload.

      • lambda (dict) --

        Invoke a Lambda function.

        • functionArn (string) -- [REQUIRED]

          The ARN of the Lambda function.

      • sns (dict) --

        Publish to an SNS topic.

        • targetArn (string) -- [REQUIRED]

          The ARN of the SNS topic.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

      • sqs (dict) --

        Publish to an SQS queue.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

        • queueUrl (string) -- [REQUIRED]

          The URL of the Amazon SQS queue.

        • useBase64 (boolean) --

          Specifies whether to use Base64 encoding.

      • kinesis (dict) --

        Write data to a Kinesis stream.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

        • streamName (string) -- [REQUIRED]

          The name of the Kinesis stream.

        • partitionKey (string) --

          The partition key.

      • republish (dict) --

        Publish to another MQTT topic.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

        • topic (string) -- [REQUIRED]

          The name of the MQTT topic.

      • s3 (dict) --

        Write to an S3 bucket.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

        • bucketName (string) -- [REQUIRED]

          The S3 bucket.

        • key (string) -- [REQUIRED]

          The object key.

      • firehose (dict) --

        • roleArn (string) -- [REQUIRED]

        • deliveryStreamName (string) -- [REQUIRED]

  • ruleDisabled (boolean) --

    Specifies whether the rule is disabled.

returns

None

GetTopicRule (new) Link ¶

Gets information about the specified rule.

Request Syntax

client.get_topic_rule(
    ruleName='string'
)
type ruleName

string

param ruleName

[REQUIRED]

The name of the rule.

rtype

dict

returns

Response Syntax

{
    'rule': {
        'ruleName': 'string',
        'sql': 'string',
        'description': 'string',
        'createdAt': datetime(2015, 1, 1),
        'actions': [
            {
                'dynamoDB': {
                    'tableName': 'string',
                    'roleArn': 'string',
                    'hashKeyField': 'string',
                    'hashKeyValue': 'string',
                    'rangeKeyField': 'string',
                    'rangeKeyValue': 'string',
                    'payloadField': 'string'
                },
                'lambda': {
                    'functionArn': 'string'
                },
                'sns': {
                    'targetArn': 'string',
                    'roleArn': 'string'
                },
                'sqs': {
                    'roleArn': 'string',
                    'queueUrl': 'string',
                    'useBase64': True|False
                },
                'kinesis': {
                    'roleArn': 'string',
                    'streamName': 'string',
                    'partitionKey': 'string'
                },
                'republish': {
                    'roleArn': 'string',
                    'topic': 'string'
                },
                's3': {
                    'roleArn': 'string',
                    'bucketName': 'string',
                    'key': 'string'
                },
                'firehose': {
                    'roleArn': 'string',
                    'deliveryStreamName': 'string'
                }
            },
        ],
        'ruleDisabled': True|False
    }
}

Response Structure

  • (dict) --

    The output from the GetTopicRule operation.

    • rule (dict) --

      The rule.

      • ruleName (string) --

        The name of the rule.

      • sql (string) --

        The SQL statement used to query the topic. When using a SQL query with multiple lines, be sure to escape the newline characters properly.

      • description (string) --

        The description of the rule.

      • createdAt (datetime) --

        The date and time the rule was created.

      • actions (list) --

        The actions associated with the rule.

        • (dict) --

          Describes the actions associated with a rule.

          • dynamoDB (dict) --

            Write to a DynamoDB table.

            • tableName (string) --

              The name of the DynamoDB table.

            • roleArn (string) --

              The ARN of the IAM role that grants access.

            • hashKeyField (string) --

              The hash key name.

            • hashKeyValue (string) --

              The hash key value.

            • rangeKeyField (string) --

              The range key name.

            • rangeKeyValue (string) --

              The range key value.

            • payloadField (string) --

              The action payload.

          • lambda (dict) --

            Invoke a Lambda function.

            • functionArn (string) --

              The ARN of the Lambda function.

          • sns (dict) --

            Publish to an SNS topic.

            • targetArn (string) --

              The ARN of the SNS topic.

            • roleArn (string) --

              The ARN of the IAM role that grants access.

          • sqs (dict) --

            Publish to an SQS queue.

            • roleArn (string) --

              The ARN of the IAM role that grants access.

            • queueUrl (string) --

              The URL of the Amazon SQS queue.

            • useBase64 (boolean) --

              Specifies whether to use Base64 encoding.

          • kinesis (dict) --

            Write data to a Kinesis stream.

            • roleArn (string) --

              The ARN of the IAM role that grants access.

            • streamName (string) --

              The name of the Kinesis stream.

            • partitionKey (string) --

              The partition key.

          • republish (dict) --

            Publish to another MQTT topic.

            • roleArn (string) --

              The ARN of the IAM role that grants access.

            • topic (string) --

              The name of the MQTT topic.

          • s3 (dict) --

            Write to an S3 bucket.

            • roleArn (string) --

              The ARN of the IAM role that grants access.

            • bucketName (string) --

              The S3 bucket.

            • key (string) --

              The object key.

          • firehose (dict) --

            • roleArn (string) --

            • deliveryStreamName (string) --

      • ruleDisabled (boolean) --

        Specifies whether the rule is disabled.

RejectCertificateTransfer (new) Link ¶

Rejects a pending certificate transfer. After AWS IoT rejects a certificate transfer, the certificate status changes from PENDING_TRANFER to INACTIVE .

To check for pending certificate transfers, call ListCertificates to enumerate your certificates.

This operation can only be called by the transfer destination. Once called, the certificate will be returned to the source's account in the INACTIVE state.

Request Syntax

client.reject_certificate_transfer(
    certificateId='string'
)
type certificateId

string

param certificateId

[REQUIRED]

The ID of the certificate.

returns

None

ListPrincipalPolicies (new) Link ¶

Lists the policies attached to the specified principal. If you use an Amazon Cognito identity, the ID needs to be in Amazon Cognito Identity format.

Request Syntax

client.list_principal_policies(
    principal='string',
    marker='string',
    pageSize=123,
    ascendingOrder=True|False
)
type principal

string

param principal

[REQUIRED]

The principal.

type marker

string

param marker

The marker for the next set of results.

type pageSize

integer

param pageSize

The result page size.

type ascendingOrder

boolean

param ascendingOrder

Specifies the order for results. If true, results are returned in ascending creation order.

rtype

dict

returns

Response Syntax

{
    'policies': [
        {
            'policyName': 'string',
            'policyArn': 'string'
        },
    ],
    'nextMarker': 'string'
}

Response Structure

  • (dict) --

    The output from the ListPrincipalPolicies operation.

    • policies (list) --

      The policies.

      • (dict) --

        Describes an AWS IoT policy.

        • policyName (string) --

          The policy name.

        • policyArn (string) --

          The policy ARN.

    • nextMarker (string) --

      The marker for the next set of results, or null if there are no additional results.

ListPolicyVersions (new) Link ¶

Lists the versions of the specified policy, and identifies the default version.

Request Syntax

client.list_policy_versions(
    policyName='string'
)
type policyName

string

param policyName

[REQUIRED]

The policy name.

rtype

dict

returns

Response Syntax

{
    'policyVersions': [
        {
            'versionId': 'string',
            'isDefaultVersion': True|False,
            'createDate': datetime(2015, 1, 1)
        },
    ]
}

Response Structure

  • (dict) --

    The output from the ListPolicyVersions operation.

    • policyVersions (list) --

      The policy versions.

      • (dict) --

        Describes a policy version.

        • versionId (string) --

          The policy version ID.

        • isDefaultVersion (boolean) --

          Specifies whether the policy version is the default.

        • createDate (datetime) --

          The date and time the policy was created.

AttachPrincipalPolicy (new) Link ¶

Attaches the specified policy to the specified principal (certificate or other credential).

Request Syntax

client.attach_principal_policy(
    policyName='string',
    principal='string'
)
type policyName

string

param policyName

[REQUIRED]

The policy name.

type principal

string

param principal

[REQUIRED]

The principal which can be a certificate ARN (as returned from the CreateCertificate operation) or a Cognito ID.

returns

None

CreatePolicy (new) Link ¶

Creates an AWS IoT policy.

The created policy is the default version for the policy. This operation creates a policy version with a version identifier of 1 and sets 1 as the policy's default version.

Request Syntax

client.create_policy(
    policyName='string',
    policyDocument='string'
)
type policyName

string

param policyName

[REQUIRED]

The policy name.

type policyDocument

string

param policyDocument

[REQUIRED]

The JSON document that describes the policy. The length of the policyDocument must be a minimum length of 1, with a maximum length of 2048, excluding whitespace.

rtype

dict

returns

Response Syntax

{
    'policyName': 'string',
    'policyArn': 'string',
    'policyDocument': 'string',
    'policyVersionId': 'string'
}

Response Structure

  • (dict) --

    The output from the CreatePolicy operation.

    • policyName (string) --

      The policy name.

    • policyArn (string) --

      The policy ARN.

    • policyDocument (string) --

      The JSON document that describes the policy.

    • policyVersionId (string) --

      The policy version ID.

GetPolicy (new) Link ¶

Gets information about the specified policy with the policy document of the default version.

Request Syntax

client.get_policy(
    policyName='string'
)
type policyName

string

param policyName

[REQUIRED]

The name of the policy.

rtype

dict

returns

Response Syntax

{
    'policyName': 'string',
    'policyArn': 'string',
    'policyDocument': 'string',
    'defaultVersionId': 'string'
}

Response Structure

  • (dict) --

    The output from the GetPolicy operation.

    • policyName (string) --

      The policy name.

    • policyArn (string) --

      The policy ARN.

    • policyDocument (string) --

      The JSON document that describes the policy.

    • defaultVersionId (string) --

      The default policy version ID.

ListCertificates (new) Link ¶

Lists your certificates.

The results are paginated with a default page size of 25. You can retrieve additional results using the returned marker.

Request Syntax

client.list_certificates(
    pageSize=123,
    marker='string',
    ascendingOrder=True|False
)
type pageSize

integer

param pageSize

The result page size.

type marker

string

param marker

The marker for the next set of results.

type ascendingOrder

boolean

param ascendingOrder

Specifies the order for results. If True, the results are returned in ascending order, based on the creation date.

rtype

dict

returns

Response Syntax

{
    'certificates': [
        {
            'certificateArn': 'string',
            'certificateId': 'string',
            'status': 'ACTIVE'|'INACTIVE'|'REVOKED'|'PENDING_TRANSFER',
            'creationDate': datetime(2015, 1, 1)
        },
    ],
    'nextMarker': 'string'
}

Response Structure

  • (dict) --

    The output of the ListCertificates operation.

    • certificates (list) --

      The descriptions of the certificates.

      • (dict) --

        Information about a certificate.

        • certificateArn (string) --

          The ARN of the certificate.

        • certificateId (string) --

          The ID of the certificate.

        • status (string) --

          The status of the certificate.

        • creationDate (datetime) --

          The date and time the certificate was created.

    • nextMarker (string) --

      The marker for the next set of results, or null if there are no additional results.

SetLoggingOptions (new) Link ¶

Sets the logging options.

Request Syntax

client.set_logging_options(
    loggingOptionsPayload={
        'roleArn': 'string',
        'logLevel': 'DEBUG'|'INFO'|'ERROR'|'WARN'|'DISABLED'
    }
)
type loggingOptionsPayload

dict

param loggingOptionsPayload

The logging options payload.

  • roleArn (string) -- [REQUIRED]

    The ARN of the IAM role that grants access.

  • logLevel (string) --

    The logging level.

returns

None

CreateKeysAndCertificate (new) Link ¶

Creates a 2048 bit RSA key pair and issues an X.509 certificate using the issued public key.

Note This is the only time AWS IoT issues the private key for this certificate. It is important to keep track of the private key.

Request Syntax

client.create_keys_and_certificate(
    setAsActive=True|False
)
type setAsActive

boolean

param setAsActive

Specifies whether the certificate is active.

rtype

dict

returns

Response Syntax

{
    'certificateArn': 'string',
    'certificateId': 'string',
    'certificatePem': 'string',
    'keyPair': {
        'PublicKey': 'string',
        'PrivateKey': 'string'
    }
}

Response Structure

  • (dict) --

    The output of the CreateKeysAndCertificate operation.

    • certificateArn (string) --

      The ARN of the certificate.

    • certificateId (string) --

      The ID of the certificate. AWS IoT issues a default subject name for the certificate (e.g., AWS IoT Certificate).

    • certificatePem (string) --

      The certificate data, in PEM format.

    • keyPair (dict) --

      The generated key pair.

      • PublicKey (string) --

        The public key.

      • PrivateKey (string) --

        The private key.

DetachThingPrincipal (new) Link ¶

Detaches the specified principal from the specified thing.

Request Syntax

client.detach_thing_principal(
    thingName='string',
    principal='string'
)
type thingName

string

param thingName

[REQUIRED]

The name of the thing.

type principal

string

param principal

[REQUIRED]

The principal.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    The output from the DetachThingPrincipal operation.

SetDefaultPolicyVersion (new) Link ¶

Sets the specified policy version as the default for the specified policy.

Request Syntax

client.set_default_policy_version(
    policyName='string',
    policyVersionId='string'
)
type policyName

string

param policyName

[REQUIRED]

The policy name.

type policyVersionId

string

param policyVersionId

[REQUIRED]

The policy version ID.

returns

None

CreateCertificateFromCsr (new) Link ¶

Creates an X.509 certificate using the specified certificate signing request.

Note Reusing the same certificate signing request (CSR) results in a distinct certificate.

Request Syntax

client.create_certificate_from_csr(
    certificateSigningRequest='string',
    setAsActive=True|False
)
type certificateSigningRequest

string

param certificateSigningRequest

[REQUIRED]

The certificate signing request (CSR).

type setAsActive

boolean

param setAsActive

Specifies whether the certificate is active.

rtype

dict

returns

Response Syntax

{
    'certificateArn': 'string',
    'certificateId': 'string',
    'certificatePem': 'string'
}

Response Structure

  • (dict) --

    The output from the CreateCertificateFromCsr operation.

    • certificateArn (string) --

      The Amazon Resource Name (ARN) of the certificate. You can use the ARN as a principal for policy operations.

    • certificateId (string) --

      The ID of the certificate. Certificate management operations only take a certificateId.

    • certificatePem (string) --

      The certificate data, in PEM format.

AcceptCertificateTransfer (new) Link ¶

Accepts a pending certificate transfer. The default state of the certificate is INACTIVE.

To check for pending certificate transfers, call ListCertificates to enumerate your certificates.

Request Syntax

client.accept_certificate_transfer(
    certificateId='string',
    setAsActive=True|False
)
type certificateId

string

param certificateId

[REQUIRED]

The ID of the certificate.

type setAsActive

boolean

param setAsActive

Specifies whether the certificate is active.

returns

None

ListPolicies (new) Link ¶

Lists your policies.

Request Syntax

client.list_policies(
    marker='string',
    pageSize=123,
    ascendingOrder=True|False
)
type marker

string

param marker

The marker for the next set of results.

type pageSize

integer

param pageSize

The result page size.

type ascendingOrder

boolean

param ascendingOrder

Specifies the order for results. If true, the results are returned in ascending creation order.

rtype

dict

returns

Response Syntax

{
    'policies': [
        {
            'policyName': 'string',
            'policyArn': 'string'
        },
    ],
    'nextMarker': 'string'
}

Response Structure

  • (dict) --

    The output from the ListPolicies operation.

    • policies (list) --

      The descriptions of the policies.

      • (dict) --

        Describes an AWS IoT policy.

        • policyName (string) --

          The policy name.

        • policyArn (string) --

          The policy ARN.

    • nextMarker (string) --

      The marker for the next set of results, or null if there are no additional results.

DetachPrincipalPolicy (new) Link ¶

Removes the specified policy from the specified certificate.

Request Syntax

client.detach_principal_policy(
    policyName='string',
    principal='string'
)
type policyName

string

param policyName

[REQUIRED]

The name of the policy to detach.

type principal

string

param principal

[REQUIRED]

The principal

If the principal is a certificate, specify the certificate ARN. If the principal is a Cognito identity specify the identity ID.

returns

None

AttachThingPrincipal (new) Link ¶

Attaches the specified principal to the specified thing.

Request Syntax

client.attach_thing_principal(
    thingName='string',
    principal='string'
)
type thingName

string

param thingName

[REQUIRED]

The name of the thing.

type principal

string

param principal

[REQUIRED]

The principal (certificate or other credential).

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    The output from the AttachThingPrincipal operation.

DeletePolicyVersion (new) Link ¶

Deletes the specified version of the specified policy. The default version of the policy cannot be deleted.

To delete the default version use the DeletePolicy API or mark the policy as non-default and then delete it.

Request Syntax

client.delete_policy_version(
    policyName='string',
    policyVersionId='string'
)
type policyName

string

param policyName

[REQUIRED]

The name of the policy.

type policyVersionId

string

param policyVersionId

[REQUIRED]

The policy version ID.

returns

None

ListThingPrincipals (new) Link ¶

Lists the principals associated with the specified thing.

Request Syntax

client.list_thing_principals(
    thingName='string'
)
type thingName

string

param thingName

[REQUIRED]

The name of the thing.

rtype

dict

returns

Response Syntax

{
    'principals': [
        'string',
    ]
}

Response Structure

  • (dict) --

    The output from the ListThingPrincipals operation.

    • principals (list) --

      The principals.

      • (string) --

UpdateCertificate (new) Link ¶

Updates the status of the specified certificate. This operation is idempotent.

Moving a cert from the ACTIVE state (including REVOKED) will NOT disconnect currently-connected devices, although these devices will be unable to reconnect.

The ACTIVE state is required to authenticate devices connecting to AWS IoT using a certificate.

Request Syntax

client.update_certificate(
    certificateId='string',
    newStatus='ACTIVE'|'INACTIVE'|'REVOKED'|'PENDING_TRANSFER'
)
type certificateId

string

param certificateId

[REQUIRED]

The ID of the certificate.

type newStatus

string

param newStatus

[REQUIRED]

The new status.

returns

None

TransferCertificate (new) Link ¶

Transfers the specified certificate to the specified AWS account.

You can cancel the transfer until it is acknowledged by the recipient.

No notification is sent to the transfer destination's account, it is up to the caller to notify the transfer target.

The certificate being transferred must not be in the ACTIVE state. It can be deactivated using the UpdateCertificate API.

The certificate must not have any policies attached to it. These can be detached using the DetachPrincipalPolicy API.

Request Syntax

client.transfer_certificate(
    certificateId='string',
    targetAwsAccount='string'
)
type certificateId

string

param certificateId

[REQUIRED]

The ID of the certificate.

type targetAwsAccount

string

param targetAwsAccount

[REQUIRED]

The AWS account.

rtype

dict

returns

Response Syntax

{
    'transferredCertificateArn': 'string'
}

Response Structure

  • (dict) --

    The output from the TransferCertificate operation.

    • transferredCertificateArn (string) --

      The ARN of the certificate.

CreatePolicyVersion (new) Link ¶

Creates a new version of the specified AWS IoT policy.

Request Syntax

client.create_policy_version(
    policyName='string',
    policyDocument='string',
    setAsDefault=True|False
)
type policyName

string

param policyName

[REQUIRED]

The policy name.

type policyDocument

string

param policyDocument

[REQUIRED]

The JSON document that describes the policy.

type setAsDefault

boolean

param setAsDefault

Specifies whether the policy version is set as the default.

rtype

dict

returns

Response Syntax

{
    'policyArn': 'string',
    'policyDocument': 'string',
    'policyVersionId': 'string',
    'isDefaultVersion': True|False
}

Response Structure

  • (dict) --

    The output of the CreatePolicyVersion operation.

    • policyArn (string) --

      The policy ARN.

    • policyDocument (string) --

      The JSON document that describes the policy.

    • policyVersionId (string) --

      The policy version ID.

    • isDefaultVersion (boolean) --

      Specifies whether the policy version is the default.

DeletePolicy (new) Link ¶

Deletes the specified policy.

A policy cannot be deleted if:

  • it has non-default versions

  • it is attached to any certificate

To delete a policy:

  • First delete all the non-default versions of the policy using the DeletePolicyVersion API.

  • Detach it from any certificate using the DetachPrincipalPolicy API.

When a policy is deleted, its default version is deleted with it.

Request Syntax

client.delete_policy(
    policyName='string'
)
type policyName

string

param policyName

[REQUIRED]

The name of the policy to delete.

returns

None

GetLoggingOptions (new) Link ¶

Gets the logging options.

Request Syntax

client.get_logging_options()
rtype

dict

returns

Response Syntax

{
    'roleArn': 'string',
    'logLevel': 'DEBUG'|'INFO'|'ERROR'|'WARN'|'DISABLED'
}

Response Structure

  • (dict) --

    The output from the GetLoggingOptions operation.

    • roleArn (string) --

      The ARN of the IAM role that grants access.

    • logLevel (string) --

      The logging level.

CreateTopicRule (new) Link ¶

Creates a rule.

Request Syntax

client.create_topic_rule(
    ruleName='string',
    topicRulePayload={
        'sql': 'string',
        'description': 'string',
        'actions': [
            {
                'dynamoDB': {
                    'tableName': 'string',
                    'roleArn': 'string',
                    'hashKeyField': 'string',
                    'hashKeyValue': 'string',
                    'rangeKeyField': 'string',
                    'rangeKeyValue': 'string',
                    'payloadField': 'string'
                },
                'lambda': {
                    'functionArn': 'string'
                },
                'sns': {
                    'targetArn': 'string',
                    'roleArn': 'string'
                },
                'sqs': {
                    'roleArn': 'string',
                    'queueUrl': 'string',
                    'useBase64': True|False
                },
                'kinesis': {
                    'roleArn': 'string',
                    'streamName': 'string',
                    'partitionKey': 'string'
                },
                'republish': {
                    'roleArn': 'string',
                    'topic': 'string'
                },
                's3': {
                    'roleArn': 'string',
                    'bucketName': 'string',
                    'key': 'string'
                },
                'firehose': {
                    'roleArn': 'string',
                    'deliveryStreamName': 'string'
                }
            },
        ],
        'ruleDisabled': True|False
    }
)
type ruleName

string

param ruleName

[REQUIRED]

The name of the rule.

type topicRulePayload

dict

param topicRulePayload

[REQUIRED]

The rule payload.

  • sql (string) -- [REQUIRED]

    The SQL statement used to query the topic. For more information, see AWS IoT SQL Reference in the AWS IoT Developer Guide .

  • description (string) --

    The description of the rule.

  • actions (list) -- [REQUIRED]

    The actions associated with the rule.

    • (dict) --

      Describes the actions associated with a rule.

      • dynamoDB (dict) --

        Write to a DynamoDB table.

        • tableName (string) -- [REQUIRED]

          The name of the DynamoDB table.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

        • hashKeyField (string) -- [REQUIRED]

          The hash key name.

        • hashKeyValue (string) -- [REQUIRED]

          The hash key value.

        • rangeKeyField (string) -- [REQUIRED]

          The range key name.

        • rangeKeyValue (string) -- [REQUIRED]

          The range key value.

        • payloadField (string) --

          The action payload.

      • lambda (dict) --

        Invoke a Lambda function.

        • functionArn (string) -- [REQUIRED]

          The ARN of the Lambda function.

      • sns (dict) --

        Publish to an SNS topic.

        • targetArn (string) -- [REQUIRED]

          The ARN of the SNS topic.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

      • sqs (dict) --

        Publish to an SQS queue.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

        • queueUrl (string) -- [REQUIRED]

          The URL of the Amazon SQS queue.

        • useBase64 (boolean) --

          Specifies whether to use Base64 encoding.

      • kinesis (dict) --

        Write data to a Kinesis stream.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

        • streamName (string) -- [REQUIRED]

          The name of the Kinesis stream.

        • partitionKey (string) --

          The partition key.

      • republish (dict) --

        Publish to another MQTT topic.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

        • topic (string) -- [REQUIRED]

          The name of the MQTT topic.

      • s3 (dict) --

        Write to an S3 bucket.

        • roleArn (string) -- [REQUIRED]

          The ARN of the IAM role that grants access.

        • bucketName (string) -- [REQUIRED]

          The S3 bucket.

        • key (string) -- [REQUIRED]

          The object key.

      • firehose (dict) --

        • roleArn (string) -- [REQUIRED]

        • deliveryStreamName (string) -- [REQUIRED]

  • ruleDisabled (boolean) --

    Specifies whether the rule is disabled.

returns

None

CancelCertificateTransfer (new) Link ¶

Cancels a pending transfer for the specified certificate.

Note Only the transfer source account can use this operation to cancel a transfer (transfer destinations can use RejectCertificateTransfer instead). After transfer, AWS IoT returns the certificate to the source account in the INACTIVE state. Once the destination account has accepted the transfer, the transfer may no longer be cancelled.

After a certificate transfer is cancelled, the status of the certificate changes from PENDING_TRANSFER to INACTIVE.

Request Syntax

client.cancel_certificate_transfer(
    certificateId='string'
)
type certificateId

string

param certificateId

[REQUIRED]

The ID of the certificate.

returns

None

ListTopicRules (new) Link ¶

Lists the rules for the specific topic.

Request Syntax

client.list_topic_rules(
    topic='string',
    maxResults=123,
    nextToken='string',
    ruleDisabled=True|False
)
type topic

string

param topic

The topic.

type maxResults

integer

param maxResults

The maximum number of results to return.

type nextToken

string

param nextToken

A token used to retrieve the next value.

type ruleDisabled

boolean

param ruleDisabled

Specifies whether the rule is disabled.

rtype

dict

returns

Response Syntax

{
    'rules': [
        {
            'ruleName': 'string',
            'topicPattern': 'string',
            'createdAt': datetime(2015, 1, 1),
            'ruleDisabled': True|False
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    The output from the ListTopicRules operation.

    • rules (list) --

      The rules.

      • (dict) --

        Describes a rule.

        • ruleName (string) --

          The name of the rule.

        • topicPattern (string) --

          The pattern for the topic names that apply.

        • createdAt (datetime) --

          The date and time the rule was created.

        • ruleDisabled (boolean) --

          Specifies whether the rule is disabled.

    • nextToken (string) --

      A token used to retrieve the next value.

DescribeCertificate (new) Link ¶

Gets information about the specified certificate.

Request Syntax

client.describe_certificate(
    certificateId='string'
)
type certificateId

string

param certificateId

[REQUIRED]

The ID of the certificate.

rtype

dict

returns

Response Syntax

{
    'certificateDescription': {
        'certificateArn': 'string',
        'certificateId': 'string',
        'status': 'ACTIVE'|'INACTIVE'|'REVOKED'|'PENDING_TRANSFER',
        'certificatePem': 'string',
        'ownedBy': 'string',
        'creationDate': datetime(2015, 1, 1),
        'lastModifiedDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    The output of the DescribeCertificate operation.

    • certificateDescription (dict) --

      The description of the certificate.

      • certificateArn (string) --

        The ARN of the certificate.

      • certificateId (string) --

        The ID of the certificate.

      • status (string) --

        The status of the certificate.

      • certificatePem (string) --

        The certificate data, in PEM format.

      • ownedBy (string) --

        The ID of the AWS account that owns the certificate.

      • creationDate (datetime) --

        The date and time the certificate was created.

      • lastModifiedDate (datetime) --

        The date and time the certificate was last modified.

DescribeEndpoint (new) Link ¶

Returns a unique URL specific to the AWS account making the call. The URL points to the AWS IoT data plane endpoint. The customer-specific endpoint should be provided to all data plane operations.

Request Syntax

client.describe_endpoint()
rtype

dict

returns

Response Syntax

{
    'endpointAddress': 'string'
}

Response Structure

  • (dict) --

    The output from the DescribeEndpoint operation.

    • endpointAddress (string) --

      The address.

UpdateThing (new) Link ¶

Updates the data for a thing.

Request Syntax

client.update_thing(
    thingName='string',
    attributePayload={
        'attributes': {
            'string': 'string'
        }
    }
)
type thingName

string

param thingName

[REQUIRED]

The thing name.

type attributePayload

dict

param attributePayload

[REQUIRED]

The attribute payload, a JSON string containing up to three key-value pairs.

For example: {"attributes":{"string1":"string2”}}

  • attributes (dict) --

    A JSON string containing up to three key-value pair in JSON format.

    For example: {"attributes":{"string1":"string2”}}

    • (string) --

      • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    The output from the UpdateThing operation.

DescribeThing (new) Link ¶

Gets information about the specified thing.

Request Syntax

client.describe_thing(
    thingName='string'
)
type thingName

string

param thingName

[REQUIRED]

The name of the thing.

rtype

dict

returns

Response Syntax

{
    'defaultClientId': 'string',
    'thingName': 'string',
    'attributes': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    The output from the DescribeThing operation.

    • defaultClientId (string) --

      The default client ID.

    • thingName (string) --

      The name of the thing.

    • attributes (dict) --

      The attributes which are name/value pairs in JSON format. For example:

      {"attributes":{"some-name1":"some-value1”}, {"some-name2":"some-value2”}, {"some-name3":"some-value3”}}

      • (string) --

        • (string) --