Ë
    €Ï2  ã                   ó8  — 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  e
j                  e
j                  j                   e
j                  j"                  e
j                  j$                  «       G d
„ de
j&                  «      «       Zy)z@Command for removing user defined fields from security policies.é    )Úabsolute_import)Údivision)Úunicode_literals)Úbase_classes)Úclient)Úbase)Ú
exceptions)Úflagsc                   ó*   — e Zd ZdZdZed„ «       Zd„ Zy)ÚRemoveUserDefinedFieldAlphaa  Remove a user defined field from a Compute Engine security policy.

  *{command}* is used to remove user defined fields from security policies.

  ## EXAMPLES

  To remove a user defined field run this:

    $ {command} SECURITY_POLICY --user-defined-field-name=my-field
  Nc                 ó˜   — t        j                  «       | _        | j                  j                  |d¬«       |j	                  ddd¬«       y )NÚupdate)Úoperation_typeú--user-defined-field-nameTz-The name of the user defined field to remove.)ÚrequiredÚhelp)r
   ÚSecurityPolicyRegionalArgumentÚSECURITY_POLICY_ARGÚAddArgumentÚadd_argument)ÚclsÚparsers     úBlib/surface/compute/security_policies/remove_user_defined_field.pyÚArgsz RemoveUserDefinedFieldAlpha.Args-   sH   € ä#×BÑBÓD€CÔØ×Ñ×'Ñ'¨¸xÐ'ÔHØ
×ÑØ#ØØ<ð õ ó    c                 ój  — t        j                  | j                  «       «      }| j                  j	                  ||j
                  «      }t        j                  ||j                  ¬«      }|j                  «       d   }|j                  }g }|D ]-  }|j                  |j                  k7  sŒ|j                  |«       Œ/ t        |«      t        |«      k(  rt        j                  dd«      ‚|j                  j                   j                  ||j"                  ¬«      }	|sdnd }
|j%                  |	|
¬«      S )N)ÚrefÚcompute_clientr   r   z1user defined field does not exist in this policy.)ÚuserDefinedFieldsÚfingerprintÚuser_defined_fields)Úsecurity_policyÚ
field_mask)r   ÚComputeApiHolderÚReleaseTrackr   ÚResolveAsResourceÚ	resourcesr   ÚSecurityPolicyÚDescriber   ÚnameÚuser_defined_field_nameÚappendÚlenr	   ÚInvalidArgumentExceptionÚmessagesr    ÚPatch)ÚselfÚargsÚholderr   r"   Úexisting_security_policyÚexisting_user_defined_fieldsÚnew_user_defined_fieldsÚuser_defined_fieldÚupdated_security_policyr#   s              r   ÚRunzRemoveUserDefinedFieldAlpha.Run7   s0  € Ü×*Ñ*¨4×+<Ñ+<Ó+>Ó?€FØ
×
"Ñ
"×
4Ñ
4°T¸6×;KÑ;KÓ
L€CÜ×+Ñ+Ø §¡ô€Oð  /×7Ñ7Ó9¸!Ñ<Ðà#;×#MÑ#MÐ Ø ÐÛ:ÐØ	×	 Ñ	  D×$@Ñ$@Ó	@Ø×&Ñ&Ð'9Õ:ð ;ô Ð'Ó(¬CÐ0GÓ,HÒHÜ×/Ñ/Ø
%Ø
=óð ð
 %Ÿm™m×4Ñ4×CÑCØ1Ø,×8Ñ8ð Dó Ðñ
 /FÑ&È4€Jà× Ñ Ø/¸Jð !ó ð r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úclassmethodr   r9   © r   r   r   r      s&   „ ñ	ð Ðàñó ðór   r   N)r=   Ú
__future__r   r   r   Úgooglecloudsdk.api_lib.computer   Ú0googlecloudsdk.api_lib.compute.security_policiesr   Úgooglecloudsdk.callioper   r	   Ú4googlecloudsdk.command_lib.compute.security_policiesr
   ÚReleaseTracksr%   ÚALPHAÚBETAÚGAÚUpdateCommandr   r?   r   r   Ú<module>rJ      s|   ðñ Gå &Ý Ý 'å 7Ý CÝ (Ý .Ý Fð €×ÑØ×Ñ×Ñ˜T×.Ñ.×3Ñ3°T×5FÑ5F×5IÑ5Ióô5 $×"4Ñ"4ó 5óñ5r   