
                            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 e
j$                   e
j&                  e
j(                  j*                         G d
 de
j,                                      Zy)zvCommand for adding member interconnects to an interconnect L2-forwarding attachment innner vlan to appliance mappings.    )absolute_import)division)unicode_literals)base_classes)client)base)flags)logc                   0    e Zd ZdZdZed        Zd Zd Zy)
AddMappingzAdd new vlan to ip mapping rule to an L2-forwarding attachment.

  *{command}* add new vlan to ip mapping rule to an L2-forwarding attachment.
  Nc                    t        j                         | _        | j                  j                  |d       t        j                  |d       t        j
                  |       t        j                  |       t        j                  |       y )Npatch)operation_typeT)required)attachment_flagsInterconnectAttachmentArgumentINTERCONNECT_ATTACHMENT_ARGAddArgument
AddVlanKeyAddApplianceIpAddressAddApplianceNameAddInnerVlanToApplianceMappings)clsparsers     Jlib/surface/compute/interconnects/attachments/l2_forwarding/add_mapping.pyArgszAddMapping.Args(   sk     	779 ###//w/O6**62%%f-44V<    c           
      @   t        j                  | j                               }| j                  j	                  ||j
                  t        j                  |j                              }t        j                  ||j                        }|j                  |j                        }|r9t        j                  j                  dj                  |j                               y |j!                  |j                  t#        |dd       t#        |dd       t#        |dd             S )N)scope_lister)compute_clientz'Mapping with vlan key {} already existsappliance_nameappliance_ip_address inner_vlan_to_appliance_mappings)vlan_keyr!   r"   r#   )r   ComputeApiHolderReleaseTrackr   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   InterconnectAttachmentDescribeMappingr$   r
   statusPrintformatUpdateMappinggetattr)selfargsholderattachment_refinterconnect_attachmentold_mappings         r   _RunzAddMapping._Run2   s    **4+<+<+>?F55GG"88G H IN
 %;;v}}6 *99$--HK	jj
3
:
:4==
I "00t%5t<$T+A4H)04d*
	 1  r   c                 $    | j                  |      S )zSee base.CreateCommand.)r8   )r2   r3   s     r   RunzAddMapping.RunL   s    99T?r   )	__name__
__module____qualname____doc__r   classmethodr   r8   r:    r   r   r   r      s+    
 !%= =4r   r   N)r>   
__future__r   r   r   googlecloudsdk.api_lib.computer   8googlecloudsdk.api_lib.compute.interconnects.attachmentsr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   r)   <googlecloudsdk.command_lib.compute.interconnects.attachmentsr   googlecloudsdk.corer
   DefaultUniverseOnlyReleaseTracksr&   ALPHAUpdateCommandr   r@   r   r   <module>rL      sn     } &  ' 7 K ( E b # D%%++,.## . - .r   