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\CaPool;
21use Google\Service\CertificateAuthorityService\FetchCaCertsRequest;
22use Google\Service\CertificateAuthorityService\FetchCaCertsResponse;
23use Google\Service\CertificateAuthorityService\ListCaPoolsResponse;
24use Google\Service\CertificateAuthorityService\Operation;
25use Google\Service\CertificateAuthorityService\Policy;
26use Google\Service\CertificateAuthorityService\SetIamPolicyRequest;
27use Google\Service\CertificateAuthorityService\TestIamPermissionsRequest;
28use Google\Service\CertificateAuthorityService\TestIamPermissionsResponse;
29
30/**
31 * The "caPools" collection of methods.
32 * Typical usage is:
33 *  <code>
34 *   $privatecaService = new Google\Service\CertificateAuthorityService(...);
35 *   $caPools = $privatecaService->caPools;
36 *  </code>
37 */
38class ProjectsLocationsCaPools extends \Google\Service\Resource
39{
40  /**
41   * Create a CaPool. (caPools.create)
42   *
43   * @param string $parent Required. The resource name of the location associated
44   * with the CaPool, in the format `projects/locations`.
45   * @param CaPool $postBody
46   * @param array $optParams Optional parameters.
47   *
48   * @opt_param string caPoolId Required. It must be unique within a location and
49   * match the regular expression `[a-zA-Z0-9_-]{1,63}`
50   * @opt_param string requestId Optional. An ID to identify requests. Specify a
51   * unique request ID so that if you must retry your request, the server will
52   * know to ignore the request if it has already been completed. The server will
53   * guarantee that for at least 60 minutes since the first request. For example,
54   * consider a situation where you make an initial request and t he request times
55   * out. If you make the request again with the same request ID, the server can
56   * check if original operation with the same request ID was received, and if so,
57   * will ignore the second request. This prevents clients from accidentally
58   * creating duplicate commitments. The request ID must be a valid UUID with the
59   * exception that zero UUID is not supported
60   * (00000000-0000-0000-0000-000000000000).
61   * @return Operation
62   */
63  public function create($parent, CaPool $postBody, $optParams = [])
64  {
65    $params = ['parent' => $parent, 'postBody' => $postBody];
66    $params = array_merge($params, $optParams);
67    return $this->call('create', [$params], Operation::class);
68  }
69  /**
70   * Delete a CaPool. (caPools.delete)
71   *
72   * @param string $name Required. The resource name for this CaPool in the format
73   * `projects/locations/caPools`.
74   * @param array $optParams Optional parameters.
75   *
76   * @opt_param string requestId Optional. An ID to identify requests. Specify a
77   * unique request ID so that if you must retry your request, the server will
78   * know to ignore the request if it has already been completed. The server will
79   * guarantee that for at least 60 minutes since the first request. For example,
80   * consider a situation where you make an initial request and t he request times
81   * out. If you make the request again with the same request ID, the server can
82   * check if original operation with the same request ID was received, and if so,
83   * will ignore the second request. This prevents clients from accidentally
84   * creating duplicate commitments. The request ID must be a valid UUID with the
85   * exception that zero UUID is not supported
86   * (00000000-0000-0000-0000-000000000000).
87   * @return Operation
88   */
89  public function delete($name, $optParams = [])
90  {
91    $params = ['name' => $name];
92    $params = array_merge($params, $optParams);
93    return $this->call('delete', [$params], Operation::class);
94  }
95  /**
96   * FetchCaCerts returns the current trust anchor for the CaPool. This will
97   * include CA certificate chains for all ACTIVE CertificateAuthority resources
98   * in the CaPool. (caPools.fetchCaCerts)
99   *
100   * @param string $caPool Required. The resource name for the CaPool in the
101   * format `projects/locations/caPools`.
102   * @param FetchCaCertsRequest $postBody
103   * @param array $optParams Optional parameters.
104   * @return FetchCaCertsResponse
105   */
106  public function fetchCaCerts($caPool, FetchCaCertsRequest $postBody, $optParams = [])
107  {
108    $params = ['caPool' => $caPool, 'postBody' => $postBody];
109    $params = array_merge($params, $optParams);
110    return $this->call('fetchCaCerts', [$params], FetchCaCertsResponse::class);
111  }
112  /**
113   * Returns a CaPool. (caPools.get)
114   *
115   * @param string $name Required. The name of the CaPool to get.
116   * @param array $optParams Optional parameters.
117   * @return CaPool
118   */
119  public function get($name, $optParams = [])
120  {
121    $params = ['name' => $name];
122    $params = array_merge($params, $optParams);
123    return $this->call('get', [$params], CaPool::class);
124  }
125  /**
126   * Gets the access control policy for a resource. Returns an empty policy if the
127   * resource exists and does not have a policy set. (caPools.getIamPolicy)
128   *
129   * @param string $resource REQUIRED: The resource for which the policy is being
130   * requested. See the operation documentation for the appropriate value for this
131   * field.
132   * @param array $optParams Optional parameters.
133   *
134   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
135   * version that will be used to format the policy. Valid values are 0, 1, and 3.
136   * Requests specifying an invalid value will be rejected. Requests for policies
137   * with any conditional role bindings must specify version 3. Policies with no
138   * conditional role bindings may specify any valid value or leave the field
139   * unset. The policy in the response might use the policy version that you
140   * specified, or it might use a lower policy version. For example, if you
141   * specify version 3, but the policy has no conditional role bindings, the
142   * response uses version 1. To learn which resources support conditions in their
143   * IAM policies, see the [IAM
144   * documentation](https://cloud.google.com/iam/help/conditions/resource-
145   * policies).
146   * @return Policy
147   */
148  public function getIamPolicy($resource, $optParams = [])
149  {
150    $params = ['resource' => $resource];
151    $params = array_merge($params, $optParams);
152    return $this->call('getIamPolicy', [$params], Policy::class);
153  }
154  /**
155   * Lists CaPools. (caPools.listProjectsLocationsCaPools)
156   *
157   * @param string $parent Required. The resource name of the location associated
158   * with the CaPools, in the format `projects/locations`.
159   * @param array $optParams Optional parameters.
160   *
161   * @opt_param string filter Optional. Only include resources that match the
162   * filter in the response.
163   * @opt_param string orderBy Optional. Specify how the results should be sorted.
164   * @opt_param int pageSize Optional. Limit on the number of CaPools to include
165   * in the response. Further CaPools can subsequently be obtained by including
166   * the ListCaPoolsResponse.next_page_token in a subsequent request. If
167   * unspecified, the server will pick an appropriate default.
168   * @opt_param string pageToken Optional. Pagination token, returned earlier via
169   * ListCaPoolsResponse.next_page_token.
170   * @return ListCaPoolsResponse
171   */
172  public function listProjectsLocationsCaPools($parent, $optParams = [])
173  {
174    $params = ['parent' => $parent];
175    $params = array_merge($params, $optParams);
176    return $this->call('list', [$params], ListCaPoolsResponse::class);
177  }
178  /**
179   * Update a CaPool. (caPools.patch)
180   *
181   * @param string $name Output only. The resource name for this CaPool in the
182   * format `projects/locations/caPools`.
183   * @param CaPool $postBody
184   * @param array $optParams Optional parameters.
185   *
186   * @opt_param string requestId Optional. An ID to identify requests. Specify a
187   * unique request ID so that if you must retry your request, the server will
188   * know to ignore the request if it has already been completed. The server will
189   * guarantee that for at least 60 minutes since the first request. For example,
190   * consider a situation where you make an initial request and t he request times
191   * out. If you make the request again with the same request ID, the server can
192   * check if original operation with the same request ID was received, and if so,
193   * will ignore the second request. This prevents clients from accidentally
194   * creating duplicate commitments. The request ID must be a valid UUID with the
195   * exception that zero UUID is not supported
196   * (00000000-0000-0000-0000-000000000000).
197   * @opt_param string updateMask Required. A list of fields to be updated in this
198   * request.
199   * @return Operation
200   */
201  public function patch($name, CaPool $postBody, $optParams = [])
202  {
203    $params = ['name' => $name, 'postBody' => $postBody];
204    $params = array_merge($params, $optParams);
205    return $this->call('patch', [$params], Operation::class);
206  }
207  /**
208   * Sets the access control policy on the specified resource. Replaces any
209   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
210   * `PERMISSION_DENIED` errors. (caPools.setIamPolicy)
211   *
212   * @param string $resource REQUIRED: The resource for which the policy is being
213   * specified. See the operation documentation for the appropriate value for this
214   * field.
215   * @param SetIamPolicyRequest $postBody
216   * @param array $optParams Optional parameters.
217   * @return Policy
218   */
219  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
220  {
221    $params = ['resource' => $resource, 'postBody' => $postBody];
222    $params = array_merge($params, $optParams);
223    return $this->call('setIamPolicy', [$params], Policy::class);
224  }
225  /**
226   * Returns permissions that a caller has on the specified resource. If the
227   * resource does not exist, this will return an empty set of permissions, not a
228   * `NOT_FOUND` error. Note: This operation is designed to be used for building
229   * permission-aware UIs and command-line tools, not for authorization checking.
230   * This operation may "fail open" without warning. (caPools.testIamPermissions)
231   *
232   * @param string $resource REQUIRED: The resource for which the policy detail is
233   * being requested. See the operation documentation for the appropriate value
234   * for this field.
235   * @param TestIamPermissionsRequest $postBody
236   * @param array $optParams Optional parameters.
237   * @return TestIamPermissionsResponse
238   */
239  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
240  {
241    $params = ['resource' => $resource, 'postBody' => $postBody];
242    $params = array_merge($params, $optParams);
243    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
244  }
245}
246
247// Adding a class alias for backwards compatibility with the previous class name.
248class_alias(ProjectsLocationsCaPools::class, 'Google_Service_CertificateAuthorityService_Resource_ProjectsLocationsCaPools');
249