
    (!                        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lmZ dZdZdZdZdZdZdZd Z	 ddZd Zd Z	 d dZ	 d!dZ	 d"dZ ej@                  d      fdZ!d Z"	 d#dZ#y)$z6Flags for Firewall Plus Endpoint Association commands.    )absolute_import)division)unicode_literalsN)activation_api)arg_parsers)concepts)deps)concept_parsers)presentation_specs)	resourcesFIREWALL_ENDPOINT_ASSOCIATIONz?networksecurity.projects.locations.firewallEndpointAssociationsz"networksecurity.projects.locationsFIREWALL_ENDPOINTz--tls-inspection-policyz9networksecurity.organizations.locations.firewallEndpointsz8networksecurity.projects.locations.tlsInspectionPoliciesc                 b   t        j                  |       }t        j                  t        d|t        j
                  t        j                  ddd      t        j                  ddd      	      }t        j                  t        |d
d      }t        j                  |g      j                  |      S )zAdds Association resource.zfirewall endpoint associationzoneZone of the {resource}.locationsIdparameter_namezassociation-nameName of the {resource}firewallEndpointAssociationsId)api_version
projectsIdr   r   TFirewall Plus.nameconcept_specrequired
group_help)r   GetApiVersionr   ResourceSpecASSOCIATION_RESOURCE_COLLECTION DEFAULT_PROJECT_ATTRIBUTE_CONFIG ResourceParameterAttributeConfigr   ResourcePresentationSpecASSOCIATION_RESOURCE_NAMEr
   ConceptParserAddToParser)release_trackparserr   resource_specpresentation_specs        Dlib/googlecloudsdk/command_lib/network_security/association_flags.pyAddAssociationResourcer-   /   s    ,,];+''%%::;;

#&
 &.%N%N

"9&-  )AA$ !	 
	&	&(9':	;	G	G	OO    c                 .    | j                  d|dd        y )Nassociation_id?)helpnargsdefaultadd_argumentr)   	help_texts     r,   AddAssociationIDArgr9   K   s     	&Yc4Pr.   c                 T   t        j                  |       }t        j                  j	                         j                  t        |      }t        j                  t        d|t        j                  ddd      t        j                  dddt        j                  d	      t        j                  t        j                  t              g|d      g
      t        j                  ddd            }t        j                   d|dd      }t#        j$                  |g      j'                  |      S )z%Adds Firewall Plus endpoint resource.zfirewall endpointorganizationz2Organization ID to which the changes should apply.organizationsIdr   zendpoint-zoner   r   --zoner   fallthroughszendpoint-namer   firewallEndpointsId)r   r<   r   r@   z
--endpointTr   r   )r   r   r   REGISTRYCloneGetCollectionInfor!   r   r    ENDPOINT_RESOURCE_COLLECTIONr#   r	   ArgFallthroughFullySpecifiedAnchorFallthroughr%   r   r$   r
   r&   r'   )r(   r)   r   collection_infor*   r+   s         r,   AddEndpointResourcerH   R   s   ,,];+&&,,.@@%{/ ''"??

>*
 ;;

#&!!(+22&&'@AB!	 #CC

".--8 )AA !	 
	&	&(9':	;	G	G	OOr.   c                     t        j                  dddt         j                  t        j                  ddd            }t	        j
                  d|d	d
      }t        j                  |g      j                  |       S )zAdds network resource.zcompute.networksnetworkv1znetwork-namer   r   )r   projectrJ   z	--networkTr   r   )	r   r    r"   r#   r   r$   r
   r&   r'   )r)   r*   r+   s      r,   AddNetworkResourcerM   }   s|    ''7777

""
- )AA !	 
	&	&(9':	;	G	G	OOr.   c           	      V    | j                  ddd||t        j                                y)zAdds --max-wait flag.z
--max-waitmax_waitF)destr   r4   r2   typeN)r6   r   Duration)r)   default_max_waitr8   s      r,   
AddMaxWaitrT      s2     	!  r.   c                 \   t        j                  |       }t        j                  j	                         j                  t        |      }t        j                  t        d|t        j                  dddt        j                  d      t        j                  t        j                  t              g|d      g      t        j                  ddd	
      t        j                  ddd
            }t        j                   t"        |d|      }t%        j&                  |g      j)                  |      S )z$Adds TLS Inspection Policy resource.zTLS Inspection Policyztls-inspection-policy-projectzProject of the {resource}.r   z	--projectr>   ztls-inspection-policy-regionz
          Region of the {resource}.
          NOTE: TLS Inspection Policy needs to be
          in the same region as Firewall Plus endpoint resource.
          r   r   tls_inspection_policyr   tlsInspectionPoliciesId)r   r   r   rW   Fr   )r   r   r   rA   rB   rC   r!   r   r    )TLS_INSPECTION_POLICY_RESOURCE_COLLECTIONr#   r	   rE   rF   r%   r   r$   #TLS_INSPECTION_POLICY_RESOURCE_NAMEr
   r&   r'   )r(   r)   r8   r   rG   r*   r+   s          r,   AddTLSInspectionPolicyrZ      s    ,,];+&&,,.@@%{/ ''/::
)
&%!!+.22&&'@AB!	 ;;
(
 ' 'GG
!
"25-@ )AA. 	 
	&	&(9':	;	G	G	OOr.   c                 ,    | j                  dd|       y )Nz--no-tls-inspection-policy
store_true)actionr2   r5   r7   s     r,   AddNoTLSInspectionPolicyArgr^      s     	"<i  r.   z      Disable a firewall endpoint association. To enable a disabled association, use:

       $ {parent_command} update MY-ASSOCIATION --no-disabled

      c                 .    | j                  ddd |       y )Nz
--disabledr\   )r]   r4   r2   r5   r7   s     r,   AddDisabledArgr`      s#     		  r.   c                       fdS )Nc                 H    t        j                        | j                  z   S )N)r   GetEffectiveApiEndpointr   )xr(   s    r,   <lambda>z MakeGetUriFunc.<locals>.<lambda>   s    66}ENr.    )r(   s   `r,   MakeGetUriFuncrg      s    Nr.   c                 .    | j                  d|d|       y )Nr=   -)r   r4   r2   r5   )r)   r   r8   s      r,   
AddZoneArgrj      s     	h3YOr.   )zTName to give the association. If not specified, an auto-generated UUID will be used.)zTime to synchronously wait for the operation to complete, after which the operation continues asynchronously. Ignored if --no-async isn't specified. See $ gcloud topic datetimes for information on time formats.)zjPath to TLS Inspection Policy configuration to use for intercepting TLS-encrypted traffic in this network.)z3Remove TLS inspection policy from this association.)Tz'Zone of a firewall endpoint association)$__doc__
__future__r   r   r   textwrap:googlecloudsdk.api_lib.network_security.firewall_endpointsr   googlecloudsdk.callioper    googlecloudsdk.calliope.conceptsr   r	   (googlecloudsdk.command_lib.util.conceptsr
   r   googlecloudsdk.corer   r%   r!   &ASSOCIATION_PARENT_RESOURCE_COLLECTIONENDPOINT_RESOURCE_NAMErY   rD   rX   r-   r9   rH   rM   rT   rZ   r^   dedentr`   rg   rj   rf   r.   r,   <module>rv      s    = &  '  U / 5 1 D G ) < E   *N &, &? #?  ? *
P< eQ(PVP2 c& {0Ph L hoo 
 " &OPr.   