ó
    €Ïö  ã                   óx   • S r SSKJr  SSKJr  SSKJr  SSKJ	r	  SSKJ
r
  SrS rS	 rS
 rS rS rS rS rS rg)z/Utilities for the cloud deploy target resource.é    )Ú
exceptions)Útarget)Úrollout_util)Úlog)Ú	resourcesz&clouddeploy.projects.locations.targetsc           
      ó^  • Sn [        [        R                  " U U[        R                  [        R                  SS95      nU(       a  US   nU$ ! [
        R                   aI  n[        R                  " SR                  U R                  5       UR                  5      5         SnAU$ SnAff = f)a|  Gets the releases in the specified target and the last deployment associated with the target.

Args:
  target_ref: protorpc.messages.Message, target resource object.
  pipeline_ref: protorpc.messages.Message, pipeline object.

Returns:
  release messages associated with the target.
  last deployed rollout message.
Raises:
 Exceptions raised by RolloutClient.GetCurrentRollout()
Né   )Ú
filter_strÚorder_byÚlimitr   z2failed to get the current rollout of target {}: {})Úlistr   ÚGetFilteredRolloutsÚ DEPLOYED_ROLLOUT_FILTER_TEMPLATEÚSUCCEED_ROLLOUT_ORDERBYÚapitools_exceptionsÚ	HttpErrorr   ÚdebugÚformatÚRelativeNameÚcontent)Ú
target_refÚpipeline_refÚcurrent_rolloutÚrolloutsÚerrors        Ú4lib/googlecloudsdk/command_lib/deploy/target_util.pyÚGetCurrentRolloutr      s¨   € ð €/ð3äÜ×(Ò(ØØÜ#×DÑDÜ!×9Ñ9Øñ	ó€Hö Ø  ™€oð
 
Ðøô	 
×	&Ñ	&ó 3Ü‡I‚IÐB×IÑIØ×ÑÓ! 5§=¡=ó2÷ 3ð 3ð 
Ðûð	3ús   „A	A ÁB,Á#>B'Â'B,c                 óF   • [         R                  R                  U [        S9$ )zzCreates a target reference from full name.

Args:
  target_name: str, target resource name.

Returns:
  Target reference.
)Ú
collection)r   ÚREGISTRYÚParseRelativeNameÚ_SHARED_TARGET_COLLECTION)Útarget_names    r   ÚTargetReferenceFromNamer$   ;   s(   € ô 
×	Ñ	×	-Ñ	-ØÔ7ð 
.ð 
9ð 9ó    c                 óD   • SU ;   a  [        U 5      R                  5       $ U $ )zcReturns target ID.

Args:
  target_name_or_id: str, target full name or ID.

Returns:
  Target ID.
z	projects/)r$   ÚName)Útarget_name_or_ids    r   ÚTargetIdr)   I   s(   € ð Ð%Ó%Ü"Ð#4Ó5×:Ñ:Ó<Ð<à	Ðr%   c           	      ób   • [         R                  R                  S[        UU[	        U 5      S.S9$ )zöCreates the target reference base on the parameters.

Returns the shared target reference.

Args:
  target_name_or_id: str, target full name or ID.
  project: str,project number or ID.
  location_id: str, region ID.

Returns:
  Target reference.
N)Ú
projectsIdÚlocationsIdÚ	targetsId)r   Úparams)r   r    ÚParser"   r)   )r(   ÚprojectÚlocation_ids      r   ÚTargetReferencer2   Y   s<   € ô 
×	Ñ	×	!Ñ	!Ø
Ü*àØ$ÜÐ 1Ó2ñð 
"ð 
	ð 	r%   c                 óf   • [         R                  " 5       R                  U R                  5       5      $ )zñGets the target message by calling the get target API.

Args:
  target_ref: protorpc.messages.Message, protorpc.messages.Message, target
    reference.

Returns:
  Target message.
Raises:
  Exceptions raised by TargetsClient's get functions
)r   ÚTargetsClientÚGetr   )r   s    r   Ú	GetTargetr6   p   s'   € ô 
×	Ò	Ó	×	#Ñ	# J×$;Ñ$;Ó$=Ó	>Ð>r%   c                 óJ   • [         R                  " 5       R                  U 5      $ )z´Patches a target resource by calling the patch target API.

Args:
    target_obj: apitools.base.protorpclite.messages.Message, target message.

Returns:
    The operation message.
)r   r4   ÚPatch)Ú
target_objs    r   ÚPatchTargetr:      s   € ô 
×	Ò	Ó	×	%Ñ	% jÓ	1Ð1r%   c                 óJ   • [         R                  " 5       R                  U 5      $ )z€Deletes a target resource by calling the delete target API.

Args:
  name: str, target name.

Returns:
  The operation message.
)r   r4   ÚDelete)Únames    r   ÚDeleteTargetr>   ‹   s   € ô 
×	Ò	Ó	×	&Ñ	& tÓ	,Ð,r%   c                 óJ   • [         R                  " 5       R                  U 5      $ )zÂList target resources by calling the list target API.

Args:
  parent_name: str, the name of the collection that owns the targets.

Returns:
  List of targets returns from target list API call.
)r   r4   ÚList)Úparent_names    r   Ú
ListTargetrB   —   s   € ô 
×	Ò	Ó	×	$Ñ	$ [Ó	1Ð1r%   N)Ú__doc__Úapitools.base.pyr   r   Ú"googlecloudsdk.api_lib.clouddeployr   Ú!googlecloudsdk.command_lib.deployr   Úgooglecloudsdk.corer   r   r"   r   r$   r)   r2   r6   r:   r>   rB   © r%   r   Ú<module>rI      sJ   ðñ 6õ ?Ý 5Ý :Ý #Ý )àDÐ òò@9òò 	ò.?ò	2ò	-ó	2r%   