
                             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	Zd
ZdZ G d de	j"                        ZddZd Zd Zd Zy)z:Flags and helpers for the compute firewall-rules commands.    )absolute_import)division)unicode_literals)arg_parsers)
completers)flags)	arg_utilsa  table(
                    name,
                    network,
                    direction,
                    priority,
                    sourceRanges.list():label=SRC_RANGES,
                    destinationRanges.list():label=DEST_RANGES,
                    allowed[].map().firewall_rule().list():label=ALLOW,
                    denied[].map().firewall_rule().list():label=DENY,
                    sourceTags.list():label=SRC_TAGS,
                    sourceServiceAccounts.list():label=SRC_SVC_ACCT,
                    targetTags.list():label=TARGET_TAGS,
                    targetServiceAccounts.list():label=TARGET_SVC_ACCT,
                    disabled
                )z    table(
      name,
      network.basename(),
      direction,
      priority,
      allowed[].map().firewall_rule().list():label=ALLOW,
      denied[].map().firewall_rule().list():label=DENY,
      disabled
    )zTo show all fields of the firewall, please show in JSON format: --format=json
To show all fields in table format, please see the examples in --help.
c                        e Zd Z fdZ xZS )FirewallsCompleterc                 2    t        t        | 
  dddd| y )Ncompute.firewallsz!compute firewall-rules list --uri)
collectionlist_command )superr   __init__)selfkwargs	__class__s     >lib/googlecloudsdk/command_lib/compute/firewall_rules/flags.pyr   zFirewallsCompleter.__init__?   s(    	
d, &8     )__name__
__module____qualname__r   __classcell__)r   s   @r   r   r   =   s     r   r   c                 >    t        j                  dt        || d      S )Nzfirewall ruler   )resource_name	completerpluralrequiredglobal_collection)compute_flagsResourceArgumentr   )r    r   s     r   FirewallRuleArgumentr$   F   s$    		'	'#"+
- -r   c                 H    | j                  dt        j                  d       y )Nz--enable-loggingaM        Enable logging for the firewall rule. Logs will be exported to
      StackDriver. Firewall logging is disabled by default. To enable logging
      for an existing rule, run:

        $ {command} MY-RULE --enable-logging

      To disable logging on an existing rule, run:

        $ {command} MY-RULE --no-enable-logging
      )actionhelp)add_argumentr   StoreTrueFalseAction)parsers    r   AddEnableLoggingr+   O   s&    --

  r   c                 b    t        j                  d| j                  j                  dddd      S )Nz--logging-metadatazinclude-allzexclude-all)INCLUDE_ALL_METADATAEXCLUDE_ALL_METADATAzyAdds or removes metadata fields to or from the reported firewall logs. Can only be specified if --enable-logging is true.)custom_mappingshelp_str)r	   ChoiceEnumMapperFirewallLogConfigMetadataValueValuesEnum)messagess    r   GetLoggingMetadataArgr5   `   s7    		#	#  88"/"/	
 	r   c                 L    t        |      j                  j                  |        y )N)r5   
choice_argAddToParser)r*   r4   s     r   AddLoggingMetadatar9   m   s    !,,88@r   N)TF)__doc__
__future__r   r   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   compute_completersr   r"   $googlecloudsdk.command_lib.util.apisr	   LIST_WITH_ALL_FIELDS_FORMATDEFAULT_LIST_FORMATLIST_NOTICEListCommandCompleterr   r$   r+   r5   r9   r   r   r   <module>rD      s_    A &  ' / O E : "		 +@@ -"
Ar   