AWS IoT

2017/12/20 - AWS IoT - 9 new api methods

Changes  Update iot client to latest version

ListStreams (new) Link ¶

Lists all of the streams in your AWS account.

See also: AWS API Documentation

Request Syntax

client.list_streams(
    maxResults=123,
    nextToken='string',
    ascendingOrder=True|False
)
type maxResults:

integer

param maxResults:

The maximum number of results to return at a time.

type nextToken:

string

param nextToken:

A token used to get the next set of results.

type ascendingOrder:

boolean

param ascendingOrder:

Set to true to return the list of streams in ascending order.

rtype:

dict

returns:

Response Syntax

{
    'streams': [
        {
            'streamId': 'string',
            'streamArn': 'string',
            'streamVersion': 123,
            'description': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • streams (list) --

      A list of streams.

      • (dict) --

        A summary of a stream.

        • streamId (string) --

          The stream ID.

        • streamArn (string) --

          The stream ARN.

        • streamVersion (integer) --

          The stream version.

        • description (string) --

          A description of the stream.

    • nextToken (string) --

      A token used to get the next set of results.

DeleteOTAUpdate (new) Link ¶

Delete an OTA update.

See also: AWS API Documentation

Request Syntax

client.delete_ota_update(
    otaUpdateId='string'
)
type otaUpdateId:

string

param otaUpdateId:

[REQUIRED]

The OTA update ID to delete.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

ListOTAUpdates (new) Link ¶

Lists OTA updates.

See also: AWS API Documentation

Request Syntax

client.list_ota_updates(
    maxResults=123,
    nextToken='string',
    otaUpdateStatus='CREATE_PENDING'|'CREATE_IN_PROGRESS'|'CREATE_COMPLETE'|'CREATE_FAILED'
)
type maxResults:

integer

param maxResults:

The maximum number of results to return at one time.

type nextToken:

string

param nextToken:

A token used to retreive the next set of results.

type otaUpdateStatus:

string

param otaUpdateStatus:

The OTA update job status.

rtype:

dict

returns:

Response Syntax

{
    'otaUpdates': [
        {
            'otaUpdateId': 'string',
            'otaUpdateArn': 'string',
            'creationDate': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • otaUpdates (list) --

      A list of OTA update jobs.

      • (dict) --

        An OTA update summary.

        • otaUpdateId (string) --

          The OTA update ID.

        • otaUpdateArn (string) --

          The OTA update ARN.

        • creationDate (datetime) --

          The date when the OTA update was created.

    • nextToken (string) --

      A token to use to get the next set of results.

DeleteStream (new) Link ¶

Deletes a stream.

See also: AWS API Documentation

Request Syntax

client.delete_stream(
    streamId='string'
)
type streamId:

string

param streamId:

[REQUIRED]

The stream ID.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

GetOTAUpdate (new) Link ¶

Gets an OTA update.

See also: AWS API Documentation

Request Syntax

client.get_ota_update(
    otaUpdateId='string'
)
type otaUpdateId:

string

param otaUpdateId:

[REQUIRED]

The OTA update ID.

rtype:

dict

returns:

Response Syntax

{
    'otaUpdateInfo': {
        'otaUpdateId': 'string',
        'otaUpdateArn': 'string',
        'creationDate': datetime(2015, 1, 1),
        'lastModifiedDate': datetime(2015, 1, 1),
        'description': 'string',
        'targets': [
            'string',
        ],
        'targetSelection': 'CONTINUOUS'|'SNAPSHOT',
        'otaUpdateFiles': [
            {
                'fileName': 'string',
                'fileVersion': 'string',
                'fileSource': {
                    'streamId': 'string',
                    'fileId': 123
                },
                'codeSigning': {
                    'awsSignerJobId': 'string',
                    'customCodeSigning': {
                        'signature': {
                            'stream': {
                                'streamId': 'string',
                                'fileId': 123
                            },
                            'inlineDocument': b'bytes'
                        },
                        'certificateChain': {
                            'stream': {
                                'streamId': 'string',
                                'fileId': 123
                            },
                            'certificateName': 'string',
                            'inlineDocument': 'string'
                        },
                        'hashAlgorithm': 'string',
                        'signatureAlgorithm': 'string'
                    }
                },
                'attributes': {
                    'string': 'string'
                }
            },
        ],
        'otaUpdateStatus': 'CREATE_PENDING'|'CREATE_IN_PROGRESS'|'CREATE_COMPLETE'|'CREATE_FAILED',
        'awsIotJobId': 'string',
        'awsIotJobArn': 'string',
        'errorInfo': {
            'code': 'string',
            'message': 'string'
        },
        'additionalParameters': {
            'string': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • otaUpdateInfo (dict) --

      The OTA update info.

      • otaUpdateId (string) --

        The OTA update ID.

      • otaUpdateArn (string) --

        The OTA update ARN.

      • creationDate (datetime) --

        The date when the OTA update was created.

      • lastModifiedDate (datetime) --

        The date when the OTA update was last updated.

      • description (string) --

        A description of the OTA update.

      • targets (list) --

        The targets of the OTA update.

        • (string) --

      • targetSelection (string) --

        Specifies whether the OTA update will continue to run (CONTINUOUS), or will be complete after all those things specified as targets have completed the OTA update (SNAPSHOT). If continuous, the OTA update may also be run on a thing when a change is detected in a target. For example, an OTA update will run on a thing when the thing is added to a target group, even after the OTA update was completed by all things originally in the group.

      • otaUpdateFiles (list) --

        A list of files associated with the OTA update.

        • (dict) --

          Describes a file to be associated with an OTA update.

          • fileName (string) --

            The name of the file.

          • fileVersion (string) --

            The file version.

          • fileSource (dict) --

            The source of the file.

            • streamId (string) --

              The stream ID.

            • fileId (integer) --

              The ID of a file associated with a stream.

          • codeSigning (dict) --

            The code signing method of the file.

            • awsSignerJobId (string) --

              The ID of the AWSSignerJob which was created to sign the file.

            • customCodeSigning (dict) --

              A custom method for code signing a file.

              • signature (dict) --

                The signature for the file.

                • stream (dict) --

                  A stream of the code signing signature.

                  • streamId (string) --

                    The stream ID.

                  • fileId (integer) --

                    The ID of a file associated with a stream.

                • inlineDocument (bytes) --

                  A base64 encoded binary representation of the code signing signature.

              • certificateChain (dict) --

                The certificate chain.

                • stream (dict) --

                  A stream of the certificate chain files.

                  • streamId (string) --

                    The stream ID.

                  • fileId (integer) --

                    The ID of a file associated with a stream.

                • certificateName (string) --

                  The name of the certificate.

                • inlineDocument (string) --

                  A base64 encoded binary representation of the code signing certificate chain.

              • hashAlgorithm (string) --

                The hash algorithm used to code sign the file.

              • signatureAlgorithm (string) --

                The signature algorithm used to code sign the file.

          • attributes (dict) --

            A list of name/attribute pairs.

            • (string) --

              • (string) --

      • otaUpdateStatus (string) --

        The status of the OTA update.

      • awsIotJobId (string) --

        The AWS IoT job ID associated with the OTA update.

      • awsIotJobArn (string) --

        The AWS IoT job ARN associated with the OTA update.

      • errorInfo (dict) --

        Error information associated with the OTA update.

        • code (string) --

          The error code.

        • message (string) --

          The error message.

      • additionalParameters (dict) --

        A collection of name/value pairs

        • (string) --

          • (string) --

CreateOTAUpdate (new) Link ¶

Creates an AWS IoT OTAUpdate on a target group of things or groups.

See also: AWS API Documentation

Request Syntax

client.create_ota_update(
    otaUpdateId='string',
    description='string',
    targets=[
        'string',
    ],
    targetSelection='CONTINUOUS'|'SNAPSHOT',
    files=[
        {
            'fileName': 'string',
            'fileVersion': 'string',
            'fileSource': {
                'streamId': 'string',
                'fileId': 123
            },
            'codeSigning': {
                'awsSignerJobId': 'string',
                'customCodeSigning': {
                    'signature': {
                        'stream': {
                            'streamId': 'string',
                            'fileId': 123
                        },
                        'inlineDocument': b'bytes'
                    },
                    'certificateChain': {
                        'stream': {
                            'streamId': 'string',
                            'fileId': 123
                        },
                        'certificateName': 'string',
                        'inlineDocument': 'string'
                    },
                    'hashAlgorithm': 'string',
                    'signatureAlgorithm': 'string'
                }
            },
            'attributes': {
                'string': 'string'
            }
        },
    ],
    roleArn='string',
    additionalParameters={
        'string': 'string'
    }
)
type otaUpdateId:

string

param otaUpdateId:

[REQUIRED]

The ID of the OTA update to be created.

type description:

string

param description:

The description of the OTA update.

type targets:

list

param targets:

[REQUIRED]

The targeted devices to receive OTA updates.

  • (string) --

type targetSelection:

string

param targetSelection:

Specifies whether the update will continue to run (CONTINUOUS), or will be complete after all the things specified as targets have completed the update (SNAPSHOT). If continuous, the update may also be run on a thing when a change is detected in a target. For example, an update will run on a thing when the thing is added to a target group, even after the update was completed by all things originally in the group. Valid values: CONTINUOUS | SNAPSHOT.

type files:

list

param files:

[REQUIRED]

The files to be streamed by the OTA update.

  • (dict) --

    Describes a file to be associated with an OTA update.

    • fileName (string) --

      The name of the file.

    • fileVersion (string) --

      The file version.

    • fileSource (dict) --

      The source of the file.

      • streamId (string) --

        The stream ID.

      • fileId (integer) --

        The ID of a file associated with a stream.

    • codeSigning (dict) --

      The code signing method of the file.

      • awsSignerJobId (string) --

        The ID of the AWSSignerJob which was created to sign the file.

      • customCodeSigning (dict) --

        A custom method for code signing a file.

        • signature (dict) --

          The signature for the file.

          • stream (dict) --

            A stream of the code signing signature.

            • streamId (string) --

              The stream ID.

            • fileId (integer) --

              The ID of a file associated with a stream.

          • inlineDocument (bytes) --

            A base64 encoded binary representation of the code signing signature.

        • certificateChain (dict) --

          The certificate chain.

          • stream (dict) --

            A stream of the certificate chain files.

            • streamId (string) --

              The stream ID.

            • fileId (integer) --

              The ID of a file associated with a stream.

          • certificateName (string) --

            The name of the certificate.

          • inlineDocument (string) --

            A base64 encoded binary representation of the code signing certificate chain.

        • hashAlgorithm (string) --

          The hash algorithm used to code sign the file.

        • signatureAlgorithm (string) --

          The signature algorithm used to code sign the file.

    • attributes (dict) --

      A list of name/attribute pairs.

      • (string) --

        • (string) --

type roleArn:

string

param roleArn:

[REQUIRED]

The IAM role that allows access to the AWS IoT Jobs service.

type additionalParameters:

dict

param additionalParameters:

A list of additional OTA update parameters which are name-value pairs.

  • (string) --

    • (string) --

rtype:

dict

returns:

Response Syntax

{
    'otaUpdateId': 'string',
    'awsIotJobId': 'string',
    'otaUpdateArn': 'string',
    'awsIotJobArn': 'string',
    'otaUpdateStatus': 'CREATE_PENDING'|'CREATE_IN_PROGRESS'|'CREATE_COMPLETE'|'CREATE_FAILED'
}

Response Structure

  • (dict) --

    • otaUpdateId (string) --

      The OTA update ID.

    • awsIotJobId (string) --

      The AWS IoT job ID associated with the OTA update.

    • otaUpdateArn (string) --

      The OTA update ARN.

    • awsIotJobArn (string) --

      The AWS IoT job ARN associated with the OTA update.

    • otaUpdateStatus (string) --

      The OTA update status.

DescribeStream (new) Link ¶

Gets information about a stream.

See also: AWS API Documentation

Request Syntax

client.describe_stream(
    streamId='string'
)
type streamId:

string

param streamId:

[REQUIRED]

The stream ID.

rtype:

dict

returns:

Response Syntax

{
    'streamInfo': {
        'streamId': 'string',
        'streamArn': 'string',
        'streamVersion': 123,
        'description': 'string',
        'files': [
            {
                'fileId': 123,
                's3Location': {
                    'bucket': 'string',
                    'key': 'string',
                    'version': 'string'
                }
            },
        ],
        'createdAt': datetime(2015, 1, 1),
        'lastUpdatedAt': datetime(2015, 1, 1),
        'roleArn': 'string'
    }
}

Response Structure

  • (dict) --

    • streamInfo (dict) --

      Information about the stream.

      • streamId (string) --

        The stream ID.

      • streamArn (string) --

        The stream ARN.

      • streamVersion (integer) --

        The stream version.

      • description (string) --

        The description of the stream.

      • files (list) --

        The files to stream.

        • (dict) --

          Represents a file to stream.

          • fileId (integer) --

            The file ID.

          • s3Location (dict) --

            The location of the file in S3.

            • bucket (string) --

              The S3 bucket that contains the file to stream.

            • key (string) --

              The name of the file within the S3 bucket to stream.

            • version (string) --

              The file version.

      • createdAt (datetime) --

        The date when the stream was created.

      • lastUpdatedAt (datetime) --

        The date when the stream was last updated.

      • roleArn (string) --

        An IAM role AWS IoT assumes to access your S3 files.

UpdateStream (new) Link ¶

Updates an existing stream. The stream version will be incremented by one.

See also: AWS API Documentation

Request Syntax

client.update_stream(
    streamId='string',
    description='string',
    files=[
        {
            'fileId': 123,
            's3Location': {
                'bucket': 'string',
                'key': 'string',
                'version': 'string'
            }
        },
    ],
    roleArn='string'
)
type streamId:

string

param streamId:

[REQUIRED]

The stream ID.

type description:

string

param description:

The description of the stream.

type files:

list

param files:

The files associated with the stream.

  • (dict) --

    Represents a file to stream.

    • fileId (integer) --

      The file ID.

    • s3Location (dict) --

      The location of the file in S3.

      • bucket (string) -- [REQUIRED]

        The S3 bucket that contains the file to stream.

      • key (string) -- [REQUIRED]

        The name of the file within the S3 bucket to stream.

      • version (string) --

        The file version.

type roleArn:

string

param roleArn:

An IAM role that allows the IoT service principal assumes to access your S3 files.

rtype:

dict

returns:

Response Syntax

{
    'streamId': 'string',
    'streamArn': 'string',
    'description': 'string',
    'streamVersion': 123
}

Response Structure

  • (dict) --

    • streamId (string) --

      The stream ID.

    • streamArn (string) --

      The stream ARN.

    • description (string) --

      A description of the stream.

    • streamVersion (integer) --

      The stream version.

CreateStream (new) Link ¶

Creates a stream for delivering one or more large files in chunks over MQTT. A stream transports data bytes in chunks or blocks packaged as MQTT messages from a source like S3. You can have one or more files associated with a stream. The total size of a file associated with the stream cannot exceed more than 2 MB. The stream will be created with version 0. If a stream is created with the same streamID as a stream that existed and was deleted within last 90 days, we will resurrect that old stream by incrementing the version by 1.

See also: AWS API Documentation

Request Syntax

client.create_stream(
    streamId='string',
    description='string',
    files=[
        {
            'fileId': 123,
            's3Location': {
                'bucket': 'string',
                'key': 'string',
                'version': 'string'
            }
        },
    ],
    roleArn='string'
)
type streamId:

string

param streamId:

[REQUIRED]

The stream ID.

type description:

string

param description:

A description of the stream.

type files:

list

param files:

[REQUIRED]

The files to stream.

  • (dict) --

    Represents a file to stream.

    • fileId (integer) --

      The file ID.

    • s3Location (dict) --

      The location of the file in S3.

      • bucket (string) -- [REQUIRED]

        The S3 bucket that contains the file to stream.

      • key (string) -- [REQUIRED]

        The name of the file within the S3 bucket to stream.

      • version (string) --

        The file version.

type roleArn:

string

param roleArn:

[REQUIRED]

An IAM role that allows the IoT service principal assumes to access your S3 files.

rtype:

dict

returns:

Response Syntax

{
    'streamId': 'string',
    'streamArn': 'string',
    'description': 'string',
    'streamVersion': 123
}

Response Structure

  • (dict) --

    • streamId (string) --

      The stream ID.

    • streamArn (string) --

      The stream ARN.

    • description (string) --

      A description of the stream.

    • streamVersion (integer) --

      The version of the stream.