:doc:`IoT <../../iot>` / Client / create_dimension

****************
create_dimension
****************



.. py:method:: IoT.Client.create_dimension(**kwargs)

  

  Create a dimension that you can use to limit the scope of a metric used in a security profile for IoT Device Defender. For example, using a ``TOPIC_FILTER`` dimension, you can narrow down the scope of the metric only to MQTT topics whose name match the pattern specified in the dimension.

   

  Requires permission to access the `CreateDimension <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions>`__ action.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/CreateDimension>`_  


  **Request Syntax**
  ::

    response = client.create_dimension(
        name='string',
        type='TOPIC_FILTER',
        stringValues=[
            'string',
        ],
        tags=[
            {
                'Key': 'string',
                'Value': 'string'
            },
        ],
        clientRequestToken='string'
    )
    
  :type name: string
  :param name: **[REQUIRED]** 

    A unique identifier for the dimension. Choose something that describes the type and value to make it easy to remember what it does.

    

  
  :type type: string
  :param type: **[REQUIRED]** 

    Specifies the type of dimension. Supported types: ``TOPIC_FILTER.``

    

  
  :type stringValues: list
  :param stringValues: **[REQUIRED]** 

    Specifies the value or list of values for the dimension. For ``TOPIC_FILTER`` dimensions, this is a pattern used to match the MQTT topic (for example, "admin/#").

    

  
    - *(string) --* 

    

  :type tags: list
  :param tags: 

    Metadata that can be used to manage the dimension.

    

  
    - *(dict) --* 

      A set of key/value pairs that are used to manage the resource.

      

    
      - **Key** *(string) --* **[REQUIRED]** 

        The tag's key.

        

      
      - **Value** *(string) --* 

        The tag's value.

        

      
    

  :type clientRequestToken: string
  :param clientRequestToken: **[REQUIRED]** 

    Each dimension must have a unique client request token. If you try to create a new dimension with the same token as a dimension that already exists, an exception occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.

    This field is autopopulated if not provided.

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'name': 'string',
          'arn': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **name** *(string) --* 

        A unique identifier for the dimension.

        
      

      - **arn** *(string) --* 

        The Amazon Resource Name (ARN) of the created dimension.

        
  
  **Exceptions**
  
  *   :py:class:`IoT.Client.exceptions.InternalFailureException`

  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`IoT.Client.exceptions.LimitExceededException`

  
  *   :py:class:`IoT.Client.exceptions.ResourceAlreadyExistsException`

  
  *   :py:class:`IoT.Client.exceptions.ThrottlingException`

  