From 3a23c951ad43851a1c584aa7e5e521453eee40ef Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 12:20:08 -0400 Subject: [PATCH] feat: add several fields to manage state of database encryption update (#7182) PiperOrigin-RevId: 619289281 Source-Link: https://github.com/googleapis/googleapis/commit/3a7c33486ca758b180c6d11dd4705fa9a22e8576 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6a8c733062d833d11c5245eda50f5108e0e55324 Copy-Tag: eyJwIjoiQ29udGFpbmVyLy5Pd2xCb3QueWFtbCIsImgiOiI2YThjNzMzMDYyZDgzM2QxMWM1MjQ1ZWRhNTBmNTEwOGUwZTU1MzI0In0= --- Container/metadata/V1/ClusterService.php | Bin 52138 -> 52725 bytes Container/src/V1/DatabaseEncryption.php | 124 +++++++++++++++ .../V1/DatabaseEncryption/CurrentState.php | 95 +++++++++++ .../V1/DatabaseEncryption/OperationError.php | 149 ++++++++++++++++++ 4 files changed, 368 insertions(+) create mode 100644 Container/src/V1/DatabaseEncryption/CurrentState.php create mode 100644 Container/src/V1/DatabaseEncryption/OperationError.php diff --git a/Container/metadata/V1/ClusterService.php b/Container/metadata/V1/ClusterService.php index d3c5eccd625651bc6bf621b0f57a47498feaf9ae..5b45309427cd9a9d9c3ae3f031a2ceaec5902acd 100644 GIT binary patch delta 537 zcmZ2Ao%!o*<_-KTOy4GL7G&}4W_rvzIi^2FQYe&*H@UQ^C^fGnzPKc@Bvpc0fl-6c z$Yk}P&LNZ+ZDXGatl?5f4`FZi#sg=bNEDFpT zoM0tFQCy-qiNz)H`30#(iC`6}MMe2V#S*NO&&NxH435+Dhsn8uq`>;5GPw9qg@pvT zIDm%7=OyN*N-zT5#wjGq#S1npJ~y?vI59m{f(b0F%f(re2^138UV9?q459! delta 33 rcmV++0N(%gn**ws1F#PS0;`U*5d=w#0+<1lT#sav`;axWK$5jP;HnL` diff --git a/Container/src/V1/DatabaseEncryption.php b/Container/src/V1/DatabaseEncryption.php index 04acc3742e44..fa7c30866762 100644 --- a/Container/src/V1/DatabaseEncryption.php +++ b/Container/src/V1/DatabaseEncryption.php @@ -28,6 +28,27 @@ class DatabaseEncryption extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.container.v1.DatabaseEncryption.State state = 2; */ private $state = 0; + /** + * Output only. The current state of etcd encryption. + * + * Generated from protobuf field optional .google.container.v1.DatabaseEncryption.CurrentState current_state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $current_state = null; + /** + * Output only. Keys in use by the cluster for decrypting + * existing objects, in addition to the key in `key_name`. + * Each item is a CloudKMS key resource. + * + * Generated from protobuf field repeated string decryption_keys = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $decryption_keys; + /** + * Output only. Records errors seen during DatabaseEncryption update + * operations. + * + * Generated from protobuf field repeated .google.container.v1.DatabaseEncryption.OperationError last_operation_errors = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $last_operation_errors; /** * Constructor. @@ -40,6 +61,15 @@ class DatabaseEncryption extends \Google\Protobuf\Internal\Message * Ex. projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key * @type int $state * The desired state of etcd encryption. + * @type int $current_state + * Output only. The current state of etcd encryption. + * @type array|\Google\Protobuf\Internal\RepeatedField $decryption_keys + * Output only. Keys in use by the cluster for decrypting + * existing objects, in addition to the key in `key_name`. + * Each item is a CloudKMS key resource. + * @type array<\Google\Cloud\Container\V1\DatabaseEncryption\OperationError>|\Google\Protobuf\Internal\RepeatedField $last_operation_errors + * Output only. Records errors seen during DatabaseEncryption update + * operations. * } */ public function __construct($data = NULL) { @@ -101,5 +131,99 @@ public function setState($var) return $this; } + /** + * Output only. The current state of etcd encryption. + * + * Generated from protobuf field optional .google.container.v1.DatabaseEncryption.CurrentState current_state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getCurrentState() + { + return isset($this->current_state) ? $this->current_state : 0; + } + + public function hasCurrentState() + { + return isset($this->current_state); + } + + public function clearCurrentState() + { + unset($this->current_state); + } + + /** + * Output only. The current state of etcd encryption. + * + * Generated from protobuf field optional .google.container.v1.DatabaseEncryption.CurrentState current_state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setCurrentState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Container\V1\DatabaseEncryption\CurrentState::class); + $this->current_state = $var; + + return $this; + } + + /** + * Output only. Keys in use by the cluster for decrypting + * existing objects, in addition to the key in `key_name`. + * Each item is a CloudKMS key resource. + * + * Generated from protobuf field repeated string decryption_keys = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDecryptionKeys() + { + return $this->decryption_keys; + } + + /** + * Output only. Keys in use by the cluster for decrypting + * existing objects, in addition to the key in `key_name`. + * Each item is a CloudKMS key resource. + * + * Generated from protobuf field repeated string decryption_keys = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDecryptionKeys($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->decryption_keys = $arr; + + return $this; + } + + /** + * Output only. Records errors seen during DatabaseEncryption update + * operations. + * + * Generated from protobuf field repeated .google.container.v1.DatabaseEncryption.OperationError last_operation_errors = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLastOperationErrors() + { + return $this->last_operation_errors; + } + + /** + * Output only. Records errors seen during DatabaseEncryption update + * operations. + * + * Generated from protobuf field repeated .google.container.v1.DatabaseEncryption.OperationError last_operation_errors = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Container\V1\DatabaseEncryption\OperationError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLastOperationErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Container\V1\DatabaseEncryption\OperationError::class); + $this->last_operation_errors = $arr; + + return $this; + } + } diff --git a/Container/src/V1/DatabaseEncryption/CurrentState.php b/Container/src/V1/DatabaseEncryption/CurrentState.php new file mode 100644 index 000000000000..56936b10a1c3 --- /dev/null +++ b/Container/src/V1/DatabaseEncryption/CurrentState.php @@ -0,0 +1,95 @@ +google.container.v1.DatabaseEncryption.CurrentState + */ +class CurrentState +{ + /** + * Should never be set + * + * Generated from protobuf enum CURRENT_STATE_UNSPECIFIED = 0; + */ + const CURRENT_STATE_UNSPECIFIED = 0; + /** + * Secrets in etcd are encrypted. + * + * Generated from protobuf enum CURRENT_STATE_ENCRYPTED = 7; + */ + const CURRENT_STATE_ENCRYPTED = 7; + /** + * Secrets in etcd are stored in plain text (at etcd level) - this is + * unrelated to Compute Engine level full disk encryption. + * + * Generated from protobuf enum CURRENT_STATE_DECRYPTED = 2; + */ + const CURRENT_STATE_DECRYPTED = 2; + /** + * Encryption (or re-encryption with a different CloudKMS key) + * of Secrets is in progress. + * + * Generated from protobuf enum CURRENT_STATE_ENCRYPTION_PENDING = 3; + */ + const CURRENT_STATE_ENCRYPTION_PENDING = 3; + /** + * Encryption (or re-encryption with a different CloudKMS key) of Secrets in + * etcd encountered an error. + * + * Generated from protobuf enum CURRENT_STATE_ENCRYPTION_ERROR = 4; + */ + const CURRENT_STATE_ENCRYPTION_ERROR = 4; + /** + * De-crypting Secrets to plain text in etcd is in progress. + * + * Generated from protobuf enum CURRENT_STATE_DECRYPTION_PENDING = 5; + */ + const CURRENT_STATE_DECRYPTION_PENDING = 5; + /** + * De-crypting Secrets to plain text in etcd encountered an error. + * + * Generated from protobuf enum CURRENT_STATE_DECRYPTION_ERROR = 6; + */ + const CURRENT_STATE_DECRYPTION_ERROR = 6; + + private static $valueToName = [ + self::CURRENT_STATE_UNSPECIFIED => 'CURRENT_STATE_UNSPECIFIED', + self::CURRENT_STATE_ENCRYPTED => 'CURRENT_STATE_ENCRYPTED', + self::CURRENT_STATE_DECRYPTED => 'CURRENT_STATE_DECRYPTED', + self::CURRENT_STATE_ENCRYPTION_PENDING => 'CURRENT_STATE_ENCRYPTION_PENDING', + self::CURRENT_STATE_ENCRYPTION_ERROR => 'CURRENT_STATE_ENCRYPTION_ERROR', + self::CURRENT_STATE_DECRYPTION_PENDING => 'CURRENT_STATE_DECRYPTION_PENDING', + self::CURRENT_STATE_DECRYPTION_ERROR => 'CURRENT_STATE_DECRYPTION_ERROR', + ]; + + 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(CurrentState::class, \Google\Cloud\Container\V1\DatabaseEncryption_CurrentState::class); + diff --git a/Container/src/V1/DatabaseEncryption/OperationError.php b/Container/src/V1/DatabaseEncryption/OperationError.php new file mode 100644 index 000000000000..102b8433fe79 --- /dev/null +++ b/Container/src/V1/DatabaseEncryption/OperationError.php @@ -0,0 +1,149 @@ +google.container.v1.DatabaseEncryption.OperationError + */ +class OperationError extends \Google\Protobuf\Internal\Message +{ + /** + * CloudKMS key resource that had the error. + * + * Generated from protobuf field string key_name = 1; + */ + private $key_name = ''; + /** + * Description of the error seen during the operation. + * + * Generated from protobuf field string error_message = 2; + */ + private $error_message = ''; + /** + * Time when the CloudKMS error was seen. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp = 3; + */ + private $timestamp = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key_name + * CloudKMS key resource that had the error. + * @type string $error_message + * Description of the error seen during the operation. + * @type \Google\Protobuf\Timestamp $timestamp + * Time when the CloudKMS error was seen. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Container\V1\ClusterService::initOnce(); + parent::__construct($data); + } + + /** + * CloudKMS key resource that had the error. + * + * Generated from protobuf field string key_name = 1; + * @return string + */ + public function getKeyName() + { + return $this->key_name; + } + + /** + * CloudKMS key resource that had the error. + * + * Generated from protobuf field string key_name = 1; + * @param string $var + * @return $this + */ + public function setKeyName($var) + { + GPBUtil::checkString($var, True); + $this->key_name = $var; + + return $this; + } + + /** + * Description of the error seen during the operation. + * + * Generated from protobuf field string error_message = 2; + * @return string + */ + public function getErrorMessage() + { + return $this->error_message; + } + + /** + * Description of the error seen during the operation. + * + * Generated from protobuf field string error_message = 2; + * @param string $var + * @return $this + */ + public function setErrorMessage($var) + { + GPBUtil::checkString($var, True); + $this->error_message = $var; + + return $this; + } + + /** + * Time when the CloudKMS error was seen. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getTimestamp() + { + return $this->timestamp; + } + + public function hasTimestamp() + { + return isset($this->timestamp); + } + + public function clearTimestamp() + { + unset($this->timestamp); + } + + /** + * Time when the CloudKMS error was seen. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setTimestamp($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->timestamp = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OperationError::class, \Google\Cloud\Container\V1\DatabaseEncryption_OperationError::class); +