
    "                     B    d Z ddlmZ ddlmZ ddlmZ  G d de      Zy)zWire Group.    )absolute_import)division)unicode_literalsc                       e Zd ZdZ	 	 ddZed        Zed        Z	 	 	 	 	 	 	 	 	 ddZ	 	 	 	 	 	 	 	 	 	 	 ddZ	d Z
d	 Z	 	 	 	 	 	 	 	 	 	 dd
ZddZddZddZy)	WireGroupzAbstracts Wire Group resource.Nc                 J    || _         || _        || _        || _        || _        y N)refprojectcross_site_network_compute_client
_resources)selfr
   r   r   compute_client	resourcess         Flib/googlecloudsdk/api_lib/compute/interconnects/wire_groups/client.py__init__zWireGroup.__init__   s)     DHDL0D)DDO    c                 .    | j                   j                  S r	   )r   apitools_clientr   s    r   _clientzWireGroup._client(   s    ///r   c                 .    | j                   j                  S r	   )r   messagesr   s    r   	_messageszWireGroup._messages,   s    (((r   c
           
         | j                   }
|
j                  | j                  j                         ||
j	                  ||r|
j                  j                  |      nd      |      }|r0|
j                  |
j                  j                  |            |_        |r||j                  _
        |r*|
j                  j                  |      |j                  _        |r*|
j                  j                  |      |j                  _        | j                  j                   d|
j#                  | j$                  | j&                  ||	      fS )a  Make a tuple for wire group insert request.

    Args:
      description: String that represents the description of the Cloud
        Wire Group resource.
      wire_group_type: type of the wire group.
      bandwidth_unmetered: amount of unmetered bandwidth for the wire group.
      bandwidth_metered: amount of metered bandwidth for the wire group.
      fault_response: fault response for the wire group.
      admin_enabled: set admin_enabled on the wire group.
      network_service_class: the network service class of the wire group.
      bandwidth_allocation: the bandwidth allocation for the wire group.
      validate_only: only validates the configuration, but doesn't create it.

    Returns:
    Insert wire group tuple that can be used in a request.
    NbandwidthUnmeteredfaultResponse)namedescriptionwirePropertiesadminEnabledtypeInsert)r   crossSiteNetwork	wireGroupvalidateOnly)r   r   r
   NameWirePropertiesFaultResponseValueValuesEnumWireGroupPropertiesTypeValueValuesEnumwireGroupPropertiesr"   bandwidthMetered"NetworkServiceClassValueValuesEnumnetworkServiceClass"BandwidthAllocationValueValuesEnumbandwidthAllocationr   
wireGroupsComputeWireGroupsInsertRequestr   r   )r   r!   wire_group_typebandwidth_unmeteredbandwidth_meteredfault_responseadmin_enablednetwork_service_classbandwidth_allocationvalidate_onlyr   
wire_groups               r   _MakeCreateRequestTuplez!WireGroup._MakeCreateRequestTuple0   sM   : ~~H##XX]]_..2   #11NN%)	 / 
 # $ 
J '/'C'C++?? (D (j$ 3Dj0

!
!
D
D# 3
 

!
!
D
D" 3 	//LL!44 &	 	0 	
	 	r   c                 
   | j                   }|g }||j                  d       ||j                  d       ||j                  d       ||j                  d       ||j                  d       ||j                  d       ||j                  d       ||j                  d	       |	|j                  d
       |j                  ||j                  ||r|j                  j	                  |      nd      ||	      }|r0|j                  |j
                  j                  |            |_        |r||j                  _	        |r*|j                  j                  |      |j                  _        |r*|j                  j                  |      |j                  _        | j                  j                  d|j!                  | j"                  | j$                  | j&                  j)                         ||
dj+                  |            fS )z*Make a tuple for wire group patch request.Nr!   zwireGroupProperties.typez!wireProperties.bandwidthUnmeteredzwireProperties.bandwidthMeteredz"wireProperties.networkServiceClassz"wireProperties.bandwidthAllocationzwireProperties.faultResponser#   	endpointsr   )r!   r"   r#   rB   r$   Patch,)r   r'   r(   wireGroupResourcer)   
updateMask)r   appendr   r+   r,   r-   r.   r/   r"   r0   r1   r2   r3   r4   r   r5   ComputeWireGroupsPatchRequestr   r   r
   r*   join)r   r!   r7   r8   r9   r:   r;   r<   r=   rB   r>   update_maskr   r?   s                 r   _MakePatchRequestTuplez WireGroup._MakePatchRequestTuple}   s!    ~~Hk'"34&<=$:;(=>'=>!78 (%##..2   #11NN%)	 / 
 # $ 
J '/'C'C++?? (D (j$ 3Dj0

!
!
D
D# 3
 

!
!
D
D" 3 	..LL!44hhmmo(&xx, 	/ 	
 r   c                     | j                   j                  d| j                  j                  | j                  | j
                  | j                  j                               fS )NDeleter   r'   r(   )r   r5   r   ComputeWireGroupsDeleteRequestr   r   r
   r*   r   s    r   _MakeDeleteRequestTuplez!WireGroup._MakeDeleteRequestTuple   sP    55LL!44hhmmo 	6 	
 r   c                     | j                   j                  d| j                  j                  | j                  j
                  | j                  | j                  j                               fS )NGetrN   )r   r5   r   ComputeWireGroupsGetRequestr
   r   r   r*   r   s    r   _MakeDescribeRequestTuplez#WireGroup._MakeDescribeRequestTuple   sV    22HH$$!44hhmmo 	3 	
 r   c                 ~    | j                  |||||||||		      g}|
s | j                  j                  |      }|d   S |S )zCreate a wire group.r   )r@   r   MakeRequests)r   r!   r7   r8   r9   r:   r;   r<   r=   r>   only_generate_requestrequestsr   s                r   CreatezWireGroup.Create   s^     	$$! 
	
H !&&33H=iq\Or   c                 p     | j                   di |g}|s | j                  j                  |      }|d   S |S )z"Patch description of a wire group.r    )rK   r   rV   )r   rW   kwargsrX   r   s        r   rC   zWireGroup.Patch
  sB    +++5f56H &&33H=iq\Or   c                 b    | j                         g}|s| j                  j                  |      S |S r	   )rP   r   rV   )r   rW   rX   s      r   rM   zWireGroup.Delete  s2    ,,./H !!..x88Or   c                 l    | j                         g}|s | j                  j                  |      }|d   S |S )Nr   )rT   r   rV   )r   rW   rX   r   s       r   DescribezWireGroup.Describe  s;    ..01H &&33H=iq\Or   )NN)	NNNNNNNNN)NNNNNNNNNNN)
 NNNNNNNNF)F)__name__
__module____qualname____doc__r   propertyr   r   r@   rK   rP   rT   rY   rC   rM   r_   r[   r   r   r   r      s    &   0 0 ) )
  K^  Un		  !@r   r   N)rd   
__future__r   r   r   objectr   r[   r   r   <module>rh      s#     '  'F Fr   