
    >                     Z    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  G d de	      Z
y	)
z<API client library for Certificate Manager certificate maps.    )absolute_import)division)unicode_literals)
list_pager)
api_clientc                   D    e Zd ZdZd	dZd
dZd Z	 	 	 	 ddZd Zd	dZ	y)CertificateMapClientz4API client for Certificate Manager certificate maps.Nc                     |xs t        j                         | _        | j                  j                  | _        |xs | j                  j
                  | _        y )N)r   GetClientInstance_client"projects_locations_certificateMaps_serviceMESSAGES_MODULEmessages)selfclientr   s      Blib/googlecloudsdk/api_lib/certificate_manager/certificate_maps.py__init__zCertificateMapClient.__init__   s>    ;Z99;DLLLCCDM< < <DM    c           	          | j                   j                  |j                         || j                   j                  |||            }| j                  j                  |      S )a  Creates a certificate map.

    Args:
      parent_ref: a Resource reference to a
        certificatemanager.projects.locations resource for the parent of this
        certificate map.
      map_id: str, the ID of the map to create.
      description: str, user-provided description.
      labels: Unified GCP Labels for the resource.
      tags: Unified GCP Tags for the resource.

    Returns:
      Operation: the long running operation to create a map.
    )labelsdescriptiontags)parentcertificateMapIdcertificateMap)r   ?CertificatemanagerProjectsLocationsCertificateMapsCreateRequestRelativeNameCertificateMapr   Create)r   
parent_refmap_idr   r   r   reqs          r   r    zCertificateMapClient.Create"   sd     --
W
W&&(}}33# 4 
 X C ==$$r   c                     | j                   j                  |j                               }| j                  j	                  |      S )zGets certificate map.

    Args:
      map_ref: a Resource reference to a
        certificatemanager.projects.locations.certificateMaps resource to get.

    Returns:
      Certificate Map API representation.
    name)r   <CertificatemanagerProjectsLocationsCertificateMapsGetRequestr   r   Get)r   map_refget_reqs      r   r(   zCertificateMapClient.Get<   s?     mmXX!!# Y %G==W%%r   c           
          | j                   j                  |j                         ||      }t        j                  | j
                  |||dddd      S )a  List certificate maps in a given project and location.

    Args:
      parent_ref: a Resource reference to a
        certificatemanager.projects.locations resource to list maps 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 certificate maps in the project.
    )r   filterorderBy	pageTokennextPageTokencertificateMapspageSize)
batch_sizelimitcurrent_token_attributenext_token_attributefieldbatch_size_attribute)r   =CertificatemanagerProjectsLocationsCertificateMapsListRequestr   r   YieldFromListr   )r   r!   r3   	page_sizelist_filterorder_bylist_reqs          r   ListzCertificateMapClient.ListJ   s^    * }}ZZ&&(h [ PH## +,') )r   c                     | j                   j                  |j                               }| j                  j	                  |      S )a   Deletes certificate map.

    Args:
      map_ref: a Resource reference to a
        certificatemanager.projects.locations.certificateMaps resource to
        delete.

    Returns:
      Operation: the long running operation to delete certificate map.
    r%   )r   ?CertificatemanagerProjectsLocationsCertificateMapsDeleteRequestr   r   Delete)r   r)   
delete_reqs      r   rA   zCertificateMapClient.Deletek   s?     ^^!!# _ %J==
++r   c                 R   | j                   j                         }g }|r||_        |j                  d       |r||_        |j                  d       dj                  |      }| j                   j                  ||j                         |      }| j                  j                  |      S )ay  Updates a certificate map.

    Used for updating labels and description.

    Args:
      map_ref: a Resource reference to a
        certificatemanager.projects.locations.certificateMaps resource.
      labels: unified GCP Labels for the resource.
      description: str, new description

    Returns:
      Operation: the long running operation to patch certificate map.
    r   r   ,)r   r&   
updateMask)
r   r   r   appendr   join>CertificatemanagerProjectsLocationsCertificateMapsPatchRequestr   r   Patch)r   r)   r   r   certificate_mapupdated_fieldsupdate_mask	patch_reqs           r   rI   zCertificateMapClient.Patchz   s     mm224ON%oH%$/o!M*((>*K\\&!!# ]  I ==y))r   )NN) NN)NNNN)
__name__
__module____qualname____doc__r   r    r(   r>   rA   rI    r   r   r	   r	      s2    <=
%4&" )B,*r   r	   N)rR   
__future__r   r   r   apitools.base.pyr   *googlecloudsdk.api_lib.certificate_managerr   objectr	   rS   r   r   <module>rX      s(    C &  ' ' A|*6 |*r   