
    '                     &   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 r\R                  " \R                  R                   \R                  R"                  \R                  R$                  5       " S S\R&                  5      5       rg	)
z)Command for creating network attachments.    )base_classes)base)flags)scopec                     U R                   S:X  a   UR                  R                  R                  $ U R                   S:X  a   UR                  R                  R                  $ g)z4Get connection preference of the network attachment.ACCEPT_AUTOMATICACCEPT_MANUALN)connection_preferenceNetworkAttachment#ConnectionPreferenceValueValuesEnumr   r	   )argsmessagess     1lib/surface/compute/network_attachments/create.pyGetConnectionPreferencer      sR    	#55%%IIZZZ	?2%%IIWWW	    c                   B    \ rS rSrSrSSSS.rSrSr\S 5       r	S r
S	rg)
Create$   z2Create a Google Compute Engine network attachment.a
        *{command}* is used to create network attachments. A service consumer
      creates network attachments and makes it available to producers.
      Service producers then use a multi-NIC VM to form a bi-directional,
      non-NAT'd communication channel.
      a  
        $ {command} NETWORK_ATTACHMENT_NAME --region=us-central1 --subnets=MY_SUBNET --connection-preference=ACCEPT_MANUAL --producer-accept-list=PROJECT1,PROJECT2 --producer-reject-list=PROJECT3,PROJECT4

      To create a network attachment with a textual description, run:

        $ {command} NETWORK_ATTACHMENT_NAME --region=us-central1 --subnets=MY_SUBNET --connection-preference=ACCEPT_MANUAL --producer-accept-list=PROJECT1,PROJECT2 --producer-reject-list=PROJECT3,PROJECT4 --description='default network attachment'

      )briefDESCRIPTIONEXAMPLESNc                 *   [         R                  " 5       U l        U R                  R                  USS9  [        R
                  " 5       U l        U R                  R                  U5        UR                  R                  [         R                  5        UR                  R                  [         R                  5        [         R                  " U5        [         R                  " U5        [         R                  " U5        [         R                  " U5        g)ztCreate a Google Compute Engine network attachment.

Args:
  parser: the parser that parses the input from the user.
create)operation_typeN)r   NetworkAttachmentArgumentNETWORK_ATTACHMENT_ARGAddArgumentsubnetwork_flags&SubnetworkArgumentForNetworkAttachmentSUBNETWORK_ARGdisplay_info	AddFormatDEFAULT_LIST_FORMATAddCacheUpdaterNetworkAttachmentsCompleterAddDescriptionAddConnectionPreferenceAddProducerRejectListAddProducerAcceptList)clsparsers     r   ArgsCreate.Args@   s     "'!@!@!BC**6(*K)PP C""6*
!!%";";<
''(I(IJ	 	!!&)	'	'r   c                    [         R                  " U R                  5       5      nUR                  nU R                  R                  XR                  [        R                  R                  S9nU R                  R                  UUR                  [        R                  R                  [        R                  " U5      S9nU Vs/ s H  ofR                  5       PM     nnUR                  R                  UR                   UR#                  5       [%        XR                  5      US9nUR'                  S5      (       a  UR(                  Ul        UR'                  S5      (       a  UR,                  Ul        UR                  R1                  UR2                  UR4                  US9n	UR6                  R8                  n
UR;                  U
SU	4/5      $ s  snf )z*Issue a network attachment INSERT request.)default_scope)r/   scope_lister)descriptionnameconnectionPreferencesubnetworksproducer_reject_listproducer_accept_list)projectregionnetworkAttachmentInsert)r   ComputeApiHolderReleaseTrackclientr   ResolveAsResource	resourcescompute_scope	ScopeEnumREGIONr    compute_flagsGetDefaultScopeListerSelfLinkr   r   r1   Namer   IsSpecifiedr5   producerRejectListsr6   producerAcceptLists&ComputeNetworkAttachmentsInsertRequestr7   r8   apitools_clientnetworkAttachmentsMakeRequests)selfr   holderr=   network_attachment_refsubnetwork_refssubnetwork_refr4   network_attachmentrequest
collections              r   Run
Create.RunU   s   **4+<+<+>?F]]F!88JJm.E.E.L.L K N));;#--44"88@	 < BO 9H8Gn!    ::$$#((*4T??K	 ; ! .///3/H/H,.///3/H/H,ooDD&..%,,, E .G ''::JXw ?@AA)s   G )__name__
__module____qualname____firstlineno____doc__detailed_helpr   r    classmethodr,   rV   __static_attributes__rX   r   r   r   r   $   sC     ; D

-&  .( ((Br   r   N)r]   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   rC   r   r@   6googlecloudsdk.command_lib.compute.network_attachments3googlecloudsdk.command_lib.compute.networks.subnetsr   r   ReleaseTracksr<   ALPHABETAGACreateCommandr   rX   r   r   <module>rk      s    0 8 ( E E H Y T..33T5F5F5I5IMBT MBMBr   