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\CloudAlloyDBAdmin\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudAlloyDBAdmin\ConnectionInfo;
|
---|
21 | use Google\Service\CloudAlloyDBAdmin\FailoverInstanceRequest;
|
---|
22 | use Google\Service\CloudAlloyDBAdmin\InjectFaultRequest;
|
---|
23 | use Google\Service\CloudAlloyDBAdmin\Instance;
|
---|
24 | use Google\Service\CloudAlloyDBAdmin\ListInstancesResponse;
|
---|
25 | use Google\Service\CloudAlloyDBAdmin\Operation;
|
---|
26 | use Google\Service\CloudAlloyDBAdmin\RestartInstanceRequest;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The "instances" collection of methods.
|
---|
30 | * Typical usage is:
|
---|
31 | * <code>
|
---|
32 | * $alloydbService = new Google\Service\CloudAlloyDBAdmin(...);
|
---|
33 | * $instances = $alloydbService->projects_locations_clusters_instances;
|
---|
34 | * </code>
|
---|
35 | */
|
---|
36 | class ProjectsLocationsClustersInstances extends \Google\Service\Resource
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Creates a new Instance in a given project and location. (instances.create)
|
---|
40 | *
|
---|
41 | * @param string $parent Required. The name of the parent resource. For the
|
---|
42 | * required format, see the comment on the Instance.name field.
|
---|
43 | * @param Instance $postBody
|
---|
44 | * @param array $optParams Optional parameters.
|
---|
45 | *
|
---|
46 | * @opt_param string instanceId Required. ID of the requesting object.
|
---|
47 | * @opt_param string requestId Optional. An optional request ID to identify
|
---|
48 | * requests. Specify a unique request ID so that if you must retry your request,
|
---|
49 | * the server ignores the request if it has already been completed. The server
|
---|
50 | * guarantees that for at least 60 minutes since the first request. For example,
|
---|
51 | * consider a situation where you make an initial request and the request times
|
---|
52 | * out. If you make the request again with the same request ID, the server can
|
---|
53 | * check if the original operation with the same request ID was received, and if
|
---|
54 | * so, ignores the second request. This prevents clients from accidentally
|
---|
55 | * creating duplicate commitments. The request ID must be a valid UUID with the
|
---|
56 | * exception that zero UUID is not supported
|
---|
57 | * (00000000-0000-0000-0000-000000000000).
|
---|
58 | * @opt_param bool validateOnly Optional. If set, performs request validation,
|
---|
59 | * for example, permission checks and any other type of validation, but does not
|
---|
60 | * actually execute the create request.
|
---|
61 | * @return Operation
|
---|
62 | * @throws \Google\Service\Exception
|
---|
63 | */
|
---|
64 | public function create($parent, Instance $postBody, $optParams = [])
|
---|
65 | {
|
---|
66 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
67 | $params = array_merge($params, $optParams);
|
---|
68 | return $this->call('create', [$params], Operation::class);
|
---|
69 | }
|
---|
70 | /**
|
---|
71 | * Creates a new SECONDARY Instance in a given project and location.
|
---|
72 | * (instances.createsecondary)
|
---|
73 | *
|
---|
74 | * @param string $parent Required. The name of the parent resource. For the
|
---|
75 | * required format, see the comment on the Instance.name field.
|
---|
76 | * @param Instance $postBody
|
---|
77 | * @param array $optParams Optional parameters.
|
---|
78 | *
|
---|
79 | * @opt_param string instanceId Required. ID of the requesting object.
|
---|
80 | * @opt_param string requestId Optional. An optional request ID to identify
|
---|
81 | * requests. Specify a unique request ID so that if you must retry your request,
|
---|
82 | * the server ignores the request if it has already been completed. The server
|
---|
83 | * guarantees that for at least 60 minutes since the first request. For example,
|
---|
84 | * consider a situation where you make an initial request and the request times
|
---|
85 | * out. If you make the request again with the same request ID, the server can
|
---|
86 | * check if the original operation with the same request ID was received, and if
|
---|
87 | * so, ignores the second request. This prevents clients from accidentally
|
---|
88 | * creating duplicate commitments. The request ID must be a valid UUID with the
|
---|
89 | * exception that zero UUID is not supported
|
---|
90 | * (00000000-0000-0000-0000-000000000000).
|
---|
91 | * @opt_param bool validateOnly Optional. If set, performs request validation,
|
---|
92 | * for example, permission checks and any other type of validation, but does not
|
---|
93 | * actually execute the create request.
|
---|
94 | * @return Operation
|
---|
95 | * @throws \Google\Service\Exception
|
---|
96 | */
|
---|
97 | public function createsecondary($parent, Instance $postBody, $optParams = [])
|
---|
98 | {
|
---|
99 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
100 | $params = array_merge($params, $optParams);
|
---|
101 | return $this->call('createsecondary', [$params], Operation::class);
|
---|
102 | }
|
---|
103 | /**
|
---|
104 | * Deletes a single Instance. (instances.delete)
|
---|
105 | *
|
---|
106 | * @param string $name Required. The name of the resource. For the required
|
---|
107 | * format, see the comment on the Instance.name field.
|
---|
108 | * @param array $optParams Optional parameters.
|
---|
109 | *
|
---|
110 | * @opt_param string etag Optional. The current etag of the Instance. If an etag
|
---|
111 | * is provided and does not match the current etag of the Instance, deletion
|
---|
112 | * will be blocked and an ABORTED error will be returned.
|
---|
113 | * @opt_param string requestId Optional. An optional request ID to identify
|
---|
114 | * requests. Specify a unique request ID so that if you must retry your request,
|
---|
115 | * the server ignores the request if it has already been completed. The server
|
---|
116 | * guarantees that for at least 60 minutes since the first request. For example,
|
---|
117 | * consider a situation where you make an initial request and the request times
|
---|
118 | * out. If you make the request again with the same request ID, the server can
|
---|
119 | * check if the original operation with the same request ID was received, and if
|
---|
120 | * so, ignores the second request. This prevents clients from accidentally
|
---|
121 | * creating duplicate commitments. The request ID must be a valid UUID with the
|
---|
122 | * exception that zero UUID is not supported
|
---|
123 | * (00000000-0000-0000-0000-000000000000).
|
---|
124 | * @opt_param bool validateOnly Optional. If set, performs request validation,
|
---|
125 | * for example, permission checks and any other type of validation, but does not
|
---|
126 | * actually execute the create request.
|
---|
127 | * @return Operation
|
---|
128 | * @throws \Google\Service\Exception
|
---|
129 | */
|
---|
130 | public function delete($name, $optParams = [])
|
---|
131 | {
|
---|
132 | $params = ['name' => $name];
|
---|
133 | $params = array_merge($params, $optParams);
|
---|
134 | return $this->call('delete', [$params], Operation::class);
|
---|
135 | }
|
---|
136 | /**
|
---|
137 | * Forces a Failover for a highly available instance. Failover promotes the HA
|
---|
138 | * standby instance as the new primary. Imperative only. (instances.failover)
|
---|
139 | *
|
---|
140 | * @param string $name Required. The name of the resource. For the required
|
---|
141 | * format, see the comment on the Instance.name field.
|
---|
142 | * @param FailoverInstanceRequest $postBody
|
---|
143 | * @param array $optParams Optional parameters.
|
---|
144 | * @return Operation
|
---|
145 | * @throws \Google\Service\Exception
|
---|
146 | */
|
---|
147 | public function failover($name, FailoverInstanceRequest $postBody, $optParams = [])
|
---|
148 | {
|
---|
149 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
150 | $params = array_merge($params, $optParams);
|
---|
151 | return $this->call('failover', [$params], Operation::class);
|
---|
152 | }
|
---|
153 | /**
|
---|
154 | * Gets details of a single Instance. (instances.get)
|
---|
155 | *
|
---|
156 | * @param string $name Required. The name of the resource. For the required
|
---|
157 | * format, see the comment on the Instance.name field.
|
---|
158 | * @param array $optParams Optional parameters.
|
---|
159 | *
|
---|
160 | * @opt_param string view The view of the instance to return.
|
---|
161 | * @return Instance
|
---|
162 | * @throws \Google\Service\Exception
|
---|
163 | */
|
---|
164 | public function get($name, $optParams = [])
|
---|
165 | {
|
---|
166 | $params = ['name' => $name];
|
---|
167 | $params = array_merge($params, $optParams);
|
---|
168 | return $this->call('get', [$params], Instance::class);
|
---|
169 | }
|
---|
170 | /**
|
---|
171 | * Get instance metadata used for a connection. (instances.getConnectionInfo)
|
---|
172 | *
|
---|
173 | * @param string $parent Required. The name of the parent resource. The required
|
---|
174 | * format is: projects/{project}/locations/{location}/clusters/{cluster}/instanc
|
---|
175 | * es/{instance}
|
---|
176 | * @param array $optParams Optional parameters.
|
---|
177 | *
|
---|
178 | * @opt_param string requestId Optional. An optional request ID to identify
|
---|
179 | * requests. Specify a unique request ID so that if you must retry your request,
|
---|
180 | * the server ignores the request if it has already been completed. The server
|
---|
181 | * guarantees that for at least 60 minutes since the first request. For example,
|
---|
182 | * consider a situation where you make an initial request and the request times
|
---|
183 | * out. If you make the request again with the same request ID, the server can
|
---|
184 | * check if the original operation with the same request ID was received, and if
|
---|
185 | * so, ignores the second request. This prevents clients from accidentally
|
---|
186 | * creating duplicate commitments. The request ID must be a valid UUID with the
|
---|
187 | * exception that zero UUID is not supported
|
---|
188 | * (00000000-0000-0000-0000-000000000000).
|
---|
189 | * @return ConnectionInfo
|
---|
190 | * @throws \Google\Service\Exception
|
---|
191 | */
|
---|
192 | public function getConnectionInfo($parent, $optParams = [])
|
---|
193 | {
|
---|
194 | $params = ['parent' => $parent];
|
---|
195 | $params = array_merge($params, $optParams);
|
---|
196 | return $this->call('getConnectionInfo', [$params], ConnectionInfo::class);
|
---|
197 | }
|
---|
198 | /**
|
---|
199 | * Injects fault in an instance. Imperative only. (instances.injectFault)
|
---|
200 | *
|
---|
201 | * @param string $name Required. The name of the resource. For the required
|
---|
202 | * format, see the comment on the Instance.name field.
|
---|
203 | * @param InjectFaultRequest $postBody
|
---|
204 | * @param array $optParams Optional parameters.
|
---|
205 | * @return Operation
|
---|
206 | * @throws \Google\Service\Exception
|
---|
207 | */
|
---|
208 | public function injectFault($name, InjectFaultRequest $postBody, $optParams = [])
|
---|
209 | {
|
---|
210 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
211 | $params = array_merge($params, $optParams);
|
---|
212 | return $this->call('injectFault', [$params], Operation::class);
|
---|
213 | }
|
---|
214 | /**
|
---|
215 | * Lists Instances in a given project and location.
|
---|
216 | * (instances.listProjectsLocationsClustersInstances)
|
---|
217 | *
|
---|
218 | * @param string $parent Required. The name of the parent resource. For the
|
---|
219 | * required format, see the comment on the Instance.name field. Additionally,
|
---|
220 | * you can perform an aggregated list operation by specifying a value with one
|
---|
221 | * of the following formats: * projects/{project}/locations/-/clusters/- *
|
---|
222 | * projects/{project}/locations/{region}/clusters/-
|
---|
223 | * @param array $optParams Optional parameters.
|
---|
224 | *
|
---|
225 | * @opt_param string filter Optional. Filtering results
|
---|
226 | * @opt_param string orderBy Optional. Hint for how to order the results
|
---|
227 | * @opt_param int pageSize Optional. Requested page size. Server may return
|
---|
228 | * fewer items than requested. If unspecified, server will pick an appropriate
|
---|
229 | * default.
|
---|
230 | * @opt_param string pageToken A token identifying a page of results the server
|
---|
231 | * should return.
|
---|
232 | * @return ListInstancesResponse
|
---|
233 | * @throws \Google\Service\Exception
|
---|
234 | */
|
---|
235 | public function listProjectsLocationsClustersInstances($parent, $optParams = [])
|
---|
236 | {
|
---|
237 | $params = ['parent' => $parent];
|
---|
238 | $params = array_merge($params, $optParams);
|
---|
239 | return $this->call('list', [$params], ListInstancesResponse::class);
|
---|
240 | }
|
---|
241 | /**
|
---|
242 | * Updates the parameters of a single Instance. (instances.patch)
|
---|
243 | *
|
---|
244 | * @param string $name Output only. The name of the instance resource with the
|
---|
245 | * format: * projects/{project}/locations/{region}/clusters/{cluster_id}/instanc
|
---|
246 | * es/{instance_id} where the cluster and instance ID segments should satisfy
|
---|
247 | * the regex expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters
|
---|
248 | * of lowercase letters, numbers, and dashes, starting with a letter, and ending
|
---|
249 | * with a letter or number. For more details see https://google.aip.dev/122. The
|
---|
250 | * prefix of the instance resource name is the name of the parent resource: *
|
---|
251 | * projects/{project}/locations/{region}/clusters/{cluster_id}
|
---|
252 | * @param Instance $postBody
|
---|
253 | * @param array $optParams Optional parameters.
|
---|
254 | *
|
---|
255 | * @opt_param bool allowMissing Optional. If set to true, update succeeds even
|
---|
256 | * if instance is not found. In that case, a new instance is created and
|
---|
257 | * `update_mask` is ignored.
|
---|
258 | * @opt_param string requestId Optional. An optional request ID to identify
|
---|
259 | * requests. Specify a unique request ID so that if you must retry your request,
|
---|
260 | * the server ignores the request if it has already been completed. The server
|
---|
261 | * guarantees that for at least 60 minutes since the first request. For example,
|
---|
262 | * consider a situation where you make an initial request and the request times
|
---|
263 | * out. If you make the request again with the same request ID, the server can
|
---|
264 | * check if the original operation with the same request ID was received, and if
|
---|
265 | * so, ignores the second request. This prevents clients from accidentally
|
---|
266 | * creating duplicate commitments. The request ID must be a valid UUID with the
|
---|
267 | * exception that zero UUID is not supported
|
---|
268 | * (00000000-0000-0000-0000-000000000000).
|
---|
269 | * @opt_param string updateMask Optional. Field mask is used to specify the
|
---|
270 | * fields to be overwritten in the Instance resource by the update. The fields
|
---|
271 | * specified in the update_mask are relative to the resource, not the full
|
---|
272 | * request. A field will be overwritten if it is in the mask. If the user does
|
---|
273 | * not provide a mask then all fields will be overwritten.
|
---|
274 | * @opt_param bool validateOnly Optional. If set, performs request validation,
|
---|
275 | * for example, permission checks and any other type of validation, but does not
|
---|
276 | * actually execute the create request.
|
---|
277 | * @return Operation
|
---|
278 | * @throws \Google\Service\Exception
|
---|
279 | */
|
---|
280 | public function patch($name, Instance $postBody, $optParams = [])
|
---|
281 | {
|
---|
282 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
283 | $params = array_merge($params, $optParams);
|
---|
284 | return $this->call('patch', [$params], Operation::class);
|
---|
285 | }
|
---|
286 | /**
|
---|
287 | * Restart an Instance in a cluster. Imperative only. (instances.restart)
|
---|
288 | *
|
---|
289 | * @param string $name Required. The name of the resource. For the required
|
---|
290 | * format, see the comment on the Instance.name field.
|
---|
291 | * @param RestartInstanceRequest $postBody
|
---|
292 | * @param array $optParams Optional parameters.
|
---|
293 | * @return Operation
|
---|
294 | * @throws \Google\Service\Exception
|
---|
295 | */
|
---|
296 | public function restart($name, RestartInstanceRequest $postBody, $optParams = [])
|
---|
297 | {
|
---|
298 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
299 | $params = array_merge($params, $optParams);
|
---|
300 | return $this->call('restart', [$params], Operation::class);
|
---|
301 | }
|
---|
302 | }
|
---|
303 |
|
---|
304 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
305 | class_alias(ProjectsLocationsClustersInstances::class, 'Google_Service_CloudAlloyDBAdmin_Resource_ProjectsLocationsClustersInstances');
|
---|