IoTSecureTunneling

Client

class IoTSecureTunneling.Client

A low-level client representing AWS IoT Secure Tunneling

IoT Secure Tunneling creates remote connections to devices deployed in the field.

For more information about how IoT Secure Tunneling works, see IoT Secure Tunneling .

client = session.create_client('iotsecuretunneling')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
close()

Closes underlying endpoint connections.

close_tunnel(**kwargs)

Closes a tunnel identified by the unique tunnel id. When a CloseTunnel request is received, we close the WebSocket connections between the client and proxy server so no data can be transmitted.

Requires permission to access the CloseTunnel action.

See also: AWS API Documentation

Request Syntax

response = client.close_tunnel(
    tunnelId='string',
    delete=True|False
)
Parameters
  • tunnelId (string) --

    [REQUIRED]

    The ID of the tunnel to close.

  • delete (boolean) -- When set to true, IoT Secure Tunneling deletes the tunnel data immediately.
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

describe_tunnel(**kwargs)

Gets information about a tunnel identified by the unique tunnel id.

Requires permission to access the DescribeTunnel action.

See also: AWS API Documentation

Request Syntax

response = client.describe_tunnel(
    tunnelId='string'
)
Parameters
tunnelId (string) --

[REQUIRED]

The tunnel to describe.

Return type
dict
Returns
Response Syntax
{
    'tunnel': {
        'tunnelId': 'string',
        'tunnelArn': 'string',
        'status': 'OPEN'|'CLOSED',
        'sourceConnectionState': {
            'status': 'CONNECTED'|'DISCONNECTED',
            'lastUpdatedAt': datetime(2015, 1, 1)
        },
        'destinationConnectionState': {
            'status': 'CONNECTED'|'DISCONNECTED',
            'lastUpdatedAt': datetime(2015, 1, 1)
        },
        'description': 'string',
        'destinationConfig': {
            'thingName': 'string',
            'services': [
                'string',
            ]
        },
        'timeoutConfig': {
            'maxLifetimeTimeoutMinutes': 123
        },
        'tags': [
            {
                'key': 'string',
                'value': 'string'
            },
        ],
        'createdAt': datetime(2015, 1, 1),
        'lastUpdatedAt': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --
    • tunnel (dict) --

      The tunnel being described.

      • tunnelId (string) --

        A unique alpha-numeric ID that identifies a tunnel.

      • tunnelArn (string) --

        The Amazon Resource Name (ARN) of a tunnel.

      • status (string) --

        The status of a tunnel. Valid values are: Open and Closed.

      • sourceConnectionState (dict) --

        The connection state of the source application.

        • status (string) --

          The connection status of the tunnel. Valid values are CONNECTED and DISCONNECTED .

        • lastUpdatedAt (datetime) --

          The last time the connection status was updated.

      • destinationConnectionState (dict) --

        The connection state of the destination application.

        • status (string) --

          The connection status of the tunnel. Valid values are CONNECTED and DISCONNECTED .

        • lastUpdatedAt (datetime) --

          The last time the connection status was updated.

      • description (string) --

        A description of the tunnel.

      • destinationConfig (dict) --

        The destination configuration that specifies the thing name of the destination device and a service name that the local proxy uses to connect to the destination application.

        • thingName (string) --

          The name of the IoT thing to which you want to connect.

        • services (list) --

          A list of service names that identify the target application. The IoT client running on the destination device reads this value and uses it to look up a port or an IP address and a port. The IoT client instantiates the local proxy, which uses this information to connect to the destination application.

          • (string) --
      • timeoutConfig (dict) --

        Timeout configuration for the tunnel.

        • maxLifetimeTimeoutMinutes (integer) --

          The maximum amount of time (in minutes) a tunnel can remain open. If not specified, maxLifetimeTimeoutMinutes defaults to 720 minutes. Valid values are from 1 minute to 12 hours (720 minutes)

      • tags (list) --

        A list of tag metadata associated with the secure tunnel.

        • (dict) --

          An arbitary key/value pair used to add searchable metadata to secure tunnel resources.

          • key (string) --

            The key of the tag.

          • value (string) --

            The value of the tag.

      • createdAt (datetime) --

        The time when the tunnel was created.

      • lastUpdatedAt (datetime) --

        The last time the tunnel was updated.

Exceptions

get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
list_tags_for_resource(**kwargs)

Lists the tags for the specified resource.

See also: AWS API Documentation

Request Syntax

response = client.list_tags_for_resource(
    resourceArn='string'
)
Parameters
resourceArn (string) --

[REQUIRED]

The resource ARN.

Return type
dict
Returns
Response Syntax
{
    'tags': [
        {
            'key': 'string',
            'value': 'string'
        },
    ]
}

Response Structure

  • (dict) --
    • tags (list) --

      The tags for the specified resource.

      • (dict) --

        An arbitary key/value pair used to add searchable metadata to secure tunnel resources.

        • key (string) --

          The key of the tag.

        • value (string) --

          The value of the tag.

Exceptions

list_tunnels(**kwargs)

List all tunnels for an Amazon Web Services account. Tunnels are listed by creation time in descending order, newer tunnels will be listed before older tunnels.

Requires permission to access the ListTunnels action.

See also: AWS API Documentation

Request Syntax

response = client.list_tunnels(
    thingName='string',
    maxResults=123,
    nextToken='string'
)
Parameters
  • thingName (string) -- The name of the IoT thing associated with the destination device.
  • maxResults (integer) -- The maximum number of results to return at once.
  • nextToken (string) -- To retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.
Return type

dict

Returns

Response Syntax

{
    'tunnelSummaries': [
        {
            'tunnelId': 'string',
            'tunnelArn': 'string',
            'status': 'OPEN'|'CLOSED',
            'description': 'string',
            'createdAt': datetime(2015, 1, 1),
            'lastUpdatedAt': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • tunnelSummaries (list) --

      A short description of the tunnels in an Amazon Web Services account.

      • (dict) --

        Information about the tunnel.

        • tunnelId (string) --

          The unique alpha-numeric identifier for the tunnel.

        • tunnelArn (string) --

          The Amazon Resource Name of the tunnel.

        • status (string) --

          The status of a tunnel. Valid values are: Open and Closed.

        • description (string) --

          A description of the tunnel.

        • createdAt (datetime) --

          The time the tunnel was created.

        • lastUpdatedAt (datetime) --

          The time the tunnel was last updated.

    • nextToken (string) --

      The token to use to get the next set of results, or null if there are no additional results.

open_tunnel(**kwargs)

Creates a new tunnel, and returns two client access tokens for clients to use to connect to the IoT Secure Tunneling proxy server.

Requires permission to access the OpenTunnel action.

See also: AWS API Documentation

Request Syntax

response = client.open_tunnel(
    description='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    destinationConfig={
        'thingName': 'string',
        'services': [
            'string',
        ]
    },
    timeoutConfig={
        'maxLifetimeTimeoutMinutes': 123
    }
)
Parameters
  • description (string) -- A short text description of the tunnel.
  • tags (list) --

    A collection of tag metadata.

    • (dict) --

      An arbitary key/value pair used to add searchable metadata to secure tunnel resources.

      • key (string) -- [REQUIRED]

        The key of the tag.

      • value (string) -- [REQUIRED]

        The value of the tag.

  • destinationConfig (dict) --

    The destination configuration for the OpenTunnel request.

    • thingName (string) --

      The name of the IoT thing to which you want to connect.

    • services (list) -- [REQUIRED]

      A list of service names that identify the target application. The IoT client running on the destination device reads this value and uses it to look up a port or an IP address and a port. The IoT client instantiates the local proxy, which uses this information to connect to the destination application.

      • (string) --
  • timeoutConfig (dict) --

    Timeout configuration for a tunnel.

    • maxLifetimeTimeoutMinutes (integer) --

      The maximum amount of time (in minutes) a tunnel can remain open. If not specified, maxLifetimeTimeoutMinutes defaults to 720 minutes. Valid values are from 1 minute to 12 hours (720 minutes)

Return type

dict

Returns

Response Syntax

{
    'tunnelId': 'string',
    'tunnelArn': 'string',
    'sourceAccessToken': 'string',
    'destinationAccessToken': 'string'
}

Response Structure

  • (dict) --

    • tunnelId (string) --

      A unique alpha-numeric tunnel ID.

    • tunnelArn (string) --

      The Amazon Resource Name for the tunnel.

    • sourceAccessToken (string) --

      The access token the source local proxy uses to connect to IoT Secure Tunneling.

    • destinationAccessToken (string) --

      The access token the destination local proxy uses to connect to IoT Secure Tunneling.

Exceptions

rotate_tunnel_access_token(**kwargs)

Revokes the current client access token (CAT) and returns new CAT for clients to use when reconnecting to secure tunneling to access the same tunnel.

Requires permission to access the RotateTunnelAccessToken action.

Note

Rotating the CAT doesn't extend the tunnel duration. For example, say the tunnel duration is 12 hours and the tunnel has already been open for 4 hours. When you rotate the access tokens, the new tokens that are generated can only be used for the remaining 8 hours.

See also: AWS API Documentation

Request Syntax

response = client.rotate_tunnel_access_token(
    tunnelId='string',
    clientMode='SOURCE'|'DESTINATION'|'ALL',
    destinationConfig={
        'thingName': 'string',
        'services': [
            'string',
        ]
    }
)
Parameters
  • tunnelId (string) --

    [REQUIRED]

    The tunnel for which you want to rotate the access tokens.

  • clientMode (string) --

    [REQUIRED]

    The mode of the client that will use the client token, which can be either the source or destination, or both source and destination.

  • destinationConfig (dict) --

    The destination configuration.

    • thingName (string) --

      The name of the IoT thing to which you want to connect.

    • services (list) -- [REQUIRED]

      A list of service names that identify the target application. The IoT client running on the destination device reads this value and uses it to look up a port or an IP address and a port. The IoT client instantiates the local proxy, which uses this information to connect to the destination application.

      • (string) --
Return type

dict

Returns

Response Syntax

{
    'tunnelArn': 'string',
    'sourceAccessToken': 'string',
    'destinationAccessToken': 'string'
}

Response Structure

  • (dict) --

    • tunnelArn (string) --

      The Amazon Resource Name for the tunnel.

    • sourceAccessToken (string) --

      The client access token that the source local proxy uses to connect to IoT Secure Tunneling.

    • destinationAccessToken (string) --

      The client access token that the destination local proxy uses to connect to IoT Secure Tunneling.

Exceptions

tag_resource(**kwargs)

A resource tag.

See also: AWS API Documentation

Request Syntax

response = client.tag_resource(
    resourceArn='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
Parameters
  • resourceArn (string) --

    [REQUIRED]

    The ARN of the resource.

  • tags (list) --

    [REQUIRED]

    The tags for the resource.

    • (dict) --

      An arbitary key/value pair used to add searchable metadata to secure tunnel resources.

      • key (string) -- [REQUIRED]

        The key of the tag.

      • value (string) -- [REQUIRED]

        The value of the tag.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

untag_resource(**kwargs)

Removes a tag from a resource.

See also: AWS API Documentation

Request Syntax

response = client.untag_resource(
    resourceArn='string',
    tagKeys=[
        'string',
    ]
)
Parameters
  • resourceArn (string) --

    [REQUIRED]

    The resource ARN.

  • tagKeys (list) --

    [REQUIRED]

    The keys of the tags to remove.

    • (string) --
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

Client Exceptions

Client exceptions are available on a client instance via the exceptions property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling user guide.

The available client exceptions are:

class IoTSecureTunneling.Client.exceptions.LimitExceededException

Thrown when a tunnel limit is exceeded.

Example

try:
  ...
except client.exceptions.LimitExceededException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    Thrown when a tunnel limit is exceeded.

    • message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class IoTSecureTunneling.Client.exceptions.ResourceNotFoundException

Thrown when an operation is attempted on a resource that does not exist.

Example

try:
  ...
except client.exceptions.ResourceNotFoundException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    Thrown when an operation is attempted on a resource that does not exist.

    • message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.

Paginators

The available paginators are: