:doc:`ServiceDiscovery <../../servicediscovery>` / Client / get_operation

*************
get_operation
*************



.. py:method:: ServiceDiscovery.Client.get_operation(**kwargs)

  

  Gets information about any operation that returns an operation ID in the response, such as a ``CreateHttpNamespace`` request.

   

  .. note::

    

    To get a list of operations that match specified criteria, see `ListOperations <https://docs.aws.amazon.com/cloud-map/latest/api/API_ListOperations.html>`__.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/servicediscovery-2017-03-14/GetOperation>`_  


  **Request Syntax**
  ::

    response = client.get_operation(
        OperationId='string',
        OwnerAccount='string'
    )
    
  :type OperationId: string
  :param OperationId: **[REQUIRED]** 

    The ID of the operation that you want to get more information about.

    

  
  :type OwnerAccount: string
  :param OwnerAccount: 

    The ID of the Amazon Web Services account that owns the namespace associated with the operation, as specified in the namespace ``ResourceOwner`` field. For operations associated with namespaces that are shared with your account, you must specify an ``OwnerAccount``.

    

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

    
    ::

      {
          'Operation': {
              'Id': 'string',
              'OwnerAccount': 'string',
              'Type': 'CREATE_NAMESPACE'|'DELETE_NAMESPACE'|'UPDATE_NAMESPACE'|'UPDATE_SERVICE'|'REGISTER_INSTANCE'|'DEREGISTER_INSTANCE',
              'Status': 'SUBMITTED'|'PENDING'|'SUCCESS'|'FAIL',
              'ErrorMessage': 'string',
              'ErrorCode': 'string',
              'CreateDate': datetime(2015, 1, 1),
              'UpdateDate': datetime(2015, 1, 1),
              'Targets': {
                  'string': 'string'
              }
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Operation** *(dict) --* 

        A complex type that contains information about the operation.

        
        

        - **Id** *(string) --* 

          The ID of the operation that you want to get information about.

          
        

        - **OwnerAccount** *(string) --* 

          The ID of the Amazon Web Services account that owns the namespace associated with the operation.

          
        

        - **Type** *(string) --* 

          The name of the operation that's associated with the specified ID.

          
        

        - **Status** *(string) --* 

          The status of the operation. Values include the following:

            SUBMITTED  

          This is the initial state that occurs immediately after you submit a request.

            PENDING  

          Cloud Map is performing the operation.

            SUCCESS  

          The operation succeeded.

            FAIL  

          The operation failed. For the failure reason, see ``ErrorMessage``.

          
        

        - **ErrorMessage** *(string) --* 

          If the value of ``Status`` is ``FAIL``, the reason that the operation failed.

          
        

        - **ErrorCode** *(string) --* 

          The code associated with ``ErrorMessage``. Values for ``ErrorCode`` include the following:

           

          
          * ``ACCESS_DENIED``
           
          * ``CANNOT_CREATE_HOSTED_ZONE``
           
          * ``EXPIRED_TOKEN``
           
          * ``HOSTED_ZONE_NOT_FOUND``
           
          * ``INTERNAL_FAILURE``
           
          * ``INVALID_CHANGE_BATCH``
           
          * ``THROTTLED_REQUEST``
          

          
        

        - **CreateDate** *(datetime) --* 

          The date and time that the request was submitted, in Unix date/time format and Coordinated Universal Time (UTC). The value of ``CreateDate`` is accurate to milliseconds. For example, the value ``1516925490.087`` represents Friday, January 26, 2018 12:11:30.087 AM.

          
        

        - **UpdateDate** *(datetime) --* 

          The date and time that the value of ``Status`` changed to the current value, in Unix date/time format and Coordinated Universal Time (UTC). The value of ``UpdateDate`` is accurate to milliseconds. For example, the value ``1516925490.087`` represents Friday, January 26, 2018 12:11:30.087 AM.

          
        

        - **Targets** *(dict) --* 

          The name of the target entity that's associated with the operation:

            NAMESPACE  

          The namespace ID is returned in the ``ResourceId`` property.

            SERVICE  

          The service ID is returned in the ``ResourceId`` property.

            INSTANCE  

          The instance ID is returned in the ``ResourceId`` property.

          
          

          - *(string) --* 
            

            - *(string) --* 
      
    
    
  
  **Exceptions**
  
  *   :py:class:`ServiceDiscovery.Client.exceptions.InvalidInput`

  
  *   :py:class:`ServiceDiscovery.Client.exceptions.OperationNotFound`

  

  **Examples**

  Example: Get operation result
  ::

    response = client.get_operation(
        OperationId='gv4g5meo7ndmeh4fqskygvk23d2fijwa-k9302yzd',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'Operation': {
            'CreateDate': 1587055860.121,
            'Id': 'gv4g5meo7ndmeh4fqskygvk23d2fijwa-k9302yzd',
            'Status': 'SUCCESS',
            'Targets': {
                'NAMESPACE': 'ns-ylexjili4cdxy3xm',
            },
            'Type': 'CREATE_NAMESPACE',
            'UpdateDate': 1587055900.469,
        },
        'ResponseMetadata': {
            '...': '...',
        },
    }

  