
                             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S rg)z3Client for interaction with ZONE 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Set Iam Policy request.)policy)resourcegoogleIamV1SetIamPolicyRequest)dataplex_apiGetMessageModule6DataplexProjectsLocationsLakesZonesSetIamPolicyRequestRelativeNameGoogleIamV1SetIamPolicyRequestGetClientInstanceprojects_locations_lakes_zonesSetIamPolicy)zone_refr	   set_iam_policy_reqs      +lib/googlecloudsdk/api_lib/dataplex/zone.pyr   r      sq    #44 ::$$&%1%B%B%D%%V%4 ; 6 
 
	'	' 
""<<0B#CD    c                     [         R                  " 5       R                  U R                  5       S9n[         R                  " 5       R
                  R                  U5      $ )zGet Iam Policy request.)r
   )r   r   6DataplexProjectsLocationsLakesZonesGetIamPolicyRequestr   r   r   GetIamPolicy)r   get_iam_policy_reqs     r   r   r   $   sW    #44 ::$$& ; (  
	'	' 
""<<0B#CDr   c                     [        U 5      n[        R                  " [        R                  " 5       R
                  X1U5        [        X5      $ )zAdd iam policy binding request.)r   r   AddBindingToIamPolicyr   r   GoogleIamV1Bindingr   )r   memberroler	   s       r   AddIamPolicyBindingr!   -   s<    !&
  ##%88&$P	h	''r   c                 \    [        U 5      n[        R                  " X1U5        [        X5      $ )z"Remove 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)Set iam policy binding request from file.)r   ParsePolicyFiler   r   GoogleIamV1Policyr   )r   policy_filer	   s      r   SetIamPolicyFromFiler*   <   s4    ####%779& 
h	''r   c                 r   [         R                  " 5       nUR                  U R                  U R                  [         R
                  " UR                  U 5      UR                  R                  U R                  5      [        U 5      UR                  UR                  R                  U R                  5      S9S9$ )z(Create Zone for Message Create Requests.)locationType)descriptiondisplayNamelabelstypediscoverySpecresourceSpec)r   r   GoogleCloudDataplexV1Zoner-   display_nameCreateLabelsTypeValueValuesEnumr0   GenerateDiscoverySpec%GoogleCloudDataplexV1ZoneResourceSpecLocationTypeValueValuesEnumresource_location_typeargsmodules     r   GenerateZoneForCreateRequestr>   D   s    ((*&		)	)""##&&v'G'GN++??		J)$/??CC&&t'B'BC @ E 
* 
F Fr   c                     [         R                  " 5       nUR                  U R                  U R                  [         R
                  " UR                  U 5      [        U 5      S9$ )z(Create Zone for Message Update Requests.)r-   r.   r/   r1   )r   r   r3   r-   r4   r5   r7   r;   s     r   GenerateZoneForUpdateRequestr@   R   sX    ((*&		)	)""##&&v'G'GN)$/	 
* 
1 1r   c           
          [         R                  " 5       R                  U R                  U R                  U R
                  U R                  [        U 5      [        U 5      S9$ )N)enabledincludePatternsexcludePatternsschedule
csvOptionsjsonOptions)	r   r   &GoogleCloudDataplexV1ZoneDiscoverySpecdiscovery_enableddiscovery_include_patternsdiscovery_exclude_patternsdiscovery_scheduleGenerateCsvOptionsGenerateJsonOptionsr<   s    r   r7   r7   \   sX    		&	&	(	O	O$$5555&&#D)%d+ 
P 
- -r   c                     [         R                  " 5       R                  U R                  U R                  U R
                  U R                  S9$ )N)	delimiterdisableTypeInferenceencoding
headerRows)r   r   0GoogleCloudDataplexV1ZoneDiscoverySpecCsvOptionscsv_delimitercsv_disable_type_inferencecsv_encodingcsv_header_rowsrO   s    r   rM   rM   f   sI    		&	& 
44""::  %%	 5 ''r   c                 p    [         R                  " 5       R                  U R                  U R                  S9$ )N)rS   rR   )r   r   1GoogleCloudDataplexV1ZoneDiscoverySpecJsonOptionsjson_encodingjson_disable_type_inferencerO   s    r   rN   rN   o   s7    		&	& 
55!!;; 6 ==r   c                     / nU R                  S5      (       a  UR                  S5        U R                  S5      (       a  UR                  S5        U R                  S5      (       a  UR                  S5        U R                  S5      (       a  UR                  S5        U R                  S5      (       a  UR                  S5        U R                  S	5      (       a  UR                  S
5        U R                  S5      (       a  UR                  S5        U R                  S5      (       a  UR                  S5        U R                  S5      (       a  UR                  S5        U R                  S5      (       a  UR                  S5        U R                  S5      (       a  UR                  S5        U R                  S5      (       a  UR                  S5        U R                  S5      (       a  UR                  S5        U$ )zCreate Update Mask for Zones.r-   r4   r.   r/   rI   zdiscoverySpec.enabledrJ   zdiscoverySpec.includePatternsrK   zdiscoverySpec.excludePatternsrL   zdiscoverySpec.schedulerY   z#discoverySpec.csvOptions.headerRowsrV   z"discoverySpec.csvOptions.delimiterrX   z!discoverySpec.csvOptions.encodingrW   z-discoverySpec.csvOptions.disableTypeInferencer\   z"discoverySpec.jsonOptions.encodingr]   z.discoverySpec.jsonOptions.disableTypeInference)IsSpecifiedappend)r<   update_masks     r   GenerateUpdateMaskrb   v   s   +	m$$}%	n%%}%	hx 	)**./	23367	23367	*++/0	'((<=	o&&;<	n%%:;	233FG	o&&;<	344GH	r   c                 j    [         R                  " U [         R                  " 5       R                  5      $ )z=Waits for the given google.longrunning.Operation to complete.)r   WaitForOperationr   r   )	operations    r   rd   rd      s,    		&	&$$&EE
G Gr   N)__doc__
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   googlecloudsdk.command_lib.iamr   r   r   r!   r%   r*   r>   r@   r7   rM   rN   rb   rd    r   r   <module>rk      sZ    : &  ' @ 3DD(((F1-'=@Gr   