
    %                     J    d Z ddlmZ ddlmZ ddlmZ ddlZ G d de      Zy)zInterconnect.    )absolute_import)division)unicode_literalsNc                       e Zd ZdZddZed        Zd Zd Zd Z	d Z
d	 Zd
 Zed        Z	 	 	 	 	 	 	 	 	 	 	 	 ddZddZddZddZddZddZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)Interconnectz Abstracts Interconnect resource.Nc                      || _         || _        y N)ref_compute_client)selfr
   compute_clients      :lib/googlecloudsdk/api_lib/compute/interconnects/client.py__init__zInterconnect.__init__   s    DH)D    c                 .    | j                   j                  S r	   )r   apitools_clientr   s    r   _clientzInterconnect._client   s    ///r   c                    | j                   j                  d| j                  j                  | j                  j
                  | j                  j                  | j                  j                         |||||||||	|
|            fS )a  Make a tuple for interconnect insert request.

    Args:
      description: String that represents the description of the Cloud
        Interconnect resource.
      location: String that represents the URL of the location resource for
        Cloud Interconnect that Cloud Interconnect should be connected to.
      subzone: String that represents the subzone of the location resource that
        Cloud Interconnect should be connected to.
      interconnect_type: InterconnectTypeValueValuesEnum that represents the
        type of Cloud Interconnect.
      requested_link_count: Number of the requested links.
      link_type: LinkTypeValueValuesEnum that represents Cloud Interconnect link
        type.
      admin_enabled: Boolean that represents administrative status of Cloud
        Interconnect.
      noc_contact_email: String that represents the customer's email address.
      customer_name: String that represents the customer's name.
      remote_location: String that represents the Cloud Interconnect remote
        location URL that should be connected to Cloud Interconnect.
      requested_features: List of features requested for this interconnect.

    Returns:
    Insert interconnect tuple that can be used in a request.
    Insert)namedescriptioninterconnectTypelinkTypenocContactEmailrequestedLinkCountlocationsubzoneadminEnabledcustomerNameremoteLocationrequestedFeaturesprojectinterconnect)r   interconnects	_messages!ComputeInterconnectsInsertRequestr
   r$   r   Name)r   r   r   r   interconnect_typerequested_link_count	link_typeadmin_enablednoc_contact_emailcustomer_nameremote_locationrequested_featuress               r   _MakeCreateRequestTuplez$Interconnect._MakeCreateRequestTuple#   s    P 	""88HH$$44XX]]_'!2" 1#7!**."4 5  	9 	
 r   c                 J   i }|||d<   |	|	|d<   |||d<   |||d<   | j                   j                  d| j                  j                  | j                  j                          | j                  j                  d	d||||||||
|d
|| j                  j                        fS )
z,Make a tuple for interconnect patch request.NlabelslabelFingerprint
aaiEnabledapplicationAwareInterconnectPatch)
r   r   r   r   r   r   r   r   macsecEnabledmacsec)r%   interconnectResourcer$    )r   r&   r'    ComputeInterconnectsPatchRequestr
   r)   r   r$   )r   r   r   r*   r+   r,   r-   r.   r4   label_fingerprintmacsec_enabledr:   aai_enabledapplication_aware_interconnectkwargss                  r   _MakePatchRequestTuplez#Interconnect._MakePatchRequestTuple`   s    " FfX$#4f (f\%1/Mf+,""77!<!<!< "'!2" 1#7!*," " HH$$ 	8 	
 r   c                     | j                   j                  d| j                  j                  | j                  j
                  | j                  j                               fS )NDeleter#   )r   r&   r'   !ComputeInterconnectsDeleteRequestr
   r$   r)   r   s    r   _MakeDeleteRequestTuplez$Interconnect._MakeDeleteRequestTuple   sN    LL&&NN<<((txx}} = HI Ir   c                     | j                   j                  d| j                  j                  | j                  j
                  | j                  j                               fS )NGetr#   )r   r&   r'   ComputeInterconnectsGetRequestr
   r$   r)   r   s    r   _MakeDescribeRequestTuplez&Interconnect._MakeDescribeRequestTuple   sN    LL&&NN99((txx}} : HI Ir   c                     | j                   j                  d| j                  j                  | j                  j
                  | j                  j                               fS )NGetDiagnosticsr#   )r   r&   r'   )ComputeInterconnectsGetDiagnosticsRequestr
   r$   r)   r   s    r   _MakeGetDiagnosticsRequestTuplez,Interconnect._MakeGetDiagnosticsRequestTuple   sP    LL&&(8NNDD((txx}} E HI Ir   c                     | j                   j                  d| j                  j                  | j                  j
                  | j                  j                               fS )NGetMacsecConfigr#   )r   r&   r'   *ComputeInterconnectsGetMacsecConfigRequestr
   r$   r)   r   s    r    _MakeGetMacsecConfigRequestTuplez-Interconnect._MakeGetMacsecConfigRequestTuple   sP    LL&&(9NNEE((txx}} F HI Ir   c                 .    | j                   j                  S r	   )r   messagesr   s    r   r'   zInterconnect._messages   s    (((r   c                     | j                  |||||||||	||xs g       g}|
s | j                  j                  |      }|d   S |S )zCreate an interconnect.r   )r2   r   MakeRequests)r   r   r   r   r*   r+   r,   r-   r.   r/   only_generate_requestr0   r1   requests	resourcess                  r   CreatezInterconnect.Create   si    " 	$$ $"	
H !&&33H=iq\Or   c                 b    | j                         g}|s| j                  j                  |      S |S r	   )rG   r   rW   )r   rX   rY   s      r   rE   zInterconnect.Delete   s2    ,,./H !!..x88Or   c                 l    | j                         g}|s | j                  j                  |      }|d   S |S Nr   )rK   r   rW   r   rX   rY   rZ   s       r   DescribezInterconnect.Describe   s;    ..01H &&33H=iq\Or   c                 l    | j                         g}|s | j                  j                  |      }|d   S |S r^   )rO   r   rW   r_   s       r   rM   zInterconnect.GetDiagnostics   s;    4467H &&33H=iq\Or   c                 l    | j                         g}|s | j                  j                  |      }|d   S |S r^   )rS   r   rW   r_   s       r   rQ   zInterconnect.GetMacsecConfig   s;    5578H &&33H=iq\Or   c                       j                         g}t        j                  d       G  fdd             }|s@ j                  j	                  |      } |t        |d   dd       t        |d   dd             S |S )NT)frozenc                   R    e Zd ZU dZeed<   W  j                  j                  ed<   y)<Interconnect.GetApplicationAwarenessConfig.<locals>.AaiStatezEncapsulates application awareness enabled status and config.

      Attr:
        aai_enabled: indicates where AAI is enabled.
        aai_config: AAI policy.
      r@   
aai_configN)__name__
__module____qualname____doc__bool__annotations__r'   (InterconnectApplicationAwareInterconnectr   s   r   AaiStaterf      s     
 ..IIIr   ro   r   r6   r7   )rK   dataclasses	dataclassr   rW   getattr)r   rX   rY   ro   rZ   s   `    r   GetApplicationAwarenessConfigz*Interconnect.GetApplicationAwarenessConfig   s    ..01H$'	J 	J (	J !&&33H=i
)A,d
3
)A, >
E  Or   c                     | j                  ||||||||	|
||||      g}|sD| j                  j                  |      5  | j                  j	                  |      }ddd       |d   S |S # 1 sw Y   d   S xY w)zPatch an interconnect.Nr   )rC   r   IncludeFieldsr   rW   )r   r   r   r*   r+   r,   r-   r.   rX   r4   r>   r?   r:   r@   rA   cleared_fieldsrY   rZ   s                     r   r8   zInterconnect.Patch   s    ( 	## *	
H" !<<%%n5((55h?	 6q\O 6q\s   A''A4r	   ) NNNNNFNNFNN)F)rw   NNNNFNFNNNNNNN)rh   ri   rj   rk   r   propertyr   r2   rC   rG   rK   rO   rS   r'   r[   rE   r`   rM   rQ   rs   r8   r<   r   r   r   r      s    (* 0 0;z.`I
I
I
I
 ) )
 !"H6 !%)!(r   r   )rk   
__future__r   r   r   rp   objectr   r<   r   r   <module>r{      s$     &  ' P6 Pr   