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\DatabaseMigrationService\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\DatabaseMigrationService\DemoteDestinationRequest;
|
---|
21 | use Google\Service\DatabaseMigrationService\GenerateSshScriptRequest;
|
---|
22 | use Google\Service\DatabaseMigrationService\GenerateTcpProxyScriptRequest;
|
---|
23 | use Google\Service\DatabaseMigrationService\ListMigrationJobsResponse;
|
---|
24 | use Google\Service\DatabaseMigrationService\MigrationJob;
|
---|
25 | use Google\Service\DatabaseMigrationService\Operation;
|
---|
26 | use Google\Service\DatabaseMigrationService\Policy;
|
---|
27 | use Google\Service\DatabaseMigrationService\PromoteMigrationJobRequest;
|
---|
28 | use Google\Service\DatabaseMigrationService\RestartMigrationJobRequest;
|
---|
29 | use Google\Service\DatabaseMigrationService\ResumeMigrationJobRequest;
|
---|
30 | use Google\Service\DatabaseMigrationService\SetIamPolicyRequest;
|
---|
31 | use Google\Service\DatabaseMigrationService\SshScript;
|
---|
32 | use Google\Service\DatabaseMigrationService\StartMigrationJobRequest;
|
---|
33 | use Google\Service\DatabaseMigrationService\StopMigrationJobRequest;
|
---|
34 | use Google\Service\DatabaseMigrationService\TcpProxyScript;
|
---|
35 | use Google\Service\DatabaseMigrationService\TestIamPermissionsRequest;
|
---|
36 | use Google\Service\DatabaseMigrationService\TestIamPermissionsResponse;
|
---|
37 | use Google\Service\DatabaseMigrationService\VerifyMigrationJobRequest;
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * The "migrationJobs" collection of methods.
|
---|
41 | * Typical usage is:
|
---|
42 | * <code>
|
---|
43 | * $datamigrationService = new Google\Service\DatabaseMigrationService(...);
|
---|
44 | * $migrationJobs = $datamigrationService->projects_locations_migrationJobs;
|
---|
45 | * </code>
|
---|
46 | */
|
---|
47 | class ProjectsLocationsMigrationJobs extends \Google\Service\Resource
|
---|
48 | {
|
---|
49 | /**
|
---|
50 | * Creates a new migration job in a given project and location.
|
---|
51 | * (migrationJobs.create)
|
---|
52 | *
|
---|
53 | * @param string $parent Required. The parent which owns this collection of
|
---|
54 | * migration jobs.
|
---|
55 | * @param MigrationJob $postBody
|
---|
56 | * @param array $optParams Optional parameters.
|
---|
57 | *
|
---|
58 | * @opt_param string migrationJobId Required. The ID of the instance to create.
|
---|
59 | * @opt_param string requestId Optional. A unique ID used to identify the
|
---|
60 | * request. If the server receives two requests with the same ID, then the
|
---|
61 | * second request is ignored. It is recommended to always set this value to a
|
---|
62 | * UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores
|
---|
63 | * (_), and hyphens (-). The maximum length is 40 characters.
|
---|
64 | * @return Operation
|
---|
65 | * @throws \Google\Service\Exception
|
---|
66 | */
|
---|
67 | public function create($parent, MigrationJob $postBody, $optParams = [])
|
---|
68 | {
|
---|
69 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
70 | $params = array_merge($params, $optParams);
|
---|
71 | return $this->call('create', [$params], Operation::class);
|
---|
72 | }
|
---|
73 | /**
|
---|
74 | * Deletes a single migration job. (migrationJobs.delete)
|
---|
75 | *
|
---|
76 | * @param string $name Required. Name of the migration job resource to delete.
|
---|
77 | * @param array $optParams Optional parameters.
|
---|
78 | *
|
---|
79 | * @opt_param bool force The destination CloudSQL connection profile is always
|
---|
80 | * deleted with the migration job. In case of force delete, the destination
|
---|
81 | * CloudSQL replica database is also deleted.
|
---|
82 | * @opt_param string requestId A unique ID used to identify the request. If the
|
---|
83 | * server receives two requests with the same ID, then the second request is
|
---|
84 | * ignored. It is recommended to always set this value to a UUID. The ID must
|
---|
85 | * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
|
---|
86 | * (-). The maximum length is 40 characters.
|
---|
87 | * @return Operation
|
---|
88 | * @throws \Google\Service\Exception
|
---|
89 | */
|
---|
90 | public function delete($name, $optParams = [])
|
---|
91 | {
|
---|
92 | $params = ['name' => $name];
|
---|
93 | $params = array_merge($params, $optParams);
|
---|
94 | return $this->call('delete', [$params], Operation::class);
|
---|
95 | }
|
---|
96 | /**
|
---|
97 | * Demotes the destination database to become a read replica of the source. This
|
---|
98 | * is applicable for the following migrations: 1. MySQL to Cloud SQL for MySQL
|
---|
99 | * 2. PostgreSQL to Cloud SQL for PostgreSQL 3. PostgreSQL to AlloyDB for
|
---|
100 | * PostgreSQL. (migrationJobs.demoteDestination)
|
---|
101 | *
|
---|
102 | * @param string $name Name of the migration job resource to demote its
|
---|
103 | * destination.
|
---|
104 | * @param DemoteDestinationRequest $postBody
|
---|
105 | * @param array $optParams Optional parameters.
|
---|
106 | * @return Operation
|
---|
107 | * @throws \Google\Service\Exception
|
---|
108 | */
|
---|
109 | public function demoteDestination($name, DemoteDestinationRequest $postBody, $optParams = [])
|
---|
110 | {
|
---|
111 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
112 | $params = array_merge($params, $optParams);
|
---|
113 | return $this->call('demoteDestination', [$params], Operation::class);
|
---|
114 | }
|
---|
115 | /**
|
---|
116 | * Generate a SSH configuration script to configure the reverse SSH
|
---|
117 | * connectivity. (migrationJobs.generateSshScript)
|
---|
118 | *
|
---|
119 | * @param string $migrationJob Name of the migration job resource to generate
|
---|
120 | * the SSH script.
|
---|
121 | * @param GenerateSshScriptRequest $postBody
|
---|
122 | * @param array $optParams Optional parameters.
|
---|
123 | * @return SshScript
|
---|
124 | * @throws \Google\Service\Exception
|
---|
125 | */
|
---|
126 | public function generateSshScript($migrationJob, GenerateSshScriptRequest $postBody, $optParams = [])
|
---|
127 | {
|
---|
128 | $params = ['migrationJob' => $migrationJob, 'postBody' => $postBody];
|
---|
129 | $params = array_merge($params, $optParams);
|
---|
130 | return $this->call('generateSshScript', [$params], SshScript::class);
|
---|
131 | }
|
---|
132 | /**
|
---|
133 | * Generate a TCP Proxy configuration script to configure a cloud-hosted VM
|
---|
134 | * running a TCP Proxy. (migrationJobs.generateTcpProxyScript)
|
---|
135 | *
|
---|
136 | * @param string $migrationJob Name of the migration job resource to generate
|
---|
137 | * the TCP Proxy script.
|
---|
138 | * @param GenerateTcpProxyScriptRequest $postBody
|
---|
139 | * @param array $optParams Optional parameters.
|
---|
140 | * @return TcpProxyScript
|
---|
141 | * @throws \Google\Service\Exception
|
---|
142 | */
|
---|
143 | public function generateTcpProxyScript($migrationJob, GenerateTcpProxyScriptRequest $postBody, $optParams = [])
|
---|
144 | {
|
---|
145 | $params = ['migrationJob' => $migrationJob, 'postBody' => $postBody];
|
---|
146 | $params = array_merge($params, $optParams);
|
---|
147 | return $this->call('generateTcpProxyScript', [$params], TcpProxyScript::class);
|
---|
148 | }
|
---|
149 | /**
|
---|
150 | * Gets details of a single migration job. (migrationJobs.get)
|
---|
151 | *
|
---|
152 | * @param string $name Required. Name of the migration job resource to get.
|
---|
153 | * @param array $optParams Optional parameters.
|
---|
154 | * @return MigrationJob
|
---|
155 | * @throws \Google\Service\Exception
|
---|
156 | */
|
---|
157 | public function get($name, $optParams = [])
|
---|
158 | {
|
---|
159 | $params = ['name' => $name];
|
---|
160 | $params = array_merge($params, $optParams);
|
---|
161 | return $this->call('get', [$params], MigrationJob::class);
|
---|
162 | }
|
---|
163 | /**
|
---|
164 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
165 | * resource exists and does not have a policy set. (migrationJobs.getIamPolicy)
|
---|
166 | *
|
---|
167 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
168 | * requested. See [Resource
|
---|
169 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
170 | * appropriate value for this field.
|
---|
171 | * @param array $optParams Optional parameters.
|
---|
172 | *
|
---|
173 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
174 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
175 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
176 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
177 | * conditional role bindings may specify any valid value or leave the field
|
---|
178 | * unset. The policy in the response might use the policy version that you
|
---|
179 | * specified, or it might use a lower policy version. For example, if you
|
---|
180 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
181 | * response uses version 1. To learn which resources support conditions in their
|
---|
182 | * IAM policies, see the [IAM
|
---|
183 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
184 | * policies).
|
---|
185 | * @return Policy
|
---|
186 | * @throws \Google\Service\Exception
|
---|
187 | */
|
---|
188 | public function getIamPolicy($resource, $optParams = [])
|
---|
189 | {
|
---|
190 | $params = ['resource' => $resource];
|
---|
191 | $params = array_merge($params, $optParams);
|
---|
192 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
193 | }
|
---|
194 | /**
|
---|
195 | * Lists migration jobs in a given project and location.
|
---|
196 | * (migrationJobs.listProjectsLocationsMigrationJobs)
|
---|
197 | *
|
---|
198 | * @param string $parent Required. The parent which owns this collection of
|
---|
199 | * migrationJobs.
|
---|
200 | * @param array $optParams Optional parameters.
|
---|
201 | *
|
---|
202 | * @opt_param string filter A filter expression that filters migration jobs
|
---|
203 | * listed in the response. The expression must specify the field name, a
|
---|
204 | * comparison operator, and the value that you want to use for filtering. The
|
---|
205 | * value must be a string, a number, or a boolean. The comparison operator must
|
---|
206 | * be either =, !=, >, or <. For example, list migration jobs created this year
|
---|
207 | * by specifying **createTime %gt; 2020-01-01T00:00:00.000000000Z.** You can
|
---|
208 | * also filter nested fields. For example, you could specify
|
---|
209 | * **reverseSshConnectivity.vmIp = "1.2.3.4"** to select all migration jobs
|
---|
210 | * connecting through the specific SSH tunnel bastion.
|
---|
211 | * @opt_param string orderBy Sort the results based on the migration job name.
|
---|
212 | * Valid values are: "name", "name asc", and "name desc".
|
---|
213 | * @opt_param int pageSize The maximum number of migration jobs to return. The
|
---|
214 | * service may return fewer than this value. If unspecified, at most 50
|
---|
215 | * migration jobs will be returned. The maximum value is 1000; values above 1000
|
---|
216 | * are coerced to 1000.
|
---|
217 | * @opt_param string pageToken The nextPageToken value received in the previous
|
---|
218 | * call to migrationJobs.list, used in the subsequent request to retrieve the
|
---|
219 | * next page of results. On first call this should be left blank. When
|
---|
220 | * paginating, all other parameters provided to migrationJobs.list must match
|
---|
221 | * the call that provided the page token.
|
---|
222 | * @return ListMigrationJobsResponse
|
---|
223 | * @throws \Google\Service\Exception
|
---|
224 | */
|
---|
225 | public function listProjectsLocationsMigrationJobs($parent, $optParams = [])
|
---|
226 | {
|
---|
227 | $params = ['parent' => $parent];
|
---|
228 | $params = array_merge($params, $optParams);
|
---|
229 | return $this->call('list', [$params], ListMigrationJobsResponse::class);
|
---|
230 | }
|
---|
231 | /**
|
---|
232 | * Updates the parameters of a single migration job. (migrationJobs.patch)
|
---|
233 | *
|
---|
234 | * @param string $name The name (URI) of this migration job resource, in the
|
---|
235 | * form of:
|
---|
236 | * projects/{project}/locations/{location}/migrationJobs/{migrationJob}.
|
---|
237 | * @param MigrationJob $postBody
|
---|
238 | * @param array $optParams Optional parameters.
|
---|
239 | *
|
---|
240 | * @opt_param string requestId A unique ID used to identify the request. If the
|
---|
241 | * server receives two requests with the same ID, then the second request is
|
---|
242 | * ignored. It is recommended to always set this value to a UUID. The ID must
|
---|
243 | * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
|
---|
244 | * (-). The maximum length is 40 characters.
|
---|
245 | * @opt_param string updateMask Required. Field mask is used to specify the
|
---|
246 | * fields to be overwritten by the update in the conversion workspace resource.
|
---|
247 | * @return Operation
|
---|
248 | * @throws \Google\Service\Exception
|
---|
249 | */
|
---|
250 | public function patch($name, MigrationJob $postBody, $optParams = [])
|
---|
251 | {
|
---|
252 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
253 | $params = array_merge($params, $optParams);
|
---|
254 | return $this->call('patch', [$params], Operation::class);
|
---|
255 | }
|
---|
256 | /**
|
---|
257 | * Promote a migration job, stopping replication to the destination and
|
---|
258 | * promoting the destination to be a standalone database.
|
---|
259 | * (migrationJobs.promote)
|
---|
260 | *
|
---|
261 | * @param string $name Name of the migration job resource to promote.
|
---|
262 | * @param PromoteMigrationJobRequest $postBody
|
---|
263 | * @param array $optParams Optional parameters.
|
---|
264 | * @return Operation
|
---|
265 | * @throws \Google\Service\Exception
|
---|
266 | */
|
---|
267 | public function promote($name, PromoteMigrationJobRequest $postBody, $optParams = [])
|
---|
268 | {
|
---|
269 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
270 | $params = array_merge($params, $optParams);
|
---|
271 | return $this->call('promote', [$params], Operation::class);
|
---|
272 | }
|
---|
273 | /**
|
---|
274 | * Restart a stopped or failed migration job, resetting the destination instance
|
---|
275 | * to its original state and starting the migration process from scratch.
|
---|
276 | * (migrationJobs.restart)
|
---|
277 | *
|
---|
278 | * @param string $name Name of the migration job resource to restart.
|
---|
279 | * @param RestartMigrationJobRequest $postBody
|
---|
280 | * @param array $optParams Optional parameters.
|
---|
281 | * @return Operation
|
---|
282 | * @throws \Google\Service\Exception
|
---|
283 | */
|
---|
284 | public function restart($name, RestartMigrationJobRequest $postBody, $optParams = [])
|
---|
285 | {
|
---|
286 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
287 | $params = array_merge($params, $optParams);
|
---|
288 | return $this->call('restart', [$params], Operation::class);
|
---|
289 | }
|
---|
290 | /**
|
---|
291 | * Resume a migration job that is currently stopped and is resumable (was
|
---|
292 | * stopped during CDC phase). (migrationJobs.resume)
|
---|
293 | *
|
---|
294 | * @param string $name Name of the migration job resource to resume.
|
---|
295 | * @param ResumeMigrationJobRequest $postBody
|
---|
296 | * @param array $optParams Optional parameters.
|
---|
297 | * @return Operation
|
---|
298 | * @throws \Google\Service\Exception
|
---|
299 | */
|
---|
300 | public function resume($name, ResumeMigrationJobRequest $postBody, $optParams = [])
|
---|
301 | {
|
---|
302 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
303 | $params = array_merge($params, $optParams);
|
---|
304 | return $this->call('resume', [$params], Operation::class);
|
---|
305 | }
|
---|
306 | /**
|
---|
307 | * Sets the access control policy on the specified resource. Replaces any
|
---|
308 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
309 | * `PERMISSION_DENIED` errors. (migrationJobs.setIamPolicy)
|
---|
310 | *
|
---|
311 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
312 | * specified. See [Resource
|
---|
313 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
314 | * appropriate value for this field.
|
---|
315 | * @param SetIamPolicyRequest $postBody
|
---|
316 | * @param array $optParams Optional parameters.
|
---|
317 | * @return Policy
|
---|
318 | * @throws \Google\Service\Exception
|
---|
319 | */
|
---|
320 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
321 | {
|
---|
322 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
323 | $params = array_merge($params, $optParams);
|
---|
324 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
325 | }
|
---|
326 | /**
|
---|
327 | * Start an already created migration job. (migrationJobs.start)
|
---|
328 | *
|
---|
329 | * @param string $name Name of the migration job resource to start.
|
---|
330 | * @param StartMigrationJobRequest $postBody
|
---|
331 | * @param array $optParams Optional parameters.
|
---|
332 | * @return Operation
|
---|
333 | * @throws \Google\Service\Exception
|
---|
334 | */
|
---|
335 | public function start($name, StartMigrationJobRequest $postBody, $optParams = [])
|
---|
336 | {
|
---|
337 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
338 | $params = array_merge($params, $optParams);
|
---|
339 | return $this->call('start', [$params], Operation::class);
|
---|
340 | }
|
---|
341 | /**
|
---|
342 | * Stops a running migration job. (migrationJobs.stop)
|
---|
343 | *
|
---|
344 | * @param string $name Name of the migration job resource to stop.
|
---|
345 | * @param StopMigrationJobRequest $postBody
|
---|
346 | * @param array $optParams Optional parameters.
|
---|
347 | * @return Operation
|
---|
348 | * @throws \Google\Service\Exception
|
---|
349 | */
|
---|
350 | public function stop($name, StopMigrationJobRequest $postBody, $optParams = [])
|
---|
351 | {
|
---|
352 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
353 | $params = array_merge($params, $optParams);
|
---|
354 | return $this->call('stop', [$params], Operation::class);
|
---|
355 | }
|
---|
356 | /**
|
---|
357 | * Returns permissions that a caller has on the specified resource. If the
|
---|
358 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
359 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
360 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
361 | * This operation may "fail open" without warning.
|
---|
362 | * (migrationJobs.testIamPermissions)
|
---|
363 | *
|
---|
364 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
365 | * being requested. See [Resource
|
---|
366 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
367 | * appropriate value for this field.
|
---|
368 | * @param TestIamPermissionsRequest $postBody
|
---|
369 | * @param array $optParams Optional parameters.
|
---|
370 | * @return TestIamPermissionsResponse
|
---|
371 | * @throws \Google\Service\Exception
|
---|
372 | */
|
---|
373 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
374 | {
|
---|
375 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
376 | $params = array_merge($params, $optParams);
|
---|
377 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
378 | }
|
---|
379 | /**
|
---|
380 | * Verify a migration job, making sure the destination can reach the source and
|
---|
381 | * that all configuration and prerequisites are met. (migrationJobs.verify)
|
---|
382 | *
|
---|
383 | * @param string $name Name of the migration job resource to verify.
|
---|
384 | * @param VerifyMigrationJobRequest $postBody
|
---|
385 | * @param array $optParams Optional parameters.
|
---|
386 | * @return Operation
|
---|
387 | * @throws \Google\Service\Exception
|
---|
388 | */
|
---|
389 | public function verify($name, VerifyMigrationJobRequest $postBody, $optParams = [])
|
---|
390 | {
|
---|
391 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
392 | $params = array_merge($params, $optParams);
|
---|
393 | return $this->call('verify', [$params], Operation::class);
|
---|
394 | }
|
---|
395 | }
|
---|
396 |
|
---|
397 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
398 | class_alias(ProjectsLocationsMigrationJobs::class, 'Google_Service_DatabaseMigrationService_Resource_ProjectsLocationsMigrationJobs');
|
---|