
                         z    S 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)z1Utilities for manipulating organization policies.    )absolute_import)division)unicode_literals)serviceorganizationfolderprojectc                 v    U R                   (       a  [        nU$ U R                  (       a  [        nU$ [        nU$ )zReturns the resource type from the user-specified arguments.

Args:
  args: argparse.Namespace, An object that contains the values for the
    arguments specified in the Args method.
)r   ORGANIZATIONr   FOLDERPROJECTargsresource_types     =lib/googlecloudsdk/api_lib/resource_manager/settings/utils.pyComputeResourceTyper      s=     
 M 
 {{M 
 M	    c                 H   [         R                  " 5       R                  XUS9nU [        :X  a$  [         R                  " 5       R	                  XS9nU$ U [
        :X  a$  [         R                  " 5       R                  XS9nU$ [         R                  " 5       R                  XS9nU$ )a  Returns the Setting from the user-specified arguments.

Args:
  resource_type: A String object that contains the resource type
  name: The resource name of the setting and has the following syntax:
    [organizations|folders|projects]/{resource_id}/settings/{setting_name}.
  local_value: The configured value of the setting at the given parent
    resource
  etag: A fingerprint used for optimistic concurrency.
)namevalueetag)r   setting)settings_serviceResourceSettingsMessagesSettingr   5CloudresourcemanagerOrganizationsSettingsPatchRequestr   /CloudresourcemanagerFoldersSettingsPatchRequest0CloudresourcemanagerProjectsSettingsPatchRequest)r   r   local_valuer   r   requests         r   GetPatchRequestFromResourceTyper!   -   s     55 G  / 
 l"77 ;; < $  
. 77 55 6 $  
.	 77 66 7 $  
.r   c                 j   [         R                  " 5       nU R                  (       a*  U(       a  UR                  US9nU$ UR	                  US9n U$ U R
                  (       a*  U(       a  UR                  US9nU$ UR                  US9n U$ U(       a  UR                  US9nU$ UR                  US9nU$ )aC  Returns the get_request from the user-specified arguments.

Args:
  args: argparse.Namespace, An object that contains the values for the
    arguments specified in the Args method.
  setting_name: setting name such as `settings/iam-projectCreatorRoles`
  is_effective: indicate if it is requesting for an effective setting
r   )
r   r   r   <CloudresourcemanagerOrganizationsEffectiveSettingsGetRequest3CloudresourcemanagerOrganizationsSettingsGetRequestr   6CloudresourcemanagerFoldersEffectiveSettingsGetRequest-CloudresourcemanagerFoldersSettingsGetRequest7CloudresourcemanagerProjectsEffectiveSettingsGetRequest.CloudresourcemanagerProjectsSettingsGetRequest)r   setting_nameis_effectivemessagesget_requests        r   GetDescribeRequestFromArgsr.   M   s    668(	

O
O P  D 
7 
F
F G  8 
/ {{

I
I J  * 
 JJ K k 
 

J
J K   
	 KK L k 
r   c                     [         R                  " 5       nU R                  (       a  UR                  US9nU$ U R                  (       a  UR                  US9nU$ UR                  US9nU$ )zReturns the get_request from the user-specified arguments.

Args:
  args: argparse.Namespace, An object that contains the values for the
    arguments specified in the Args method.
  parent_resource: resource location such as `organizations/123`
)parent)r   r   r   4CloudresourcemanagerOrganizationsSettingsListRequestr   .CloudresourcemanagerFoldersSettingsListRequest/CloudresourcemanagerProjectsSettingsListRequest)r   parent_resourcer,   r-   s       r   GetListRequestFromArgsr5      s     668(	OO P  K 
 {{II J  K 
 JJ K  K 
r   c                     [         R                  " 5       nU R                  (       a  UR                  US9nU$ U R                  (       a  UR                  US9nU$ UR                  US9nU$ )zReturns the get_request from the user-specified arguments.

Args:
  args: argparse.Namespace, An object that contains the values for the
    arguments specified in the Args method.
  setting_name: setting name such as `settings/iam-projectCreatorRoles`
r#   )r   r   r   5CloudresourcemanagerOrganizationsSettingsClearRequestr   /CloudresourcemanagerFoldersSettingsClearRequest0CloudresourcemanagerProjectsSettingsClearRequest)r   r*   r,   r-   s       r   GetDeleteValueRequestFromArgsr:      s     668(	FF 	G 	
  
 {{JJ K K 
	 KK L K 
r   c                 .    [        U 5      n[        U5      $ zReturns the service from the user-specified arguments.

Args:
  args: argparse.Namespace, An object that contains the values for the
    arguments specified in the Args method.
)r   GetServiceFromResourceTyper   s     r   GetServiceFromArgsr>      s     &d+-	#M	22r   c                     U [         :X  a  [        R                  " 5       nU$ U [        :X  a  [        R                  " 5       nU$ [        R
                  " 5       nU$ zzReturns the service from the resource type input.

Args:
  resource_type: A String object that contains the resource type
)r   r   OrganizationsSettingsServicer   FoldersSettingsServiceProjectsSettingsServicer   r   s     r   r=   r=      sU     l";;=G 
. 557G 
. 668G	.r   c                 .    [        U 5      n[        U5      $ r<   )r   #GetEffectiveServiceFromResourceTyper   s     r   GetEffectiveServiceFromArgsrG      s     &d+-	,]	;;r   c                     U [         :X  a  [        R                  " 5       nU$ U [        :X  a  [        R                  " 5       nU$ [        R
                  " 5       nU$ r@   )r   r   %OrganizationsEffectiveSettingsServicer   FoldersEffectiveSettingsService ProjectsEffectiveSettingsServicerD   s     r   rF   rF      sU     l"DDFG 
. >>@G 
. ??AG	.r   N)__doc__
__future__r   r   r   0googlecloudsdk.api_lib.resource_manager.settingsr   r   r   r   r   r   r!   r.   r5   r:   r>   r=   rG   rF    r   r   <module>rP      sT    8 &  ' X	
"@0f0:
3"
<r   