
                            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 dZej(                   ej*                  ej,                  j.                         G d	 d
ej0                                      Zej(                   ej*                  ej,                  j4                         G d de                    Zej(                   ej*                  ej,                  j8                         G d de                    Zy)z8Command for creating dedicated interconnect attachments.    )base_classes)client)base)parser_errors)flags)logzUhttps://cloud.google.com/interconnect/docs/how-to/dedicated/creating-vlan-attachmentsc                   >    e Zd ZdZdZdZdZed        Zd Z	d Z
d Zy)Create  Create a Compute Engine dedicated interconnect attachment.

  *{command}* is used to create a dedicated 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                  d      | _        | j                  j                  |       t	        j
                         | _        | j                  j                  |       t        j                         | _	        | j                  j                  |d       t        j                  |       t        j                  |d       t        j                  |       t        j                  |       t        j                  |d| j                                t        j                   |       t        j"                  |       t        j$                         j'                  |       t        j(                  |       t        j*                  |       t        j,                  |       t        j.                  |       t        j0                  |       y )Nz0The interconnect for the interconnect attachmentcreate)operation_typeT)default_behaviorF)requiredrelease_track)interconnect_flags$InterconnectArgumentForOtherResourceINTERCONNECT_ARGAddArgumentrouter_flagsRouterArgumentForOtherResources
ROUTER_ARGattachment_flagsInterconnectAttachmentArgumentINTERCONNECT_ATTACHMENT_ARGAddDescriptionAddAdminEnabledAddVlanAddCandidateSubnetsAddBandwidthReleaseTrackAddMtuAddEncryptionGetIpsecInternalAddressesFlagAddToParserAddStackTypeAddCandidateIpv6SubnetsAddCloudRouterIpv6InterfaceId AddCustomerRouterIpv6InterfaceIdAddSubnetLength)clsparsers     Alib/surface/compute/interconnects/attachments/dedicated/create.pyArgszCreate.Args+   sX    	??>	@  $$V,!AACCNNNv& 	779 ###//x/P##F+$$VdCV$((0!!c.>.>.@ F#""6*224@@H!!&),,V4226:55f=$$V,    c                    t        j                  | j                               }| j                  j	                  ||j
                  t        j                  |j                              }t        j                  ||j                        }d }|j                  &| j                  j	                  ||j
                        }|j                  |j                  |_        |j                  |j                  k7  rt        j                  d      d }|j                   &| j"                  j	                  ||j
                        }t%        j&                  |      }d }|j                  }	|j(                  Q|j(                  D 
cg c]<  }
t%        j*                  |j
                  |
|	|j,                        j/                         > }}
|j1                  |j2                  |d||j4                  ||j6                  t9        |dd       t9        |dd       t9        |dd       t9        |dd       |t9        |d	d       |j:                  t9        |d
d       t9        |dd       t9        |dd       t9        |dd       t9        |dd       t9        |dd       t9        |dd       t9        |dd       | j                         t<        j                  j>                  k(        S c c}
w )N)scope_lister)compute_clientz4router-region must be same as the attachment region.	DEDICATED	bandwidthdry_runmtu
encryption
stack_typecloud_router_ipv6_interface_id!customer_router_ipv6_interface_idsubnet_lengthenable_multicast!candidate_cloud_router_ip_address$candidate_customer_router_ip_address#candidate_cloud_router_ipv6_address&candidate_customer_router_ipv6_address)descriptioninterconnectattachment_typeroutervlan_tag_802_1qadmin_enabledcandidate_subnetsr4   validate_onlyr6   r7   ipsec_internal_addressesr8   candidate_ipv6_subnetsr9   r:   r;   multicast_enabledr=   r>   r?   r@   supports_400g) r   ComputeApiHolderr!   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   InterconnectAttachmentrB   r   router_regionregionr   ArgumentExceptionrD   r   r   GetAdminEnabledFlagrI   GetAddressRefprojectSelfLinkr
   rA   vlanrG   getattrrJ   r   ALPHA)selfargsholderattachment_refinterconnect_attachmentinterconnect_ref
router_refrF   ipsec_internal_addresses_urlsrT   names              r-   _RunzCreate._RunH   s   **4+<+<+>?F55GG"88G H IN
 %;;v}}6 $..@@
  " !)00d^222++
@B B J{{??44T6;K;KLj$88>M$(!""F$$0
 33	' 4d 
(
(fn.D.DHJ 4	 $ ' #))$$%#		#00$T2dIt4D%&4t4!>4t4#::'.2D(
 +25t+
 dOT:!$(:DA*15t+
 .58$.
 -47-
 07:D0
 '')T->->-D-DDG * $ $'s   :AKc                 l    dj                  t              }t        j                  j	                  |       y )NzYou must configure your Cloud Router with an interface and BGP peer for your created VLAN attachment. See also {} for more detailed help.)format_DOCUMENTATION_LINKr   statusPrint)r]   resources_were_displayedmessages      r-   EpilogzCreate.Epilog   s+    %%+V,?%@  JJWr/   c                 $    | j                  |      S zSee base.CreateCommand.rf   r]   r^   s     r-   Runz
Create.Run       99T?r/   )__name__
__module____qualname____doc__r   r   r   classmethodr.   rf   rn   rs    r/   r-   r
   r
      s=     !%*- -8JXr/   r
   c                   2     e Zd ZdZe fd       Zd Z xZS )
CreateBetar   c                     t         t        |   |       t        j                  |       t        j
                  |       t        j                  |       t        j                  |       y N)superr|   r.   r    AddCandidateCloudRouterIpAddress#AddCandidateCustomerRouterIpAddress"AddCandidateCloudRouterIpv6Address%AddCandidateCustomerRouterIpv6Addressr+   r,   	__class__s     r-   r.   zCreateBeta.Args   sJ    	*c'55f=88@77?::6Br/   c                 $    | j                  |      S rp   rq   rr   s     r-   rs   zCreateBeta.Run   rt   r/   ru   rv   rw   rx   ry   r.   rs   __classcell__r   s   @r-   r|   r|      s#     C Cr/   r|   c                   2     e Zd ZdZe fd       Zd Z xZS )CreateAlphar   c                     t         t        |   |       t        j                  |       t        j
                  |       y r~   )r   r   r.   r   AddEnableMulticast	AddDryRunr   s     r-   r.   zCreateAlpha.Args   s.    	+s (''/v&r/   c                 $    | j                  |      S rp   rq   rr   s     r-   rs   zCreateAlpha.Run   rt   r/   r   r   s   @r-   r   r      s!     ' '
r/   r   N)rx   googlecloudsdk.api_lib.computer   8googlecloudsdk.api_lib.compute.interconnects.attachmentsr   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer   rP   0googlecloudsdk.command_lib.compute.interconnectsr   <googlecloudsdk.command_lib.compute.interconnects.attachmentsr   *googlecloudsdk.command_lib.compute.routersr   googlecloudsdk.corer   ri   UniverseCompatibleReleaseTracksr!   GACreateCommandr
   BETAr|   r\   r   rz   r/   r-   <module>r      s    ? 7 K ( 1 E X b L #m  D%%(()|T | * |~ D%%**+  , * D%%++,*  - r/   