From efdf69920808805464ec7437c6998eadece421f6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:49:16 -0700 Subject: [PATCH] feat: add fields and the BackupType proto for Hot Backups (#7576) docs: clarify comments and fix typos PiperOrigin-RevId: 658791576 Source-Link: https://github.com/googleapis/googleapis/commit/c93b54fa3060c7185f6dc724f0f9ec0c12bc44fc Source-Link: https://github.com/googleapis/googleapis-gen/commit/e52ba38a95a82f7588d0dd3a2284c98850dab9e1 Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6ImU1MmJhMzhhOTVhODJmNzU4OGQwZGQzYTIyODRjOTg4NTBkYWI5ZTEifQ== --- metadata/Admin/V2/Table.php | Bin 6104 -> 6294 bytes src/Admin/V2/Backup.php | 158 +++++++++++++++--- src/Admin/V2/Backup/BackupType.php | 69 ++++++++ src/Admin/V2/BackupInfo.php | 12 +- .../V2/Client/BigtableTableAdminClient.php | 2 +- src/Admin/V2/CopyBackupRequest.php | 10 +- 6 files changed, 217 insertions(+), 34 deletions(-) create mode 100644 src/Admin/V2/Backup/BackupType.php diff --git a/metadata/Admin/V2/Table.php b/metadata/Admin/V2/Table.php index 82cd8f9c5af92be5006a16e536bf968691926e3b..8bd9c50772afd8e16b7cb9d080951b572ce67276 100644 GIT binary patch delta 157 zcmcbiKh1E15i|1)Ew0HEn58!dFqiW){bb#IQmC6zP{@IcJ1H?ayR;y_q_QAYf_t(7 zi-NWjSVRv(g#g8cEVx86@=M}N^5ct367y0Li&ElCGILWUcqY#mRG1thVkx2Iz{Q26 sL7Ge4$/instances//backups/. + * are of the form: + * projects//instances//clusters//backups/ * * Generated from protobuf field string source_backup = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ protected $source_backup = ''; /** - * Required. The expiration time of the backup, with microseconds - * granularity that must be at least 6 hours and at most 90 days - * from the time the request is received. Once the `expire_time` - * has passed, Cloud Bigtable will delete the backup and free the - * resources used by the backup. + * Required. The expiration time of the backup. + * When creating a backup or updating its `expire_time`, the value must be + * greater than the backup creation time by: + * - At least 6 hours + * - At most 90 days + * Once the `expire_time` has passed, Cloud Bigtable will delete the backup. * * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = REQUIRED]; */ @@ -90,6 +92,24 @@ class Backup extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.bigtable.admin.v2.EncryptionInfo encryption_info = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ protected $encryption_info = null; + /** + * Indicates the backup type of the backup. + * + * Generated from protobuf field .google.bigtable.admin.v2.Backup.BackupType backup_type = 11; + */ + protected $backup_type = 0; + /** + * The time at which the hot backup will be converted to a standard backup. + * Once the `hot_to_standard_time` has passed, Cloud Bigtable will convert the + * hot backup to a standard backup. This value must be greater than the backup + * creation time by: + * - At least 24 hours + * This field only applies for hot backups. When creating or updating a + * standard backup, attempting to set this field will fail the request. + * + * Generated from protobuf field .google.protobuf.Timestamp hot_to_standard_time = 12; + */ + protected $hot_to_standard_time = null; /** * Constructor. @@ -114,13 +134,15 @@ class Backup extends \Google\Protobuf\Internal\Message * @type string $source_backup * Output only. Name of the backup from which this backup was copied. If a * backup is not created by copying a backup, this field will be empty. Values - * are of the form: projects//instances//backups/. + * are of the form: + * projects//instances//clusters//backups/ * @type \Google\Protobuf\Timestamp $expire_time - * Required. The expiration time of the backup, with microseconds - * granularity that must be at least 6 hours and at most 90 days - * from the time the request is received. Once the `expire_time` - * has passed, Cloud Bigtable will delete the backup and free the - * resources used by the backup. + * Required. The expiration time of the backup. + * When creating a backup or updating its `expire_time`, the value must be + * greater than the backup creation time by: + * - At least 6 hours + * - At most 90 days + * Once the `expire_time` has passed, Cloud Bigtable will delete the backup. * @type \Google\Protobuf\Timestamp $start_time * Output only. `start_time` is the time that the backup was started * (i.e. approximately the time the @@ -136,6 +158,16 @@ class Backup extends \Google\Protobuf\Internal\Message * Output only. The current state of the backup. * @type \Google\Cloud\Bigtable\Admin\V2\EncryptionInfo $encryption_info * Output only. The encryption information for the backup. + * @type int $backup_type + * Indicates the backup type of the backup. + * @type \Google\Protobuf\Timestamp $hot_to_standard_time + * The time at which the hot backup will be converted to a standard backup. + * Once the `hot_to_standard_time` has passed, Cloud Bigtable will convert the + * hot backup to a standard backup. This value must be greater than the backup + * creation time by: + * - At least 24 hours + * This field only applies for hot backups. When creating or updating a + * standard backup, attempting to set this field will fail the request. * } */ public function __construct($data = NULL) { @@ -218,7 +250,8 @@ public function setSourceTable($var) /** * Output only. Name of the backup from which this backup was copied. If a * backup is not created by copying a backup, this field will be empty. Values - * are of the form: projects//instances//backups/. + * are of the form: + * projects//instances//clusters//backups/ * * Generated from protobuf field string source_backup = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @return string @@ -231,7 +264,8 @@ public function getSourceBackup() /** * Output only. Name of the backup from which this backup was copied. If a * backup is not created by copying a backup, this field will be empty. Values - * are of the form: projects//instances//backups/. + * are of the form: + * projects//instances//clusters//backups/ * * Generated from protobuf field string source_backup = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @param string $var @@ -246,11 +280,12 @@ public function setSourceBackup($var) } /** - * Required. The expiration time of the backup, with microseconds - * granularity that must be at least 6 hours and at most 90 days - * from the time the request is received. Once the `expire_time` - * has passed, Cloud Bigtable will delete the backup and free the - * resources used by the backup. + * Required. The expiration time of the backup. + * When creating a backup or updating its `expire_time`, the value must be + * greater than the backup creation time by: + * - At least 6 hours + * - At most 90 days + * Once the `expire_time` has passed, Cloud Bigtable will delete the backup. * * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = REQUIRED]; * @return \Google\Protobuf\Timestamp|null @@ -271,11 +306,12 @@ public function clearExpireTime() } /** - * Required. The expiration time of the backup, with microseconds - * granularity that must be at least 6 hours and at most 90 days - * from the time the request is received. Once the `expire_time` - * has passed, Cloud Bigtable will delete the backup and free the - * resources used by the backup. + * Required. The expiration time of the backup. + * When creating a backup or updating its `expire_time`, the value must be + * greater than the backup creation time by: + * - At least 6 hours + * - At most 90 days + * Once the `expire_time` has passed, Cloud Bigtable will delete the backup. * * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = REQUIRED]; * @param \Google\Protobuf\Timestamp $var @@ -459,5 +495,79 @@ public function setEncryptionInfo($var) return $this; } + /** + * Indicates the backup type of the backup. + * + * Generated from protobuf field .google.bigtable.admin.v2.Backup.BackupType backup_type = 11; + * @return int + */ + public function getBackupType() + { + return $this->backup_type; + } + + /** + * Indicates the backup type of the backup. + * + * Generated from protobuf field .google.bigtable.admin.v2.Backup.BackupType backup_type = 11; + * @param int $var + * @return $this + */ + public function setBackupType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Bigtable\Admin\V2\Backup\BackupType::class); + $this->backup_type = $var; + + return $this; + } + + /** + * The time at which the hot backup will be converted to a standard backup. + * Once the `hot_to_standard_time` has passed, Cloud Bigtable will convert the + * hot backup to a standard backup. This value must be greater than the backup + * creation time by: + * - At least 24 hours + * This field only applies for hot backups. When creating or updating a + * standard backup, attempting to set this field will fail the request. + * + * Generated from protobuf field .google.protobuf.Timestamp hot_to_standard_time = 12; + * @return \Google\Protobuf\Timestamp|null + */ + public function getHotToStandardTime() + { + return $this->hot_to_standard_time; + } + + public function hasHotToStandardTime() + { + return isset($this->hot_to_standard_time); + } + + public function clearHotToStandardTime() + { + unset($this->hot_to_standard_time); + } + + /** + * The time at which the hot backup will be converted to a standard backup. + * Once the `hot_to_standard_time` has passed, Cloud Bigtable will convert the + * hot backup to a standard backup. This value must be greater than the backup + * creation time by: + * - At least 24 hours + * This field only applies for hot backups. When creating or updating a + * standard backup, attempting to set this field will fail the request. + * + * Generated from protobuf field .google.protobuf.Timestamp hot_to_standard_time = 12; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setHotToStandardTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->hot_to_standard_time = $var; + + return $this; + } + } diff --git a/src/Admin/V2/Backup/BackupType.php b/src/Admin/V2/Backup/BackupType.php new file mode 100644 index 0000000..cf2244e --- /dev/null +++ b/src/Admin/V2/Backup/BackupType.php @@ -0,0 +1,69 @@ +google.bigtable.admin.v2.Backup.BackupType + */ +class BackupType +{ + /** + * Not specified. + * + * Generated from protobuf enum BACKUP_TYPE_UNSPECIFIED = 0; + */ + const BACKUP_TYPE_UNSPECIFIED = 0; + /** + * The default type for Cloud Bigtable managed backups. Supported for + * backups created in both HDD and SSD instances. Requires optimization when + * restored to a table in an SSD instance. + * + * Generated from protobuf enum STANDARD = 1; + */ + const STANDARD = 1; + /** + * A backup type with faster restore to SSD performance. Only supported for + * backups created in SSD instances. A new SSD table restored from a hot + * backup reaches production performance more quickly than a standard + * backup. + * + * Generated from protobuf enum HOT = 2; + */ + const HOT = 2; + + private static $valueToName = [ + self::BACKUP_TYPE_UNSPECIFIED => 'BACKUP_TYPE_UNSPECIFIED', + self::STANDARD => 'STANDARD', + self::HOT => 'HOT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BackupType::class, \Google\Cloud\Bigtable\Admin\V2\Backup_BackupType::class); + diff --git a/src/Admin/V2/BackupInfo.php b/src/Admin/V2/BackupInfo.php index 97b8b31..a968022 100644 --- a/src/Admin/V2/BackupInfo.php +++ b/src/Admin/V2/BackupInfo.php @@ -44,7 +44,8 @@ class BackupInfo extends \Google\Protobuf\Internal\Message /** * Output only. Name of the backup from which this backup was copied. If a * backup is not created by copying a backup, this field will be empty. Values - * are of the form: projects//instances//backups/. + * are of the form: + * projects//instances//clusters//backups/ * * Generated from protobuf field string source_backup = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ @@ -69,7 +70,8 @@ class BackupInfo extends \Google\Protobuf\Internal\Message * @type string $source_backup * Output only. Name of the backup from which this backup was copied. If a * backup is not created by copying a backup, this field will be empty. Values - * are of the form: projects//instances//backups/. + * are of the form: + * projects//instances//clusters//backups/ * } */ public function __construct($data = NULL) { @@ -208,7 +210,8 @@ public function setSourceTable($var) /** * Output only. Name of the backup from which this backup was copied. If a * backup is not created by copying a backup, this field will be empty. Values - * are of the form: projects//instances//backups/. + * are of the form: + * projects//instances//clusters//backups/ * * Generated from protobuf field string source_backup = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @return string @@ -221,7 +224,8 @@ public function getSourceBackup() /** * Output only. Name of the backup from which this backup was copied. If a * backup is not created by copying a backup, this field will be empty. Values - * are of the form: projects//instances//backups/. + * are of the form: + * projects//instances//clusters//backups/ * * Generated from protobuf field string source_backup = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @param string $var diff --git a/src/Admin/V2/Client/BigtableTableAdminClient.php b/src/Admin/V2/Client/BigtableTableAdminClient.php index 7d3292c..6fc0436 100644 --- a/src/Admin/V2/Client/BigtableTableAdminClient.php +++ b/src/Admin/V2/Client/BigtableTableAdminClient.php @@ -1098,7 +1098,7 @@ public function modifyColumnFamilies(ModifyColumnFamiliesRequest $request, array * returned table [long-running operation][google.longrunning.Operation] can * be used to track the progress of the operation, and to cancel it. The * [metadata][google.longrunning.Operation.metadata] field type is - * [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The + * [RestoreTableMetadata][google.bigtable.admin.v2.RestoreTableMetadata]. The * [response][google.longrunning.Operation.response] type is * [Table][google.bigtable.admin.v2.Table], if successful. * diff --git a/src/Admin/V2/CopyBackupRequest.php b/src/Admin/V2/CopyBackupRequest.php index 2212688..8f004b2 100644 --- a/src/Admin/V2/CopyBackupRequest.php +++ b/src/Admin/V2/CopyBackupRequest.php @@ -18,7 +18,7 @@ class CopyBackupRequest extends \Google\Protobuf\Internal\Message { /** * Required. The name of the destination cluster that will contain the backup - * copy. The cluster must already exists. Values are of the form: + * copy. The cluster must already exist. Values are of the form: * `projects/{project}/instances/{instance}/clusters/{cluster}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { @@ -60,7 +60,7 @@ class CopyBackupRequest extends \Google\Protobuf\Internal\Message /** * @param string $parent Required. The name of the destination cluster that will contain the backup - * copy. The cluster must already exists. Values are of the form: + * copy. The cluster must already exist. Values are of the form: * `projects/{project}/instances/{instance}/clusters/{cluster}`. Please see * {@see BigtableTableAdminClient::clusterName()} for help formatting this field. * @param string $backupId Required. The id of the new backup. The `backup_id` along with `parent` @@ -104,7 +104,7 @@ public static function build(string $parent, string $backupId, string $sourceBac * * @type string $parent * Required. The name of the destination cluster that will contain the backup - * copy. The cluster must already exists. Values are of the form: + * copy. The cluster must already exist. Values are of the form: * `projects/{project}/instances/{instance}/clusters/{cluster}`. * @type string $backup_id * Required. The id of the new backup. The `backup_id` along with `parent` @@ -136,7 +136,7 @@ public function __construct($data = NULL) { /** * Required. The name of the destination cluster that will contain the backup - * copy. The cluster must already exists. Values are of the form: + * copy. The cluster must already exist. Values are of the form: * `projects/{project}/instances/{instance}/clusters/{cluster}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { @@ -149,7 +149,7 @@ public function getParent() /** * Required. The name of the destination cluster that will contain the backup - * copy. The cluster must already exists. Values are of the form: + * copy. The cluster must already exist. Values are of the form: * `projects/{project}/instances/{instance}/clusters/{cluster}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {