
                             d Z ddlmZ ddlmZ ddlmZ ddl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dZ G d de	j&                        Zee_        y)z$Create endpoint association command.    )absolute_import)division)unicode_literalsN)association_api)base)association_flags)labels_util)
exceptions)
propertiesa{  
        Associate the specified network with the firewall endpoint. Successful
        creation of a firewall endpoint association results in an association
        in READY state. Check the progress of association creation by using
        `gcloud network-security firewall-endpoint-associations list`.

        For more examples, refer to the EXAMPLES section below.

        a  
        To associate a network with a firewall endpoint, run:

            $ {command} --network=projects/my-project/networks/global/myNetwork --endpoint=organizations/1234/locations/us-central1-a/firewallEndpoints/my-endpoint  --zone=us-central1-a  --project=my-project
        )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)Createz,Create a Firewall Plus endpoint association.c                    t        j                  |       t        j                  |       t        j                  | j	                         |       t        j
                  |       t        j                  |d       t        j                  | j	                         |       t        j                  j                  |       t        j                  j                  |d       t        j                  |       y )N60mT)r   AddAssociationIDArg
AddZoneArgAddEndpointResourceReleaseTrackAddNetworkResource
AddMaxWaitAddTLSInspectionPolicyr   
ASYNC_FLAGAddToParser
SetDefaultr	   AddCreateLabelsFlags)clsparsers     Elib/surface/network_security/firewall_endpoint_associations/create.pyArgszCreate.Args3   s    ))&1  ())#*:*:*<fE((0  /,,S-=-=-?HOO'OOvt,$$V,    c                    t        j                  | j                               }|j                  xs2 t        j
                  j                  j                  j                         }|j                  }dj                  ||      }|j                  }t        j                  ||j                  j                  j                        }|j                   }t#        j$                  |j&                        }	|j(                  j*                  j-                         }
|j(                  j.                  j-                         }d }|j1                  d      r;|j(                  j2                  j-                         }|t5        j6                  d      |j9                  |||
j;                         |j;                         ||j;                         nd |      }|r|j1                  d      sd|_	        |S |rdj                  ||      }n.d	j                  |
j;                         |j;                               }|j=                  |j?                  |      d
j                  |      d|	      S )Nzprojects/{}/locations/{})secondstls_inspection_policyzTLS Inspection Policy resource path is either malformed or missing necessary flag `--tls-inspection-policy-region`.
NOTE: TLS Inspection Policy needs to be in the same region as Firewall Plus endpoint resource.)association_idparentnetworkfirewall_endpointr$   labelsformatdefaultz"{}/firewallEndpointAssociations/{}zbetween {} and {}z:waiting for firewall endpoint association {} to be createdT)operation_refmessage
has_resultmax_wait) r   Clientr   projectr   VALUEScore	GetOrFailzoner*   r%   r	   ParseCreateArgsmessagesFirewallEndpointAssociationLabelsValueasync_datetime	timedeltar/   CONCEPTSr'   ParseendpointIsSpecifiedr$   core_exceptionsErrorCreateAssociationRelativeNameWaitForOperationGetOperationRef)selfargsclientr1   r5   r&   r%   r)   is_asyncr/   r'   r?   r$   	operationassociation_names                  r   Runz
Create.Run?   s   ##D$5$5$78FllHj//44<<FFHG99D'..w=F((N((foo99EEF {{H!!$--8Hmm##))+G}}%%++-H /0"mmAAGGI		&##"
 	
 ((%$$&"//1 , 4@@B ) 	I  h'=DD
. -33



 ("7"7"9 "",,Y7HOO   # 	 	r!   N)__name__
__module____qualname____doc__classmethodr    rM    r!   r   r   r   0   s    4	- 	-@r!   r   )rQ   
__future__r   r   r   r;   Fgooglecloudsdk.api_lib.network_security.firewall_endpoint_associationsr   googlecloudsdk.callioper   +googlecloudsdk.command_lib.network_securityr   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   rA   r   DETAILED_HELPCreateCommandr   detailed_helprS   r!   r   <module>r]      sX    + &  '  b ( I < = *$OT Od % r!   