
    ^                      H   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r
  SSKJr  S	rS
rSSSSS.r " S S\
R                   5      r " S S\
R                   5      r " S S\
R                   5      rS!S jrS"S jrS!S jrS"S jrS"S jrS rS#S jrS#S jrS rS  rg)$z8Flags and helpers for the compute ssl-policies commands.    )absolute_import)division)unicode_literals)arg_parsers)base)
completers)flagsz?    table(
      name,
      profile,
      minTlsVersion
    )zX    table(
      name,
      region.basename(),
      profile,
      minTlsVersion
    )TLS_1_0TLS_1_1TLS_1_2TLS_1_3z1.0z1.1z1.2z1.3c                   (   ^  \ rS rSrU 4S jrSrU =r$ )GlobalSslPoliciesCompleter4   c                 4   > [         [        U ]
  " SSSS.UD6  g )Ncompute.sslPoliciesz(compute ssl-policies list --global --uri
collectionlist_command )superr   __init__selfkwargs	__class__s     <lib/googlecloudsdk/command_lib/compute/ssl_policies/flags.pyr   #GlobalSslPoliciesCompleter.__init__6   s(    	
$d4 (?     r   __name__
__module____qualname____firstlineno__r   __static_attributes____classcell__r   s   @r   r   r   4        r    r   c                   (   ^  \ rS rSrU 4S jrSrU =r$ )RegionalSslPoliciesCompleter=   c                 4   > [         [        U ]
  " SSSS.UD6  g )Ncompute.regionSslPoliciesz1compute ssl-policies list --filter=region:* --urir   r   )r   r+   r   r   s     r   r   %RegionalSslPoliciesCompleter.__init__?   s(    	
&6 .H r    r   r!   r(   s   @r   r+   r+   =   r)   r    r+   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )SslPoliciesCompleterF   z0An SSL policy completer for a resource argument.c                 F   > [         [        U ]
  " SS[        [        /0UD6  g )Nr   r   )r   r1   r   r   r+   r   s     r   r   SslPoliciesCompleter.__init__I   s)    	
. .0LM
r    r   )r"   r#   r$   r%   __doc__r   r&   r'   r(   s   @r   r1   r1   F   s    8 r    r1   c           
      >    [         R                  " SS[        USU SS9$ )=Returns the resource argument object for the SSL policy flag.
SSL_POLICY
SSL policySSL policiesr   )nameresource_name	completerpluralcustom_pluralrequiredglobal_collectioncompute_flagsResourceArgumentr1   r@   r>   s     r   GetSslPolicyArgumentrF   O   s*    		'	' $"-
/ /r    c                 Z    [         R                  " SS[        SUSSSR                  U S9S9$ )	/Returns the flag for specifying the SSL policy.--ssl-policyr9   Fr   \A reference to an SSL policy resource that defines the server-side support for SSL features.S          A reference to an SSL policy resource that defines the server-side
        support for SSL features and affects the connections between clients
        and load balancers that are using the {proxy_type} proxy. The SSL
        policy must exist and cannot be
        deleted while referenced by a target {proxy_type} proxy.
        
proxy_type)r;   r<   r=   r>   r@   rA   
short_helpdetailed_helprC   rD   r1   formatrM   r@   s     r   $GetSslPolicyArgumentForOtherResourcerS   [   s?    		'	' $-& FjF)!
+ +r    c                 @    [         R                  " SS[        USU SSS9$ )r7   r8   r9   r:   r.   r   )r;   r<   r=   r>   r?   r@   regional_collectionrA   rB   rE   s     r   GetSslPolicyMultiScopeArgumentrV   p   s-    		'	' $"5-
/ /r    c                 \    [         R                  " SS[        SUSSSSR                  U S9S	9	$ )
rH   rI   r9   Fr.   r   rJ   rK   rL   )	r;   r<   r=   r>   r@   rU   rA   rN   rO   rP   rR   s     r   .GetSslPolicyMultiScopeArgumentForOtherResourcerX   }   sB    		'	' $5-& FjF)#
+ +r    c           	      P    [         R                  " SSSUSR                  U 5      S9$ )z-Returns the flag for clearing the SSL policy.z--clear-ssl-policy
store_trueFz?      Removes any attached SSL policy from the {} proxy.
      )actiondefaultr@   help)r   ArgumentrQ   rR   s     r   )GetClearSslPolicyArgumentForOtherResourcer_      s.    	

&

 r    c                  ,    [         R                  " SSS9$ )z,Returns the flag for SSL policy description.z--descriptionz4An optional, textual description for the SSL policy.)r]   r   r^   r   r    r   GetDescriptionFlagrb      s    	A
C Cr    Nc           	      <    [         R                  " SSSSSSS.U SS	9$ )
z7Returns the flag for specifying the SSL policy profile.z	--profilezCompatible profile. Allows the broadest set of clients, even those which support only out-of-date SSL features, to negotiate SSL with the load balancer.z^Modern profile. Supports a wide set of SSL features, allowing modern clients to negotiate SSL.znRestricted profile. Supports a reduced set of SSL features, intended to meet stricter compliance requirements.zCustom profile. Allows customization by selecting only the features which are required. The list of all available features can be obtained using:

  gcloud compute ssl-policies list-available-features
zoFIPS_202205 profile. Supports a reduced set of SSL features, intended to meet stricter compliance requirements.)
COMPATIBLEMODERN
RESTRICTEDCUSTOMFIPS_202205zSSL policy profile. Changing profile from CUSTOM to COMPATIBLE|MODERN|RESTRICTED|FIPS_202205 will clear the custom-features field.choicesr\   r]   ra   r\   s    r   GetProfileFlagrl      sA    	,2DH
C#( #1
% %r    c                 :    [         R                  " SSSSSS.U SS9$ )	zEReturns the flag for specifying minimum TLS version of an SSL policy.z--min-tls-versionzTLS 1.0.zTLS 1.1.zTLS 1.2.zTLS 1.3.r   zMinimum TLS version.ri   ra   rk   s    r   GetMinTlsVersionFlagrn      s/    		 !	
# 	#r    c                  V    [         R                  " SS[        R                  " 5       SS9$ )zAReturns the flag for specifying custom features in an SSL policy.z--custom-featuresCUSTOM_FEATURESac  A comma-separated list of custom features, required when the profile being used is CUSTOM.

Using CUSTOM profile allows customization of the features that are part of the SSL policy. This flag allows specifying those custom features.

The list of all supported custom features can be obtained using:

  gcloud compute ssl-policies list-available-features
)metavartyper]   )r   r^   r   ArgListr   r    r   GetCustomFeaturesFlagrt      s-    	 D
F Fr    c                 &    U (       a	  [         U    $ S $ N)_TLS_VERSION_MAP)tls_versions    r   ParseTlsVersionry      s    *5	+	&?4?r    )TF)Frv   )r5   
__future__r   r   r   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer   compute_completersr	   rC   DEFAULT_LIST_FORMATDEFAULT_AGGREGATED_LIST_FORMATrw   ListCommandCompleterr   r+   r1   rF   rS   rV   rX   r_   rb   rl   rn   rt   ry   r   r    r   <module>r      s    ? &  ' / ( O E	 "	  	 !3!H!H #5#J#J -BB 	/+*
/+,	C%>#F @r    