
                             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  G d	 d
ej                        Zy)z(Google Cloud Private Connections client.    )absolute_import)division)unicode_literals)
list_pager)util)NetworksClient)	arg_utilsc                   X     e Zd ZdZ fdZd Z	 	 	 d
dZddZd Zd Z	ddZ
d	 Z xZS )PrivateConnectionsClientzPrivate Connections client.c                 ~    t         t        |           | j                  j                  | _        t               | _        y N)superr   __init__client%projects_locations_privateConnectionsservicer   networks_client)self	__class__s    7lib/googlecloudsdk/api_lib/vmware/privateconnections.pyr   z!PrivateConnectionsClient.__init__   s-    	
"D24;;DDDL)+D    c                     | j                   j                  |j                               }| j                  j	                  |      }|S N)name)messages9VmwareengineProjectsLocationsPrivateConnectionsGetRequestRelativeNamer   Get)r   resourcerequestresponses       r   r   zPrivateConnectionsClient.Get#   sA    mmUU""$ V &G||(HOr   c                    |j                         j                         }|j                         j                         j                         }	|j                         }
| j                  j	                  |      }|| j                  |      |_        | j                  j                  |	|      }|j                  |_
        t        j                  d| j                  j                  j                  d       j                  t        j                  |            }||_        | j#                  ||      }dj%                  ||      |_        | j                  j)                  |||
      }| j*                  j-                  |      S )N)descriptiontypec                 
    d| vS )NTYPE_UNSPECIFIED xs    r   <lambda>z1PrivateConnectionsClient.Create.<locals>.<lambda>=   s
    !31!<r   arg_namemessage_enuminclude_filterz/projects/{project}/global/networks/{network_id})project
network_id)parentprivateConnectionprivateConnectionId)Parentr   Namer   PrivateConnectionGetRoutingModeroutingModer   GetByIDr   vmwareEngineNetworkr	   ChoiceEnumMapperTypeValueValuesEnumGetEnumForChoiceEnumNameToChoicer$   GetServiceNetworkformatserviceNetwork<VmwareengineProjectsLocationsPrivateConnectionsCreateRequestr   Create)r   r   vmware_engine_networkservice_projectprivate_connection_typerouting_moder#   service_networkr1   r/   private_connection_idprivate_connectionven	type_enumr    s                  r   rC   zPrivateConnectionsClient.Create)   s`    __++-Foo&&(--/G$MMO88 9 !'+':':<'H$



&
&w0E
FC-0XX***]]44HH<> ?O>N&&'>??A 
 (,,YHO(Y(`(`O )a )=%mmXX,1 Y 3G <<w''r   c                 Z   | j                  |      }g }|||_        |j                  d       |'| j                  |      |_        |j                  d       | j
                  j                  ||j                         dj                  |            }| j                  j                  |      S )Nr#   rG   ,)r2   r   
updateMask)r   r#   appendr7   r8   r   ;VmwareengineProjectsLocationsPrivateConnectionsPatchRequestr   joinr   Patch)r   r   r#   rG   rJ   update_maskr    s          r   UpdatezPrivateConnectionsClient.UpdateI   s    (+K'2$''+':':<'H$(mmWW,""$88K( X *G <<g&&r   c                     | j                   j                  |j                               }| j                  j	                  |      S r   )r   <VmwareengineProjectsLocationsPrivateConnectionsDeleteRequestr   r   Delete)r   r   r    s      r   rX   zPrivateConnectionsClient.DeleteX   s=    mmXX""$ Y &G<<w''r   c                     |j                         }| j                  j                  |      }t        j                  | j
                  |dd      S )N)r1   privateConnectionspageSize)fieldbatch_size_attribute)r   r   :VmwareengineProjectsLocationsPrivateConnectionsListRequestr   YieldFromListr   )r   location_resourcelocationr    s       r   ListzPrivateConnectionsClient.List]   sP     --/HmmVV W G##"'	) )r   c                     |r|S || j                   j                  j                  j                  k(  ry|| j                   j                  j                  j                  k(  ry|| j                   j                  j                  j
                  k(  ryy )Nservicenetworkingzdell-tenant-vpcznetapp-tenant-vpc)r   r6   r<   PRIVATE_SERVICE_ACCESSDELL_POWERSCALENETAPP_CLOUD_VOLUMES)r   rL   rH   s      r   r?   z*PrivateConnectionsClient.GetServiceNetworkg   st    DMM33GG^^^ DMM33GGWWWDMM33GG\\\  ]r   c                     t        j                  d| j                  j                  j                  d       j                  t        j                  |            }|S )NrG   c                 
    d| vS )NROUTING_MODE_UNSPECIFIEDr'   r(   s    r   r*   z9PrivateConnectionsClient.GetRoutingMode.<locals>.<lambda>u   s
    !;1!Dr   r+   )r	   r;   r   r6   RoutingModeValueValuesEnumr=   r>   )r   rG   routing_mode_enums      r   r7   z'PrivateConnectionsClient.GetRoutingModeq   sN    !22]]44OOD y11,?@	 
 r   )NNN)NNr   )__name__
__module____qualname____doc__r   r   rC   rU   rX   rb   r?   r7   __classcell__)r   s   @r   r   r      s:    #,
 !(@'(
)!r   r   N)rp   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.vmwarer   &googlecloudsdk.api_lib.vmware.networksr   $googlecloudsdk.command_lib.util.apisr	   VmwareClientBaser   r'   r   r   <module>rx      s3    / &  ' ' . A :\t44 \r   