
                         b    S 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.    )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"   2   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'   9   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+   CreateLabelsr-   kernel_typeGenerateNotebooknotebookquery_engineGenerateSqlScript	sqlScriptargsmodulecontents      r   GenerateContentForCreateRequestr<   A       ((*&//~~""&&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)   r.   r8   s      r   GenerateContentForUpdateRequestr?   Q   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
   $GoogleCloudDataplexV1ContentNotebookr2   KernelTypeValueValuesEnum
kernelType)r9   r:   kernel_type_fieldr4   s       r   r3   r3   a   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
   %GoogleCloudDataplexV1ContentSqlScriptr5   EngineValueValuesEnumengine)r9   r:   query_engine_field
sql_scripts       r   r6   r6   l   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,   r-   zsqlScript.engineznotebook.kernelTyper0   )r+   r,   r-   r5   r2   r0   )itemsIsSpecifiedappend)r9   args_api_field_mapupdate_maskkvs        r   GenerateUpdateMaskrS   w   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   rU   rU      s,    		&	&$$&GG
I Ir   N)__doc__googlecloudsdk.api_lib.dataplexr   r	   googlecloudsdk.command_lib.iamr   r   r   r   r"   r'   r<   r?   r3   r6   rS   rU    r   r   <module>r[      sM    = A 3FF+(+  $Ir   