
    )                         d 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d	lmZ dd
lmZ  G d de
j"                        Zy)zCommand to update SSL policies.    )absolute_import)division)unicode_literals)base_classes)ssl_policies_utils)base)
exceptions)scope)flagsc                   :    e Zd ZdZdZed        Zd Zed        Z	y)Updatea  Update a Compute Engine SSL policy.

  *{command}* is used to update SSL policies.

  An SSL policy specifies the server-side support for SSL features. An SSL
  policy can be attached to a TargetHttpsProxy or a TargetSslProxy. This affects
  connections between clients and the load balancer. SSL
  policies do not affect the connection between the load balancers and the
  backends. SSL policies are used by Application Load Balancers and proxy
  Network Load Balancers.
  Nc                    |j                   j                  t        j                         t        j                         | _        | j
                  j                  |d       t        j                         j                  |       t        j                         j                  |       t        j                         j                  |       y )Npatch)operation_type)display_info	AddFormatr   DEFAULT_LIST_FORMATGetSslPolicyMultiScopeArgumentSSL_POLICY_ARGAddArgumentGetProfileFlagAddToParserGetMinTlsVersionFlagGetCustomFeaturesFlag)clsparsers     *lib/surface/compute/ssl_policies/update.pyArgszUpdate.Args,   s    
!!%";";<==?C""6'"B	&&v.	 ,,V4	!--f5    c                 &   t        j                  | j                               }t        j                  |      }| j
                  j                  ||j                  t        j                  j                        }t        j                  |      \  }}|j                  |      }|j                  |j                  |j                   t#        j$                  |j&                        |      }|j)                  |||xr |       }	|j+                  ||	d      S )z*Issues the request to update a SSL policy.)default_scope)fingerprintprofilemin_tls_versioncustom_featureszUpdating SSL policy)r   ComputeApiHolderReleaseTrackr   SslPolicyHelperr   ResolveAsResource	resourcescompute_scope	ScopeEnumGLOBALr   _GetCustomFeaturesDescribeGetSslPolicyForPatchr"   r#   r   ParseTlsVersionr$   PatchWaitForOperation)
selfargsholderhelperssl_policy_refinclude_custom_featuresr%   existing_ssl_policypatch_ssl_policyoperation_refs
             r   Runz
Update.Run5   s   **4+<+<+>?F//7F((::fm.E.E.L.L ; NN 06/H/H/N,_ //.922'33--d.B.BC'	 3 )
 LL(*A +M "">=#8: :r   c                    | j                  d      rR| j                  dk7  rC| j                  d      r.t        | j                        dkD  rt	        j
                  dd      dg fS | j                  d      rd| j                  fS dg fS )	ak  Returns the custom features specified on the command line.

    Args:
      args: The arguments passed to this command from the command line.

    Returns:
      A tuple. The first element in the tuple indicates whether custom
      features must be included in the request or not. The second element in
      the tuple specifies the list of custom features.
    r#   CUSTOMr%   r   z--custom-featureszCCustom features cannot be specified when using non-CUSTOM profiles.TF)IsSpecifiedr#   lenr%   r	   InvalidArgumentException)r5   s    r   r.   zUpdate._GetCustomFeaturesJ   s     	"t||x'?			+	,T5I5I1JQ1N 11 "./ 	/
 BZ			+	,D(()) R[r   )
__name__
__module____qualname____doc__r   classmethodr   r=   staticmethodr.    r   r   r   r      s9    
 .6 6:*  r   r   N)rF   
__future__r   r   r   googlecloudsdk.api_lib.computer   +googlecloudsdk.api_lib.compute.ssl_policiesr   googlecloudsdk.callioper   r	   "googlecloudsdk.command_lib.computer
   r+   /googlecloudsdk.command_lib.compute.ssl_policiesr   UpdateCommandr   rI   r   r   <module>rQ      s9    & &  ' 7 J ( . E AJT Jr   