
                            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mZ ddlmZ  G d de      Z ej0                  ej2                  j4                         G d dej6                               Z ej0                  ej2                  j:                         G d de             Z ej0                  ej2                  j>                         G d de             Z y)z-Command for deleting security policies rules.    )absolute_import)division)unicode_literals)base_classes)utils)client)base)scope)flags)
properties)	resourcesc                   8    e Zd ZdZdZdZed        Zed        Zy)DeleteHelperDelete Compute Engine security policy rules.

  *{command}* is used to delete security policy rules.

  ## EXAMPLES

  To delete the rule at priority 1000, run:

    $ {command} 1000 \
       --security-policy=my-policy
  Nc                 ^   t        j                  dd      | _        | j                  j                  |dd       t        j                  |d       t        j                         | _        | j                  j                  |       |j                  j                  t
        j                         y)z+Generates the flagset for a Delete command.deleteT)	is_pluralPRIORITY)operation_typecust_metavarN)r   PriorityArgumentNAME_ARGAddArgumentAddRegionFlagsecurity_policies_flags(SecurityPolicyMultiScopeArgumentForRulesSECURITY_POLICY_ARGdisplay_infoAddCacheUpdaterSecurityPoliciesCompleterclsparsers     5lib/surface/compute/security_policies/rules/delete.pyArgszDeleteHelper.Args1   s     **8tDCLLLxj  B	)HHJ  ''/
''99    c                    t        j                  |      }g }|j                  rH| j                  j	                  ||j
                  t        j                  j                        }t        |dd      |j                  D ]s  }|j                  |j
                  j                  |dt        j                  j                  j                   j"                  |j$                  |j                  d             u n|j                  D ]h  }|j                  |j
                  j                  |dt        j                  j                  j                   j"                  |j                  d             j ny|j                  D ]j  }	 |j                  |j
                  j                  |dt        j                  j                  j                   j"                  t        |dd      d	             l t+        j,                  |       g }|D ]D  }t/        j0                  ||j.                        }	|j3                  |	j5                  d             F |j.                  j7                  |      S # t
        j&                  t
        j(                  f$ r_ |j                  |j
                  j                  |dd
t        j                  j                  j                   j"                  i             Y iw xY w)z8Validates arguments and deletes security policy rule(s).)default_scoperegionNz!compute.regionSecurityPolicyRules)projectr)   securityPolicy)
collectionparamszcompute.securityPolicyRules)r*   r+   )r*   r)   r*   )compute_clientT)only_generate_request)r   ComputeApiHoldersecurity_policyr   ResolveAsResourcer   compute_scope	ScopeEnumGLOBALgetattrnamesappendParser   VALUEScorer*   	GetOrFailr)   RequiredFieldOmittedException WrongResourceCollectionExceptionr   PromptForDeletionr   SecurityPolicyRuleextendDeleteMakeRequests)
r"   release_trackargsholderrefssecurity_policy_refnamerequestsrefsecurity_policy_rules
             r$   RunzDeleteHelper.Run@   s    **=9FD33EE



%//66 F 8 
$h	5	AJJD
++f&&,,<'..33;;EE/66$($8$8 -    JJD
++f&&,,6'..33;;EE$($8$8 -    **$	
++f&&,,<'..33;;EE#D(D9 -   * 
D!H#66
fmm-oo*111MN 
 ==%%h//% 3366
 
	 ++f&&,,6Z..33;;EE -  	
	s   =A'I!!A>K#"K#)	__name__
__module____qualname____doc__r   r   classmethodr%   rM    r&   r$   r   r   !   s:    
 (  ;0 ;0r&   r   c                   *    e Zd ZdZdZed        Zd Zy)DeleteGAr   Nc                 .    t         j                  |       y N)r   r%   r!   s     r$   r%   zDeleteGA.Args   s    fr&   c                 J    t         j                  | j                         |      S rW   )r   rM   ReleaseTrack)selfrE   s     r$   rM   zDeleteGA.Run   s    D--/66r&   )rN   rO   rP   rQ   r   rR   r%   rM   rS   r&   r$   rU   rU      s&    
  7r&   rU   c                       e Zd ZdZy)
DeleteBetar   NrN   rO   rP   rQ   rS   r&   r$   r\   r\          
r&   r\   c                       e Zd ZdZy)DeleteAlphar   Nr]   rS   r&   r$   r`   r`      r^   r&   r`   N)!rQ   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   0googlecloudsdk.api_lib.compute.security_policiesr   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   r3   4googlecloudsdk.command_lib.compute.security_policiesr   r   :googlecloudsdk.command_lib.compute.security_policies.rulesgooglecloudsdk.corer   r   objectr   ReleaseTracksrY   GADeleteCommandrU   BETAr\   ALPHAr`   rS   r&   r$   <module>ro      s     4 &  ' 7 0 C ( E a L * )[06 [0| D%%(()7t!! 7 *7. D%%**+  , D%%++,*  -r&   