
                         z    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 d Z
d Zd	 Zd
 Zd Zd Zd Zd Zd Zy)z9Client for interaction with EntryGroup API CRUD DATAPLEX.    )absolute_import)division)unicode_literals)util)iam_utilc                     t        j                         }|j                  | j                  | j                  t        j
                  |j                  |             }|S )zCreate Entry Group Request.)descriptiondisplayNamelabels)dataplex_apiGetMessageModuleGoogleCloudDataplexV1EntryGroupr	   display_nameCreateLabels)argsmodulerequests      2lib/googlecloudsdk/api_lib/dataplex/entry_group.py"GenerateEntryGroupForCreateRequestr      sW    ((*&22""##&&v'M'M'+- 3 .'
 
.    c           	          t        j                         }|j                  | j                  | j                  | j
                  t        j                  |j                  |             S )zUpdate Entry Group Request.)r	   r
   etagr   )r   r   r   r	   r   r   r   )r   r   s     r   "GenerateEntryGroupForUpdateRequestr   $   sZ    ((*&		/	/""##99&&v'M'M'+-	 
0 
. .r   c                     g }| j                  d      r|j                  d       | j                  d      r|j                  d       | j                  d      r|j                  d       |S )z"Create Update Mask for EntryGroup.r	   r   r
   r   )IsSpecifiedappend)r   update_masks     r   GenerateEntryGroupUpdateMaskr   /   sa    +	m$}%	n%}%	hx 	r   c                 f    t        j                  | t        j                         j                        S )z=Waits for the given google.longrunning.Operation to complete.)r   WaitForOperationGetClientInstanceprojects_locations_entryGroups)	operations    r   r    r    ;   s,    		&	&$$&EE
G Gr   c                    t        j                         j                  | j                         t        j                         j	                  |            }t        j
                         j                  j                  |      S )zSet Iam Policy request.)policy)resourcegoogleIamV1SetIamPolicyRequest)r   r   7DataplexProjectsLocationsEntryGroupsSetIamPolicyRequestRelativeNameGoogleIamV1SetIamPolicyRequestr!   r"   SetIamPolicy)entry_group_refr%   set_iam_policy_reqs      r   EntryGroupSetIamPolicyr.   B   sq    #44 ;;++-%1%B%B%D%%V%4 < 6 
 
	'	' 
""<<0B#CDr   c                     t        j                         j                  | j                               }t        j                         j
                  j                  |      S )zGet Iam Policy request.)r&   )r   r   7DataplexProjectsLocationsEntryGroupsGetIamPolicyRequestr)   r!   r"   GetIamPolicy)r,   get_iam_policy_reqs     r   EntryGroupGetIamPolicyr3   M   sW    #44 ;;++- < /  
	'	' 
""<<0B#CDr   c                     t        |       }t        j                  t        j                         j
                  |||       t        | |      S )zAdd IAM policy binding request.)r3   r   AddBindingToIamPolicyr   r   GoogleIamV1Bindingr.   r,   memberroler%   s       r   EntryGroupAddIamPolicyBindingr:   V   s@    !/2&
  ##%88&&$P		88r   c                 ^    t        |       }t        j                  |||       t        | |      S )z"Remove IAM policy binding request.)r3   r   RemoveBindingFromIamPolicyr.   r7   s       r    EntryGroupRemoveIamPolicyBindingr=   ^   s+    !/2&
%%ffd;		88r   c                 ~    t        j                  |t        j                         j                        }t        | |      S )z)Set IAM policy binding request from file.)r   ParsePolicyFiler   r   GoogleIamV1Policyr.   )r,   policy_filer%   s      r   EntryGroupSetIamPolicyFromFilerB   e   s6    ####%779& 
 	88r   N)__doc__
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   googlecloudsdk.command_lib.iamr   r   r   r   r    r.   r3   r:   r=   rB    r   r   <module>rH      sJ    @ &  ' @ 3.	GDD999r   