[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\Backup;
|
---|
| 21 | use Google\Service\Spanner\CopyBackupRequest;
|
---|
| 22 | use Google\Service\Spanner\GetIamPolicyRequest;
|
---|
| 23 | use Google\Service\Spanner\ListBackupsResponse;
|
---|
| 24 | use Google\Service\Spanner\Operation;
|
---|
| 25 | use Google\Service\Spanner\Policy;
|
---|
| 26 | use Google\Service\Spanner\SetIamPolicyRequest;
|
---|
| 27 | use Google\Service\Spanner\SpannerEmpty;
|
---|
| 28 | use Google\Service\Spanner\TestIamPermissionsRequest;
|
---|
| 29 | use Google\Service\Spanner\TestIamPermissionsResponse;
|
---|
| 30 |
|
---|
| 31 | /**
|
---|
| 32 | * The "backups" collection of methods.
|
---|
| 33 | * Typical usage is:
|
---|
| 34 | * <code>
|
---|
| 35 | * $spannerService = new Google\Service\Spanner(...);
|
---|
| 36 | * $backups = $spannerService->projects_instances_backups;
|
---|
| 37 | * </code>
|
---|
| 38 | */
|
---|
| 39 | class ProjectsInstancesBackups extends \Google\Service\Resource
|
---|
| 40 | {
|
---|
| 41 | /**
|
---|
| 42 | * Starts copying a Cloud Spanner Backup. The returned backup long-running
|
---|
| 43 | * operation will have a name of the format
|
---|
| 44 | * `projects//instances//backups//operations/` and can be used to track copying
|
---|
| 45 | * of the backup. The operation is associated with the destination backup. The
|
---|
| 46 | * metadata field type is CopyBackupMetadata. The response field type is Backup,
|
---|
| 47 | * if successful. Cancelling the returned operation will stop the copying and
|
---|
| 48 | * delete the destination backup. Concurrent CopyBackup requests can run on the
|
---|
| 49 | * same source backup. (backups.copy)
|
---|
| 50 | *
|
---|
| 51 | * @param string $parent Required. The name of the destination instance that
|
---|
| 52 | * will contain the backup copy. Values are of the form: `projects//instances/`.
|
---|
| 53 | * @param CopyBackupRequest $postBody
|
---|
| 54 | * @param array $optParams Optional parameters.
|
---|
| 55 | * @return Operation
|
---|
| 56 | * @throws \Google\Service\Exception
|
---|
| 57 | */
|
---|
| 58 | public function copy($parent, CopyBackupRequest $postBody, $optParams = [])
|
---|
| 59 | {
|
---|
| 60 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 61 | $params = array_merge($params, $optParams);
|
---|
| 62 | return $this->call('copy', [$params], Operation::class);
|
---|
| 63 | }
|
---|
| 64 | /**
|
---|
| 65 | * Starts creating a new Cloud Spanner Backup. The returned backup long-running
|
---|
| 66 | * operation will have a name of the format
|
---|
| 67 | * `projects//instances//backups//operations/` and can be used to track creation
|
---|
| 68 | * of the backup. The metadata field type is CreateBackupMetadata. The response
|
---|
| 69 | * field type is Backup, if successful. Cancelling the returned operation will
|
---|
| 70 | * stop the creation and delete the backup. There can be only one pending backup
|
---|
| 71 | * creation per database. Backup creation of different databases can run
|
---|
| 72 | * concurrently. (backups.create)
|
---|
| 73 | *
|
---|
| 74 | * @param string $parent Required. The name of the instance in which the backup
|
---|
| 75 | * will be created. This must be the same instance that contains the database
|
---|
| 76 | * the backup will be created from. The backup will be stored in the location(s)
|
---|
| 77 | * specified in the instance configuration of this instance. Values are of the
|
---|
| 78 | * form `projects//instances/`.
|
---|
| 79 | * @param Backup $postBody
|
---|
| 80 | * @param array $optParams Optional parameters.
|
---|
| 81 | *
|
---|
| 82 | * @opt_param string backupId Required. The id of the backup to be created. The
|
---|
| 83 | * `backup_id` appended to `parent` forms the full backup name of the form
|
---|
| 84 | * `projects//instances//backups/`.
|
---|
| 85 | * @opt_param string encryptionConfig.encryptionType Required. The encryption
|
---|
| 86 | * type of the backup.
|
---|
| 87 | * @opt_param string encryptionConfig.kmsKeyName Optional. The Cloud KMS key
|
---|
| 88 | * that will be used to protect the backup. This field should be set only when
|
---|
| 89 | * encryption_type is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
|
---|
| 90 | * `projects//locations//keyRings//cryptoKeys/`.
|
---|
| 91 | * @opt_param string encryptionConfig.kmsKeyNames Optional. Specifies the KMS
|
---|
| 92 | * configuration for the one or more keys used to protect the backup. Values are
|
---|
| 93 | * of the form `projects//locations//keyRings//cryptoKeys/`. The keys referenced
|
---|
| 94 | * by `kms_key_names` must fully cover all regions of the backup's instance
|
---|
| 95 | * configuration. Some examples: * For regional (single-region) instance
|
---|
| 96 | * configurations, specify a regional location KMS key. * For multi-region
|
---|
| 97 | * instance configurations of type `GOOGLE_MANAGED`, either specify a multi-
|
---|
| 98 | * region location KMS key or multiple regional location KMS keys that cover all
|
---|
| 99 | * regions in the instance configuration. * For an instance configuration of
|
---|
| 100 | * type `USER_MANAGED`, specify only regional location KMS keys to cover each
|
---|
| 101 | * region in the instance configuration. Multi-region location KMS keys aren't
|
---|
| 102 | * supported for `USER_MANAGED` type instance configurations.
|
---|
| 103 | * @return Operation
|
---|
| 104 | * @throws \Google\Service\Exception
|
---|
| 105 | */
|
---|
| 106 | public function create($parent, Backup $postBody, $optParams = [])
|
---|
| 107 | {
|
---|
| 108 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 109 | $params = array_merge($params, $optParams);
|
---|
| 110 | return $this->call('create', [$params], Operation::class);
|
---|
| 111 | }
|
---|
| 112 | /**
|
---|
| 113 | * Deletes a pending or completed Backup. (backups.delete)
|
---|
| 114 | *
|
---|
| 115 | * @param string $name Required. Name of the backup to delete. Values are of the
|
---|
| 116 | * form `projects//instances//backups/`.
|
---|
| 117 | * @param array $optParams Optional parameters.
|
---|
| 118 | * @return SpannerEmpty
|
---|
| 119 | * @throws \Google\Service\Exception
|
---|
| 120 | */
|
---|
| 121 | public function delete($name, $optParams = [])
|
---|
| 122 | {
|
---|
| 123 | $params = ['name' => $name];
|
---|
| 124 | $params = array_merge($params, $optParams);
|
---|
| 125 | return $this->call('delete', [$params], SpannerEmpty::class);
|
---|
| 126 | }
|
---|
| 127 | /**
|
---|
| 128 | * Gets metadata on a pending or completed Backup. (backups.get)
|
---|
| 129 | *
|
---|
| 130 | * @param string $name Required. Name of the backup. Values are of the form
|
---|
| 131 | * `projects//instances//backups/`.
|
---|
| 132 | * @param array $optParams Optional parameters.
|
---|
| 133 | * @return Backup
|
---|
| 134 | * @throws \Google\Service\Exception
|
---|
| 135 | */
|
---|
| 136 | public function get($name, $optParams = [])
|
---|
| 137 | {
|
---|
| 138 | $params = ['name' => $name];
|
---|
| 139 | $params = array_merge($params, $optParams);
|
---|
| 140 | return $this->call('get', [$params], Backup::class);
|
---|
| 141 | }
|
---|
| 142 | /**
|
---|
| 143 | * Gets the access control policy for a database or backup resource. Returns an
|
---|
| 144 | * empty policy if a database or backup exists but does not have a policy set.
|
---|
| 145 | * Authorization requires `spanner.databases.getIamPolicy` permission on
|
---|
| 146 | * resource. For backups, authorization requires `spanner.backups.getIamPolicy`
|
---|
| 147 | * permission on resource. For backup schedules, authorization requires
|
---|
| 148 | * `spanner.backupSchedules.getIamPolicy` permission on resource.
|
---|
| 149 | * (backups.getIamPolicy)
|
---|
| 150 | *
|
---|
| 151 | * @param string $resource REQUIRED: The Cloud Spanner resource for which the
|
---|
| 152 | * policy is being retrieved. The format is `projects//instances/` for instance
|
---|
| 153 | * resources and `projects//instances//databases/` for database resources.
|
---|
| 154 | * @param GetIamPolicyRequest $postBody
|
---|
| 155 | * @param array $optParams Optional parameters.
|
---|
| 156 | * @return Policy
|
---|
| 157 | * @throws \Google\Service\Exception
|
---|
| 158 | */
|
---|
| 159 | public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
|
---|
| 160 | {
|
---|
| 161 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 162 | $params = array_merge($params, $optParams);
|
---|
| 163 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
| 164 | }
|
---|
| 165 | /**
|
---|
| 166 | * Lists completed and pending backups. Backups returned are ordered by
|
---|
| 167 | * `create_time` in descending order, starting from the most recent
|
---|
| 168 | * `create_time`. (backups.listProjectsInstancesBackups)
|
---|
| 169 | *
|
---|
| 170 | * @param string $parent Required. The instance to list backups from. Values are
|
---|
| 171 | * of the form `projects//instances/`.
|
---|
| 172 | * @param array $optParams Optional parameters.
|
---|
| 173 | *
|
---|
| 174 | * @opt_param string filter An expression that filters the list of returned
|
---|
| 175 | * backups. A filter expression consists of a field name, a comparison operator,
|
---|
| 176 | * and a value for filtering. The value must be a string, a number, or a
|
---|
| 177 | * boolean. The comparison operator must be one of: `<`, `>`, `<=`, `>=`, `!=`,
|
---|
| 178 | * `=`, or `:`. Colon `:` is the contains operator. Filter rules are not case
|
---|
| 179 | * sensitive. The following fields in the Backup are eligible for filtering: *
|
---|
| 180 | * `name` * `database` * `state` * `create_time` (and values are of the format
|
---|
| 181 | * YYYY-MM-DDTHH:MM:SSZ) * `expire_time` (and values are of the format YYYY-MM-
|
---|
| 182 | * DDTHH:MM:SSZ) * `version_time` (and values are of the format YYYY-MM-
|
---|
| 183 | * DDTHH:MM:SSZ) * `size_bytes` * `backup_schedules` You can combine multiple
|
---|
| 184 | * expressions by enclosing each expression in parentheses. By default,
|
---|
| 185 | * expressions are combined with AND logic, but you can specify AND, OR, and NOT
|
---|
| 186 | * logic explicitly. Here are a few examples: * `name:Howl` - The backup's name
|
---|
| 187 | * contains the string "howl". * `database:prod` - The database's name contains
|
---|
| 188 | * the string "prod". * `state:CREATING` - The backup is pending creation. *
|
---|
| 189 | * `state:READY` - The backup is fully created and ready for use. * `(name:howl)
|
---|
| 190 | * AND (create_time < \"2018-03-28T14:50:00Z\")` - The backup name contains the
|
---|
| 191 | * string "howl" and `create_time` of the backup is before 2018-03-28T14:50:00Z.
|
---|
| 192 | * * `expire_time < \"2018-03-28T14:50:00Z\"` - The backup `expire_time` is
|
---|
| 193 | * before 2018-03-28T14:50:00Z. * `size_bytes > 10000000000` - The backup's size
|
---|
| 194 | * is greater than 10GB * `backup_schedules:daily` - The backup is created from
|
---|
| 195 | * a schedule with "daily" in its name.
|
---|
| 196 | * @opt_param int pageSize Number of backups to be returned in the response. If
|
---|
| 197 | * 0 or less, defaults to the server's maximum allowed page size.
|
---|
| 198 | * @opt_param string pageToken If non-empty, `page_token` should contain a
|
---|
| 199 | * next_page_token from a previous ListBackupsResponse to the same `parent` and
|
---|
| 200 | * with the same `filter`.
|
---|
| 201 | * @return ListBackupsResponse
|
---|
| 202 | * @throws \Google\Service\Exception
|
---|
| 203 | */
|
---|
| 204 | public function listProjectsInstancesBackups($parent, $optParams = [])
|
---|
| 205 | {
|
---|
| 206 | $params = ['parent' => $parent];
|
---|
| 207 | $params = array_merge($params, $optParams);
|
---|
| 208 | return $this->call('list', [$params], ListBackupsResponse::class);
|
---|
| 209 | }
|
---|
| 210 | /**
|
---|
| 211 | * Updates a pending or completed Backup. (backups.patch)
|
---|
| 212 | *
|
---|
| 213 | * @param string $name Output only for the CreateBackup operation. Required for
|
---|
| 214 | * the UpdateBackup operation. A globally unique identifier for the backup which
|
---|
| 215 | * cannot be changed. Values are of the form
|
---|
| 216 | * `projects//instances//backups/a-z*[a-z0-9]` The final segment of the name
|
---|
| 217 | * must be between 2 and 60 characters in length. The backup is stored in the
|
---|
| 218 | * location(s) specified in the instance configuration of the instance
|
---|
| 219 | * containing the backup, identified by the prefix of the backup name of the
|
---|
| 220 | * form `projects//instances/`.
|
---|
| 221 | * @param Backup $postBody
|
---|
| 222 | * @param array $optParams Optional parameters.
|
---|
| 223 | *
|
---|
| 224 | * @opt_param string updateMask Required. A mask specifying which fields (e.g.
|
---|
| 225 | * `expire_time`) in the Backup resource should be updated. This mask is
|
---|
| 226 | * relative to the Backup resource, not to the request message. The field mask
|
---|
| 227 | * must always be specified; this prevents any future fields from being erased
|
---|
| 228 | * accidentally by clients that do not know about them.
|
---|
| 229 | * @return Backup
|
---|
| 230 | * @throws \Google\Service\Exception
|
---|
| 231 | */
|
---|
| 232 | public function patch($name, Backup $postBody, $optParams = [])
|
---|
| 233 | {
|
---|
| 234 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 235 | $params = array_merge($params, $optParams);
|
---|
| 236 | return $this->call('patch', [$params], Backup::class);
|
---|
| 237 | }
|
---|
| 238 | /**
|
---|
| 239 | * Sets the access control policy on a database or backup resource. Replaces any
|
---|
| 240 | * existing policy. Authorization requires `spanner.databases.setIamPolicy`
|
---|
| 241 | * permission on resource. For backups, authorization requires
|
---|
| 242 | * `spanner.backups.setIamPolicy` permission on resource. For backup schedules,
|
---|
| 243 | * authorization requires `spanner.backupSchedules.setIamPolicy` permission on
|
---|
| 244 | * resource. (backups.setIamPolicy)
|
---|
| 245 | *
|
---|
| 246 | * @param string $resource REQUIRED: The Cloud Spanner resource for which the
|
---|
| 247 | * policy is being set. The format is `projects//instances/` for instance
|
---|
| 248 | * resources and `projects//instances//databases/` for databases resources.
|
---|
| 249 | * @param SetIamPolicyRequest $postBody
|
---|
| 250 | * @param array $optParams Optional parameters.
|
---|
| 251 | * @return Policy
|
---|
| 252 | * @throws \Google\Service\Exception
|
---|
| 253 | */
|
---|
| 254 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
| 255 | {
|
---|
| 256 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 257 | $params = array_merge($params, $optParams);
|
---|
| 258 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
| 259 | }
|
---|
| 260 | /**
|
---|
| 261 | * Returns permissions that the caller has on the specified database or backup
|
---|
| 262 | * resource. Attempting this RPC on a non-existent Cloud Spanner database will
|
---|
| 263 | * result in a NOT_FOUND error if the user has `spanner.databases.list`
|
---|
| 264 | * permission on the containing Cloud Spanner instance. Otherwise returns an
|
---|
| 265 | * empty set of permissions. Calling this method on a backup that does not exist
|
---|
| 266 | * will result in a NOT_FOUND error if the user has `spanner.backups.list`
|
---|
| 267 | * permission on the containing instance. Calling this method on a backup
|
---|
| 268 | * schedule that does not exist will result in a NOT_FOUND error if the user has
|
---|
| 269 | * `spanner.backupSchedules.list` permission on the containing database.
|
---|
| 270 | * (backups.testIamPermissions)
|
---|
| 271 | *
|
---|
| 272 | * @param string $resource REQUIRED: The Cloud Spanner resource for which
|
---|
| 273 | * permissions are being tested. The format is `projects//instances/` for
|
---|
| 274 | * instance resources and `projects//instances//databases/` for database
|
---|
| 275 | * resources.
|
---|
| 276 | * @param TestIamPermissionsRequest $postBody
|
---|
| 277 | * @param array $optParams Optional parameters.
|
---|
| 278 | * @return TestIamPermissionsResponse
|
---|
| 279 | * @throws \Google\Service\Exception
|
---|
| 280 | */
|
---|
| 281 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
| 282 | {
|
---|
| 283 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 284 | $params = array_merge($params, $optParams);
|
---|
| 285 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
| 286 | }
|
---|
| 287 | }
|
---|
| 288 |
|
---|
| 289 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 290 | class_alias(ProjectsInstancesBackups::class, 'Google_Service_Spanner_Resource_ProjectsInstancesBackups');
|
---|