diff --git a/RedisCluster/metadata/V1/CloudRedisCluster.php b/RedisCluster/metadata/V1/CloudRedisCluster.php index 958d741750aa..ca7ebc33312f 100644 Binary files a/RedisCluster/metadata/V1/CloudRedisCluster.php and b/RedisCluster/metadata/V1/CloudRedisCluster.php differ diff --git a/RedisCluster/samples/V1/CloudRedisClusterClient/get_cluster_certificate_authority.php b/RedisCluster/samples/V1/CloudRedisClusterClient/get_cluster_certificate_authority.php new file mode 100644 index 000000000000..b23b63cb2e21 --- /dev/null +++ b/RedisCluster/samples/V1/CloudRedisClusterClient/get_cluster_certificate_authority.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var CertificateAuthority $response */ + $response = $cloudRedisClusterClient->getClusterCertificateAuthority($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = CloudRedisClusterClient::certificateAuthorityName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + + get_cluster_certificate_authority_sample($formattedName); +} +// [END redis_v1_generated_CloudRedisCluster_GetClusterCertificateAuthority_sync] diff --git a/RedisCluster/src/V1/CertificateAuthority.php b/RedisCluster/src/V1/CertificateAuthority.php new file mode 100644 index 000000000000..65adb51a42bd --- /dev/null +++ b/RedisCluster/src/V1/CertificateAuthority.php @@ -0,0 +1,112 @@ +google.cloud.redis.cluster.v1.CertificateAuthority + */ +class CertificateAuthority extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. Unique name of the resource in this scope including project, + * location and cluster using the form: + * `projects/{project}/locations/{location}/clusters/{cluster}/certificateAuthority` + * + * Generated from protobuf field string name = 2 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + protected $server_ca; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Redis\Cluster\V1\CertificateAuthority\ManagedCertificateAuthority $managed_server_ca + * @type string $name + * Identifier. Unique name of the resource in this scope including project, + * location and cluster using the form: + * `projects/{project}/locations/{location}/clusters/{cluster}/certificateAuthority` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Redis\Cluster\V1\CloudRedisCluster::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field .google.cloud.redis.cluster.v1.CertificateAuthority.ManagedCertificateAuthority managed_server_ca = 1; + * @return \Google\Cloud\Redis\Cluster\V1\CertificateAuthority\ManagedCertificateAuthority|null + */ + public function getManagedServerCa() + { + return $this->readOneof(1); + } + + public function hasManagedServerCa() + { + return $this->hasOneof(1); + } + + /** + * Generated from protobuf field .google.cloud.redis.cluster.v1.CertificateAuthority.ManagedCertificateAuthority managed_server_ca = 1; + * @param \Google\Cloud\Redis\Cluster\V1\CertificateAuthority\ManagedCertificateAuthority $var + * @return $this + */ + public function setManagedServerCa($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Redis\Cluster\V1\CertificateAuthority\ManagedCertificateAuthority::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Identifier. Unique name of the resource in this scope including project, + * location and cluster using the form: + * `projects/{project}/locations/{location}/clusters/{cluster}/certificateAuthority` + * + * Generated from protobuf field string name = 2 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. Unique name of the resource in this scope including project, + * location and cluster using the form: + * `projects/{project}/locations/{location}/clusters/{cluster}/certificateAuthority` + * + * Generated from protobuf field string name = 2 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * @return string + */ + public function getServerCa() + { + return $this->whichOneof("server_ca"); + } + +} + diff --git a/RedisCluster/src/V1/CertificateAuthority/ManagedCertificateAuthority.php b/RedisCluster/src/V1/CertificateAuthority/ManagedCertificateAuthority.php new file mode 100644 index 000000000000..a6ae67f1e601 --- /dev/null +++ b/RedisCluster/src/V1/CertificateAuthority/ManagedCertificateAuthority.php @@ -0,0 +1,70 @@ +google.cloud.redis.cluster.v1.CertificateAuthority.ManagedCertificateAuthority + */ +class ManagedCertificateAuthority extends \Google\Protobuf\Internal\Message +{ + /** + * The PEM encoded CA certificate chains for redis managed + * server authentication + * + * Generated from protobuf field repeated .google.cloud.redis.cluster.v1.CertificateAuthority.ManagedCertificateAuthority.CertChain ca_certs = 1; + */ + private $ca_certs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Redis\Cluster\V1\CertificateAuthority\ManagedCertificateAuthority\CertChain>|\Google\Protobuf\Internal\RepeatedField $ca_certs + * The PEM encoded CA certificate chains for redis managed + * server authentication + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Redis\Cluster\V1\CloudRedisCluster::initOnce(); + parent::__construct($data); + } + + /** + * The PEM encoded CA certificate chains for redis managed + * server authentication + * + * Generated from protobuf field repeated .google.cloud.redis.cluster.v1.CertificateAuthority.ManagedCertificateAuthority.CertChain ca_certs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCaCerts() + { + return $this->ca_certs; + } + + /** + * The PEM encoded CA certificate chains for redis managed + * server authentication + * + * Generated from protobuf field repeated .google.cloud.redis.cluster.v1.CertificateAuthority.ManagedCertificateAuthority.CertChain ca_certs = 1; + * @param array<\Google\Cloud\Redis\Cluster\V1\CertificateAuthority\ManagedCertificateAuthority\CertChain>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCaCerts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Redis\Cluster\V1\CertificateAuthority\ManagedCertificateAuthority\CertChain::class); + $this->ca_certs = $arr; + + return $this; + } + +} + + diff --git a/RedisCluster/src/V1/CertificateAuthority/ManagedCertificateAuthority/CertChain.php b/RedisCluster/src/V1/CertificateAuthority/ManagedCertificateAuthority/CertChain.php new file mode 100644 index 000000000000..09a80e62cb93 --- /dev/null +++ b/RedisCluster/src/V1/CertificateAuthority/ManagedCertificateAuthority/CertChain.php @@ -0,0 +1,66 @@ +google.cloud.redis.cluster.v1.CertificateAuthority.ManagedCertificateAuthority.CertChain + */ +class CertChain extends \Google\Protobuf\Internal\Message +{ + /** + * The certificates that form the CA chain, from leaf to root order. + * + * Generated from protobuf field repeated string certificates = 1; + */ + private $certificates; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $certificates + * The certificates that form the CA chain, from leaf to root order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Redis\Cluster\V1\CloudRedisCluster::initOnce(); + parent::__construct($data); + } + + /** + * The certificates that form the CA chain, from leaf to root order. + * + * Generated from protobuf field repeated string certificates = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCertificates() + { + return $this->certificates; + } + + /** + * The certificates that form the CA chain, from leaf to root order. + * + * Generated from protobuf field repeated string certificates = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCertificates($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->certificates = $arr; + + return $this; + } + +} + + diff --git a/RedisCluster/src/V1/Client/CloudRedisClusterClient.php b/RedisCluster/src/V1/Client/CloudRedisClusterClient.php index 52e411bafbe6..9522b09bc6b2 100644 --- a/RedisCluster/src/V1/Client/CloudRedisClusterClient.php +++ b/RedisCluster/src/V1/Client/CloudRedisClusterClient.php @@ -37,9 +37,11 @@ use Google\Cloud\Location\GetLocationRequest; use Google\Cloud\Location\ListLocationsRequest; use Google\Cloud\Location\Location; +use Google\Cloud\Redis\Cluster\V1\CertificateAuthority; use Google\Cloud\Redis\Cluster\V1\Cluster; use Google\Cloud\Redis\Cluster\V1\CreateClusterRequest; use Google\Cloud\Redis\Cluster\V1\DeleteClusterRequest; +use Google\Cloud\Redis\Cluster\V1\GetClusterCertificateAuthorityRequest; use Google\Cloud\Redis\Cluster\V1\GetClusterRequest; use Google\Cloud\Redis\Cluster\V1\ListClustersRequest; use Google\Cloud\Redis\Cluster\V1\UpdateClusterRequest; @@ -82,6 +84,7 @@ * @method PromiseInterface createClusterAsync(CreateClusterRequest $request, array $optionalArgs = []) * @method PromiseInterface deleteClusterAsync(DeleteClusterRequest $request, array $optionalArgs = []) * @method PromiseInterface getClusterAsync(GetClusterRequest $request, array $optionalArgs = []) + * @method PromiseInterface getClusterCertificateAuthorityAsync(GetClusterCertificateAuthorityRequest $request, array $optionalArgs = []) * @method PromiseInterface listClustersAsync(ListClustersRequest $request, array $optionalArgs = []) * @method PromiseInterface updateClusterAsync(UpdateClusterRequest $request, array $optionalArgs = []) * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) @@ -185,6 +188,25 @@ private function createOperationsClient(array $options) return new OperationsClient($options); } + /** + * Formats a string containing the fully-qualified path to represent a + * certificate_authority resource. + * + * @param string $project + * @param string $location + * @param string $cluster + * + * @return string The formatted certificate_authority resource. + */ + public static function certificateAuthorityName(string $project, string $location, string $cluster): string + { + return self::getPathTemplate('certificateAuthority')->render([ + 'project' => $project, + 'location' => $location, + 'cluster' => $cluster, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a cluster * resource. @@ -225,6 +247,7 @@ public static function locationName(string $project, string $location): string * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern + * - certificateAuthority: projects/{project}/locations/{location}/clusters/{cluster}/certificateAuthority * - cluster: projects/{project}/locations/{location}/clusters/{cluster} * - location: projects/{project}/locations/{location} * @@ -404,6 +427,35 @@ public function getCluster(GetClusterRequest $request, array $callOptions = []): return $this->startApiCall('GetCluster', $request, $callOptions)->wait(); } + /** + * Gets the details of certificate authority information for Redis cluster. + * + * The async variant is + * {@see CloudRedisClusterClient::getClusterCertificateAuthorityAsync()} . + * + * @example samples/V1/CloudRedisClusterClient/get_cluster_certificate_authority.php + * + * @param GetClusterCertificateAuthorityRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return CertificateAuthority + * + * @throws ApiException Thrown if the API call fails. + */ + public function getClusterCertificateAuthority( + GetClusterCertificateAuthorityRequest $request, + array $callOptions = [] + ): CertificateAuthority { + return $this->startApiCall('GetClusterCertificateAuthority', $request, $callOptions)->wait(); + } + /** * Lists all Redis clusters owned by a project in either the specified * location (region) or all locations. diff --git a/RedisCluster/src/V1/Cluster.php b/RedisCluster/src/V1/Cluster.php index 717d2175cd9b..58b6ccfa3e61 100644 --- a/RedisCluster/src/V1/Cluster.php +++ b/RedisCluster/src/V1/Cluster.php @@ -63,7 +63,8 @@ class Cluster extends \Google\Protobuf\Internal\Message */ protected $transit_encryption_mode = 0; /** - * Output only. Redis memory size in GB for the entire cluster. + * Output only. Redis memory size in GB for the entire cluster rounded up to + * the next integer. * * Generated from protobuf field optional int32 size_gb = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ @@ -102,6 +103,45 @@ class Cluster extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.redis.cluster.v1.Cluster.StateInfo state_info = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ protected $state_info = null; + /** + * Optional. The type of a redis node in the cluster. NodeType determines the + * underlying machine-type of a redis node. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.NodeType node_type = 19 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $node_type = 0; + /** + * Optional. Persistence config (RDB, AOF) for the cluster. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig persistence_config = 20 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $persistence_config = null; + /** + * Optional. Key/Value pairs of customer overrides for mutable Redis Configs + * + * Generated from protobuf field map redis_configs = 21 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $redis_configs; + /** + * Output only. Precise value of redis memory size in GB for the entire + * cluster. + * + * Generated from protobuf field optional double precise_size_gb = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $precise_size_gb = null; + /** + * Optional. This config will be used to determine how the customer wants us + * to distribute cluster resources within the region. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ZoneDistributionConfig zone_distribution_config = 23 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $zone_distribution_config = null; + /** + * Optional. The delete operation will fail when the value is set to true. + * + * Generated from protobuf field optional bool deletion_protection_enabled = 25 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $deletion_protection_enabled = null; /** * Constructor. @@ -129,7 +169,8 @@ class Cluster extends \Google\Protobuf\Internal\Message * Optional. The in-transit encryption for the Redis cluster. * If not provided, encryption is disabled for the cluster. * @type int $size_gb - * Output only. Redis memory size in GB for the entire cluster. + * Output only. Redis memory size in GB for the entire cluster rounded up to + * the next integer. * @type int $shard_count * Required. Number of shards for the Redis cluster. * @type array<\Google\Cloud\Redis\Cluster\V1\PscConfig>|\Google\Protobuf\Internal\RepeatedField $psc_configs @@ -144,6 +185,21 @@ class Cluster extends \Google\Protobuf\Internal\Message * accessing the cluster. * @type \Google\Cloud\Redis\Cluster\V1\Cluster\StateInfo $state_info * Output only. Additional information about the current state of the cluster. + * @type int $node_type + * Optional. The type of a redis node in the cluster. NodeType determines the + * underlying machine-type of a redis node. + * @type \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig $persistence_config + * Optional. Persistence config (RDB, AOF) for the cluster. + * @type array|\Google\Protobuf\Internal\MapField $redis_configs + * Optional. Key/Value pairs of customer overrides for mutable Redis Configs + * @type float $precise_size_gb + * Output only. Precise value of redis memory size in GB for the entire + * cluster. + * @type \Google\Cloud\Redis\Cluster\V1\ZoneDistributionConfig $zone_distribution_config + * Optional. This config will be used to determine how the customer wants us + * to distribute cluster resources within the region. + * @type bool $deletion_protection_enabled + * Optional. The delete operation will fail when the value is set to true. * } */ public function __construct($data = NULL) { @@ -364,7 +420,8 @@ public function setTransitEncryptionMode($var) } /** - * Output only. Redis memory size in GB for the entire cluster. + * Output only. Redis memory size in GB for the entire cluster rounded up to + * the next integer. * * Generated from protobuf field optional int32 size_gb = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @return int @@ -385,7 +442,8 @@ public function clearSizeGb() } /** - * Output only. Redis memory size in GB for the entire cluster. + * Output only. Redis memory size in GB for the entire cluster rounded up to + * the next integer. * * Generated from protobuf field optional int32 size_gb = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @param int $var @@ -557,5 +615,207 @@ public function setStateInfo($var) return $this; } + /** + * Optional. The type of a redis node in the cluster. NodeType determines the + * underlying machine-type of a redis node. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.NodeType node_type = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getNodeType() + { + return $this->node_type; + } + + /** + * Optional. The type of a redis node in the cluster. NodeType determines the + * underlying machine-type of a redis node. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.NodeType node_type = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setNodeType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Redis\Cluster\V1\NodeType::class); + $this->node_type = $var; + + return $this; + } + + /** + * Optional. Persistence config (RDB, AOF) for the cluster. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig persistence_config = 20 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig|null + */ + public function getPersistenceConfig() + { + return $this->persistence_config; + } + + public function hasPersistenceConfig() + { + return isset($this->persistence_config); + } + + public function clearPersistenceConfig() + { + unset($this->persistence_config); + } + + /** + * Optional. Persistence config (RDB, AOF) for the cluster. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig persistence_config = 20 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig $var + * @return $this + */ + public function setPersistenceConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig::class); + $this->persistence_config = $var; + + return $this; + } + + /** + * Optional. Key/Value pairs of customer overrides for mutable Redis Configs + * + * Generated from protobuf field map redis_configs = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getRedisConfigs() + { + return $this->redis_configs; + } + + /** + * Optional. Key/Value pairs of customer overrides for mutable Redis Configs + * + * Generated from protobuf field map redis_configs = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setRedisConfigs($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->redis_configs = $arr; + + return $this; + } + + /** + * Output only. Precise value of redis memory size in GB for the entire + * cluster. + * + * Generated from protobuf field optional double precise_size_gb = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return float + */ + public function getPreciseSizeGb() + { + return isset($this->precise_size_gb) ? $this->precise_size_gb : 0.0; + } + + public function hasPreciseSizeGb() + { + return isset($this->precise_size_gb); + } + + public function clearPreciseSizeGb() + { + unset($this->precise_size_gb); + } + + /** + * Output only. Precise value of redis memory size in GB for the entire + * cluster. + * + * Generated from protobuf field optional double precise_size_gb = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param float $var + * @return $this + */ + public function setPreciseSizeGb($var) + { + GPBUtil::checkDouble($var); + $this->precise_size_gb = $var; + + return $this; + } + + /** + * Optional. This config will be used to determine how the customer wants us + * to distribute cluster resources within the region. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ZoneDistributionConfig zone_distribution_config = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Redis\Cluster\V1\ZoneDistributionConfig|null + */ + public function getZoneDistributionConfig() + { + return $this->zone_distribution_config; + } + + public function hasZoneDistributionConfig() + { + return isset($this->zone_distribution_config); + } + + public function clearZoneDistributionConfig() + { + unset($this->zone_distribution_config); + } + + /** + * Optional. This config will be used to determine how the customer wants us + * to distribute cluster resources within the region. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ZoneDistributionConfig zone_distribution_config = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Redis\Cluster\V1\ZoneDistributionConfig $var + * @return $this + */ + public function setZoneDistributionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Redis\Cluster\V1\ZoneDistributionConfig::class); + $this->zone_distribution_config = $var; + + return $this; + } + + /** + * Optional. The delete operation will fail when the value is set to true. + * + * Generated from protobuf field optional bool deletion_protection_enabled = 25 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getDeletionProtectionEnabled() + { + return isset($this->deletion_protection_enabled) ? $this->deletion_protection_enabled : false; + } + + public function hasDeletionProtectionEnabled() + { + return isset($this->deletion_protection_enabled); + } + + public function clearDeletionProtectionEnabled() + { + unset($this->deletion_protection_enabled); + } + + /** + * Optional. The delete operation will fail when the value is set to true. + * + * Generated from protobuf field optional bool deletion_protection_enabled = 25 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setDeletionProtectionEnabled($var) + { + GPBUtil::checkBool($var); + $this->deletion_protection_enabled = $var; + + return $this; + } + } diff --git a/RedisCluster/src/V1/ClusterPersistenceConfig.php b/RedisCluster/src/V1/ClusterPersistenceConfig.php new file mode 100644 index 000000000000..b17af3046ed1 --- /dev/null +++ b/RedisCluster/src/V1/ClusterPersistenceConfig.php @@ -0,0 +1,155 @@ +google.cloud.redis.cluster.v1.ClusterPersistenceConfig + */ +class ClusterPersistenceConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The mode of persistence. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.PersistenceMode mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mode = 0; + /** + * Optional. RDB configuration. This field will be ignored if mode is not RDB. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig rdb_config = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $rdb_config = null; + /** + * Optional. AOF configuration. This field will be ignored if mode is not AOF. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig aof_config = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $aof_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $mode + * Optional. The mode of persistence. + * @type \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\RDBConfig $rdb_config + * Optional. RDB configuration. This field will be ignored if mode is not RDB. + * @type \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\AOFConfig $aof_config + * Optional. AOF configuration. This field will be ignored if mode is not AOF. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Redis\Cluster\V1\CloudRedisCluster::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The mode of persistence. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.PersistenceMode mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getMode() + { + return $this->mode; + } + + /** + * Optional. The mode of persistence. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.PersistenceMode mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\PersistenceMode::class); + $this->mode = $var; + + return $this; + } + + /** + * Optional. RDB configuration. This field will be ignored if mode is not RDB. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig rdb_config = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\RDBConfig|null + */ + public function getRdbConfig() + { + return $this->rdb_config; + } + + public function hasRdbConfig() + { + return isset($this->rdb_config); + } + + public function clearRdbConfig() + { + unset($this->rdb_config); + } + + /** + * Optional. RDB configuration. This field will be ignored if mode is not RDB. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig rdb_config = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\RDBConfig $var + * @return $this + */ + public function setRdbConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\RDBConfig::class); + $this->rdb_config = $var; + + return $this; + } + + /** + * Optional. AOF configuration. This field will be ignored if mode is not AOF. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig aof_config = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\AOFConfig|null + */ + public function getAofConfig() + { + return $this->aof_config; + } + + public function hasAofConfig() + { + return isset($this->aof_config); + } + + public function clearAofConfig() + { + unset($this->aof_config); + } + + /** + * Optional. AOF configuration. This field will be ignored if mode is not AOF. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig aof_config = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\AOFConfig $var + * @return $this + */ + public function setAofConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\AOFConfig::class); + $this->aof_config = $var; + + return $this; + } + +} + diff --git a/RedisCluster/src/V1/ClusterPersistenceConfig/AOFConfig.php b/RedisCluster/src/V1/ClusterPersistenceConfig/AOFConfig.php new file mode 100644 index 000000000000..7ae275fc1b9a --- /dev/null +++ b/RedisCluster/src/V1/ClusterPersistenceConfig/AOFConfig.php @@ -0,0 +1,68 @@ +google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig + */ +class AOFConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. fsync configuration. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig.AppendFsync append_fsync = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $append_fsync = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $append_fsync + * Optional. fsync configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Redis\Cluster\V1\CloudRedisCluster::initOnce(); + parent::__construct($data); + } + + /** + * Optional. fsync configuration. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig.AppendFsync append_fsync = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getAppendFsync() + { + return $this->append_fsync; + } + + /** + * Optional. fsync configuration. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig.AppendFsync append_fsync = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setAppendFsync($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\AOFConfig\AppendFsync::class); + $this->append_fsync = $var; + + return $this; + } + +} + + diff --git a/RedisCluster/src/V1/ClusterPersistenceConfig/AOFConfig/AppendFsync.php b/RedisCluster/src/V1/ClusterPersistenceConfig/AOFConfig/AppendFsync.php new file mode 100644 index 000000000000..c825e1b2ee66 --- /dev/null +++ b/RedisCluster/src/V1/ClusterPersistenceConfig/AOFConfig/AppendFsync.php @@ -0,0 +1,72 @@ +google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig.AppendFsync + */ +class AppendFsync +{ + /** + * Not set. Default: EVERYSEC + * + * Generated from protobuf enum APPEND_FSYNC_UNSPECIFIED = 0; + */ + const APPEND_FSYNC_UNSPECIFIED = 0; + /** + * Never fsync. Normally Linux will flush data every 30 seconds with this + * configuration, but it's up to the kernel's exact tuning. + * + * Generated from protobuf enum NO = 1; + */ + const NO = 1; + /** + * fsync every second. Fast enough, and you may lose 1 second of data if + * there is a disaster + * + * Generated from protobuf enum EVERYSEC = 2; + */ + const EVERYSEC = 2; + /** + * fsync every time new commands are appended to the AOF. It has the best + * data loss protection at the cost of performance + * + * Generated from protobuf enum ALWAYS = 3; + */ + const ALWAYS = 3; + + private static $valueToName = [ + self::APPEND_FSYNC_UNSPECIFIED => 'APPEND_FSYNC_UNSPECIFIED', + self::NO => 'NO', + self::EVERYSEC => 'EVERYSEC', + self::ALWAYS => 'ALWAYS', + ]; + + 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); + } +} + + diff --git a/RedisCluster/src/V1/ClusterPersistenceConfig/PersistenceMode.php b/RedisCluster/src/V1/ClusterPersistenceConfig/PersistenceMode.php new file mode 100644 index 000000000000..5e37e2527fd1 --- /dev/null +++ b/RedisCluster/src/V1/ClusterPersistenceConfig/PersistenceMode.php @@ -0,0 +1,69 @@ +google.cloud.redis.cluster.v1.ClusterPersistenceConfig.PersistenceMode + */ +class PersistenceMode +{ + /** + * Not set. + * + * Generated from protobuf enum PERSISTENCE_MODE_UNSPECIFIED = 0; + */ + const PERSISTENCE_MODE_UNSPECIFIED = 0; + /** + * Persistence is disabled, and any snapshot data is deleted. + * + * Generated from protobuf enum DISABLED = 1; + */ + const DISABLED = 1; + /** + * RDB based persistence is enabled. + * + * Generated from protobuf enum RDB = 2; + */ + const RDB = 2; + /** + * AOF based persistence is enabled. + * + * Generated from protobuf enum AOF = 3; + */ + const AOF = 3; + + private static $valueToName = [ + self::PERSISTENCE_MODE_UNSPECIFIED => 'PERSISTENCE_MODE_UNSPECIFIED', + self::DISABLED => 'DISABLED', + self::RDB => 'RDB', + self::AOF => 'AOF', + ]; + + 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); + } +} + + diff --git a/RedisCluster/src/V1/ClusterPersistenceConfig/RDBConfig.php b/RedisCluster/src/V1/ClusterPersistenceConfig/RDBConfig.php new file mode 100644 index 000000000000..72bea412dc13 --- /dev/null +++ b/RedisCluster/src/V1/ClusterPersistenceConfig/RDBConfig.php @@ -0,0 +1,120 @@ +google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig + */ +class RDBConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Period between RDB snapshots. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig.SnapshotPeriod rdb_snapshot_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $rdb_snapshot_period = 0; + /** + * Optional. The time that the first snapshot was/will be attempted, and to + * which future snapshots will be aligned. If not provided, the current time + * will be used. + * + * Generated from protobuf field .google.protobuf.Timestamp rdb_snapshot_start_time = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $rdb_snapshot_start_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $rdb_snapshot_period + * Optional. Period between RDB snapshots. + * @type \Google\Protobuf\Timestamp $rdb_snapshot_start_time + * Optional. The time that the first snapshot was/will be attempted, and to + * which future snapshots will be aligned. If not provided, the current time + * will be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Redis\Cluster\V1\CloudRedisCluster::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Period between RDB snapshots. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig.SnapshotPeriod rdb_snapshot_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getRdbSnapshotPeriod() + { + return $this->rdb_snapshot_period; + } + + /** + * Optional. Period between RDB snapshots. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig.SnapshotPeriod rdb_snapshot_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setRdbSnapshotPeriod($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\RDBConfig\SnapshotPeriod::class); + $this->rdb_snapshot_period = $var; + + return $this; + } + + /** + * Optional. The time that the first snapshot was/will be attempted, and to + * which future snapshots will be aligned. If not provided, the current time + * will be used. + * + * Generated from protobuf field .google.protobuf.Timestamp rdb_snapshot_start_time = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRdbSnapshotStartTime() + { + return $this->rdb_snapshot_start_time; + } + + public function hasRdbSnapshotStartTime() + { + return isset($this->rdb_snapshot_start_time); + } + + public function clearRdbSnapshotStartTime() + { + unset($this->rdb_snapshot_start_time); + } + + /** + * Optional. The time that the first snapshot was/will be attempted, and to + * which future snapshots will be aligned. If not provided, the current time + * will be used. + * + * Generated from protobuf field .google.protobuf.Timestamp rdb_snapshot_start_time = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRdbSnapshotStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->rdb_snapshot_start_time = $var; + + return $this; + } + +} + + diff --git a/RedisCluster/src/V1/ClusterPersistenceConfig/RDBConfig/SnapshotPeriod.php b/RedisCluster/src/V1/ClusterPersistenceConfig/RDBConfig/SnapshotPeriod.php new file mode 100644 index 000000000000..a1ff3273539a --- /dev/null +++ b/RedisCluster/src/V1/ClusterPersistenceConfig/RDBConfig/SnapshotPeriod.php @@ -0,0 +1,76 @@ +google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig.SnapshotPeriod + */ +class SnapshotPeriod +{ + /** + * Not set. + * + * Generated from protobuf enum SNAPSHOT_PERIOD_UNSPECIFIED = 0; + */ + const SNAPSHOT_PERIOD_UNSPECIFIED = 0; + /** + * One hour. + * + * Generated from protobuf enum ONE_HOUR = 1; + */ + const ONE_HOUR = 1; + /** + * Six hours. + * + * Generated from protobuf enum SIX_HOURS = 2; + */ + const SIX_HOURS = 2; + /** + * Twelve hours. + * + * Generated from protobuf enum TWELVE_HOURS = 3; + */ + const TWELVE_HOURS = 3; + /** + * Twenty four hours. + * + * Generated from protobuf enum TWENTY_FOUR_HOURS = 4; + */ + const TWENTY_FOUR_HOURS = 4; + + private static $valueToName = [ + self::SNAPSHOT_PERIOD_UNSPECIFIED => 'SNAPSHOT_PERIOD_UNSPECIFIED', + self::ONE_HOUR => 'ONE_HOUR', + self::SIX_HOURS => 'SIX_HOURS', + self::TWELVE_HOURS => 'TWELVE_HOURS', + self::TWENTY_FOUR_HOURS => 'TWENTY_FOUR_HOURS', + ]; + + 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); + } +} + + diff --git a/RedisCluster/src/V1/GetClusterCertificateAuthorityRequest.php b/RedisCluster/src/V1/GetClusterCertificateAuthorityRequest.php new file mode 100644 index 000000000000..5a8f0feed587 --- /dev/null +++ b/RedisCluster/src/V1/GetClusterCertificateAuthorityRequest.php @@ -0,0 +1,92 @@ +google.cloud.redis.cluster.v1.GetClusterCertificateAuthorityRequest + */ +class GetClusterCertificateAuthorityRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Redis cluster certificate authority resource name using the form: + * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/certificateAuthority` + * where `location_id` refers to a GCP region. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Redis cluster certificate authority resource name using the form: + * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/certificateAuthority` + * where `location_id` refers to a GCP region. Please see + * {@see CloudRedisClusterClient::certificateAuthorityName()} for help formatting this field. + * + * @return \Google\Cloud\Redis\Cluster\V1\GetClusterCertificateAuthorityRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Redis cluster certificate authority resource name using the form: + * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/certificateAuthority` + * where `location_id` refers to a GCP region. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Redis\Cluster\V1\CloudRedisCluster::initOnce(); + parent::__construct($data); + } + + /** + * Required. Redis cluster certificate authority resource name using the form: + * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/certificateAuthority` + * where `location_id` refers to a GCP region. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Redis cluster certificate authority resource name using the form: + * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/certificateAuthority` + * where `location_id` refers to a GCP region. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/RedisCluster/src/V1/NodeType.php b/RedisCluster/src/V1/NodeType.php new file mode 100644 index 000000000000..3fe082e637cb --- /dev/null +++ b/RedisCluster/src/V1/NodeType.php @@ -0,0 +1,73 @@ +google.cloud.redis.cluster.v1.NodeType + */ +class NodeType +{ + /** + * Generated from protobuf enum NODE_TYPE_UNSPECIFIED = 0; + */ + const NODE_TYPE_UNSPECIFIED = 0; + /** + * Redis shared core nano node_type. + * + * Generated from protobuf enum REDIS_SHARED_CORE_NANO = 1; + */ + const REDIS_SHARED_CORE_NANO = 1; + /** + * Redis highmem medium node_type. + * + * Generated from protobuf enum REDIS_HIGHMEM_MEDIUM = 2; + */ + const REDIS_HIGHMEM_MEDIUM = 2; + /** + * Redis highmem xlarge node_type. + * + * Generated from protobuf enum REDIS_HIGHMEM_XLARGE = 3; + */ + const REDIS_HIGHMEM_XLARGE = 3; + /** + * Redis standard small node_type. + * + * Generated from protobuf enum REDIS_STANDARD_SMALL = 4; + */ + const REDIS_STANDARD_SMALL = 4; + + private static $valueToName = [ + self::NODE_TYPE_UNSPECIFIED => 'NODE_TYPE_UNSPECIFIED', + self::REDIS_SHARED_CORE_NANO => 'REDIS_SHARED_CORE_NANO', + self::REDIS_HIGHMEM_MEDIUM => 'REDIS_HIGHMEM_MEDIUM', + self::REDIS_HIGHMEM_XLARGE => 'REDIS_HIGHMEM_XLARGE', + self::REDIS_STANDARD_SMALL => 'REDIS_STANDARD_SMALL', + ]; + + 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); + } +} + diff --git a/RedisCluster/src/V1/ZoneDistributionConfig.php b/RedisCluster/src/V1/ZoneDistributionConfig.php new file mode 100644 index 000000000000..1645d3cf3f67 --- /dev/null +++ b/RedisCluster/src/V1/ZoneDistributionConfig.php @@ -0,0 +1,113 @@ +google.cloud.redis.cluster.v1.ZoneDistributionConfig + */ +class ZoneDistributionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The mode of zone distribution. Defaults to MULTI_ZONE, when not + * specified. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ZoneDistributionConfig.ZoneDistributionMode mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mode = 0; + /** + * Optional. When SINGLE ZONE distribution is selected, zone field would be + * used to allocate all resources in that zone. This is not applicable to + * MULTI_ZONE, and would be ignored for MULTI_ZONE clusters. + * + * Generated from protobuf field string zone = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $zone = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $mode + * Optional. The mode of zone distribution. Defaults to MULTI_ZONE, when not + * specified. + * @type string $zone + * Optional. When SINGLE ZONE distribution is selected, zone field would be + * used to allocate all resources in that zone. This is not applicable to + * MULTI_ZONE, and would be ignored for MULTI_ZONE clusters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Redis\Cluster\V1\CloudRedisCluster::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The mode of zone distribution. Defaults to MULTI_ZONE, when not + * specified. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ZoneDistributionConfig.ZoneDistributionMode mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getMode() + { + return $this->mode; + } + + /** + * Optional. The mode of zone distribution. Defaults to MULTI_ZONE, when not + * specified. + * + * Generated from protobuf field .google.cloud.redis.cluster.v1.ZoneDistributionConfig.ZoneDistributionMode mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Redis\Cluster\V1\ZoneDistributionConfig\ZoneDistributionMode::class); + $this->mode = $var; + + return $this; + } + + /** + * Optional. When SINGLE ZONE distribution is selected, zone field would be + * used to allocate all resources in that zone. This is not applicable to + * MULTI_ZONE, and would be ignored for MULTI_ZONE clusters. + * + * Generated from protobuf field string zone = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getZone() + { + return $this->zone; + } + + /** + * Optional. When SINGLE ZONE distribution is selected, zone field would be + * used to allocate all resources in that zone. This is not applicable to + * MULTI_ZONE, and would be ignored for MULTI_ZONE clusters. + * + * Generated from protobuf field string zone = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setZone($var) + { + GPBUtil::checkString($var, True); + $this->zone = $var; + + return $this; + } + +} + diff --git a/RedisCluster/src/V1/ZoneDistributionConfig/ZoneDistributionMode.php b/RedisCluster/src/V1/ZoneDistributionConfig/ZoneDistributionMode.php new file mode 100644 index 000000000000..80c81d323b89 --- /dev/null +++ b/RedisCluster/src/V1/ZoneDistributionConfig/ZoneDistributionMode.php @@ -0,0 +1,67 @@ +google.cloud.redis.cluster.v1.ZoneDistributionConfig.ZoneDistributionMode + */ +class ZoneDistributionMode +{ + /** + * Not Set. Default: MULTI_ZONE + * + * Generated from protobuf enum ZONE_DISTRIBUTION_MODE_UNSPECIFIED = 0; + */ + const ZONE_DISTRIBUTION_MODE_UNSPECIFIED = 0; + /** + * Distribute all resources across 3 zones picked at random, within the + * region. + * + * Generated from protobuf enum MULTI_ZONE = 1; + */ + const MULTI_ZONE = 1; + /** + * Distribute all resources in a single zone. The zone field must be + * specified, when this mode is selected. + * + * Generated from protobuf enum SINGLE_ZONE = 2; + */ + const SINGLE_ZONE = 2; + + private static $valueToName = [ + self::ZONE_DISTRIBUTION_MODE_UNSPECIFIED => 'ZONE_DISTRIBUTION_MODE_UNSPECIFIED', + self::MULTI_ZONE => 'MULTI_ZONE', + self::SINGLE_ZONE => 'SINGLE_ZONE', + ]; + + 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); + } +} + + diff --git a/RedisCluster/src/V1/gapic_metadata.json b/RedisCluster/src/V1/gapic_metadata.json index 441f3d1baf21..3c75e8b0b86c 100644 --- a/RedisCluster/src/V1/gapic_metadata.json +++ b/RedisCluster/src/V1/gapic_metadata.json @@ -25,6 +25,11 @@ "getCluster" ] }, + "GetClusterCertificateAuthority": { + "methods": [ + "getClusterCertificateAuthority" + ] + }, "ListClusters": { "methods": [ "listClusters" diff --git a/RedisCluster/src/V1/resources/cloud_redis_cluster_client_config.json b/RedisCluster/src/V1/resources/cloud_redis_cluster_client_config.json index 574207f2c4ac..11c25ca9ac4a 100644 --- a/RedisCluster/src/V1/resources/cloud_redis_cluster_client_config.json +++ b/RedisCluster/src/V1/resources/cloud_redis_cluster_client_config.json @@ -41,6 +41,11 @@ "retry_codes_name": "no_retry_1_codes", "retry_params_name": "no_retry_1_params" }, + "GetClusterCertificateAuthority": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, "ListClusters": { "timeout_millis": 600000, "retry_codes_name": "no_retry_1_codes", diff --git a/RedisCluster/src/V1/resources/cloud_redis_cluster_descriptor_config.php b/RedisCluster/src/V1/resources/cloud_redis_cluster_descriptor_config.php index e5d8665a28fc..686a9576bac4 100644 --- a/RedisCluster/src/V1/resources/cloud_redis_cluster_descriptor_config.php +++ b/RedisCluster/src/V1/resources/cloud_redis_cluster_descriptor_config.php @@ -93,6 +93,18 @@ ], ], ], + 'GetClusterCertificateAuthority' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Redis\Cluster\V1\CertificateAuthority', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], 'ListClusters' => [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', @@ -148,6 +160,7 @@ 'interfaceOverride' => 'google.cloud.location.Locations', ], 'templateMap' => [ + 'certificateAuthority' => 'projects/{project}/locations/{location}/clusters/{cluster}/certificateAuthority', 'cluster' => 'projects/{project}/locations/{location}/clusters/{cluster}', 'location' => 'projects/{project}/locations/{location}', ], diff --git a/RedisCluster/src/V1/resources/cloud_redis_cluster_rest_client_config.php b/RedisCluster/src/V1/resources/cloud_redis_cluster_rest_client_config.php index 115039ea6b92..69fe4ba287c9 100644 --- a/RedisCluster/src/V1/resources/cloud_redis_cluster_rest_client_config.php +++ b/RedisCluster/src/V1/resources/cloud_redis_cluster_rest_client_config.php @@ -84,6 +84,17 @@ ], ], ], + 'GetClusterCertificateAuthority' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/clusters/*/certificateAuthority}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'ListClusters' => [ 'method' => 'get', 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/clusters', diff --git a/RedisCluster/tests/Unit/V1/Client/CloudRedisClusterClientTest.php b/RedisCluster/tests/Unit/V1/Client/CloudRedisClusterClientTest.php index f2c609e59f7f..8c5d0fb49197 100644 --- a/RedisCluster/tests/Unit/V1/Client/CloudRedisClusterClientTest.php +++ b/RedisCluster/tests/Unit/V1/Client/CloudRedisClusterClientTest.php @@ -30,10 +30,12 @@ use Google\Cloud\Location\ListLocationsRequest; use Google\Cloud\Location\ListLocationsResponse; use Google\Cloud\Location\Location; +use Google\Cloud\Redis\Cluster\V1\CertificateAuthority; use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient; use Google\Cloud\Redis\Cluster\V1\Cluster; use Google\Cloud\Redis\Cluster\V1\CreateClusterRequest; use Google\Cloud\Redis\Cluster\V1\DeleteClusterRequest; +use Google\Cloud\Redis\Cluster\V1\GetClusterCertificateAuthorityRequest; use Google\Cloud\Redis\Cluster\V1\GetClusterRequest; use Google\Cloud\Redis\Cluster\V1\ListClustersRequest; use Google\Cloud\Redis\Cluster\V1\ListClustersResponse; @@ -103,12 +105,16 @@ public function createClusterTest() $replicaCount = 564075208; $sizeGb = 2105542105; $shardCount = 495377042; + $preciseSizeGb = 1.3422684e8; + $deletionProtectionEnabled = true; $expectedResponse = new Cluster(); $expectedResponse->setName($name); $expectedResponse->setUid($uid); $expectedResponse->setReplicaCount($replicaCount); $expectedResponse->setSizeGb($sizeGb); $expectedResponse->setShardCount($shardCount); + $expectedResponse->setPreciseSizeGb($preciseSizeGb); + $expectedResponse->setDeletionProtectionEnabled($deletionProtectionEnabled); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -371,12 +377,16 @@ public function getClusterTest() $replicaCount = 564075208; $sizeGb = 2105542105; $shardCount = 495377042; + $preciseSizeGb = 1.3422684e8; + $deletionProtectionEnabled = true; $expectedResponse = new Cluster(); $expectedResponse->setName($name2); $expectedResponse->setUid($uid); $expectedResponse->setReplicaCount($replicaCount); $expectedResponse->setSizeGb($sizeGb); $expectedResponse->setShardCount($shardCount); + $expectedResponse->setPreciseSizeGb($preciseSizeGb); + $expectedResponse->setDeletionProtectionEnabled($deletionProtectionEnabled); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); @@ -430,6 +440,74 @@ public function getClusterExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function getClusterCertificateAuthorityTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new CertificateAuthority(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->certificateAuthorityName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $request = (new GetClusterCertificateAuthorityRequest())->setName($formattedName); + $response = $gapicClient->getClusterCertificateAuthority($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.cloud.redis.cluster.v1.CloudRedisCluster/GetClusterCertificateAuthority', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getClusterCertificateAuthorityExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->certificateAuthorityName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $request = (new GetClusterCertificateAuthorityRequest())->setName($formattedName); + try { + $gapicClient->getClusterCertificateAuthority($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function listClustersTest() { @@ -527,12 +605,16 @@ public function updateClusterTest() $replicaCount = 564075208; $sizeGb = 2105542105; $shardCount = 495377042; + $preciseSizeGb = 1.3422684e8; + $deletionProtectionEnabled = true; $expectedResponse = new Cluster(); $expectedResponse->setName($name); $expectedResponse->setUid($uid); $expectedResponse->setReplicaCount($replicaCount); $expectedResponse->setSizeGb($sizeGb); $expectedResponse->setShardCount($shardCount); + $expectedResponse->setPreciseSizeGb($preciseSizeGb); + $expectedResponse->setDeletionProtectionEnabled($deletionProtectionEnabled); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -803,12 +885,16 @@ public function createClusterAsyncTest() $replicaCount = 564075208; $sizeGb = 2105542105; $shardCount = 495377042; + $preciseSizeGb = 1.3422684e8; + $deletionProtectionEnabled = true; $expectedResponse = new Cluster(); $expectedResponse->setName($name); $expectedResponse->setUid($uid); $expectedResponse->setReplicaCount($replicaCount); $expectedResponse->setSizeGb($sizeGb); $expectedResponse->setShardCount($shardCount); + $expectedResponse->setPreciseSizeGb($preciseSizeGb); + $expectedResponse->setDeletionProtectionEnabled($deletionProtectionEnabled); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation();