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