
                         Z    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\	5      r
g	)
z8API client library for Certificate Manager certificates.    )absolute_import)division)unicode_literals)
list_pager)
api_clientc                   `    \ rS rSrSrSS jr   SS jrS r    SS jrS r	   SS	 jr
S
rg)CertificateClient   z0API client for Certificate Manager certificates.Nc                     U=(       d    [         R                  " 5       U l        U R                  R                  U l        U=(       d    U R                  R
                  U l        g )N)r   GetClientInstance_clientprojects_locations_certificates_serviceMESSAGES_MODULEmessages)selfclientr   s      >lib/googlecloudsdk/api_lib/certificate_manager/certificates.py__init__CertificateClient.__init__   s>    ;Z99;DLLL@@DM< < <DM    c           
          U R                   R                  UR                  5       UU R                   R                  UUUS9S9nU R                  R                  U5      $ )a  Creates a certificate.

Args:
  parent_ref: a Resource reference to a
    certificatemanager.projects.locations resource for the parent of this
    certificate.
  cert_id: str, the ID of the cerificate to create.
  self_managed_cert_data: API message for self-managed certificate data.
  description: str, user-provided description.
  labels: Unified GCP Labels for the resource.

Returns:
  Operation: the long running operation to create a certificate.
)labelsdescriptionselfManagedCertData)parentcertificateIdcertificate)r   <CertificatemanagerProjectsLocationsCertificatesCreateRequestRelativeNameCertificater   Create)r   
parent_refcert_idself_managed_cert_datar   r   reqs          r   r"   CertificateClient.Create"   sd    ( --
T
T&&(MM--# 6 . 
 U C ==$$r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zGets certificate.

Args:
  cert_ref: a Resource reference to a
    certificatemanager.projects.locations.certificates resource to get.

Returns:
  Certificate API representation.
name)r   9CertificatemanagerProjectsLocationsCertificatesGetRequestr    r   Get)r   cert_refget_reqs      r   r,   CertificateClient.GetA   s?     mmUU""$ V &G==W%%r   c                     U R                   R                  UR                  5       XES9n[        R                  " U R
                  UUUSSSSS9$ )a  List certificates in a given project and location.

Args:
  parent_ref: a Resource reference to a
    certificatemanager.projects.locations resource to list certs for.
  limit: int, the total number of results to return from the API.
  page_size: int, the number of results in each batch from the API.
  list_filter: str, filter to apply in the list request.
  order_by: str, fields used for resource ordering.

Returns:
  A list of the certificates in the project.
)r   filterorderBy	pageTokennextPageTokencertificatespageSize)
batch_sizelimitcurrent_token_attributenext_token_attributefieldbatch_size_attribute)r   :CertificatemanagerProjectsLocationsCertificatesListRequestr    r   YieldFromListr   )r   r#   r8   	page_sizelist_filterorder_bylist_reqs          r   ListCertificateClient.ListO   s\    * }}WW&&( X PH## +,') )r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zDeletes certificate.

Args:
  cert_ref: a Resource reference to a
    certificatemanager.projects.locations.certificates resource to delete.

Returns:
  Operation: the long running operation to delete certificate.
r)   )r   <CertificatemanagerProjectsLocationsCertificatesDeleteRequestr    r   Delete)r   r-   
delete_reqs      r   rG   CertificateClient.Deletep   s?     [[""$ \ &J==
++r   c                    U R                   R                  5       n/ nU(       a  X%l        UR                  S5        U(       a  X5l        UR                  S5        U(       a  XEl        UR                  S5        SR                  U5      nU R                   R                  UUR                  5       US9nU R                  R                  U5      $ )a  Updates a certificate.

Used for updating labels, description and certificate data.

Args:
  cert_ref: a Resource reference to a
    certificatemanager.projects.locations.certificates resource.
  self_managed_cert_data: API message for self-managed certificate data.
  labels: unified GCP Labels for the resource.
  description: str, new description

Returns:
  Operation: the long running operation to patch certificate.
self_managedr   r   ,)r   r*   
updateMask)r   r!   selfManagedappendr   r   join;CertificatemanagerProjectsLocationsCertificatesPatchRequestr    r   Patch)	r   r-   r%   r   r   r   updated_fieldsupdate_mask	patch_reqs	            r   rR   CertificateClient.Patch~   s    & --++-KN 6N+!H% +M*((>*KYY""$ Z  I ==y))r   )r   r   r   )NN)N N)NNNN)NNN)__name__
__module____qualname____firstlineno____doc__r   r"   r,   rC   rG   rR   __static_attributes__ r   r   r	   r	      sH    8= %)%>&" )B,  $(	$*r   r	   N)r\   
__future__r   r   r   apitools.base.pyr   *googlecloudsdk.api_lib.certificate_managerr   objectr	   r^   r   r   <module>rc      s'    ? &  ' ' AH* H*r   