
    p                     R    S r SSKJr  SSKJr  SSKJr  SSKJr  Sr " S S\5      r	g	)
z1Support library to handle the target subcommands.    )absolute_import)division)unicode_literals)client_utilz*,labelsc                   :    \ rS rSrSrS
S jrS rS rS rS r	S	r
g)TargetsClient   z2Client for target service in the Cloud Deploy API.Nc                     U=(       d    [         R                  " 5       U l        U=(       d    [         R                  " U5      U l        U R                  R
                  U l        g)zInitialize a target.TargetClient.

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messagesprojects_locations_targets_service)selfr   r   s      0lib/googlecloudsdk/api_lib/clouddeploy/target.py__init__TargetsClient.__init__   sA     ;K99;DKE = =f EDMKK::DM    c                 j    U R                   R                  US9nU R                  R                  U5      $ )zGets the shared target object by calling the ProjectsLocationsTargetsService.Get API.

Args:
  name: str, target name.

Returns:
  a target object.
)name)r   -ClouddeployProjectsLocationsTargetsGetRequestr   Get)r   r   requests      r   r   TargetsClient.Get(   s6     mmII J G==W%%r   c           	          U R                   R                  U R                  R                  USUR                  [
        S95      $ )zPatches a target resource.

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

Returns:
  The operation message.
T)targetallowMissingr   
updateMask)r   Patchr   /ClouddeployProjectsLocationsTargetsPatchRequestr   TARGET_UPDATE_MASK)r   
target_objs     r   r    TargetsClient.Patch5   sC     ==EE)	 	F 	+, ,r   c                 h    U R                   R                  U R                  R                  SUS95      $ )zDeletes a target resource.

Args:

  name: str, target name.

Returns:
  The operation message. It could be none if the resource doesn't exist.
T)r   r   )r   Deleter   0ClouddeployProjectsLocationsTargetsDeleteRequest)r   r   s     r   r&   TargetsClient.DeleteE   s8     ==FFD 	G 	*+ +r   c                 f    U R                   R                  U R                  R                  US95      $ )zLists target resources in a location.

Args:
  location: str, the full name of the location which owns the targets.

Returns:
  Returns a list of targets in the given location.
)parent)r   Listr   .ClouddeployProjectsLocationsTargetsListRequest)r   locations     r   r+   TargetsClient.ListS   s6     ==DD 	E 	 r   )r   r   r   )NN)__name__
__module____qualname____firstlineno____doc__r   r   r    r&   r+   __static_attributes__ r   r   r   r      s    :	;&, +r   r   N)
r3   
__future__r   r   r   "googlecloudsdk.api_lib.clouddeployr   r"   objectr   r5   r   r   <module>r9      s*    8 &  ' : DF Dr   