
                            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 ej                   ej                  ej                   j"                         G d dej$                                      Zej                   ej                  ej                   j(                         G d	 d
e                    Zej                   ej                  ej                   j,                         G d de                    Zy)z8Command for updating dedicated interconnect attachments.    )base_classes)client)base)flags)labels_utilc                   8    e Zd ZdZdZdZdZd Zed        Z	d Z
y)Update  Update a Compute Engine dedicated interconnect attachment.

  *{command}* is used to update interconnect attachments. An interconnect
  attachment is what binds the underlying connectivity of an interconnect to a
  path into and out of the customer's cloud network.
  Nc                    t        j                  | j                               }| j                  j	                  ||j
                  t        j                  |j                              }t        j                  ||j                        S )N)scope_lister)compute_client)
r   ComputeApiHolderReleaseTrackINTERCONNECT_ATTACHMENT_ARGResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   InterconnectAttachment)selfargsholderattachment_refs       Alib/surface/compute/interconnects/attachments/dedicated/update.py_get_attachmentzUpdate._get_attachment&   st    **4+<+<+>?F55GG"88G H IN ((v}}6 6    c                    t        j                         | _        | j                  j                  |d       t        j                  |       t        j
                  |d       t        j                  |d| j                                t        j                  |       t        j                  |       t        j                  |       t        j                  |       t        j                  |       y )Npatch)operation_typeTupdateF)requiredrelease_track)attachment_flagsInterconnectAttachmentArgumentr   AddArgumentAddDescriptionAddAdminEnabledAddBandwidthr   AddMtuAddStackTypeAddCandidateIpv6SubnetsAddCloudRouterIpv6InterfaceId AddCustomerRouterIpv6InterfaceId)clsparsers     r   ArgszUpdate.Args/   s     	779 ###//w/O##F+$$VD9!!c.>.>.@ F#!!&),,V4226:55f=r   c                 0   | j                  |      }t        j                  |      }|j                  |j                  |t        |dd       t        |dd       t        |dd       t        |dd       t        |dd       t        |dd       t        |dd       	      S )	N	bandwidthmtu
stack_typecandidate_ipv6_subnetscloud_router_ipv6_interface_id!customer_router_ipv6_interface_idenable_multicast)	descriptionadmin_enabledr3   r4   r5   r6   r7   r8   multicast_enabled)r   r$   GetAdminEnabledFlagPatchr:   getattr)r   r   interconnect_attachmentr;   s       r   Runz
Update.Run@   s    "2248$88>M"(($$#$T2D%&4t4&t-EtL'.2D(
 +25t+
 "$(:DA )  r   )__name__
__module____qualname____doc__r   INTERCONNECT_ARG
ROUTER_ARGr   classmethodr1   rA    r   r   r	   r	      s8     !%*6 > > r   r	   c                   2     e Zd ZdZe fd       Zd Z xZS )
UpdateBetar
   c                     t         t        |   |       t        j                  |       t        j                  |       t        j                  |       y )N)superrK   r1   r   AddUpdateLabelsFlagsr$   "AddCandidateCloudRouterIpv6Address%AddCandidateCustomerRouterIpv6Addressr/   r0   	__class__s     r   r1   zUpdateBeta.Args^   s<    	*c'$$V,77?::6Br   c                 J   t        j                  | j                               }| j                  |      }d }d }t        j
                  j                  |      }|j                         rs|j                         }|j                  j                  j                  j                  }|j                  ||j                        j                         }||j                   }t#        j$                  |      }	|j'                  |j(                  |	||t+        |dd       t+        |dd       t+        |dd       t+        |dd       t+        |dd       t+        |dd       t+        |dd       t+        |d	d       t+        |d
d       | j                         t,        j                  j.                  k(        S )N)labelsr3   r4   r5   r6   r7   r8   r9   #candidate_cloud_router_ipv6_address&candidate_customer_router_ipv6_address)r:   r;   rT   label_fingerprintr3   r4   r5   r6   r7   r8   r<   rU   rV   supports_400g)r   r   r   r   r   DiffFromUpdateArgsMayHaveUpdatesDescriber   messagesr   LabelsValueApplyrT   	GetOrNonelabelFingerprintr$   r=   r>   r:   r?   r   ALPHA)
r   r   r   r@   rT   rW   labels_diffold_attachment
labels_clsr;   s
             r   rA   zUpdateBeta.Rune   s   **4+<+<+>?F"2248F""11$7K!!#.779n==))@@LLj  
^22 ! 44=IK 		*;;$88>M"(($$#+$T2D%&4t4&t-EtL'.2D(
 +25t+
 "$(:DA,37-
 07:D0
 '')T->->-D-DD- )  r   )rB   rC   rD   rE   rH   r1   rA   __classcell__rR   s   @r   rK   rK   T   s#     C C'r   rK   c                   ,     e Zd ZdZe fd       Z xZS )UpdateAlphar
   c                 Z    t         t        |   |       t        j                  |d       y )NTr    )rM   ri   r1   r$   AddEnableMulticastrQ   s     r   r1   zUpdateAlpha.Args   s"    	+s (''t<r   )rB   rC   rD   rE   rH   r1   rf   rg   s   @r   ri   ri      s     = =r   ri   N)rE   googlecloudsdk.api_lib.computer   8googlecloudsdk.api_lib.compute.interconnects.attachmentsr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   r   <googlecloudsdk.command_lib.compute.interconnects.attachmentsr$   $googlecloudsdk.command_lib.util.argsr   UniverseCompatibleReleaseTracksr   GAUpdateCommandr	   BETArK   rb   ri   rI   r   r   <module>rw      s    ? 7 K ( E b < D%%(()6T 6 * 6r D%%**+6 6 , 6r D%%++,=* = - =r   