
                         B    d Z ddlmZ ddlmZ ddlmZ dZd Z	d Z
d Zy	)
z3Utilities for the cloud deploy automation resource.    )
automation)
exceptions)	resourcesz<clouddeploy.projects.locations.deliveryPipelines.automationsc           	          	 | j                  d      \  }}t        j
                  j                  dt        ||||d      S # t        $ r t        j                  |       w xY w)a.  Creates the automation reference base on the parameters.

  Returns the reference of the automation name.

  Args:
    automation_name: str, in the format of pipeline_id/automation_id.
    project: str,project number or ID.
    location_id: str, region ID.

  Returns:
    Automation name reference.
  /N)
projectsIdlocationsIddeliveryPipelinesIdautomationsId)
collectionparams)split
ValueErrorcd_exceptionsAutomationNameFormatErrorr   REGISTRYParse_AUTOMATION_COLLECTION)automation_nameprojectlocation_idpipeline_idautomation_ids        8lib/googlecloudsdk/command_lib/deploy/automation_util.pyAutomationReferencer      sx    C!0!6!6s!;K 
			!	!
'$!,(	 
" 	
 	 
 C

1
1/
BBCs   A A c                 H    t        j                         j                  |       S )zPatches an automation resource by calling the patch automation API.

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

  Returns:
      The operation message.
  )r   AutomationsClientPatch)resources    r   PatchAutomationr    9   s     
	%	%	'	-	-h	77    c                 H    t        j                         j                  |       S )zDeletes an automation resource by calling the delete automation API.

  Args:
    name: str, automation name.

  Returns:
    The operation message.
  )r   r   Delete)names    r   DeleteAutomationr%   E   s     
	%	%	'	.	.t	44r!   N)__doc__"googlecloudsdk.api_lib.clouddeployr   !googlecloudsdk.command_lib.deployr   r   googlecloudsdk.corer   r   r   r    r%    r!   r   <module>r+      s/    : : I ) C 
<	8	5r!   