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\FetchInventoryResponse;
21use Google\Service\VMMigrationService\ListSourcesResponse;
22use Google\Service\VMMigrationService\Operation;
23use Google\Service\VMMigrationService\Source;
24
25/**
26 * The "sources" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $vmmigrationService = new Google\Service\VMMigrationService(...);
30 *   $sources = $vmmigrationService->sources;
31 *  </code>
32 */
33class ProjectsLocationsSources extends \Google\Service\Resource
34{
35  /**
36   * Creates a new Source in a given project and location. (sources.create)
37   *
38   * @param string $parent Required. The Source's parent.
39   * @param Source $postBody
40   * @param array $optParams Optional parameters.
41   *
42   * @opt_param string requestId A request ID to identify requests. Specify a
43   * unique request ID so that if you must retry your request, the server will
44   * know to ignore the request if it has already been completed. The server will
45   * guarantee that for at least 60 minutes since the first request. For example,
46   * consider a situation where you make an initial request and t he request times
47   * out. If you make the request again with the same request ID, the server can
48   * check if original operation with the same request ID was received, and if so,
49   * will ignore the second request. This prevents clients from accidentally
50   * creating duplicate commitments. The request ID must be a valid UUID with the
51   * exception that zero UUID is not supported
52   * (00000000-0000-0000-0000-000000000000).
53   * @opt_param string sourceId Required. The source identifier.
54   * @return Operation
55   */
56  public function create($parent, Source $postBody, $optParams = [])
57  {
58    $params = ['parent' => $parent, 'postBody' => $postBody];
59    $params = array_merge($params, $optParams);
60    return $this->call('create', [$params], Operation::class);
61  }
62  /**
63   * Deletes a single Source. (sources.delete)
64   *
65   * @param string $name Required. The Source name.
66   * @param array $optParams Optional parameters.
67   *
68   * @opt_param string requestId Optional. A request ID to identify requests.
69   * Specify a unique request ID so that if you must retry your request, the
70   * server will know to ignore the request if it has already been completed. The
71   * server will guarantee that for at least 60 minutes after the first request.
72   * For example, consider a situation where you make an initial request and t he
73   * request times out. If you make the request again with the same request ID,
74   * the server can check if original operation with the same request ID was
75   * received, and if so, will ignore the second request. This prevents clients
76   * from accidentally creating duplicate commitments. The request ID must be a
77   * valid UUID with the exception that zero UUID is not supported
78   * (00000000-0000-0000-0000-000000000000).
79   * @return Operation
80   */
81  public function delete($name, $optParams = [])
82  {
83    $params = ['name' => $name];
84    $params = array_merge($params, $optParams);
85    return $this->call('delete', [$params], Operation::class);
86  }
87  /**
88   * List remote source's inventory of VMs. The remote source is the onprem
89   * vCenter (remote in the sense it's not in Compute Engine). The inventory
90   * describes the list of existing VMs in that source. Note that this operation
91   * lists the VMs on the remote source, as opposed to listing the MigratingVms
92   * resources in the vmmigration service. (sources.fetchInventory)
93   *
94   * @param string $source Required. The name of the Source.
95   * @param array $optParams Optional parameters.
96   *
97   * @opt_param bool forceRefresh If this flag is set to true, the source will be
98   * queried instead of using cached results. Using this flag will make the call
99   * slower.
100   * @return FetchInventoryResponse
101   */
102  public function fetchInventory($source, $optParams = [])
103  {
104    $params = ['source' => $source];
105    $params = array_merge($params, $optParams);
106    return $this->call('fetchInventory', [$params], FetchInventoryResponse::class);
107  }
108  /**
109   * Gets details of a single Source. (sources.get)
110   *
111   * @param string $name Required. The Source name.
112   * @param array $optParams Optional parameters.
113   * @return Source
114   */
115  public function get($name, $optParams = [])
116  {
117    $params = ['name' => $name];
118    $params = array_merge($params, $optParams);
119    return $this->call('get', [$params], Source::class);
120  }
121  /**
122   * Lists Sources in a given project and location.
123   * (sources.listProjectsLocationsSources)
124   *
125   * @param string $parent Required. The parent, which owns this collection of
126   * sources.
127   * @param array $optParams Optional parameters.
128   *
129   * @opt_param string filter Optional. The filter request.
130   * @opt_param string orderBy Optional. the order by fields for the result.
131   * @opt_param int pageSize Optional. The maximum number of sources to return.
132   * The service may return fewer than this value. If unspecified, at most 500
133   * sources will be returned. The maximum value is 1000; values above 1000 will
134   * be coerced to 1000.
135   * @opt_param string pageToken Required. A page token, received from a previous
136   * `ListSources` call. Provide this to retrieve the subsequent page. When
137   * paginating, all other parameters provided to `ListSources` must match the
138   * call that provided the page token.
139   * @return ListSourcesResponse
140   */
141  public function listProjectsLocationsSources($parent, $optParams = [])
142  {
143    $params = ['parent' => $parent];
144    $params = array_merge($params, $optParams);
145    return $this->call('list', [$params], ListSourcesResponse::class);
146  }
147  /**
148   * Updates the parameters of a single Source. (sources.patch)
149   *
150   * @param string $name Output only. The Source name.
151   * @param Source $postBody
152   * @param array $optParams Optional parameters.
153   *
154   * @opt_param string requestId A request ID to identify requests. Specify a
155   * unique request ID so that if you must retry your request, the server will
156   * know to ignore the request if it has already been completed. The server will
157   * guarantee that for at least 60 minutes since the first request. For example,
158   * consider a situation where you make an initial request and t he request times
159   * out. If you make the request again with the same request ID, the server can
160   * check if original operation with the same request ID was received, and if so,
161   * will ignore the second request. This prevents clients from accidentally
162   * creating duplicate commitments. The request ID must be a valid UUID with the
163   * exception that zero UUID is not supported
164   * (00000000-0000-0000-0000-000000000000).
165   * @opt_param string updateMask Field mask is used to specify the fields to be
166   * overwritten in the Source resource by the update. The fields specified in the
167   * update_mask are relative to the resource, not the full request. A field will
168   * be overwritten if it is in the mask. If the user does not provide a mask then
169   * all fields will be overwritten.
170   * @return Operation
171   */
172  public function patch($name, Source $postBody, $optParams = [])
173  {
174    $params = ['name' => $name, 'postBody' => $postBody];
175    $params = array_merge($params, $optParams);
176    return $this->call('patch', [$params], Operation::class);
177  }
178}
179
180// Adding a class alias for backwards compatibility with the previous class name.
181class_alias(ProjectsLocationsSources::class, 'Google_Service_VMMigrationService_Resource_ProjectsLocationsSources');
182