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\ActivateCertificateAuthorityRequest;
21use Google\Service\CertificateAuthorityService\CertificateAuthority;
22use Google\Service\CertificateAuthorityService\DisableCertificateAuthorityRequest;
23use Google\Service\CertificateAuthorityService\EnableCertificateAuthorityRequest;
24use Google\Service\CertificateAuthorityService\FetchCertificateAuthorityCsrResponse;
25use Google\Service\CertificateAuthorityService\ListCertificateAuthoritiesResponse;
26use Google\Service\CertificateAuthorityService\Operation;
27use Google\Service\CertificateAuthorityService\UndeleteCertificateAuthorityRequest;
28
29/**
30 * The "certificateAuthorities" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $privatecaService = new Google\Service\CertificateAuthorityService(...);
34 *   $certificateAuthorities = $privatecaService->certificateAuthorities;
35 *  </code>
36 */
37class ProjectsLocationsCaPoolsCertificateAuthorities extends \Google\Service\Resource
38{
39  /**
40   * Activate a CertificateAuthority that is in state AWAITING_USER_ACTIVATION and
41   * is of type SUBORDINATE. After the parent Certificate Authority signs a
42   * certificate signing request from FetchCertificateAuthorityCsr, this method
43   * can complete the activation process. (certificateAuthorities.activate)
44   *
45   * @param string $name Required. The resource name for this CertificateAuthority
46   * in the format `projects/locations/caPools/certificateAuthorities`.
47   * @param ActivateCertificateAuthorityRequest $postBody
48   * @param array $optParams Optional parameters.
49   * @return Operation
50   */
51  public function activate($name, ActivateCertificateAuthorityRequest $postBody, $optParams = [])
52  {
53    $params = ['name' => $name, 'postBody' => $postBody];
54    $params = array_merge($params, $optParams);
55    return $this->call('activate', [$params], Operation::class);
56  }
57  /**
58   * Create a new CertificateAuthority in a given Project and Location.
59   * (certificateAuthorities.create)
60   *
61   * @param string $parent Required. The resource name of the CaPool associated
62   * with the CertificateAuthorities, in the format `projects/locations/caPools`.
63   * @param CertificateAuthority $postBody
64   * @param array $optParams Optional parameters.
65   *
66   * @opt_param string certificateAuthorityId Required. It must be unique within a
67   * location and match the regular expression `[a-zA-Z0-9_-]{1,63}`
68   * @opt_param string requestId Optional. An ID to identify requests. Specify a
69   * unique request ID so that if you must retry your request, the server will
70   * know to ignore the request if it has already been completed. The server will
71   * guarantee that for at least 60 minutes since the first request. For example,
72   * consider a situation where you make an initial request and t he request times
73   * out. If you make the request again with the same request ID, the server can
74   * check if original operation with the same request ID was received, and if so,
75   * will ignore the second request. This prevents clients from accidentally
76   * creating duplicate commitments. The request ID must be a valid UUID with the
77   * exception that zero UUID is not supported
78   * (00000000-0000-0000-0000-000000000000).
79   * @return Operation
80   */
81  public function create($parent, CertificateAuthority $postBody, $optParams = [])
82  {
83    $params = ['parent' => $parent, 'postBody' => $postBody];
84    $params = array_merge($params, $optParams);
85    return $this->call('create', [$params], Operation::class);
86  }
87  /**
88   * Delete a CertificateAuthority. (certificateAuthorities.delete)
89   *
90   * @param string $name Required. The resource name for this CertificateAuthority
91   * in the format `projects/locations/caPools/certificateAuthorities`.
92   * @param array $optParams Optional parameters.
93   *
94   * @opt_param bool ignoreActiveCertificates Optional. This field allows the CA
95   * to be deleted even if the CA has active certs. Active certs include both
96   * unrevoked and unexpired certs.
97   * @opt_param string requestId Optional. An ID to identify requests. Specify a
98   * unique request ID so that if you must retry your request, the server will
99   * know to ignore the request if it has already been completed. The server will
100   * guarantee that for at least 60 minutes since the first request. For example,
101   * consider a situation where you make an initial request and t he request times
102   * out. If you make the request again with the same request ID, the server can
103   * check if original operation with the same request ID was received, and if so,
104   * will ignore the second request. This prevents clients from accidentally
105   * creating duplicate commitments. The request ID must be a valid UUID with the
106   * exception that zero UUID is not supported
107   * (00000000-0000-0000-0000-000000000000).
108   * @opt_param bool skipGracePeriod Optional. If this flag is set, the
109   * Certificate Authority will be deleted as soon as possible without a 30-day
110   * grace period where undeletion would have been allowed. If you proceed, there
111   * will be no way to recover this CA.
112   * @return Operation
113   */
114  public function delete($name, $optParams = [])
115  {
116    $params = ['name' => $name];
117    $params = array_merge($params, $optParams);
118    return $this->call('delete', [$params], Operation::class);
119  }
120  /**
121   * Disable a CertificateAuthority. (certificateAuthorities.disable)
122   *
123   * @param string $name Required. The resource name for this CertificateAuthority
124   * in the format `projects/locations/caPools/certificateAuthorities`.
125   * @param DisableCertificateAuthorityRequest $postBody
126   * @param array $optParams Optional parameters.
127   * @return Operation
128   */
129  public function disable($name, DisableCertificateAuthorityRequest $postBody, $optParams = [])
130  {
131    $params = ['name' => $name, 'postBody' => $postBody];
132    $params = array_merge($params, $optParams);
133    return $this->call('disable', [$params], Operation::class);
134  }
135  /**
136   * Enable a CertificateAuthority. (certificateAuthorities.enable)
137   *
138   * @param string $name Required. The resource name for this CertificateAuthority
139   * in the format `projects/locations/caPools/certificateAuthorities`.
140   * @param EnableCertificateAuthorityRequest $postBody
141   * @param array $optParams Optional parameters.
142   * @return Operation
143   */
144  public function enable($name, EnableCertificateAuthorityRequest $postBody, $optParams = [])
145  {
146    $params = ['name' => $name, 'postBody' => $postBody];
147    $params = array_merge($params, $optParams);
148    return $this->call('enable', [$params], Operation::class);
149  }
150  /**
151   * Fetch a certificate signing request (CSR) from a CertificateAuthority that is
152   * in state AWAITING_USER_ACTIVATION and is of type SUBORDINATE. The CSR must
153   * then be signed by the desired parent Certificate Authority, which could be
154   * another CertificateAuthority resource, or could be an on-prem certificate
155   * authority. See also ActivateCertificateAuthority.
156   * (certificateAuthorities.fetch)
157   *
158   * @param string $name Required. The resource name for this CertificateAuthority
159   * in the format `projects/locations/caPools/certificateAuthorities`.
160   * @param array $optParams Optional parameters.
161   * @return FetchCertificateAuthorityCsrResponse
162   */
163  public function fetch($name, $optParams = [])
164  {
165    $params = ['name' => $name];
166    $params = array_merge($params, $optParams);
167    return $this->call('fetch', [$params], FetchCertificateAuthorityCsrResponse::class);
168  }
169  /**
170   * Returns a CertificateAuthority. (certificateAuthorities.get)
171   *
172   * @param string $name Required. The name of the CertificateAuthority to get.
173   * @param array $optParams Optional parameters.
174   * @return CertificateAuthority
175   */
176  public function get($name, $optParams = [])
177  {
178    $params = ['name' => $name];
179    $params = array_merge($params, $optParams);
180    return $this->call('get', [$params], CertificateAuthority::class);
181  }
182  /**
183   * Lists CertificateAuthorities.
184   * (certificateAuthorities.listProjectsLocationsCaPoolsCertificateAuthorities)
185   *
186   * @param string $parent Required. The resource name of the CaPool associated
187   * with the CertificateAuthorities, in the format `projects/locations/caPools`.
188   * @param array $optParams Optional parameters.
189   *
190   * @opt_param string filter Optional. Only include resources that match the
191   * filter in the response.
192   * @opt_param string orderBy Optional. Specify how the results should be sorted.
193   * @opt_param int pageSize Optional. Limit on the number of
194   * CertificateAuthorities to include in the response. Further
195   * CertificateAuthorities can subsequently be obtained by including the
196   * ListCertificateAuthoritiesResponse.next_page_token in a subsequent request.
197   * If unspecified, the server will pick an appropriate default.
198   * @opt_param string pageToken Optional. Pagination token, returned earlier via
199   * ListCertificateAuthoritiesResponse.next_page_token.
200   * @return ListCertificateAuthoritiesResponse
201   */
202  public function listProjectsLocationsCaPoolsCertificateAuthorities($parent, $optParams = [])
203  {
204    $params = ['parent' => $parent];
205    $params = array_merge($params, $optParams);
206    return $this->call('list', [$params], ListCertificateAuthoritiesResponse::class);
207  }
208  /**
209   * Update a CertificateAuthority. (certificateAuthorities.patch)
210   *
211   * @param string $name Output only. The resource name for this
212   * CertificateAuthority in the format
213   * `projects/locations/caPools/certificateAuthorities`.
214   * @param CertificateAuthority $postBody
215   * @param array $optParams Optional parameters.
216   *
217   * @opt_param string requestId Optional. An ID to identify requests. Specify a
218   * unique request ID so that if you must retry your request, the server will
219   * know to ignore the request if it has already been completed. The server will
220   * guarantee that for at least 60 minutes since the first request. For example,
221   * consider a situation where you make an initial request and t he request times
222   * out. If you make the request again with the same request ID, the server can
223   * check if original operation with the same request ID was received, and if so,
224   * will ignore the second request. This prevents clients from accidentally
225   * creating duplicate commitments. The request ID must be a valid UUID with the
226   * exception that zero UUID is not supported
227   * (00000000-0000-0000-0000-000000000000).
228   * @opt_param string updateMask Required. A list of fields to be updated in this
229   * request.
230   * @return Operation
231   */
232  public function patch($name, CertificateAuthority $postBody, $optParams = [])
233  {
234    $params = ['name' => $name, 'postBody' => $postBody];
235    $params = array_merge($params, $optParams);
236    return $this->call('patch', [$params], Operation::class);
237  }
238  /**
239   * Undelete a CertificateAuthority that has been deleted.
240   * (certificateAuthorities.undelete)
241   *
242   * @param string $name Required. The resource name for this CertificateAuthority
243   * in the format `projects/locations/caPools/certificateAuthorities`.
244   * @param UndeleteCertificateAuthorityRequest $postBody
245   * @param array $optParams Optional parameters.
246   * @return Operation
247   */
248  public function undelete($name, UndeleteCertificateAuthorityRequest $postBody, $optParams = [])
249  {
250    $params = ['name' => $name, 'postBody' => $postBody];
251    $params = array_merge($params, $optParams);
252    return $this->call('undelete', [$params], Operation::class);
253  }
254}
255
256// Adding a class alias for backwards compatibility with the previous class name.
257class_alias(ProjectsLocationsCaPoolsCertificateAuthorities::class, 'Google_Service_CertificateAuthorityService_Resource_ProjectsLocationsCaPoolsCertificateAuthorities');
258