
                         ^   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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dlZe
j$                   e
j&                  e
j(                  j*                  e
j(                  j,                         G d de
j.                                      Zddie_        y)z4Command for updating organization security policies.    )absolute_import)division)unicode_literals)base_classes)client)base)flags)org_security_policies_utils)security_policies_utilsNc                   *    e Zd ZdZdZed        Zd Zy)UpdatezUpdate a Compute Engine organization security policy.

  *{command}* is used to update organization security policies. An organization
  security policy is a set of rules that controls access to various resources.
  Nc                     t        j                  dd      | _        | j                  j                  |d       t        j                  |       t        j                  |       y )NTupdate)required	operation)operation_type)r	   OrgSecurityPolicyArgumentORG_SECURITY_POLICY_ARGAddArgumentAddArgsUpdateSpsp_flagsAddAdvancedOptions)clsparsers     3lib/surface/compute/org_security_policies/update.pyArgszUpdate.Args*   sO    "'"A"A#+C++F8+L	&!'    c           	         t        j                  | j                               }| j                  j	                  ||j
                  d      }t        j                  ||j                  |j
                  t        j                  | j                               j                               }t        j                  ||j                         |j                        }|j                  |d      d   }|j                   }|j"                  }|j                   |j                   }|j%                  d      s3|j%                  d      s"|j%                  d	      s|j%                  d
      r!t'        j(                  |j                  ||      }|j                  j*                  j-                  |||j.                        }	|j1                  |d|	      S )NF)with_project)refcompute_client	resourcesversion)organization)sp_idonly_generate_requestr   json_parsingjson_custom_content_types	log_leveluser_ip_request_headers)descriptionadvancedOptionsConfigfingerprint)r%   r&   security_policy)r   ComputeApiHolderReleaseTrackr   ResolveAsResourcer"   r   OrgSecurityPolicysix	text_typelowerr
   GetSecurityPolicyIdNamer$   Describer+   r,   IsSpecifiedr   CreateAdvancedOptionsConfigmessagesSecurityPolicyr-   r   )
selfargsholderr    org_security_policyr%   existing_security_policyr+   advanced_options_configr.   s
             r   Runz
Update.Run2   s   **4+<+<+>?F

&
&
8
8fU 9 4C 22}}""d//1288:	<
 (;;SXXZd6G6GIE2;;5  <  223 5*66K6LL#$$k(45%23
!
=
=mmT#:<  mm,,;;5,88 < :O
 %%#' & ) )r   )__name__
__module____qualname____doc__r   classmethodr   rC    r   r   r   r      s&     !( ( )r   r   EXAMPLESz    To update an organization security policy with ID ``123456789'' to change the
    description to ``New description'', run:

      $ {command} 123456789 --description='New description'
    )rG   
__future__r   r   r   googlecloudsdk.api_lib.computer   4googlecloudsdk.api_lib.compute.org_security_policiesr   googlecloudsdk.callioper   8googlecloudsdk.command_lib.compute.org_security_policiesr	   r
   4googlecloudsdk.command_lib.compute.security_policiesr   r   r3   UniverseCompatibleReleaseTracksr0   ALPHABETAUpdateCommandr   detailed_helprI   r   r   <module>rW      s    ; &  ' 7 G ( J ` R X 
 D%%++T->->-C-CD1)T 1) E 1)j 	 r   