
                             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 ej                    ej"                  ej$                  j&                         G d dej(                                      Zddie_        y)z:Command for updating network firewall policy associations.    )absolute_import)division)unicode_literals)base_classes)!firewall_policy_association_utils)client)region_client)base)flagsc                   *    e Zd ZdZdZed        Zd Zy)UpdatezUpdate association between a firewall policy and a network.

  *{command}* is used to update network firewall policy associations. A
  network firewall policy is a set of rules that controls access to various
  resources.
  Nc                     t        j                  dd      | _        | j                  j                  |d       t        j                  |       y )NTupdate)required	operation)operation_type)r   (NetworkFirewallPolicyAssociationArgumentNETWORK_FIREWALL_POLICY_ARGAddArgumentAddArgsUpdateAssociation)clsparsers     Dlib/surface/compute/network_firewall_policies/associations/update.pyArgszUpdate.Args)   sH     	66X	
 #
 ##//x/P	""6*    c                    t        j                  | j                               }| j                  j	                  ||j
                        }t        j                  ||j                        }t        |d      r!t        j                  ||j                        }t        j                  |j                        }|j                  j                  j                  |j                   |      }|j#                  ||j$                  d      S )N)compute_clientregion)namepriorityF)associationfirewall_policyonly_generate_request)r   ComputeApiHolderReleaseTrackr   ResolveAsResource	resourcesr   NetworkFirewallPolicyhasattrr	   RegionNetworkFirewallPolicyassociation_utilsConvertPriorityToIntr    messagesFirewallPolicyAssociationr   PatchAssociationr"   )selfargsholderrefnetwork_firewall_policyr    r!   s          r   Runz
Update.Run3   s    **4+<+<+>?F

*
*
<
<fC %::FMM sH - I I
fmm! !55dmmDH--((BBYY C K #33,,# 4  r   )__name__
__module____qualname____doc__r   classmethodr   r5    r   r   r   r      s&     !%+ +r   r   EXAMPLESa.    To update priority of association named ``my-association'' on network
  firewall policy with name ``my-policy'' in region ``region-a'', run:

    $ {command}
        --firewall-policy=my-policy
        --name=my-association
        --firewall-policy-region=region-a
        --priority=new-priority
  N)r9   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   r+   8googlecloudsdk.api_lib.compute.network_firewall_policiesr   r	   googlecloudsdk.callioper
   <googlecloudsdk.command_lib.compute.network_firewall_policiesr   HiddenReleaseTracksr%   ALPHAUpdateCommandr   detailed_helpr;   r   r   <module>rG      s    A &  ' 7 a K R ( N D%%++,,T , - ,`  	 r   