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\Spanner\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Spanner\CreateInstanceConfigRequest;
|
---|
21 | use Google\Service\Spanner\InstanceConfig;
|
---|
22 | use Google\Service\Spanner\ListInstanceConfigsResponse;
|
---|
23 | use Google\Service\Spanner\Operation;
|
---|
24 | use Google\Service\Spanner\SpannerEmpty;
|
---|
25 | use Google\Service\Spanner\UpdateInstanceConfigRequest;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The "instanceConfigs" collection of methods.
|
---|
29 | * Typical usage is:
|
---|
30 | * <code>
|
---|
31 | * $spannerService = new Google\Service\Spanner(...);
|
---|
32 | * $instanceConfigs = $spannerService->projects_instanceConfigs;
|
---|
33 | * </code>
|
---|
34 | */
|
---|
35 | class ProjectsInstanceConfigs extends \Google\Service\Resource
|
---|
36 | {
|
---|
37 | /**
|
---|
38 | * Creates an instance configuration and begins preparing it to be used. The
|
---|
39 | * returned long-running operation can be used to track the progress of
|
---|
40 | * preparing the new instance configuration. The instance configuration name is
|
---|
41 | * assigned by the caller. If the named instance configuration already exists,
|
---|
42 | * `CreateInstanceConfig` returns `ALREADY_EXISTS`. Immediately after the
|
---|
43 | * request returns: * The instance configuration is readable via the API, with
|
---|
44 | * all requested attributes. The instance configuration's reconciling field is
|
---|
45 | * set to true. Its state is `CREATING`. While the operation is pending: *
|
---|
46 | * Cancelling the operation renders the instance configuration immediately
|
---|
47 | * unreadable via the API. * Except for deleting the creating resource, all
|
---|
48 | * other attempts to modify the instance configuration are rejected. Upon
|
---|
49 | * completion of the returned operation: * Instances can be created using the
|
---|
50 | * instance configuration. * The instance configuration's reconciling field
|
---|
51 | * becomes false. Its state becomes `READY`. The returned long-running operation
|
---|
52 | * will have a name of the format `/operations/` and can be used to track
|
---|
53 | * creation of the instance configuration. The metadata field type is
|
---|
54 | * CreateInstanceConfigMetadata. The response field type is InstanceConfig, if
|
---|
55 | * successful. Authorization requires `spanner.instanceConfigs.create`
|
---|
56 | * permission on the resource parent. (instanceConfigs.create)
|
---|
57 | *
|
---|
58 | * @param string $parent Required. The name of the project in which to create
|
---|
59 | * the instance configuration. Values are of the form `projects/`.
|
---|
60 | * @param CreateInstanceConfigRequest $postBody
|
---|
61 | * @param array $optParams Optional parameters.
|
---|
62 | * @return Operation
|
---|
63 | * @throws \Google\Service\Exception
|
---|
64 | */
|
---|
65 | public function create($parent, CreateInstanceConfigRequest $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 the instance configuration. Deletion is only allowed when no
|
---|
73 | * instances are using the configuration. If any instances are using the
|
---|
74 | * configuration, returns `FAILED_PRECONDITION`. Only user-managed
|
---|
75 | * configurations can be deleted. Authorization requires
|
---|
76 | * `spanner.instanceConfigs.delete` permission on the resource name.
|
---|
77 | * (instanceConfigs.delete)
|
---|
78 | *
|
---|
79 | * @param string $name Required. The name of the instance configuration to be
|
---|
80 | * deleted. Values are of the form `projects//instanceConfigs/`
|
---|
81 | * @param array $optParams Optional parameters.
|
---|
82 | *
|
---|
83 | * @opt_param string etag Used for optimistic concurrency control as a way to
|
---|
84 | * help prevent simultaneous deletes of an instance configuration from
|
---|
85 | * overwriting each other. If not empty, the API only deletes the instance
|
---|
86 | * configuration when the etag provided matches the current status of the
|
---|
87 | * requested instance configuration. Otherwise, deletes the instance
|
---|
88 | * configuration without checking the current status of the requested instance
|
---|
89 | * configuration.
|
---|
90 | * @opt_param bool validateOnly An option to validate, but not actually execute,
|
---|
91 | * a request, and provide the same response.
|
---|
92 | * @return SpannerEmpty
|
---|
93 | * @throws \Google\Service\Exception
|
---|
94 | */
|
---|
95 | public function delete($name, $optParams = [])
|
---|
96 | {
|
---|
97 | $params = ['name' => $name];
|
---|
98 | $params = array_merge($params, $optParams);
|
---|
99 | return $this->call('delete', [$params], SpannerEmpty::class);
|
---|
100 | }
|
---|
101 | /**
|
---|
102 | * Gets information about a particular instance configuration.
|
---|
103 | * (instanceConfigs.get)
|
---|
104 | *
|
---|
105 | * @param string $name Required. The name of the requested instance
|
---|
106 | * configuration. Values are of the form `projects//instanceConfigs/`.
|
---|
107 | * @param array $optParams Optional parameters.
|
---|
108 | * @return InstanceConfig
|
---|
109 | * @throws \Google\Service\Exception
|
---|
110 | */
|
---|
111 | public function get($name, $optParams = [])
|
---|
112 | {
|
---|
113 | $params = ['name' => $name];
|
---|
114 | $params = array_merge($params, $optParams);
|
---|
115 | return $this->call('get', [$params], InstanceConfig::class);
|
---|
116 | }
|
---|
117 | /**
|
---|
118 | * Lists the supported instance configurations for a given project. Returns both
|
---|
119 | * Google-managed configurations and user-managed configurations.
|
---|
120 | * (instanceConfigs.listProjectsInstanceConfigs)
|
---|
121 | *
|
---|
122 | * @param string $parent Required. The name of the project for which a list of
|
---|
123 | * supported instance configurations is requested. Values are of the form
|
---|
124 | * `projects/`.
|
---|
125 | * @param array $optParams Optional parameters.
|
---|
126 | *
|
---|
127 | * @opt_param int pageSize Number of instance configurations to be returned in
|
---|
128 | * the response. If 0 or less, defaults to the server's maximum allowed page
|
---|
129 | * size.
|
---|
130 | * @opt_param string pageToken If non-empty, `page_token` should contain a
|
---|
131 | * next_page_token from a previous ListInstanceConfigsResponse.
|
---|
132 | * @return ListInstanceConfigsResponse
|
---|
133 | * @throws \Google\Service\Exception
|
---|
134 | */
|
---|
135 | public function listProjectsInstanceConfigs($parent, $optParams = [])
|
---|
136 | {
|
---|
137 | $params = ['parent' => $parent];
|
---|
138 | $params = array_merge($params, $optParams);
|
---|
139 | return $this->call('list', [$params], ListInstanceConfigsResponse::class);
|
---|
140 | }
|
---|
141 | /**
|
---|
142 | * Updates an instance configuration. The returned long-running operation can be
|
---|
143 | * used to track the progress of updating the instance. If the named instance
|
---|
144 | * configuration does not exist, returns `NOT_FOUND`. Only user-managed
|
---|
145 | * configurations can be updated. Immediately after the request returns: * The
|
---|
146 | * instance configuration's reconciling field is set to true. While the
|
---|
147 | * operation is pending: * Cancelling the operation sets its metadata's
|
---|
148 | * cancel_time. The operation is guaranteed to succeed at undoing all changes,
|
---|
149 | * after which point it terminates with a `CANCELLED` status. * All other
|
---|
150 | * attempts to modify the instance configuration are rejected. * Reading the
|
---|
151 | * instance configuration via the API continues to give the pre-request values.
|
---|
152 | * Upon completion of the returned operation: * Creating instances using the
|
---|
153 | * instance configuration uses the new values. * The new values of the instance
|
---|
154 | * configuration are readable via the API. * The instance configuration's
|
---|
155 | * reconciling field becomes false. The returned long-running operation will
|
---|
156 | * have a name of the format `/operations/` and can be used to track the
|
---|
157 | * instance configuration modification. The metadata field type is
|
---|
158 | * UpdateInstanceConfigMetadata. The response field type is InstanceConfig, if
|
---|
159 | * successful. Authorization requires `spanner.instanceConfigs.update`
|
---|
160 | * permission on the resource name. (instanceConfigs.patch)
|
---|
161 | *
|
---|
162 | * @param string $name A unique identifier for the instance configuration.
|
---|
163 | * Values are of the form `projects//instanceConfigs/a-z*`. User instance
|
---|
164 | * configuration must start with `custom-`.
|
---|
165 | * @param UpdateInstanceConfigRequest $postBody
|
---|
166 | * @param array $optParams Optional parameters.
|
---|
167 | * @return Operation
|
---|
168 | * @throws \Google\Service\Exception
|
---|
169 | */
|
---|
170 | public function patch($name, UpdateInstanceConfigRequest $postBody, $optParams = [])
|
---|
171 | {
|
---|
172 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
173 | $params = array_merge($params, $optParams);
|
---|
174 | return $this->call('patch', [$params], Operation::class);
|
---|
175 | }
|
---|
176 | }
|
---|
177 |
|
---|
178 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
179 | class_alias(ProjectsInstanceConfigs::class, 'Google_Service_Spanner_Resource_ProjectsInstanceConfigs');
|
---|