
                            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)zxCommand for updating 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)UpdateMappingzUpdate vlan to ip mapping rule to an L2-forwarding attachment.

  *{command}* update 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create)operation_typeT)required)attachment_flagsInterconnectAttachmentArgumentINTERCONNECT_ATTACHMENT_ARGAddArgument
AddVlanKeyAddApplianceIpAddressAddApplianceNameAddInnerVlanToApplianceMappings)clsparsers     Mlib/surface/compute/interconnects/attachments/l2_forwarding/update_mapping.pyArgszUpdateMapping.Args(   sk     	779 ###//x/P6**62%%f-44V<    c           
      @   t        j                  | j                               }| j                  j	                  ||j
                  t        j                  |j                              }t        j                  ||j                        }|j                  |j                        }|s9t        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 {} does not exist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formatr   getattr)selfargsholderattachment_refinterconnect_attachmentold_mappings         r   _RunzUpdateMapping._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.UpdateCommand.)r7   )r1   r2   s     r   RunzUpdateMapping.RunL   s    99T?r   )	__name__
__module____qualname____doc__r   classmethodr   r7   r9    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>rK      sn      &  ' 7 K ( E b # D%%++,.D&& . - .r   