
    3                        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d
lmZ ddlmZ dZdZdZe	j*                   e	j,                  e	j.                  j0                         G d de	j2                                      Z e	j6                  dd       e	j,                  e	j.                  j8                         G d de                    Zy)z2Command to create a datastream private connection.    )absolute_import)division)unicode_literals)private_connections)util)base)flags)resource_args)concept_parsers)presentation_specsz&Create a Datastream private connectiona      To create a privateConnection with VPC Peering called 'my-privateConnection', run:

        $ {command} my-privateConnection --location=us-central1 --display-name=my-privateConnection --vpc=vpc-example --subnet=10.0.0.0/29

    To create a privateConnection with PSC Interface called 'my-privateConnection', run:

        $ {command} my-privateConnection --location=us-central1 --display-name=my-privateConnection --network-attachment=network-attachment-example
   z    To create a privateConnection with VPC Peering called 'my-privateConnection', run:

        $ {command} my-privateConnection --location=us-central1 --display-name=my-privateConnection --vpc-name=vpc-example --subnet=10.0.0.0/29


   c                   @    e Zd ZdZeedZed        Zed        Z	d Z
y)Create'Create a Datastream private connection.DESCRIPTIONEXAMPLESc                    t        j                  | d       t        j                  |        t        j                  |        t        j                  |        | j                  dd      }|j                  d      }|j                  ddd       d	}|t        j                  j                  k(  rd
}t        j                  d|z  t        j                         dd      }t        j                   |g      j#                  |       |t        j                  j$                  k(  r(|j                  d      }t        j&                  |       yy)a/  Common arguments for all release tracks.

    Args:
      parser: An argparse parser that you can use to add arguments that go on
        the command line after this command. Positional arguments are allowed.
      release_track: Some arguments are added based on the command release
        track.
    z	to createT)mutexrequiredz(Arguments for VPC Peering configuration.)helpz--subnetz)A free subnet for peering. (CIDR of /29).)r   r   vpczvpc-namez--%sz,Resource ID of the VPC network to peer with.)r   z>Arguments for Private Service Connect Interface configuration.N)r
   AddPrivateConnectionResourceArgpc_flagsAddDisplayNameFlagAddValidateOnlyFlagr	   AddLabelsCreateFlags	add_groupadd_argumentr   ReleaseTrackBETAr   ResourcePresentationSpecGetVpcResourceSpecr   ConceptParserAddToParserGAAddNetworkAttachmentFlag)parserrelease_trackconfig_groupvpc_peering_groupvpc_field_namevpc_spec	psc_groups          4lib/surface/datastream/private_connections/create.py
CommonArgszCreate.CommonArgs8   s5    11&+F'  (	v&##$#>L$..7 /  ""< #  N))...!n!::((*6	H !!8*-99:KL )),,,((O ) i ''	2	 -    c                 `    t         j                  | t        j                  j                         yz@Args is called by calliope to gather arguments for this command.N)r   r/   r   r   r%   r'   s    r.   ArgszCreate.Argsg   s      fd//223r0   c                 N   |j                   j                  j                         }|j                         j	                         }t        j                         }|j                  ||j                  | j                         |      }t        j                         }t        j                         }t        j                         }|j                  d|j                  |j                  |j                         }	|j"                  j%                  |j'                  |	j(                              S )a  Create a Datastream private connection.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
        with.

    Returns:
      A dict object representing the operations resource describing the create
      operation if the create was successful.
    z(datastream.projects.locations.operations)operationsId
projectsIdlocationsId)name)CONCEPTSprivate_connectionParseParentRelativeNamer   PrivateConnectionsClientr   privateConnectionsIdr   r   GetClientInstanceGetMessagesModuleGetResourceParserr9   r7   r8   projects_locations_operationsGet/DatastreamProjectsLocationsOperationsGetRequestr6   )
selfargsprivate_connection_ref
parent_ref	pc_clientresult_operationclientmessagesresource_parseroperation_refs
             r.   Runz
Create.Runl   s    "]]==CCE'..0==?J#<<>I ''*??T# ##%F%%'H,,.O#**2%**)44*66	 + 8M //33@@++ 	A 	-. .r0   N)__name__
__module____qualname____doc__r   r   detailed_helpstaticmethodr/   r4   rQ    r0   r.   r   r   2   s=     0"-8D-,3 ,3\ 4 4.r0   r   FzpDatastream beta version is deprecated. Please use`gcloud datastream private-connections create` command instead.)
is_removedwarningc                   *    e Zd ZdZeedZed        Zy)
CreateBetar   r   c                 `    t         j                  | t        j                  j                         yr2   )r   r/   r   r   r    r3   s    r.   r4   zCreateBeta.Args   s      fd//445r0   N)	rR   rS   rT   rU   r   EXAMPLES_BETArV   rW   r4   rX   r0   r.   r\   r\      s#     0"-=I-6 6r0   r\   N)rU   
__future__r   r   r   !googlecloudsdk.api_lib.datastreamr   r   googlecloudsdk.callioper   %googlecloudsdk.command_lib.datastreamr	   r
   9googlecloudsdk.command_lib.datastream.private_connectionsr   (googlecloudsdk.command_lib.util.conceptsr   r   r   r   r^   DefaultUniverseOnlyReleaseTracksr   r%   Commandr   	Deprecater    r\   rX   r0   r.   <module>ri      s    9 &  ' A 2 ( 7 ? W D G 8 D%%(()W.T\\ W. * W.t G
 D%%**+6 6 ,6r0   