
    <                     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)z:Client for interaction with Environment 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Set Iam Policy request.)policy)resourcegoogleIamV1SetIamPolicyRequest)dataplex_apiGetMessageModule=DataplexProjectsLocationsLakesEnvironmentsSetIamPolicyRequestRelativeNameGoogleIamV1SetIamPolicyRequestGetClientInstance%projects_locations_lakes_environmentsSetIamPolicy)environment_refr   set_iam_policy_reqs      2lib/googlecloudsdk/api_lib/dataplex/environment.pyr   r      sr    #44 AA++-%1%B%B%D%%V%4 B 6 
 
	'	' 
)),,7I*JK    c                     [         R                  " 5       R                  U R                  5       S9n[         R                  " 5       R
                  R                  U5      $ )zGet Iam Policy request.)r   )r	   r
   =DataplexProjectsLocationsLakesEnvironmentsGetIamPolicyRequestr   r   r   GetIamPolicy)r   get_iam_policy_reqs     r   r   r   !   sX    #44 AA++- B /  
	'	' 
)),,7I*JK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	o	..r   c                 \    [        U 5      n[        R                  " X1U5        [        X5      $ )z"Remove IAM policy binding request.)r   r   RemoveBindingFromIamPolicyr   r   s       r   RemoveIamPolicyBindingr"   2   s'    (&
%%fd;	o	..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'   9   s4    ####%779& 
o	..r   c                     [         R                  " 5       nUR                  U R                  U R                  U R
                  S9nUR                  U R                  U R                  U R                  U R                  S9nUR                  X#S9nU$ )z+Generate InfrastructureSpec From Arguments.)
diskSizeGb	nodeCountmaxNodeCount)imageVersionjavaLibrariespythonPackages
properties)computeosImage)r	   r
   BGoogleCloudDataplexV1EnvironmentInfrastructureSpecComputeResourcescompute_disk_size_gbcompute_node_countcompute_max_node_count@GoogleCloudDataplexV1EnvironmentInfrastructureSpecOsImageRuntimeos_image_versionos_image_java_librariesos_image_python_packagesos_image_properties2GoogleCloudDataplexV1EnvironmentInfrastructureSpec)argsmodulecompute_resourceos_image_runtimeinfrastructure_specs        r   GenerateInfrastructureSpecrA   A   s    ((*&^^**''.. _ 0 \\((0022))	 ] +
 QQ R :	r   c                 x    [         R                  " 5       nUR                  U R                  U R                  S9nU$ )z$Generate SessionSpec From Arguments.)enableFastStartupmaxIdleDuration)r	   r
   +GoogleCloudDataplexV1EnvironmentSessionSpecsession_enable_fast_startupsession_max_idle_duration)r<   r=   session_specs      r   GenerateSessionSpecrI   R   s@    ((*&CC8844 D 6, 
r   c           	          [         R                  " 5       nUR                  U R                  U R                  [         R
                  " UR                  U 5      [        U 5      [        U 5      S9nU$ )z/Create Environment for Message Create Requests.descriptiondisplayNamelabelsinfrastructureSpecsessionSpecr	   r
    GoogleCloudDataplexV1EnvironmentrL   display_nameCreateLabelsrA   rI   )r<   r=   requests      r   #GenerateEnvironmentForCreateRequestrV   [   sg    ((*&33""##&&v'N'N'+-3D9%d+ 4 -' 
.r   c           	          [         R                  " 5       nUR                  U R                  U R                  [         R
                  " UR                  U 5      [        U 5      [        U 5      S9$ )z/Create Environment for Message Update Requests.rK   rQ   )r<   r=   s     r   #GenerateEnvironmentForUpdateRequestrX   h   sc    ((*&		0	0""##&&v'N'N'+-3D9%d+ 
1 
- -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$ )z$Create Update Mask for Environments.rL   rS   rM   rN   r3   z%infrastructureSpec.compute.diskSizeGbr4   z$infrastructureSpec.compute.nodeCountr5   z'infrastructureSpec.compute.maxNodeCountr7   z'infrastructureSpec.osImage.imageVersionr8   z(infrastructureSpec.osImage.javaLibrariesr9   z)infrastructureSpec.osImage.pythonPackagesr:   z%infrastructureSpec.osImage.propertiesrG   zsessionSpec.maxIdleDurationrF   zsessionSpec.enableFastStartup)IsSpecifiedappend)r<   update_masks     r   GenerateUpdateMaskr]   t   s   +	m$$}%	n%%}%	hx 	,-->?	*++=>	.//@A	())@A	/00AB	011BC	+,,>?	12245	34467	r   c                 j    [         R                  " U [         R                  " 5       R                  5      $ )z=Waits for the given google.longrunning.Operation to complete.)r	   WaitForOperationr   r   )	operations    r   r_   r_      s,    		&	&$$&LL
N Nr   N)__doc__googlecloudsdk.api_lib.dataplexr   r	   googlecloudsdk.command_lib.iamr   r   r   r   r"   r'   rA   rI   rV   rX   r]   r_    r   r   <module>re      sN    A A 3KK///"
	-<Nr   