
                         8   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SS	KJr  \
R                  " \
R                  R                   \
R                  R"                  \
R                  R$                  5       " S
 S\
R&                  5      5       rg)z<Command for adding user defined fields to security policies.    )absolute_import)division)unicode_literals)base_classes)client)base)flags)security_policies_utilsc                   2    \ rS rSrSrSr\S 5       rS rSr	g)AddUserDefinedField   a7  Add a user defined field to a Compute Engine security policy.

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

## EXAMPLES

To add a user defined field run this:

  $ {command} SECURITY_POLICY \
     --user-defined-field-name=my-field \
     --base=ipv6 \
     --offset=10 \
     --size=3
Nc                 .   [         R                  " 5       U l        U R                  R                  USS9  UR	                  SSSS9  UR	                  S/ SQSS	S
9  UR	                  S[
        SSS9  UR	                  S[
        SSS9  UR	                  SSS9  g )Nupdate)operation_typez--user-defined-field-nameTz$The name for the user defined field.)requiredhelpz--base)ipv4ipv6tcpudpz.The base relative to which offset is measured.)choicesr   r   z--offsetzOOffset of the first byte of the field (in network byte order) relative to base.)typer   r   z--sizez.Size of the field in bytes. Valid values: 1-4.z--maskzIf specified, apply this mask (bitwise AND) to the field to ignore bits before matching. Encoded as a hexadecimal number (starting with "0x").)r   )r	   SecurityPolicyRegionalArgumentSECURITY_POLICY_ARGAddArgumentadd_argumentint)clsparsers     ?lib/surface/compute/security_policies/add_user_defined_field.pyArgsAddUserDefinedField.Args1   s    #BBDC''x'H
#3  
 .=	   !   =	         c                    [         R                  " U R                  5       5      nU R                  R	                  XR
                  5      n[        R                  " X2R                  S9nUR                  5       S   n[        R                  " UR                  U5      nUR                  nUR                  U5        UR                  R                  R                  UUR                  S9nUR                  US9$ )N)refcompute_clientr   )userDefinedFieldsfingerprint)security_policy)r   ComputeApiHolderReleaseTrackr   ResolveAsResource	resourcesr   SecurityPolicyDescriber
   CreateUserDefinedFieldr'   appendmessagesr(   Patch)	selfargsholderr%   r)   existing_security_policyuser_defined_fielduser_defined_fieldsupdated_security_policys	            r    RunAddUserDefinedField.RunX   s    **4+<+<+>?F

"
"
4
4T;K;K
LC++O  /779!<0GGt 3DD12$mm44CC-,88 D 
   1H IIr#    )
__name__
__module____qualname____firstlineno____doc__r   classmethodr!   r;   __static_attributes__r=   r#   r    r   r      s(     $ $LJr#   r   N)rB   
__future__r   r   r   googlecloudsdk.api_lib.computer   0googlecloudsdk.api_lib.compute.security_policiesr   googlecloudsdk.callioper   4googlecloudsdk.command_lib.compute.security_policiesr	   r
   ReleaseTracksr+   ALPHABETAGAUpdateCommandr   r=   r#   r    <module>rO      s    C &  ' 7 C ( F X T..33T5F5F5I5ILJ$,, LJLJr#   