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\CloudFilestore\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudFilestore\Instance;
|
---|
21 | use Google\Service\CloudFilestore\ListInstancesResponse;
|
---|
22 | use Google\Service\CloudFilestore\Operation;
|
---|
23 | use Google\Service\CloudFilestore\PromoteReplicaRequest;
|
---|
24 | use Google\Service\CloudFilestore\RestoreInstanceRequest;
|
---|
25 | use Google\Service\CloudFilestore\RevertInstanceRequest;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The "instances" collection of methods.
|
---|
29 | * Typical usage is:
|
---|
30 | * <code>
|
---|
31 | * $fileService = new Google\Service\CloudFilestore(...);
|
---|
32 | * $instances = $fileService->projects_locations_instances;
|
---|
33 | * </code>
|
---|
34 | */
|
---|
35 | class ProjectsLocationsInstances extends \Google\Service\Resource
|
---|
36 | {
|
---|
37 | /**
|
---|
38 | * Creates an instance. When creating from a backup, the capacity of the new
|
---|
39 | * instance needs to be equal to or larger than the capacity of the backup (and
|
---|
40 | * also equal to or larger than the minimum capacity of the tier).
|
---|
41 | * (instances.create)
|
---|
42 | *
|
---|
43 | * @param string $parent Required. The instance's project and location, in the
|
---|
44 | * format `projects/{project_id}/locations/{location}`. In Filestore, locations
|
---|
45 | * map to Google Cloud zones, for example **us-west1-b**.
|
---|
46 | * @param Instance $postBody
|
---|
47 | * @param array $optParams Optional parameters.
|
---|
48 | *
|
---|
49 | * @opt_param string instanceId Required. The name of the instance to create.
|
---|
50 | * The name must be unique for the specified project and location.
|
---|
51 | * @return Operation
|
---|
52 | * @throws \Google\Service\Exception
|
---|
53 | */
|
---|
54 | public function create($parent, Instance $postBody, $optParams = [])
|
---|
55 | {
|
---|
56 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
57 | $params = array_merge($params, $optParams);
|
---|
58 | return $this->call('create', [$params], Operation::class);
|
---|
59 | }
|
---|
60 | /**
|
---|
61 | * Deletes an instance. (instances.delete)
|
---|
62 | *
|
---|
63 | * @param string $name Required. The instance resource name, in the format
|
---|
64 | * `projects/{project_id}/locations/{location}/instances/{instance_id}`
|
---|
65 | * @param array $optParams Optional parameters.
|
---|
66 | *
|
---|
67 | * @opt_param bool force If set to true, all snapshots of the instance will also
|
---|
68 | * be deleted. (Otherwise, the request will only work if the instance has no
|
---|
69 | * snapshots.)
|
---|
70 | * @return Operation
|
---|
71 | * @throws \Google\Service\Exception
|
---|
72 | */
|
---|
73 | public function delete($name, $optParams = [])
|
---|
74 | {
|
---|
75 | $params = ['name' => $name];
|
---|
76 | $params = array_merge($params, $optParams);
|
---|
77 | return $this->call('delete', [$params], Operation::class);
|
---|
78 | }
|
---|
79 | /**
|
---|
80 | * Gets the details of a specific instance. (instances.get)
|
---|
81 | *
|
---|
82 | * @param string $name Required. The instance resource name, in the format
|
---|
83 | * `projects/{project_id}/locations/{location}/instances/{instance_id}`.
|
---|
84 | * @param array $optParams Optional parameters.
|
---|
85 | * @return Instance
|
---|
86 | * @throws \Google\Service\Exception
|
---|
87 | */
|
---|
88 | public function get($name, $optParams = [])
|
---|
89 | {
|
---|
90 | $params = ['name' => $name];
|
---|
91 | $params = array_merge($params, $optParams);
|
---|
92 | return $this->call('get', [$params], Instance::class);
|
---|
93 | }
|
---|
94 | /**
|
---|
95 | * Lists all instances in a project for either a specified location or for all
|
---|
96 | * locations. (instances.listProjectsLocationsInstances)
|
---|
97 | *
|
---|
98 | * @param string $parent Required. The project and location for which to
|
---|
99 | * retrieve instance information, in the format
|
---|
100 | * `projects/{project_id}/locations/{location}`. In Cloud Filestore, locations
|
---|
101 | * map to Google Cloud zones, for example **us-west1-b**. To retrieve instance
|
---|
102 | * information for all locations, use "-" for the `{location}` value.
|
---|
103 | * @param array $optParams Optional parameters.
|
---|
104 | *
|
---|
105 | * @opt_param string filter List filter.
|
---|
106 | * @opt_param string orderBy Sort results. Supported values are "name", "name
|
---|
107 | * desc" or "" (unsorted).
|
---|
108 | * @opt_param int pageSize The maximum number of items to return.
|
---|
109 | * @opt_param string pageToken The next_page_token value to use if there are
|
---|
110 | * additional results to retrieve for this list request.
|
---|
111 | * @return ListInstancesResponse
|
---|
112 | * @throws \Google\Service\Exception
|
---|
113 | */
|
---|
114 | public function listProjectsLocationsInstances($parent, $optParams = [])
|
---|
115 | {
|
---|
116 | $params = ['parent' => $parent];
|
---|
117 | $params = array_merge($params, $optParams);
|
---|
118 | return $this->call('list', [$params], ListInstancesResponse::class);
|
---|
119 | }
|
---|
120 | /**
|
---|
121 | * Updates the settings of a specific instance. (instances.patch)
|
---|
122 | *
|
---|
123 | * @param string $name Output only. The resource name of the instance, in the
|
---|
124 | * format `projects/{project}/locations/{location}/instances/{instance}`.
|
---|
125 | * @param Instance $postBody
|
---|
126 | * @param array $optParams Optional parameters.
|
---|
127 | *
|
---|
128 | * @opt_param string updateMask Mask of fields to update. At least one path must
|
---|
129 | * be supplied in this field. The elements of the repeated paths field may only
|
---|
130 | * include these fields: * "description" * "file_shares" * "labels" *
|
---|
131 | * "performance_config" * "deletion_protection_enabled" *
|
---|
132 | * "deletion_protection_reason"
|
---|
133 | * @return Operation
|
---|
134 | * @throws \Google\Service\Exception
|
---|
135 | */
|
---|
136 | public function patch($name, Instance $postBody, $optParams = [])
|
---|
137 | {
|
---|
138 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
139 | $params = array_merge($params, $optParams);
|
---|
140 | return $this->call('patch', [$params], Operation::class);
|
---|
141 | }
|
---|
142 | /**
|
---|
143 | * Promote the standby instance (replica). (instances.promoteReplica)
|
---|
144 | *
|
---|
145 | * @param string $name Required. The resource name of the instance, in the
|
---|
146 | * format
|
---|
147 | * `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
|
---|
148 | * @param PromoteReplicaRequest $postBody
|
---|
149 | * @param array $optParams Optional parameters.
|
---|
150 | * @return Operation
|
---|
151 | * @throws \Google\Service\Exception
|
---|
152 | */
|
---|
153 | public function promoteReplica($name, PromoteReplicaRequest $postBody, $optParams = [])
|
---|
154 | {
|
---|
155 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
156 | $params = array_merge($params, $optParams);
|
---|
157 | return $this->call('promoteReplica', [$params], Operation::class);
|
---|
158 | }
|
---|
159 | /**
|
---|
160 | * Restores an existing instance's file share from a backup. The capacity of the
|
---|
161 | * instance needs to be equal to or larger than the capacity of the backup (and
|
---|
162 | * also equal to or larger than the minimum capacity of the tier).
|
---|
163 | * (instances.restore)
|
---|
164 | *
|
---|
165 | * @param string $name Required. The resource name of the instance, in the
|
---|
166 | * format
|
---|
167 | * `projects/{project_number}/locations/{location_id}/instances/{instance_id}`.
|
---|
168 | * @param RestoreInstanceRequest $postBody
|
---|
169 | * @param array $optParams Optional parameters.
|
---|
170 | * @return Operation
|
---|
171 | * @throws \Google\Service\Exception
|
---|
172 | */
|
---|
173 | public function restore($name, RestoreInstanceRequest $postBody, $optParams = [])
|
---|
174 | {
|
---|
175 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
176 | $params = array_merge($params, $optParams);
|
---|
177 | return $this->call('restore', [$params], Operation::class);
|
---|
178 | }
|
---|
179 | /**
|
---|
180 | * Revert an existing instance's file system to a specified snapshot.
|
---|
181 | * (instances.revert)
|
---|
182 | *
|
---|
183 | * @param string $name Required. The resource name of the instance, in the
|
---|
184 | * format
|
---|
185 | * `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
|
---|
186 | * @param RevertInstanceRequest $postBody
|
---|
187 | * @param array $optParams Optional parameters.
|
---|
188 | * @return Operation
|
---|
189 | * @throws \Google\Service\Exception
|
---|
190 | */
|
---|
191 | public function revert($name, RevertInstanceRequest $postBody, $optParams = [])
|
---|
192 | {
|
---|
193 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
194 | $params = array_merge($params, $optParams);
|
---|
195 | return $this->call('revert', [$params], Operation::class);
|
---|
196 | }
|
---|
197 | }
|
---|
198 |
|
---|
199 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
200 | class_alias(ProjectsLocationsInstances::class, 'Google_Service_CloudFilestore_Resource_ProjectsLocationsInstances');
|
---|