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\VMMigrationService\Resource;
19
20use Google\Service\VMMigrationService\FinalizeMigrationRequest;
21use Google\Service\VMMigrationService\ListMigratingVmsResponse;
22use Google\Service\VMMigrationService\MigratingVm;
23use Google\Service\VMMigrationService\Operation;
24use Google\Service\VMMigrationService\PauseMigrationRequest;
25use Google\Service\VMMigrationService\ResumeMigrationRequest;
26use Google\Service\VMMigrationService\StartMigrationRequest;
27
28/**
29 * The "migratingVms" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $vmmigrationService = new Google\Service\VMMigrationService(...);
33 *   $migratingVms = $vmmigrationService->migratingVms;
34 *  </code>
35 */
36class ProjectsLocationsSourcesMigratingVms extends \Google\Service\Resource
37{
38  /**
39   * Creates a new MigratingVm in a given Source. (migratingVms.create)
40   *
41   * @param string $parent Required. The MigratingVm's parent.
42   * @param MigratingVm $postBody
43   * @param array $optParams Optional parameters.
44   *
45   * @opt_param string migratingVmId Required. The migratingVm identifier.
46   * @opt_param string requestId A request ID to identify requests. Specify a
47   * unique request ID so that if you must retry your request, the server will
48   * know to ignore the request if it has already been completed. The server will
49   * guarantee that for at least 60 minutes since the first request. For example,
50   * consider a situation where you make an initial request and t he request times
51   * out. If you make the request again with the same request ID, the server can
52   * check if original operation with the same request ID was received, and if so,
53   * will ignore the second request. This prevents clients from accidentally
54   * creating duplicate commitments. The request ID must be a valid UUID with the
55   * exception that zero UUID is not supported
56   * (00000000-0000-0000-0000-000000000000).
57   * @return Operation
58   */
59  public function create($parent, MigratingVm $postBody, $optParams = [])
60  {
61    $params = ['parent' => $parent, 'postBody' => $postBody];
62    $params = array_merge($params, $optParams);
63    return $this->call('create', [$params], Operation::class);
64  }
65  /**
66   * Deletes a single MigratingVm. (migratingVms.delete)
67   *
68   * @param string $name Required. The name of the MigratingVm.
69   * @param array $optParams Optional parameters.
70   * @return Operation
71   */
72  public function delete($name, $optParams = [])
73  {
74    $params = ['name' => $name];
75    $params = array_merge($params, $optParams);
76    return $this->call('delete', [$params], Operation::class);
77  }
78  /**
79   * Marks a migration as completed, deleting migration resources that are no
80   * longer being used. Only applicable after cutover is done.
81   * (migratingVms.finalizeMigration)
82   *
83   * @param string $migratingVm Required. The name of the MigratingVm.
84   * @param FinalizeMigrationRequest $postBody
85   * @param array $optParams Optional parameters.
86   * @return Operation
87   */
88  public function finalizeMigration($migratingVm, FinalizeMigrationRequest $postBody, $optParams = [])
89  {
90    $params = ['migratingVm' => $migratingVm, 'postBody' => $postBody];
91    $params = array_merge($params, $optParams);
92    return $this->call('finalizeMigration', [$params], Operation::class);
93  }
94  /**
95   * Gets details of a single MigratingVm. (migratingVms.get)
96   *
97   * @param string $name Required. The name of the MigratingVm.
98   * @param array $optParams Optional parameters.
99   *
100   * @opt_param string view Optional. The level of details of the migrating VM.
101   * @return MigratingVm
102   */
103  public function get($name, $optParams = [])
104  {
105    $params = ['name' => $name];
106    $params = array_merge($params, $optParams);
107    return $this->call('get', [$params], MigratingVm::class);
108  }
109  /**
110   * Lists MigratingVms in a given Source.
111   * (migratingVms.listProjectsLocationsSourcesMigratingVms)
112   *
113   * @param string $parent Required. The parent, which owns this collection of
114   * MigratingVms.
115   * @param array $optParams Optional parameters.
116   *
117   * @opt_param string filter Optional. The filter request.
118   * @opt_param string orderBy Optional. the order by fields for the result.
119   * @opt_param int pageSize Optional. The maximum number of migrating VMs to
120   * return. The service may return fewer than this value. If unspecified, at most
121   * 500 migrating VMs will be returned. The maximum value is 1000; values above
122   * 1000 will be coerced to 1000.
123   * @opt_param string pageToken Required. A page token, received from a previous
124   * `ListMigratingVms` call. Provide this to retrieve the subsequent page. When
125   * paginating, all other parameters provided to `ListMigratingVms` must match
126   * the call that provided the page token.
127   * @opt_param string view Optional. The level of details of each migrating VM.
128   * @return ListMigratingVmsResponse
129   */
130  public function listProjectsLocationsSourcesMigratingVms($parent, $optParams = [])
131  {
132    $params = ['parent' => $parent];
133    $params = array_merge($params, $optParams);
134    return $this->call('list', [$params], ListMigratingVmsResponse::class);
135  }
136  /**
137   * Updates the parameters of a single MigratingVm. (migratingVms.patch)
138   *
139   * @param string $name Output only. The identifier of the MigratingVm.
140   * @param MigratingVm $postBody
141   * @param array $optParams Optional parameters.
142   *
143   * @opt_param string requestId A request ID to identify requests. Specify a
144   * unique request ID so that if you must retry your request, the server will
145   * know to ignore the request if it has already been completed. The server will
146   * guarantee that for at least 60 minutes since the first request. For example,
147   * consider a situation where you make an initial request and t he request times
148   * out. If you make the request again with the same request ID, the server can
149   * check if original operation with the same request ID was received, and if so,
150   * will ignore the second request. This prevents clients from accidentally
151   * creating duplicate commitments. The request ID must be a valid UUID with the
152   * exception that zero UUID is not supported
153   * (00000000-0000-0000-0000-000000000000).
154   * @opt_param string updateMask Field mask is used to specify the fields to be
155   * overwritten in the MigratingVm resource by the update. The fields specified
156   * in the update_mask are relative to the resource, not the full request. A
157   * field will be overwritten if it is in the mask. If the user does not provide
158   * a mask then all fields will be overwritten.
159   * @return Operation
160   */
161  public function patch($name, MigratingVm $postBody, $optParams = [])
162  {
163    $params = ['name' => $name, 'postBody' => $postBody];
164    $params = array_merge($params, $optParams);
165    return $this->call('patch', [$params], Operation::class);
166  }
167  /**
168   * Pauses a migration for a VM. If cycle tasks are running they will be
169   * cancelled, preserving source task data. Further replication cycles will not
170   * be triggered while the VM is paused. (migratingVms.pauseMigration)
171   *
172   * @param string $migratingVm Required. The name of the MigratingVm.
173   * @param PauseMigrationRequest $postBody
174   * @param array $optParams Optional parameters.
175   * @return Operation
176   */
177  public function pauseMigration($migratingVm, PauseMigrationRequest $postBody, $optParams = [])
178  {
179    $params = ['migratingVm' => $migratingVm, 'postBody' => $postBody];
180    $params = array_merge($params, $optParams);
181    return $this->call('pauseMigration', [$params], Operation::class);
182  }
183  /**
184   * Resumes a migration for a VM. When called on a paused migration, will start
185   * the process of uploading data and creating snapshots; when called on a
186   * completed cut-over migration, will update the migration to active state and
187   * start the process of uploading data and creating snapshots.
188   * (migratingVms.resumeMigration)
189   *
190   * @param string $migratingVm Required. The name of the MigratingVm.
191   * @param ResumeMigrationRequest $postBody
192   * @param array $optParams Optional parameters.
193   * @return Operation
194   */
195  public function resumeMigration($migratingVm, ResumeMigrationRequest $postBody, $optParams = [])
196  {
197    $params = ['migratingVm' => $migratingVm, 'postBody' => $postBody];
198    $params = array_merge($params, $optParams);
199    return $this->call('resumeMigration', [$params], Operation::class);
200  }
201  /**
202   * Starts migration for a VM. Starts the process of uploading data and creating
203   * snapshots, in replication cycles scheduled by the policy.
204   * (migratingVms.startMigration)
205   *
206   * @param string $migratingVm Required. The name of the MigratingVm.
207   * @param StartMigrationRequest $postBody
208   * @param array $optParams Optional parameters.
209   * @return Operation
210   */
211  public function startMigration($migratingVm, StartMigrationRequest $postBody, $optParams = [])
212  {
213    $params = ['migratingVm' => $migratingVm, 'postBody' => $postBody];
214    $params = array_merge($params, $optParams);
215    return $this->call('startMigration', [$params], Operation::class);
216  }
217}
218
219// Adding a class alias for backwards compatibility with the previous class name.
220class_alias(ProjectsLocationsSourcesMigratingVms::class, 'Google_Service_VMMigrationService_Resource_ProjectsLocationsSourcesMigratingVms');
221