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\CloudRedis\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudRedis\ExportInstanceRequest;
|
---|
21 | use Google\Service\CloudRedis\FailoverInstanceRequest;
|
---|
22 | use Google\Service\CloudRedis\ImportInstanceRequest;
|
---|
23 | use Google\Service\CloudRedis\Instance;
|
---|
24 | use Google\Service\CloudRedis\InstanceAuthString;
|
---|
25 | use Google\Service\CloudRedis\ListInstancesResponse;
|
---|
26 | use Google\Service\CloudRedis\Operation;
|
---|
27 | use Google\Service\CloudRedis\RescheduleMaintenanceRequest;
|
---|
28 | use Google\Service\CloudRedis\UpgradeInstanceRequest;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * The "instances" collection of methods.
|
---|
32 | * Typical usage is:
|
---|
33 | * <code>
|
---|
34 | * $redisService = new Google\Service\CloudRedis(...);
|
---|
35 | * $instances = $redisService->projects_locations_instances;
|
---|
36 | * </code>
|
---|
37 | */
|
---|
38 | class ProjectsLocationsInstances extends \Google\Service\Resource
|
---|
39 | {
|
---|
40 | /**
|
---|
41 | * Creates a Redis instance based on the specified tier and memory size. By
|
---|
42 | * default, the instance is accessible from the project's [default
|
---|
43 | * network](https://cloud.google.com/vpc/docs/vpc). The creation is executed
|
---|
44 | * asynchronously and callers may check the returned operation to track its
|
---|
45 | * progress. Once the operation is completed the Redis instance will be fully
|
---|
46 | * functional. Completed longrunning.Operation will contain the new instance
|
---|
47 | * object in the response field. The returned operation is automatically deleted
|
---|
48 | * after a few hours, so there is no need to call DeleteOperation.
|
---|
49 | * (instances.create)
|
---|
50 | *
|
---|
51 | * @param string $parent Required. The resource name of the instance location
|
---|
52 | * using the form: `projects/{project_id}/locations/{location_id}` where
|
---|
53 | * `location_id` refers to a GCP region.
|
---|
54 | * @param Instance $postBody
|
---|
55 | * @param array $optParams Optional parameters.
|
---|
56 | *
|
---|
57 | * @opt_param string instanceId Required. The logical name of the Redis instance
|
---|
58 | * in the customer project with the following restrictions: * Must contain only
|
---|
59 | * lowercase letters, numbers, and hyphens. * Must start with a letter. * Must
|
---|
60 | * be between 1-40 characters. * Must end with a number or a letter. * Must be
|
---|
61 | * unique within the customer project / location
|
---|
62 | * @return Operation
|
---|
63 | * @throws \Google\Service\Exception
|
---|
64 | */
|
---|
65 | public function create($parent, Instance $postBody, $optParams = [])
|
---|
66 | {
|
---|
67 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
68 | $params = array_merge($params, $optParams);
|
---|
69 | return $this->call('create', [$params], Operation::class);
|
---|
70 | }
|
---|
71 | /**
|
---|
72 | * Deletes a specific Redis instance. Instance stops serving and data is
|
---|
73 | * deleted. (instances.delete)
|
---|
74 | *
|
---|
75 | * @param string $name Required. Redis instance resource name using the form:
|
---|
76 | * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where
|
---|
77 | * `location_id` refers to a GCP region.
|
---|
78 | * @param array $optParams Optional parameters.
|
---|
79 | * @return Operation
|
---|
80 | * @throws \Google\Service\Exception
|
---|
81 | */
|
---|
82 | public function delete($name, $optParams = [])
|
---|
83 | {
|
---|
84 | $params = ['name' => $name];
|
---|
85 | $params = array_merge($params, $optParams);
|
---|
86 | return $this->call('delete', [$params], Operation::class);
|
---|
87 | }
|
---|
88 | /**
|
---|
89 | * Export Redis instance data into a Redis RDB format file in Cloud Storage.
|
---|
90 | * Redis will continue serving during this operation. The returned operation is
|
---|
91 | * automatically deleted after a few hours, so there is no need to call
|
---|
92 | * DeleteOperation. (instances.export)
|
---|
93 | *
|
---|
94 | * @param string $name Required. Redis instance resource name using the form:
|
---|
95 | * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where
|
---|
96 | * `location_id` refers to a GCP region.
|
---|
97 | * @param ExportInstanceRequest $postBody
|
---|
98 | * @param array $optParams Optional parameters.
|
---|
99 | * @return Operation
|
---|
100 | * @throws \Google\Service\Exception
|
---|
101 | */
|
---|
102 | public function export($name, ExportInstanceRequest $postBody, $optParams = [])
|
---|
103 | {
|
---|
104 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
105 | $params = array_merge($params, $optParams);
|
---|
106 | return $this->call('export', [$params], Operation::class);
|
---|
107 | }
|
---|
108 | /**
|
---|
109 | * Initiates a failover of the primary node to current replica node for a
|
---|
110 | * specific STANDARD tier Cloud Memorystore for Redis instance.
|
---|
111 | * (instances.failover)
|
---|
112 | *
|
---|
113 | * @param string $name Required. Redis instance resource name using the form:
|
---|
114 | * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where
|
---|
115 | * `location_id` refers to a GCP region.
|
---|
116 | * @param FailoverInstanceRequest $postBody
|
---|
117 | * @param array $optParams Optional parameters.
|
---|
118 | * @return Operation
|
---|
119 | * @throws \Google\Service\Exception
|
---|
120 | */
|
---|
121 | public function failover($name, FailoverInstanceRequest $postBody, $optParams = [])
|
---|
122 | {
|
---|
123 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
124 | $params = array_merge($params, $optParams);
|
---|
125 | return $this->call('failover', [$params], Operation::class);
|
---|
126 | }
|
---|
127 | /**
|
---|
128 | * Gets the details of a specific Redis instance. (instances.get)
|
---|
129 | *
|
---|
130 | * @param string $name Required. Redis instance resource name using the form:
|
---|
131 | * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where
|
---|
132 | * `location_id` refers to a GCP region.
|
---|
133 | * @param array $optParams Optional parameters.
|
---|
134 | * @return Instance
|
---|
135 | * @throws \Google\Service\Exception
|
---|
136 | */
|
---|
137 | public function get($name, $optParams = [])
|
---|
138 | {
|
---|
139 | $params = ['name' => $name];
|
---|
140 | $params = array_merge($params, $optParams);
|
---|
141 | return $this->call('get', [$params], Instance::class);
|
---|
142 | }
|
---|
143 | /**
|
---|
144 | * Gets the AUTH string for a Redis instance. If AUTH is not enabled for the
|
---|
145 | * instance the response will be empty. This information is not included in the
|
---|
146 | * details returned to GetInstance. (instances.getAuthString)
|
---|
147 | *
|
---|
148 | * @param string $name Required. Redis instance resource name using the form:
|
---|
149 | * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where
|
---|
150 | * `location_id` refers to a GCP region.
|
---|
151 | * @param array $optParams Optional parameters.
|
---|
152 | * @return InstanceAuthString
|
---|
153 | * @throws \Google\Service\Exception
|
---|
154 | */
|
---|
155 | public function getAuthString($name, $optParams = [])
|
---|
156 | {
|
---|
157 | $params = ['name' => $name];
|
---|
158 | $params = array_merge($params, $optParams);
|
---|
159 | return $this->call('getAuthString', [$params], InstanceAuthString::class);
|
---|
160 | }
|
---|
161 | /**
|
---|
162 | * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
|
---|
163 | * Redis may stop serving during this operation. Instance state will be
|
---|
164 | * IMPORTING for entire operation. When complete, the instance will contain only
|
---|
165 | * data from the imported file. The returned operation is automatically deleted
|
---|
166 | * after a few hours, so there is no need to call DeleteOperation.
|
---|
167 | * (instances.import)
|
---|
168 | *
|
---|
169 | * @param string $name Required. Redis instance resource name using the form:
|
---|
170 | * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where
|
---|
171 | * `location_id` refers to a GCP region.
|
---|
172 | * @param ImportInstanceRequest $postBody
|
---|
173 | * @param array $optParams Optional parameters.
|
---|
174 | * @return Operation
|
---|
175 | * @throws \Google\Service\Exception
|
---|
176 | */
|
---|
177 | public function import($name, ImportInstanceRequest $postBody, $optParams = [])
|
---|
178 | {
|
---|
179 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
180 | $params = array_merge($params, $optParams);
|
---|
181 | return $this->call('import', [$params], Operation::class);
|
---|
182 | }
|
---|
183 | /**
|
---|
184 | * Lists all Redis instances owned by a project in either the specified location
|
---|
185 | * (region) or all locations. The location should have the following format: *
|
---|
186 | * `projects/{project_id}/locations/{location_id}` If `location_id` is specified
|
---|
187 | * as `-` (wildcard), then all regions available to the project are queried, and
|
---|
188 | * the results are aggregated. (instances.listProjectsLocationsInstances)
|
---|
189 | *
|
---|
190 | * @param string $parent Required. The resource name of the instance location
|
---|
191 | * using the form: `projects/{project_id}/locations/{location_id}` where
|
---|
192 | * `location_id` refers to a GCP region.
|
---|
193 | * @param array $optParams Optional parameters.
|
---|
194 | *
|
---|
195 | * @opt_param int pageSize The maximum number of items to return. If not
|
---|
196 | * specified, a default value of 1000 will be used by the service. Regardless of
|
---|
197 | * the page_size value, the response may include a partial list and a caller
|
---|
198 | * should only rely on response's `next_page_token` to determine if there are
|
---|
199 | * more instances left to be queried.
|
---|
200 | * @opt_param string pageToken The `next_page_token` value returned from a
|
---|
201 | * previous ListInstances request, if any.
|
---|
202 | * @return ListInstancesResponse
|
---|
203 | * @throws \Google\Service\Exception
|
---|
204 | */
|
---|
205 | public function listProjectsLocationsInstances($parent, $optParams = [])
|
---|
206 | {
|
---|
207 | $params = ['parent' => $parent];
|
---|
208 | $params = array_merge($params, $optParams);
|
---|
209 | return $this->call('list', [$params], ListInstancesResponse::class);
|
---|
210 | }
|
---|
211 | /**
|
---|
212 | * Updates the metadata and configuration of a specific Redis instance.
|
---|
213 | * Completed longrunning.Operation will contain the new instance object in the
|
---|
214 | * response field. The returned operation is automatically deleted after a few
|
---|
215 | * hours, so there is no need to call DeleteOperation. (instances.patch)
|
---|
216 | *
|
---|
217 | * @param string $name Required. Unique name of the resource in this scope
|
---|
218 | * including project and location using the form:
|
---|
219 | * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` Note:
|
---|
220 | * Redis instances are managed and addressed at regional level so location_id
|
---|
221 | * here refers to a GCP region; however, users may choose which specific zone
|
---|
222 | * (or collection of zones for cross-zone instances) an instance should be
|
---|
223 | * provisioned in. Refer to location_id and alternative_location_id fields for
|
---|
224 | * more details.
|
---|
225 | * @param Instance $postBody
|
---|
226 | * @param array $optParams Optional parameters.
|
---|
227 | *
|
---|
228 | * @opt_param string updateMask Required. Mask of fields to update. At least one
|
---|
229 | * path must be supplied in this field. The elements of the repeated paths field
|
---|
230 | * may only include these fields from Instance: * `displayName` * `labels` *
|
---|
231 | * `memorySizeGb` * `redisConfig` * `replica_count`
|
---|
232 | * @return Operation
|
---|
233 | * @throws \Google\Service\Exception
|
---|
234 | */
|
---|
235 | public function patch($name, Instance $postBody, $optParams = [])
|
---|
236 | {
|
---|
237 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
238 | $params = array_merge($params, $optParams);
|
---|
239 | return $this->call('patch', [$params], Operation::class);
|
---|
240 | }
|
---|
241 | /**
|
---|
242 | * Reschedule maintenance for a given instance in a given project and location.
|
---|
243 | * (instances.rescheduleMaintenance)
|
---|
244 | *
|
---|
245 | * @param string $name Required. Redis instance resource name using the form:
|
---|
246 | * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where
|
---|
247 | * `location_id` refers to a GCP region.
|
---|
248 | * @param RescheduleMaintenanceRequest $postBody
|
---|
249 | * @param array $optParams Optional parameters.
|
---|
250 | * @return Operation
|
---|
251 | * @throws \Google\Service\Exception
|
---|
252 | */
|
---|
253 | public function rescheduleMaintenance($name, RescheduleMaintenanceRequest $postBody, $optParams = [])
|
---|
254 | {
|
---|
255 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
256 | $params = array_merge($params, $optParams);
|
---|
257 | return $this->call('rescheduleMaintenance', [$params], Operation::class);
|
---|
258 | }
|
---|
259 | /**
|
---|
260 | * Upgrades Redis instance to the newer Redis version specified in the request.
|
---|
261 | * (instances.upgrade)
|
---|
262 | *
|
---|
263 | * @param string $name Required. Redis instance resource name using the form:
|
---|
264 | * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where
|
---|
265 | * `location_id` refers to a GCP region.
|
---|
266 | * @param UpgradeInstanceRequest $postBody
|
---|
267 | * @param array $optParams Optional parameters.
|
---|
268 | * @return Operation
|
---|
269 | * @throws \Google\Service\Exception
|
---|
270 | */
|
---|
271 | public function upgrade($name, UpgradeInstanceRequest $postBody, $optParams = [])
|
---|
272 | {
|
---|
273 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
274 | $params = array_merge($params, $optParams);
|
---|
275 | return $this->call('upgrade', [$params], Operation::class);
|
---|
276 | }
|
---|
277 | }
|
---|
278 |
|
---|
279 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
280 | class_alias(ProjectsLocationsInstances::class, 'Google_Service_CloudRedis_Resource_ProjectsLocationsInstances');
|
---|