
    P                     |    S r SSKJr  SSKJr  SSKJr  SSK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g)z0Create hooks for Cloud Media Asset's asset type.    )absolute_import)division)unicode_literalsN)encoding)apis)utils)	resourcesc                     A [         R                  " 5       n[         R                  " U5      n[         R                  " X4UR                  5      Ul        U$ )zQPython hook for yaml commands to wildcard the parent parameter in asset requests.)r   
GetProjectGetLocationGetAssetTypeParentTemplate
asset_typeparent)refargsreqprojectlocations        :lib/googlecloudsdk/command_lib/media/asset/assets/hooks.pyAddParentInfoToAssetRequestsr      sD    	't$(//04A#*	*    c                    A [         R                  " SS5      nUR                  S5      (       a\  [        R                  " UR
                  5      n[        R                  " XCR                  5      n[        R                  " U5        XRl        UR                  S5      (       aD  [        R                  " UR                  UR                  R                  5      UR                  l        U$ )z1Prepare the asset for create and update requests.
mediaassetv1alphaasset_config_filelabels)r   GetMessagesModuleIsKnownAndSpecifiedjsonloadsr   r   DictToMessageAssetr   ValidateMediaAssetMessageassetr   LabelsValue)r   r   r   messages
asset_datar$   s         r   ParseAssetConfigFiler(   '   s    	##L)<(	122D223J"":~~>E	##E*I	h''--dkk.6nn.H.HJCII	*r   c                 `    [         R                  " U 5      R                  R                  U5      $ )zGet the modified resource.

Args:
  api_version: the request's release track.
  request_message: request message type in the python client.

Returns:
  The modified resource.
)r   	GetClient$projects_locations_assetTypes_assetsGet)api_versionrequest_messages     r   GetExistingResourcer/   6   s)     
	%	J	J	N	N
 r   c                    [         R                  " U5      n[         R                  " X5        [         R                  " 5       n[         R                  " U5      n[
        R                  R                  SUUUR                  UR                  S9nSUR                  ;   a  U $ [         R                  " U5      R                  UR                  5       S9n[        X&5      $ )z6Wait for operations to finish and return the resource.z/mediaasset.projects.locations.assetTypes.assets)
projectsIdlocationsIdassetTypesIdassetsIddelete)name)r   GetApiVersionFromArgsWaitForOperationr   r   r	   REGISTRYCreater   r$   command_pathGetApiMessage5MediaassetProjectsLocationsAssetTypesAssetsGetRequestRelativeNamer/   )responser   r-   r   r   resource_refr.   s          r   ProcessOutputrA   D   s    ++D1+/'t$(##**7??zz + , """O''HH((* I ,  
[	::r   )__doc__
__future__r   r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.utilr   &googlecloudsdk.command_lib.media.assetr   googlecloudsdk.corer	   r   r(   r/   rA    r   r   <module>rI      s6    7 &  '  % , 8 );r   