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 |
|
---|
18 | namespace Google\Service\CloudDeploy\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudDeploy\ListTargetsResponse;
|
---|
21 | use Google\Service\CloudDeploy\Operation;
|
---|
22 | use Google\Service\CloudDeploy\Policy;
|
---|
23 | use Google\Service\CloudDeploy\SetIamPolicyRequest;
|
---|
24 | use Google\Service\CloudDeploy\Target;
|
---|
25 | use Google\Service\CloudDeploy\TestIamPermissionsRequest;
|
---|
26 | use Google\Service\CloudDeploy\TestIamPermissionsResponse;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The "targets" collection of methods.
|
---|
30 | * Typical usage is:
|
---|
31 | * <code>
|
---|
32 | * $clouddeployService = new Google\Service\CloudDeploy(...);
|
---|
33 | * $targets = $clouddeployService->projects_locations_targets;
|
---|
34 | * </code>
|
---|
35 | */
|
---|
36 | class ProjectsLocationsTargets extends \Google\Service\Resource
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Creates a new Target in a given project and location. (targets.create)
|
---|
40 | *
|
---|
41 | * @param string $parent Required. The parent collection in which the `Target`
|
---|
42 | * must be created. The format is
|
---|
43 | * `projects/{project_id}/locations/{location_name}`.
|
---|
44 | * @param Target $postBody
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | *
|
---|
47 | * @opt_param string requestId Optional. A request ID to identify requests.
|
---|
48 | * Specify a unique request ID so that if you must retry your request, the
|
---|
49 | * server knows to ignore the request if it has already been completed. The
|
---|
50 | * server guarantees that for at least 60 minutes after the first request. For
|
---|
51 | * example, consider a situation where you make an initial request and the
|
---|
52 | * request times out. If you make the request again with the same request ID,
|
---|
53 | * the server can check if original operation with the same request ID was
|
---|
54 | * received, and if so, will ignore the second request. This prevents clients
|
---|
55 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
56 | * valid UUID with the exception that zero UUID is not supported
|
---|
57 | * (00000000-0000-0000-0000-000000000000).
|
---|
58 | * @opt_param string targetId Required. ID of the `Target`.
|
---|
59 | * @opt_param bool validateOnly Optional. If set to true, the request is
|
---|
60 | * validated and the user is provided with an expected result, but no actual
|
---|
61 | * change is made.
|
---|
62 | * @return Operation
|
---|
63 | * @throws \Google\Service\Exception
|
---|
64 | */
|
---|
65 | public function create($parent, Target $postBody, $optParams = [])
|
---|
66 | {
|
---|
67 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
68 | $params = array_merge($params, $optParams);
|
---|
69 | return $this->call('create', [$params], Operation::class);
|
---|
70 | }
|
---|
71 | /**
|
---|
72 | * Deletes a single Target. (targets.delete)
|
---|
73 | *
|
---|
74 | * @param string $name Required. The name of the `Target` to delete. The format
|
---|
75 | * is `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
|
---|
76 | * @param array $optParams Optional parameters.
|
---|
77 | *
|
---|
78 | * @opt_param bool allowMissing Optional. If set to true, then deleting an
|
---|
79 | * already deleted or non-existing `Target` will succeed.
|
---|
80 | * @opt_param string etag Optional. This checksum is computed by the server
|
---|
81 | * based on the value of other fields, and may be sent on update and delete
|
---|
82 | * requests to ensure the client has an up-to-date value before proceeding.
|
---|
83 | * @opt_param string requestId Optional. A request ID to identify requests.
|
---|
84 | * Specify a unique request ID so that if you must retry your request, the
|
---|
85 | * server knows to ignore the request if it has already been completed. The
|
---|
86 | * server guarantees that for at least 60 minutes after the first request. For
|
---|
87 | * example, consider a situation where you make an initial request and the
|
---|
88 | * request times out. If you make the request again with the same request ID,
|
---|
89 | * the server can check if original operation with the same request ID was
|
---|
90 | * received, and if so, will ignore the second request. This prevents clients
|
---|
91 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
92 | * valid UUID with the exception that zero UUID is not supported
|
---|
93 | * (00000000-0000-0000-0000-000000000000).
|
---|
94 | * @opt_param bool validateOnly Optional. If set, validate the request and
|
---|
95 | * preview the review, but do not actually post it.
|
---|
96 | * @return Operation
|
---|
97 | * @throws \Google\Service\Exception
|
---|
98 | */
|
---|
99 | public function delete($name, $optParams = [])
|
---|
100 | {
|
---|
101 | $params = ['name' => $name];
|
---|
102 | $params = array_merge($params, $optParams);
|
---|
103 | return $this->call('delete', [$params], Operation::class);
|
---|
104 | }
|
---|
105 | /**
|
---|
106 | * Gets details of a single Target. (targets.get)
|
---|
107 | *
|
---|
108 | * @param string $name Required. Name of the `Target`. Format must be
|
---|
109 | * `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
|
---|
110 | * @param array $optParams Optional parameters.
|
---|
111 | * @return Target
|
---|
112 | * @throws \Google\Service\Exception
|
---|
113 | */
|
---|
114 | public function get($name, $optParams = [])
|
---|
115 | {
|
---|
116 | $params = ['name' => $name];
|
---|
117 | $params = array_merge($params, $optParams);
|
---|
118 | return $this->call('get', [$params], Target::class);
|
---|
119 | }
|
---|
120 | /**
|
---|
121 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
122 | * resource exists and does not have a policy set. (targets.getIamPolicy)
|
---|
123 | *
|
---|
124 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
125 | * requested. See [Resource
|
---|
126 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
127 | * appropriate value for this field.
|
---|
128 | * @param array $optParams Optional parameters.
|
---|
129 | *
|
---|
130 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
131 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
132 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
133 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
134 | * conditional role bindings may specify any valid value or leave the field
|
---|
135 | * unset. The policy in the response might use the policy version that you
|
---|
136 | * specified, or it might use a lower policy version. For example, if you
|
---|
137 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
138 | * response uses version 1. To learn which resources support conditions in their
|
---|
139 | * IAM policies, see the [IAM
|
---|
140 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
141 | * policies).
|
---|
142 | * @return Policy
|
---|
143 | * @throws \Google\Service\Exception
|
---|
144 | */
|
---|
145 | public function getIamPolicy($resource, $optParams = [])
|
---|
146 | {
|
---|
147 | $params = ['resource' => $resource];
|
---|
148 | $params = array_merge($params, $optParams);
|
---|
149 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
150 | }
|
---|
151 | /**
|
---|
152 | * Lists Targets in a given project and location.
|
---|
153 | * (targets.listProjectsLocationsTargets)
|
---|
154 | *
|
---|
155 | * @param string $parent Required. The parent, which owns this collection of
|
---|
156 | * targets. Format must be `projects/{project_id}/locations/{location_name}`.
|
---|
157 | * @param array $optParams Optional parameters.
|
---|
158 | *
|
---|
159 | * @opt_param string filter Optional. Filter targets to be returned. See
|
---|
160 | * https://google.aip.dev/160 for more details.
|
---|
161 | * @opt_param string orderBy Optional. Field to sort by. See
|
---|
162 | * https://google.aip.dev/132#ordering for more details.
|
---|
163 | * @opt_param int pageSize Optional. The maximum number of `Target` objects to
|
---|
164 | * return. The service may return fewer than this value. If unspecified, at most
|
---|
165 | * 50 `Target` objects will be returned. The maximum value is 1000; values above
|
---|
166 | * 1000 will be set to 1000.
|
---|
167 | * @opt_param string pageToken Optional. A page token, received from a previous
|
---|
168 | * `ListTargets` call. Provide this to retrieve the subsequent page. When
|
---|
169 | * paginating, all other provided parameters match the call that provided the
|
---|
170 | * page token.
|
---|
171 | * @return ListTargetsResponse
|
---|
172 | * @throws \Google\Service\Exception
|
---|
173 | */
|
---|
174 | public function listProjectsLocationsTargets($parent, $optParams = [])
|
---|
175 | {
|
---|
176 | $params = ['parent' => $parent];
|
---|
177 | $params = array_merge($params, $optParams);
|
---|
178 | return $this->call('list', [$params], ListTargetsResponse::class);
|
---|
179 | }
|
---|
180 | /**
|
---|
181 | * Updates the parameters of a single Target. (targets.patch)
|
---|
182 | *
|
---|
183 | * @param string $name Optional. Name of the `Target`. Format is
|
---|
184 | * `projects/{project}/locations/{location}/targets/{target}`. The `target`
|
---|
185 | * component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
|
---|
186 | * @param Target $postBody
|
---|
187 | * @param array $optParams Optional parameters.
|
---|
188 | *
|
---|
189 | * @opt_param bool allowMissing Optional. If set to true, updating a `Target`
|
---|
190 | * that does not exist will result in the creation of a new `Target`.
|
---|
191 | * @opt_param string requestId Optional. A request ID to identify requests.
|
---|
192 | * Specify a unique request ID so that if you must retry your request, the
|
---|
193 | * server knows to ignore the request if it has already been completed. The
|
---|
194 | * server guarantees that for at least 60 minutes after the first request. For
|
---|
195 | * example, consider a situation where you make an initial request and the
|
---|
196 | * request times out. If you make the request again with the same request ID,
|
---|
197 | * the server can check if original operation with the same request ID was
|
---|
198 | * received, and if so, will ignore the second request. This prevents clients
|
---|
199 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
200 | * valid UUID with the exception that zero UUID is not supported
|
---|
201 | * (00000000-0000-0000-0000-000000000000).
|
---|
202 | * @opt_param string updateMask Required. Field mask is used to specify the
|
---|
203 | * fields to be overwritten by the update in the `Target` resource. The fields
|
---|
204 | * specified in the update_mask are relative to the resource, not the full
|
---|
205 | * request. A field will be overwritten if it's in the mask. If the user doesn't
|
---|
206 | * provide a mask then all fields are overwritten.
|
---|
207 | * @opt_param bool validateOnly Optional. If set to true, the request is
|
---|
208 | * validated and the user is provided with an expected result, but no actual
|
---|
209 | * change is made.
|
---|
210 | * @return Operation
|
---|
211 | * @throws \Google\Service\Exception
|
---|
212 | */
|
---|
213 | public function patch($name, Target $postBody, $optParams = [])
|
---|
214 | {
|
---|
215 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
216 | $params = array_merge($params, $optParams);
|
---|
217 | return $this->call('patch', [$params], Operation::class);
|
---|
218 | }
|
---|
219 | /**
|
---|
220 | * Sets the access control policy on the specified resource. Replaces any
|
---|
221 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
222 | * `PERMISSION_DENIED` errors. (targets.setIamPolicy)
|
---|
223 | *
|
---|
224 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
225 | * specified. See [Resource
|
---|
226 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
227 | * appropriate value for this field.
|
---|
228 | * @param SetIamPolicyRequest $postBody
|
---|
229 | * @param array $optParams Optional parameters.
|
---|
230 | * @return Policy
|
---|
231 | * @throws \Google\Service\Exception
|
---|
232 | */
|
---|
233 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
234 | {
|
---|
235 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
236 | $params = array_merge($params, $optParams);
|
---|
237 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
238 | }
|
---|
239 | /**
|
---|
240 | * Returns permissions that a caller has on the specified resource. If the
|
---|
241 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
242 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
243 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
244 | * This operation may "fail open" without warning. (targets.testIamPermissions)
|
---|
245 | *
|
---|
246 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
247 | * being requested. See [Resource
|
---|
248 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
249 | * appropriate value for this field.
|
---|
250 | * @param TestIamPermissionsRequest $postBody
|
---|
251 | * @param array $optParams Optional parameters.
|
---|
252 | * @return TestIamPermissionsResponse
|
---|
253 | * @throws \Google\Service\Exception
|
---|
254 | */
|
---|
255 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
256 | {
|
---|
257 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
258 | $params = array_merge($params, $optParams);
|
---|
259 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
260 | }
|
---|
261 | }
|
---|
262 |
|
---|
263 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
264 | class_alias(ProjectsLocationsTargets::class, 'Google_Service_CloudDeploy_Resource_ProjectsLocationsTargets');
|
---|