[e3d4e0a] | 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\CreateInstancePartitionRequest;
|
---|
| 21 | use Google\Service\Spanner\InstancePartition;
|
---|
| 22 | use Google\Service\Spanner\ListInstancePartitionsResponse;
|
---|
| 23 | use Google\Service\Spanner\Operation;
|
---|
| 24 | use Google\Service\Spanner\SpannerEmpty;
|
---|
| 25 | use Google\Service\Spanner\UpdateInstancePartitionRequest;
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * The "instancePartitions" collection of methods.
|
---|
| 29 | * Typical usage is:
|
---|
| 30 | * <code>
|
---|
| 31 | * $spannerService = new Google\Service\Spanner(...);
|
---|
| 32 | * $instancePartitions = $spannerService->projects_instances_instancePartitions;
|
---|
| 33 | * </code>
|
---|
| 34 | */
|
---|
| 35 | class ProjectsInstancesInstancePartitions extends \Google\Service\Resource
|
---|
| 36 | {
|
---|
| 37 | /**
|
---|
| 38 | * Creates an instance partition 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 partition. The instance partition name is assigned
|
---|
| 41 | * by the caller. If the named instance partition already exists,
|
---|
| 42 | * `CreateInstancePartition` returns `ALREADY_EXISTS`. Immediately upon
|
---|
| 43 | * completion of this request: * The instance partition is readable via the API,
|
---|
| 44 | * with all requested attributes but no allocated resources. Its state is
|
---|
| 45 | * `CREATING`. Until completion of the returned operation: * Cancelling the
|
---|
| 46 | * operation renders the instance partition immediately unreadable via the API.
|
---|
| 47 | * * The instance partition can be deleted. * All other attempts to modify the
|
---|
| 48 | * instance partition are rejected. Upon completion of the returned operation: *
|
---|
| 49 | * Billing for all successfully-allocated resources begins (some types may have
|
---|
| 50 | * lower than the requested levels). * Databases can start using this instance
|
---|
| 51 | * partition. * The instance partition's allocated resource levels are readable
|
---|
| 52 | * via the API. * The instance partition's state becomes `READY`. The returned
|
---|
| 53 | * long-running operation will have a name of the format `/operations/` and can
|
---|
| 54 | * be used to track creation of the instance partition. The metadata field type
|
---|
| 55 | * is CreateInstancePartitionMetadata. The response field type is
|
---|
| 56 | * InstancePartition, if successful. (instancePartitions.create)
|
---|
| 57 | *
|
---|
| 58 | * @param string $parent Required. The name of the instance in which to create
|
---|
| 59 | * the instance partition. Values are of the form `projects//instances/`.
|
---|
| 60 | * @param CreateInstancePartitionRequest $postBody
|
---|
| 61 | * @param array $optParams Optional parameters.
|
---|
| 62 | * @return Operation
|
---|
| 63 | * @throws \Google\Service\Exception
|
---|
| 64 | */
|
---|
| 65 | public function create($parent, CreateInstancePartitionRequest $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 an existing instance partition. Requires that the instance partition
|
---|
| 73 | * is not used by any database or backup and is not the default instance
|
---|
| 74 | * partition of an instance. Authorization requires
|
---|
| 75 | * `spanner.instancePartitions.delete` permission on the resource name.
|
---|
| 76 | * (instancePartitions.delete)
|
---|
| 77 | *
|
---|
| 78 | * @param string $name Required. The name of the instance partition to be
|
---|
| 79 | * deleted. Values are of the form `projects/{project}/instances/{instance}/inst
|
---|
| 80 | * ancePartitions/{instance_partition}`
|
---|
| 81 | * @param array $optParams Optional parameters.
|
---|
| 82 | *
|
---|
| 83 | * @opt_param string etag Optional. If not empty, the API only deletes the
|
---|
| 84 | * instance partition when the etag provided matches the current status of the
|
---|
| 85 | * requested instance partition. Otherwise, deletes the instance partition
|
---|
| 86 | * without checking the current status of the requested instance partition.
|
---|
| 87 | * @return SpannerEmpty
|
---|
| 88 | * @throws \Google\Service\Exception
|
---|
| 89 | */
|
---|
| 90 | public function delete($name, $optParams = [])
|
---|
| 91 | {
|
---|
| 92 | $params = ['name' => $name];
|
---|
| 93 | $params = array_merge($params, $optParams);
|
---|
| 94 | return $this->call('delete', [$params], SpannerEmpty::class);
|
---|
| 95 | }
|
---|
| 96 | /**
|
---|
| 97 | * Gets information about a particular instance partition.
|
---|
| 98 | * (instancePartitions.get)
|
---|
| 99 | *
|
---|
| 100 | * @param string $name Required. The name of the requested instance partition.
|
---|
| 101 | * Values are of the form `projects/{project}/instances/{instance}/instanceParti
|
---|
| 102 | * tions/{instance_partition}`.
|
---|
| 103 | * @param array $optParams Optional parameters.
|
---|
| 104 | * @return InstancePartition
|
---|
| 105 | * @throws \Google\Service\Exception
|
---|
| 106 | */
|
---|
| 107 | public function get($name, $optParams = [])
|
---|
| 108 | {
|
---|
| 109 | $params = ['name' => $name];
|
---|
| 110 | $params = array_merge($params, $optParams);
|
---|
| 111 | return $this->call('get', [$params], InstancePartition::class);
|
---|
| 112 | }
|
---|
| 113 | /**
|
---|
| 114 | * Lists all instance partitions for the given instance.
|
---|
| 115 | * (instancePartitions.listProjectsInstancesInstancePartitions)
|
---|
| 116 | *
|
---|
| 117 | * @param string $parent Required. The instance whose instance partitions should
|
---|
| 118 | * be listed. Values are of the form `projects//instances/`. Use `{instance} =
|
---|
| 119 | * '-'` to list instance partitions for all Instances in a project, e.g.,
|
---|
| 120 | * `projects/myproject/instances/-`.
|
---|
| 121 | * @param array $optParams Optional parameters.
|
---|
| 122 | *
|
---|
| 123 | * @opt_param string instancePartitionDeadline Optional. Deadline used while
|
---|
| 124 | * retrieving metadata for instance partitions. Instance partitions whose
|
---|
| 125 | * metadata cannot be retrieved within this deadline will be added to
|
---|
| 126 | * unreachable in ListInstancePartitionsResponse.
|
---|
| 127 | * @opt_param int pageSize Number of instance partitions to be returned in the
|
---|
| 128 | * response. If 0 or less, defaults to the server's maximum allowed page size.
|
---|
| 129 | * @opt_param string pageToken If non-empty, `page_token` should contain a
|
---|
| 130 | * next_page_token from a previous ListInstancePartitionsResponse.
|
---|
| 131 | * @return ListInstancePartitionsResponse
|
---|
| 132 | * @throws \Google\Service\Exception
|
---|
| 133 | */
|
---|
| 134 | public function listProjectsInstancesInstancePartitions($parent, $optParams = [])
|
---|
| 135 | {
|
---|
| 136 | $params = ['parent' => $parent];
|
---|
| 137 | $params = array_merge($params, $optParams);
|
---|
| 138 | return $this->call('list', [$params], ListInstancePartitionsResponse::class);
|
---|
| 139 | }
|
---|
| 140 | /**
|
---|
| 141 | * Updates an instance partition, and begins allocating or releasing resources
|
---|
| 142 | * as requested. The returned long-running operation can be used to track the
|
---|
| 143 | * progress of updating the instance partition. If the named instance partition
|
---|
| 144 | * does not exist, returns `NOT_FOUND`. Immediately upon completion of this
|
---|
| 145 | * request: * For resource types for which a decrease in the instance
|
---|
| 146 | * partition's allocation has been requested, billing is based on the newly-
|
---|
| 147 | * requested level. Until completion of the returned operation: * Cancelling the
|
---|
| 148 | * operation sets its metadata's cancel_time, and begins restoring resources to
|
---|
| 149 | * their pre-request values. The operation is guaranteed to succeed at undoing
|
---|
| 150 | * all resource changes, after which point it terminates with a `CANCELLED`
|
---|
| 151 | * status. * All other attempts to modify the instance partition are rejected. *
|
---|
| 152 | * Reading the instance partition via the API continues to give the pre-request
|
---|
| 153 | * resource levels. Upon completion of the returned operation: * Billing begins
|
---|
| 154 | * for all successfully-allocated resources (some types may have lower than the
|
---|
| 155 | * requested levels). * All newly-reserved resources are available for serving
|
---|
| 156 | * the instance partition's tables. * The instance partition's new resource
|
---|
| 157 | * levels are readable via the API. The returned long-running operation will
|
---|
| 158 | * have a name of the format `/operations/` and can be used to track the
|
---|
| 159 | * instance partition modification. The metadata field type is
|
---|
| 160 | * UpdateInstancePartitionMetadata. The response field type is
|
---|
| 161 | * InstancePartition, if successful. Authorization requires
|
---|
| 162 | * `spanner.instancePartitions.update` permission on the resource name.
|
---|
| 163 | * (instancePartitions.patch)
|
---|
| 164 | *
|
---|
| 165 | * @param string $name Required. A unique identifier for the instance partition.
|
---|
| 166 | * Values are of the form
|
---|
| 167 | * `projects//instances//instancePartitions/a-z*[a-z0-9]`. The final segment of
|
---|
| 168 | * the name must be between 2 and 64 characters in length. An instance
|
---|
| 169 | * partition's name cannot be changed after the instance partition is created.
|
---|
| 170 | * @param UpdateInstancePartitionRequest $postBody
|
---|
| 171 | * @param array $optParams Optional parameters.
|
---|
| 172 | * @return Operation
|
---|
| 173 | * @throws \Google\Service\Exception
|
---|
| 174 | */
|
---|
| 175 | public function patch($name, UpdateInstancePartitionRequest $postBody, $optParams = [])
|
---|
| 176 | {
|
---|
| 177 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 178 | $params = array_merge($params, $optParams);
|
---|
| 179 | return $this->call('patch', [$params], Operation::class);
|
---|
| 180 | }
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 184 | class_alias(ProjectsInstancesInstancePartitions::class, 'Google_Service_Spanner_Resource_ProjectsInstancesInstancePartitions');
|
---|