
                             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  ej                  ej                   j"                         G d
 dej$                               Zy)zUpdate an existing certificate.    )absolute_import)division)unicode_literals)base)request_utils)
exceptions)resource_args)labels_utilc                   0    e Zd ZdZdZed        Zd Zd Zy)UpdatezUpdate an existing certificate.

  ## EXAMPLES

   To update labels on a certificate:

      $ {command} frontend-server-tls \
        --issuer-pool=my-pool --issuer-location=us-west1 \
        --update-labels=in_use=true
  z8There are no changes to the certificate [{certificate}].c                 Z    t        j                  | d       t        j                  |        y )Nz	to update)r	   AddCertPositionalResourceArgr
   AddUpdateLabelsFlags)parsers    ,lib/surface/privateca/certificates/update.pyArgszUpdate.Args-   s     ..v{C$$V,    c           	         t        j                  |      }|j                  |j                  j                  |j
                        }|j                  s:t        j                  d| j                  j                  |j                              |j
                  |_        |j                  j                  |j                  |j                  |dt        j                                      S )Nlabels)certificate)namer   
updateMask	requestId)r
   GetAndValidateOpsFromArgsApplyCertificateLabelsValuer   needs_updater   InvalidArgumentExceptionNO_CHANGES_MESSAGEformatr   'projects_locations_caPools_certificatesPatch9PrivatecaProjectsLocationsCaPoolsCertificatesPatchRequestr   GenerateRequestId)selfclientmessagesoriginal_certargslabels_difflabels_updates          r   
_RunUpdatezUpdate._RunUpdate2   s    77=K%%h&:&:&F&F&3&:&:<M %%//


!
!
(
(]5G5G
(
HJ J )//M99??AA##%#557	 	B 	9: :r   c                 <   t        j                  d      }t        j                  d      }|j                  j                  j                         }|j                  j                  |j                  |j                                     }| j                  ||||      S )Nv1)api_version)r   )privateca_baseGetClientInstanceGetMessagesModuleCONCEPTSr   Parser"   Get7PrivatecaProjectsLocationsCaPoolsCertificatesGetRequestRelativeNamer-   )r&   r*   r'   r(   certificate_refr   s         r   Runz
Update.RunG   s    --$?F//DAHmm//557O@@DD	@	@ --/ 
A 
12K ??68[$??r   N)	__name__
__module____qualname____doc__r    staticmethodr   r-   r:    r   r   r   r      s1    	 A  - -:*@r   r   N)r>   
__future__r   r   r    googlecloudsdk.api_lib.privatecar   r1   r   googlecloudsdk.callioper   $googlecloudsdk.command_lib.privatecar	   $googlecloudsdk.command_lib.util.argsr
   ReleaseTracksReleaseTrackGAUpdateCommandr   r@   r   r   <module>rJ      sb    & &  ' C : ( . > < D%%(()5@T 5@ *5@r   