
    7                     R   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  SS
KJr  SSKr\R"                  \R$                  " \R&                  R(                  \R&                  R*                  5       " S S\R,                  5      5       5       rSS0\l        g)zICommand for updating organization firewall policy packet mirroring rules.    )absolute_import)division)unicode_literals)base_classes)firewall_policy_rule_utils)client)base)firewall_policies_utils)flagsNc                   2    \ rS rSrSrSr\S 5       rS rSr	g)Update   zUpdates a Compute Engine firewall policy packet mirroring rule.

*{command}* is used to update organization firewall policy packet mirroring
rules.
Nc                 v   [         R                  " SSS9U l        U R                  R                  U5        [         R                  " USS9  [         R
                  " USS9  [         R                  " U5        [         R                  " U5        [         R                  " U5        [         R                  " U5        [         R                  " U5        [         R                  " U5        [         R                  " U5        [         R                  " U5        [         R                  " USS9  [         R                  " USS9  g )NTupdate)required	operationF)r   updated)r   )r   FirewallPolicyRuleArgumentFIREWALL_POLICY_ARGAddArgumentAddPacketMirroringActionAddFirewallPolicyIdAddSrcIpRangesAddDestIpRangesAddLayer4ConfigsAddDirectionAddDisabledAddTargetResources AddMirroringSecurityProfileGroupAddDescriptionAddNewPriorityAddOrganization)clsparsers     ?lib/surface/compute/firewall_policies/mirroring_rules/update.pyArgsUpdate.Args)   s    #>>C ''/	""6E:	f	:	 	&!	6"	v	f	V$	**62	 	84	&51    c                 (	   SSSSS.n[         R                  " U R                  5       5      nU R                  R	                  XR
                  SS9n[        R                  " UUR                  UR
                  [        R                  " U R                  5       5      R                  5       S9n[        R                  " UUR                  UR
                  [        R                  " U R                  5       5      R                  5       S9n/ n[        R                  " UR                  5       5      n/ n	/ n
/ n/ nS nSnS nS nS nU HG  nUR                  U5      (       d  M  UR!                  U5      (       a  M3  UR#                  UU   5        MI     UR%                  S	5      (       a  UR&                  n	S
nUR%                  S5      (       a  UR(                  n
S
nUR%                  S5      (       a7  S
n[        R*                  " UR,                  UR                  R.                  5      nUR%                  S5      (       a  UR0                  nUR%                  S5      (       a6  [2        R4                  " UR6                  UR8                  UUR:                  S9nO7UR%                  S5      (       a!  UR<                  S:w  a  UR#                  S5        UR%                  S5      (       a  UR>                  nUR%                  S5      (       a!  [        R                  " UR@                  5      nOUnU(       a%  UR                  R.                  RC                  U	U
US9nUR%                  S5      (       ay  URD                  S:X  a5  UR                  R.                  RF                  RH                  RJ                  nO4UR                  R.                  RF                  RH                  RL                  nUR                  R.                  RG                  UUR<                  UUUURN                  UUS9n[2        RP                  " UUR:                  UR8                  S9nUR                  RR                  RU                  U5         URW                  UUUS9sS S S 5        $ ! , (       d  f       g = f)Nzmatch.srcIpRangeszmatch.destIpRangessecurityProfileGrouptargetResources)src_ip_rangesdest_ip_rangessecurity_profile_grouptarget_resourcesF)with_project)refcompute_client	resourcesversionr,   Tr-   layer4_configsr/   r.   )r.   optional_organizationfirewall_policy_clientfirewall_policy_idactionapply_security_profile_groupdisablednew_priority)srcIpRangesdestIpRangeslayer4Configs	directionINGRESS)priorityr9   matchr@   r+   descriptionr;   r*   )organization)rB   firewall_policyfirewall_policy_rule),r   ComputeApiHolderReleaseTrackr   ResolveAsResourcer3   r   OrgFirewallPolicysix	text_typelower$OrgFirewallPolicyPacketMirroringRule
rule_utilsConvertPriorityToIntNameIsKnownAndSpecifiedGetValueappendIsSpecifiedr,   r-   ParseLayer4Configsr5   messagesr/   r
   BuildSecurityProfileGroupUrlr.   rE   rF   r9   r;   r<   FirewallPolicyRuleMatcherr@   FirewallPolicyRuleDirectionValueValuesEnumrA   EGRESSrD   GetFirewallPolicyIdapitools_clientIncludeFields
UpdateRule)selfargs clearable_arg_name_to_field_nameholderr1   org_firewall_policyfirewall_policy_rule_clientcleared_fieldsrB   r,   r-   layer4_config_listr/   r;   should_setup_matchtraffic_directmatcherr.   argr<   rG   r8   s                         r%   Run
Update.Run=   s   ,."8-	($ **4+<+<+>?F

"
"
4
4U 5 C !22}}""d//1288:	 #)"M"M}}""d//1288:	# N..sxxz:HMNHNG!/		!	!#	&	&t}}S/A/A>sCD 0 ((((m())**n())%88


v}}55 *++..011
!
>
>%)%@%@$($5$5%8!%!5!5	  	""KK9923
##h''44T5F5FGll &&@@#%* A g $$	9	$MM""55NNVV 	
 MM""55NNUU 	 "==11DD{{ ($$3 E 	 1DD#&& 
	&	&	4	4^	D(33,3 4  
E	D	Ds   (R
R )
__name__
__module____qualname____firstlineno____doc__r   classmethodr&   rn   __static_attributes__rp   r(   r%   r   r      s'     2 2&qr(   r   EXAMPLESa)      To update a rule with priority ``10" in an organization firewall policy
    with ID ``123456789" to change the action to ``allow" and description to
    ``new-example-rule", run:

      $ {command} 10 --firewall-policy=123456789 --action=do_not_mirror
      --description=new-example-rule
    )ru   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   rP   0googlecloudsdk.api_lib.compute.firewall_policiesr   googlecloudsdk.callioper	   4googlecloudsdk.command_lib.compute.firewall_policiesr
   r   rL   UniverseCompatibleReleaseTracksrI   ALPHABETAUpdateCommandr   detailed_helprp   r(   r%   <module>r      s    P &  ' 7 S C ( X F 
 D%%++T->->-C-CDNT N E Nd  	 r(   