
    ~                         d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm	Z	 ddl
mZ dd	lmZ d
ddZ e	j                  e	j                   j"                         G d de	j$                               Zee_        y)zCreate attachment command.    )absolute_import)division)unicode_literalsN)attachment_api)base)attachment_flags)labels_utila?  
          Create a firewall attachment. Successful creation of an attachment results
          in an attachment in READY state. Check the progress of attachment creation
          by using `gcloud network-security firewall-attachments list`.

          For more examples, refer to the EXAMPLES section below.

        a?  
            To create a firewall attachment called `my-attachment`, in zone
            `us-central1-a` and project my-proj, run:

            $ {command} my-attachment --zone=us-central1-a --project=my-proj
            --producer-forwarding-rule=projects/my-proj/locations/us-central1-a/forwardingRule/my-fw

        )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)CreatezCreate a Firewall attachment.c                 J   t        j                  | j                         |       t        j                  |d       t        j                  |       t
        j                  j                  |       t
        j                  j                  |d       t        j                  |       y )N60mT)r   AddAttachmentResourceReleaseTrack
AddMaxWaitAddProducerForwardingRuleArgr   
ASYNC_FLAGAddToParser
SetDefaultr	   AddCreateLabelsFlags)clsparsers     ;lib/surface/network_security/firewall_attachments/create.pyArgszCreate.Args4   sm    **3+;+;+=vF.11&9OO'OOvt,$$V,    c                    t        j                  | j                               }|j                  j                  j                         }t        j                  ||j                  j                  j                        }|j                  }t        j                  |j                        }|j                  |j!                         |j#                         j%                         t'        |d      |      }|r|j)                  d      sd|_        |S |j-                  |j/                  |      dj+                  |j%                               d|      S )	N)secondsproducer_forwarding_rule)attachment_idparentproducer_forwarding_rule_namelabelsformatdefaultz2waiting for firewall attachment [{}] to be createdT)operation_refmessage
has_resultmax_wait)r   Clientr   CONCEPTSfirewall_attachmentParser	   ParseCreateArgsmessagesFirewallAttachmentLabelsValueasync_datetime	timedeltar)   CreateAttachmentNameParentRelativeNamegetattrIsSpecifiedr$   WaitForOperationGetOperationRef)selfargsclient
attachmentr#   is_asyncr)   	operations           r   Runz
Create.Run=   s   ""4#4#4#67F2288:J((foo00<<F {{H!!$--8H'' oo'  "//1&-d4N&O	 ( I  h'"",,Y7@VJ++-. #  r   N)__name__
__module____qualname____doc__classmethodr   rC    r   r   r   r   0   s    %- - r   r   )rG   
__future__r   r   r   r3   <googlecloudsdk.api_lib.network_security.firewall_attachmentsr   googlecloudsdk.callioper   +googlecloudsdk.command_lib.network_securityr   $googlecloudsdk.command_lib.util.argsr	   DETAILED_HELPReleaseTracksr   ALPHACreateCommandr   detailed_helprI   r   r   <module>rT      sx    ! &  '  W ( H <( D%%++,,T , -,^ % r   