
                             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S rS rg)z6Client for interaction with CONTENT API CRUD DATAPLEX.    )absolute_import)division)unicode_literals)util)iam_utilc                     [         R                  " 5       R                  U R                  5       [         R                  " 5       R	                  US9S9n[         R
                  " 5       R                  R                  U5      $ )zSets Iam Policy request.)policy)resourcegoogleIamV1SetIamPolicyRequest)dataplex_apiGetMessageModule8DataplexProjectsLocationsLakesContentSetIamPolicyRequestRelativeNameGoogleIamV1SetIamPolicyRequestGetClientInstance projects_locations_lakes_contentSetIamPolicy)content_refr	   set_iam_policy_reqs      .lib/googlecloudsdk/api_lib/dataplex/content.pyr   r      sq    #44 <<'')%1%B%B%D%%V%4 = 6 
 
	'	' 
$$\\2D%EF    c                     [         R                  " 5       R                  U R                  5       S9n[         R                  " 5       R
                  R                  U5      $ )zGets Iam Policy request.)r
   )r   r   8DataplexProjectsLocationsLakesContentGetIamPolicyRequestr   r   r   GetIamPolicy)r   get_iam_policy_reqs     r   r   r   $   sW    #44 <<'') = +  
	'	' 
$$\\2D%EFr   c                     [        U 5      n[        R                  " [        R                  " 5       R
                  X1U5        [        X5      $ )z Adds iam policy binding request.)r   r   AddBindingToIamPolicyr   r   GoogleIamV1Bindingr   )r   memberroler	   s       r   AddIamPolicyBindingr!   -   s<    $&
  ##%88&$P	k	**r   c                 \    [        U 5      n[        R                  " X1U5        [        X5      $ )z#Removes iam policy binding request.)r   r   RemoveBindingFromIamPolicyr   )lake_refr   r    r	   s       r   RemoveIamPolicyBindingr%   5   s'    !&
%%fd;	h	''r   c                     [         R                  " U[        R                  " 5       R                  5      n[        X5      $ )z*Sets iam policy binding request from file.)r   ParsePolicyFiler   r   GoogleIamV1Policyr   )r   policy_filer	   s      r   SetIamPolicyFromFiler*   <   s4    ####%779& 
k	**r   c                 R   [         R                  " 5       nUR                  U R                  U R                  [         R
                  " UR                  U 5      U R                  S9nU R                  (       a  [        U 5      Ul	        U R                  (       a  [        U 5      Ul        U$ )z,Creates Content for Message Create Requests.dataTextdescriptionlabelspathr   r   GoogleCloudDataplexV1Content	data_textr.   CreateLabelsr0   kernel_typeGenerateNotebooknotebookquery_engineGenerateSqlScript	sqlScriptargsmodulecontents      r   GenerateContentForCreateRequestr?   D       ((*&//~~""&&v'J'J'+-99 0 ' 
'-G	)$/G	.r   c                 R   [         R                  " 5       nUR                  U R                  U R                  [         R
                  " UR                  U 5      U R                  S9nU R                  (       a  [        U 5      Ul	        U R                  (       a  [        U 5      Ul        U$ )z,Creates Content for Message Update Requests.r,   r1   r;   s      r   GenerateContentForUpdateRequestrB   T   r@   r   c                     [         R                  " 5       nUR                  nUR                  5       nU R                  (       a   UR	                  U R                  5      Ul        U$ )zBCreates Notebook field for Content Message Create/Update Requests.)r   r   $GoogleCloudDataplexV1ContentNotebookr5   KernelTypeValueValuesEnum
kernelType)r<   r=   kernel_type_fieldr7   s       r   r6   r6   d   sT    ((*&AA88:(	+EEH	/r   c                     [         R                  " 5       nUR                  nUR                  5       nU R                  (       a   UR	                  U R                  5      Ul        U$ )zDCreates SQL Script field for Content Message Create/Update Requests.)r   r   %GoogleCloudDataplexV1ContentSqlScriptr8   EngineValueValuesEnumengine)r<   r=   query_engine_field
sql_scripts       r   r9   r9   o   sU    ((*&CC;;=*	*@@J	r   c                     SSSSSSS.n/ nUR                  5        H.  u  p4U R                  U5      (       d  M  UR                  U5        M0     U$ )z Creates Update Mask for Content.r.   r/   r0   zsqlScript.engineznotebook.kernelTyper3   )r.   r/   r0   r8   r5   r3   )itemsIsSpecifiedappend)r<   args_api_field_mapupdate_maskkvs        r   GenerateUpdateMaskrV   z   sa     #(* + &&(da ) 
r   c                 j    [         R                  " U [         R                  " 5       R                  5      $ )z=Waits for the given google.longrunning.Operation to complete.)r   WaitForOperationr   r   )	operations    r   rX   rX      s,    		&	&$$&GG
I Ir   N)__doc__
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   googlecloudsdk.command_lib.iamr   r   r   r!   r%   r*   r?   rB   r6   r9   rV   rX    r   r   <module>r_      sS    = &  ' @ 3FF+(+  $Ir   