1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\CertificateAuthorityService\Resource;
19
20use Google\Service\CertificateAuthorityService\Certificate;
21use Google\Service\CertificateAuthorityService\ListCertificatesResponse;
22use Google\Service\CertificateAuthorityService\RevokeCertificateRequest;
23
24/**
25 * The "certificates" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $privatecaService = new Google\Service\CertificateAuthorityService(...);
29 *   $certificates = $privatecaService->certificates;
30 *  </code>
31 */
32class ProjectsLocationsCaPoolsCertificates extends \Google\Service\Resource
33{
34  /**
35   * Create a new Certificate in a given Project, Location from a particular
36   * CaPool. (certificates.create)
37   *
38   * @param string $parent Required. The resource name of the CaPool associated
39   * with the Certificate, in the format `projects/locations/caPools`.
40   * @param Certificate $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string certificateId Optional. It must be unique within a location
44   * and match the regular expression `[a-zA-Z0-9_-]{1,63}`. This field is
45   * required when using a CertificateAuthority in the Enterprise
46   * CertificateAuthority.Tier, but is optional and its value is ignored
47   * otherwise.
48   * @opt_param string issuingCertificateAuthorityId Optional. The resource ID of
49   * the CertificateAuthority that should issue the certificate. This optional
50   * field will ignore the load-balancing scheme of the Pool and directly issue
51   * the certificate from the CA with the specified ID, contained in the same
52   * CaPool referenced by `parent`. Per-CA quota rules apply. If left empty, a
53   * CertificateAuthority will be chosen from the CaPool by the service. For
54   * example, to issue a Certificate from a Certificate Authority with resource
55   * name "projects/my-project/locations/us-central1/caPools/my-
56   * pool/certificateAuthorities/my-ca", you can set the parent to "projects/my-
57   * project/locations/us-central1/caPools/my-pool" and the
58   * issuing_certificate_authority_id to "my-ca".
59   * @opt_param string requestId Optional. An ID to identify requests. Specify a
60   * unique request ID so that if you must retry your request, the server will
61   * know to ignore the request if it has already been completed. The server will
62   * guarantee that for at least 60 minutes since the first request. For example,
63   * consider a situation where you make an initial request and the request times
64   * out. If you make the request again with the same request ID, the server can
65   * check if original operation with the same request ID was received, and if so,
66   * will ignore the second request. This prevents clients from accidentally
67   * creating duplicate commitments. The request ID must be a valid UUID with the
68   * exception that zero UUID is not supported
69   * (00000000-0000-0000-0000-000000000000).
70   * @opt_param bool validateOnly Optional. If this is true, no Certificate
71   * resource will be persisted regardless of the CaPool's tier, and the returned
72   * Certificate will not contain the pem_certificate field.
73   * @return Certificate
74   */
75  public function create($parent, Certificate $postBody, $optParams = [])
76  {
77    $params = ['parent' => $parent, 'postBody' => $postBody];
78    $params = array_merge($params, $optParams);
79    return $this->call('create', [$params], Certificate::class);
80  }
81  /**
82   * Returns a Certificate. (certificates.get)
83   *
84   * @param string $name Required. The name of the Certificate to get.
85   * @param array $optParams Optional parameters.
86   * @return Certificate
87   */
88  public function get($name, $optParams = [])
89  {
90    $params = ['name' => $name];
91    $params = array_merge($params, $optParams);
92    return $this->call('get', [$params], Certificate::class);
93  }
94  /**
95   * Lists Certificates. (certificates.listProjectsLocationsCaPoolsCertificates)
96   *
97   * @param string $parent Required. The resource name of the location associated
98   * with the Certificates, in the format `projects/locations/caPools`.
99   * @param array $optParams Optional parameters.
100   *
101   * @opt_param string filter Optional. Only include resources that match the
102   * filter in the response. For details on supported filters and syntax, see
103   * [Certificates Filtering documentation](https://cloud.google.com/certificate-
104   * authority-service/docs/sorting-filtering-certificates#filtering_support).
105   * @opt_param string orderBy Optional. Specify how the results should be sorted.
106   * For details on supported fields and syntax, see [Certificates Sorting
107   * documentation](https://cloud.google.com/certificate-authority-service/docs
108   * /sorting-filtering-certificates#sorting_support).
109   * @opt_param int pageSize Optional. Limit on the number of Certificates to
110   * include in the response. Further Certificates can subsequently be obtained by
111   * including the ListCertificatesResponse.next_page_token in a subsequent
112   * request. If unspecified, the server will pick an appropriate default.
113   * @opt_param string pageToken Optional. Pagination token, returned earlier via
114   * ListCertificatesResponse.next_page_token.
115   * @return ListCertificatesResponse
116   */
117  public function listProjectsLocationsCaPoolsCertificates($parent, $optParams = [])
118  {
119    $params = ['parent' => $parent];
120    $params = array_merge($params, $optParams);
121    return $this->call('list', [$params], ListCertificatesResponse::class);
122  }
123  /**
124   * Update a Certificate. Currently, the only field you can update is the labels
125   * field. (certificates.patch)
126   *
127   * @param string $name Output only. The resource name for this Certificate in
128   * the format `projects/locations/caPools/certificates`.
129   * @param Certificate $postBody
130   * @param array $optParams Optional parameters.
131   *
132   * @opt_param string requestId Optional. An ID to identify requests. Specify a
133   * unique request ID so that if you must retry your request, the server will
134   * know to ignore the request if it has already been completed. The server will
135   * guarantee that for at least 60 minutes since the first request. For example,
136   * consider a situation where you make an initial request and t he request times
137   * out. If you make the request again with the same request ID, the server can
138   * check if original operation with the same request ID was received, and if so,
139   * will ignore the second request. This prevents clients from accidentally
140   * creating duplicate commitments. The request ID must be a valid UUID with the
141   * exception that zero UUID is not supported
142   * (00000000-0000-0000-0000-000000000000).
143   * @opt_param string updateMask Required. A list of fields to be updated in this
144   * request.
145   * @return Certificate
146   */
147  public function patch($name, Certificate $postBody, $optParams = [])
148  {
149    $params = ['name' => $name, 'postBody' => $postBody];
150    $params = array_merge($params, $optParams);
151    return $this->call('patch', [$params], Certificate::class);
152  }
153  /**
154   * Revoke a Certificate. (certificates.revoke)
155   *
156   * @param string $name Required. The resource name for this Certificate in the
157   * format `projects/locations/caPools/certificates`.
158   * @param RevokeCertificateRequest $postBody
159   * @param array $optParams Optional parameters.
160   * @return Certificate
161   */
162  public function revoke($name, RevokeCertificateRequest $postBody, $optParams = [])
163  {
164    $params = ['name' => $name, 'postBody' => $postBody];
165    $params = array_merge($params, $optParams);
166    return $this->call('revoke', [$params], Certificate::class);
167  }
168}
169
170// Adding a class alias for backwards compatibility with the previous class name.
171class_alias(ProjectsLocationsCaPoolsCertificates::class, 'Google_Service_CertificateAuthorityService_Resource_ProjectsLocationsCaPoolsCertificates');
172