
    u
                     R    d Z ddlmZ ddlmZ ddlmZ ddlmZ dZ G d de      Z	y	)
z5Support library to handle the automation subcommands.    )absolute_import)division)unicode_literals)client_utilz*,labelsc                   *    e Zd ZdZddZd Zd Zd Zy)AutomationsClientz6Client for automation service in the Cloud Deploy API.Nc                     |xs t        j                         | _        |xs t        j                  |      | _        | j                  j
                  | _        y)zInitialize an automation.AutomationsClient.

    Args:
      client: base_api.BaseApiClient, the client class for Cloud Deploy.
      messages: module containing the definitions of messages for Cloud Deploy.
    N)r   GetClientInstanceclientGetMessagesModulemessages0projects_locations_deliveryPipelines_automations_service)selfr   r   s      4lib/googlecloudsdk/api_lib/clouddeploy/automation.py__init__zAutomationsClient.__init__   sA     ;K99;DKE = =f EDMKKPPDM    c                     | j                   j                  | j                  j                  |d|j                  t
                    S )zPatches a target resource.

    Args:
      obj: apitools.base.protorpclite.messages.Message, automation message.

    Returns:
      The operation message.
    T)
automationallowMissingname
updateMask)r   Patchr   DClouddeployProjectsLocationsDeliveryPipelinesAutomationsPatchRequestr   AUTOMATION_UPDATE_MASK)r   objs     r   r   zAutomationsClient.Patch(   sC     ==ZZ-	 	[ 	
 r   c                 p    | j                   j                  |      }| j                  j                  |      S )zGets the automation object by calling the automation get API.

    Args:
      name: automation name.

    Returns:
      an automation object.
    )r   )r   BClouddeployProjectsLocationsDeliveryPipelinesAutomationsGetRequestr   Get)r   r   requests      r   r   zAutomationsClient.Get:   s8     mm^^ _ G ==W%%r   c                 n    | j                   j                  | j                  j                  d|            S )zDeletes an automation resource.

    Args:
      name: str, automation name.

    Returns:
      The operation message. It could be none if the resource doesn't exist.
    T)r   r   )r   Deleter   EClouddeployProjectsLocationsDeliveryPipelinesAutomationsDeleteRequest)r   r   s     r   r"   zAutomationsClient.DeleteH   s8     ==[[D 	\ 	
 r   )NN)__name__
__module____qualname____doc__r   r   r   r"    r   r   r   r      s    >	Q$&r   r   N)
r'   
__future__r   r   r   "googlecloudsdk.api_lib.clouddeployr   r   objectr   r(   r   r   <module>r,      s(    < &  ' :# ; ;r   