
    9                     j    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 Z G d	 d
      Zy)z)Cloud Datastream private connections API.    )absolute_import)division)unicode_literals)util)base)	resourcesc                 x    t         j                  j                  | j                  d      }|j	                         S )Nz0datastream.projects.locations.privateConnections)
collection)r   REGISTRYParseRelativeNamenameSelfLink)resourceprivate_connections     <lib/googlecloudsdk/api_lib/datastream/private_connections.pyGetPrivateConnectionURIr      s:     ));;mmC < E 
	$	$	&&    c                   &    e Zd ZdZddZd ZddZy)PrivateConnectionsClientz2Client for private connections service in the API.Nc                     |xs t        j                         | _        |xs t        j                         | _        | j                  j
                  | _        t        j                         | _        y N)	r   GetClientInstance_clientGetMessagesModule	_messages%projects_locations_privateConnections_serviceGetResourceParser_resource_parser)selfclientmessagess      r   __init__z!PrivateConnectionsClient.__init__$   sN    5T335DL9!7!7!9DNLLFFDM 224Dr   c                     | j                   j                  |i |j                        }t        |d      r9|j                  r-| j                   j                  |j                        |_        |S |t        j                  j                  k(  r%|j                  j                  j                         }n$|j                  j                  j                         }| j                   j                  |j                         |j                         |_        |S )z$Returns a private connection object.)r   labelsdisplayNamenetwork_attachment)networkAttachment)vpcsubnet)r   PrivateConnectiondisplay_namehasattrr'   PscInterfaceConfigpscInterfaceConfigr   ReleaseTrackBETACONCEPTSvpc_nameParser)   VpcPeeringConfigRelativeNamer*   vpcPeeringConfig)r    private_connection_idrelease_trackargsprivate_connection_objvpc_peering_refs         r   _GetPrivateConnectionz.PrivateConnectionsClient._GetPrivateConnection*   s    !^^=="24;L;L > N t)*t/F/F
..
+
+ $ 7 7 ,  /  "! 
$++00	0--00668--++113040O0O**,T[[ 1P 1- "!r   c                     | j                  |||      }t        j                         }| j                  j                  } |||j
                  |||j                        }| j                  j                  |      S )a  Creates a private connection.

    Args:
      parent_ref: a Resource reference to a parent datastream.projects.locations
        resource for this private connection.
      private_connection_id: str, the name of the resource to create.
      release_track: Some arguments are added based on the command release
        track.
      args: argparse.Namespace, The arguments that this command was invoked
        with.

    Returns:
      Operation: the operation for creating the private connection.
    )privateConnectionprivateConnectionIdparent	requestIdvalidateOnly)	r=   r   GenerateRequestIdr   :DatastreamProjectsLocationsPrivateConnectionsCreateRequestr   validate_onlyr   Create)	r    
parent_refr8   r9   r:   r   
request_idcreate_req_type
create_reqs	            r   rG   zPrivateConnectionsClient.CreateB   s~      334I4A4I '')JQQ  !,.33''J ==
++r   )NNr   )__name__
__module____qualname____doc__r#   r=   rG    r   r   r   r   !   s    :5"0,r   r   N)rO   
__future__r   r   r   !googlecloudsdk.api_lib.datastreamr   googlecloudsdk.callioper   googlecloudsdk.corer   r   r   rP   r   r   <module>rU      s-    0 &  ' 2 ( )'@, @,r   