diff --git a/Filestore/metadata/V1/CloudFilestoreService.php b/Filestore/metadata/V1/CloudFilestoreService.php
index 749f93876a1a..a31f40f03e29 100644
Binary files a/Filestore/metadata/V1/CloudFilestoreService.php and b/Filestore/metadata/V1/CloudFilestoreService.php differ
diff --git a/Filestore/samples/V1/CloudFilestoreManagerClient/revert_instance.php b/Filestore/samples/V1/CloudFilestoreManagerClient/revert_instance.php
new file mode 100644
index 000000000000..f8b283f105d5
--- /dev/null
+++ b/Filestore/samples/V1/CloudFilestoreManagerClient/revert_instance.php
@@ -0,0 +1,84 @@
+revertInstance($formattedName, $targetSnapshotId);
+ $response->pollUntilComplete();
+
+ if ($response->operationSucceeded()) {
+ /** @var Instance $result */
+ $result = $response->getResult();
+ printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
+ } else {
+ /** @var Status $error */
+ $error = $response->getError();
+ printf('Operation failed with error data: %s' . PHP_EOL, $error->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 = CloudFilestoreManagerClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
+ $targetSnapshotId = '[TARGET_SNAPSHOT_ID]';
+
+ revert_instance_sample($formattedName, $targetSnapshotId);
+}
+// [END file_v1_generated_CloudFilestoreManager_RevertInstance_sync]
diff --git a/Filestore/src/V1/Backup.php b/Filestore/src/V1/Backup.php
index aa75810468be..6c1515e31e4f 100644
--- a/Filestore/src/V1/Backup.php
+++ b/Filestore/src/V1/Backup.php
@@ -96,6 +96,12 @@ class Backup extends \Google\Protobuf\Internal\Message
* Generated from protobuf field .google.protobuf.BoolValue satisfies_pzs = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
private $satisfies_pzs = null;
+ /**
+ * Output only. Reserved for future use.
+ *
+ * Generated from protobuf field bool satisfies_pzi = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $satisfies_pzi = false;
/**
* Immutable. KMS key name used for data encryption.
*
@@ -142,6 +148,8 @@ class Backup extends \Google\Protobuf\Internal\Message
* backups of the same disk will share storage.
* @type \Google\Protobuf\BoolValue $satisfies_pzs
* Output only. Reserved for future use.
+ * @type bool $satisfies_pzi
+ * Output only. Reserved for future use.
* @type string $kms_key
* Immutable. KMS key name used for data encryption.
* }
@@ -528,6 +536,32 @@ public function setSatisfiesPzsValue($var)
$this->writeWrapperValue("satisfies_pzs", $var);
return $this;}
+ /**
+ * Output only. Reserved for future use.
+ *
+ * Generated from protobuf field bool satisfies_pzi = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return bool
+ */
+ public function getSatisfiesPzi()
+ {
+ return $this->satisfies_pzi;
+ }
+
+ /**
+ * Output only. Reserved for future use.
+ *
+ * Generated from protobuf field bool satisfies_pzi = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param bool $var
+ * @return $this
+ */
+ public function setSatisfiesPzi($var)
+ {
+ GPBUtil::checkBool($var);
+ $this->satisfies_pzi = $var;
+
+ return $this;
+ }
+
/**
* Immutable. KMS key name used for data encryption.
*
diff --git a/Filestore/src/V1/Backup/State.php b/Filestore/src/V1/Backup/State.php
index 4de58f5ab23d..a2187268316c 100644
--- a/Filestore/src/V1/Backup/State.php
+++ b/Filestore/src/V1/Backup/State.php
@@ -44,6 +44,13 @@ class State
* Generated from protobuf enum DELETING = 4;
*/
const DELETING = 4;
+ /**
+ * Backup is not valid and cannot be used for creating new instances or
+ * restoring existing instances.
+ *
+ * Generated from protobuf enum INVALID = 5;
+ */
+ const INVALID = 5;
private static $valueToName = [
self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
@@ -51,6 +58,7 @@ class State
self::FINALIZING => 'FINALIZING',
self::READY => 'READY',
self::DELETING => 'DELETING',
+ self::INVALID => 'INVALID',
];
public static function name($value)
diff --git a/Filestore/src/V1/Client/CloudFilestoreManagerClient.php b/Filestore/src/V1/Client/CloudFilestoreManagerClient.php
index 4b15115f60f1..865c75933dd0 100644
--- a/Filestore/src/V1/Client/CloudFilestoreManagerClient.php
+++ b/Filestore/src/V1/Client/CloudFilestoreManagerClient.php
@@ -50,6 +50,7 @@
use Google\Cloud\Filestore\V1\ListInstancesRequest;
use Google\Cloud\Filestore\V1\ListSnapshotsRequest;
use Google\Cloud\Filestore\V1\RestoreInstanceRequest;
+use Google\Cloud\Filestore\V1\RevertInstanceRequest;
use Google\Cloud\Filestore\V1\Snapshot;
use Google\Cloud\Filestore\V1\UpdateBackupRequest;
use Google\Cloud\Filestore\V1\UpdateInstanceRequest;
@@ -105,6 +106,7 @@
* @method PromiseInterface listInstancesAsync(ListInstancesRequest $request, array $optionalArgs = [])
* @method PromiseInterface listSnapshotsAsync(ListSnapshotsRequest $request, array $optionalArgs = [])
* @method PromiseInterface restoreInstanceAsync(RestoreInstanceRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface revertInstanceAsync(RevertInstanceRequest $request, array $optionalArgs = [])
* @method PromiseInterface updateBackupAsync(UpdateBackupRequest $request, array $optionalArgs = [])
* @method PromiseInterface updateInstanceAsync(UpdateInstanceRequest $request, array $optionalArgs = [])
* @method PromiseInterface updateSnapshotAsync(UpdateSnapshotRequest $request, array $optionalArgs = [])
@@ -679,6 +681,30 @@ public function restoreInstance(RestoreInstanceRequest $request, array $callOpti
return $this->startApiCall('RestoreInstance', $request, $callOptions)->wait();
}
+ /**
+ * Revert an existing instance's file system to a specified snapshot.
+ *
+ * The async variant is {@see CloudFilestoreManagerClient::revertInstanceAsync()} .
+ *
+ * @param RevertInstanceRequest $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 OperationResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function revertInstance(RevertInstanceRequest $request, array $callOptions = []): OperationResponse
+ {
+ return $this->startApiCall('RevertInstance', $request, $callOptions)->wait();
+ }
+
/**
* Updates the settings of a specific backup.
*
diff --git a/Filestore/src/V1/FileShareConfig.php b/Filestore/src/V1/FileShareConfig.php
index 13509e53d466..10f94769038a 100644
--- a/Filestore/src/V1/FileShareConfig.php
+++ b/Filestore/src/V1/FileShareConfig.php
@@ -16,7 +16,10 @@
class FileShareConfig extends \Google\Protobuf\Internal\Message
{
/**
- * The name of the file share (must be 16 characters or less).
+ * Required. The name of the file share. Must use 1-16 characters for the
+ * basic service tier and 1-63 characters for all other service tiers.
+ * Must use lowercase letters, numbers, or underscores `[a-z0-9_]`. Must
+ * start with a letter. Immutable.
*
* Generated from protobuf field string name = 1;
*/
@@ -44,7 +47,10 @@ class FileShareConfig extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type string $name
- * The name of the file share (must be 16 characters or less).
+ * Required. The name of the file share. Must use 1-16 characters for the
+ * basic service tier and 1-63 characters for all other service tiers.
+ * Must use lowercase letters, numbers, or underscores `[a-z0-9_]`. Must
+ * start with a letter. Immutable.
* @type int|string $capacity_gb
* File share capacity in gigabytes (GB).
* Filestore defines 1 GB as 1024^3 bytes.
@@ -63,7 +69,10 @@ public function __construct($data = NULL) {
}
/**
- * The name of the file share (must be 16 characters or less).
+ * Required. The name of the file share. Must use 1-16 characters for the
+ * basic service tier and 1-63 characters for all other service tiers.
+ * Must use lowercase letters, numbers, or underscores `[a-z0-9_]`. Must
+ * start with a letter. Immutable.
*
* Generated from protobuf field string name = 1;
* @return string
@@ -74,7 +83,10 @@ public function getName()
}
/**
- * The name of the file share (must be 16 characters or less).
+ * Required. The name of the file share. Must use 1-16 characters for the
+ * basic service tier and 1-63 characters for all other service tiers.
+ * Must use lowercase letters, numbers, or underscores `[a-z0-9_]`. Must
+ * start with a letter. Immutable.
*
* Generated from protobuf field string name = 1;
* @param string $var
diff --git a/Filestore/src/V1/Gapic/CloudFilestoreManagerGapicClient.php b/Filestore/src/V1/Gapic/CloudFilestoreManagerGapicClient.php
index 4a3dd870ca1d..cf4c4bac595f 100644
--- a/Filestore/src/V1/Gapic/CloudFilestoreManagerGapicClient.php
+++ b/Filestore/src/V1/Gapic/CloudFilestoreManagerGapicClient.php
@@ -53,6 +53,7 @@
use Google\Cloud\Filestore\V1\ListSnapshotsRequest;
use Google\Cloud\Filestore\V1\ListSnapshotsResponse;
use Google\Cloud\Filestore\V1\RestoreInstanceRequest;
+use Google\Cloud\Filestore\V1\RevertInstanceRequest;
use Google\Cloud\Filestore\V1\Snapshot;
use Google\Cloud\Filestore\V1\UpdateBackupRequest;
use Google\Cloud\Filestore\V1\UpdateInstanceRequest;
@@ -1482,6 +1483,89 @@ public function restoreInstance($name, $fileShare, array $optionalArgs = [])
)->wait();
}
+ /**
+ * Revert an existing instance's file system to a specified snapshot.
+ *
+ * Sample code:
+ * ```
+ * $cloudFilestoreManagerClient = new CloudFilestoreManagerClient();
+ * try {
+ * $formattedName = $cloudFilestoreManagerClient->instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
+ * $targetSnapshotId = 'target_snapshot_id';
+ * $operationResponse = $cloudFilestoreManagerClient->revertInstance($formattedName, $targetSnapshotId);
+ * $operationResponse->pollUntilComplete();
+ * if ($operationResponse->operationSucceeded()) {
+ * $result = $operationResponse->getResult();
+ * // doSomethingWith($result)
+ * } else {
+ * $error = $operationResponse->getError();
+ * // handleError($error)
+ * }
+ * // Alternatively:
+ * // start the operation, keep the operation name, and resume later
+ * $operationResponse = $cloudFilestoreManagerClient->revertInstance($formattedName, $targetSnapshotId);
+ * $operationName = $operationResponse->getName();
+ * // ... do other work
+ * $newOperationResponse = $cloudFilestoreManagerClient->resumeOperation($operationName, 'revertInstance');
+ * while (!$newOperationResponse->isDone()) {
+ * // ... do other work
+ * $newOperationResponse->reload();
+ * }
+ * if ($newOperationResponse->operationSucceeded()) {
+ * $result = $newOperationResponse->getResult();
+ * // doSomethingWith($result)
+ * } else {
+ * $error = $newOperationResponse->getError();
+ * // handleError($error)
+ * }
+ * } finally {
+ * $cloudFilestoreManagerClient->close();
+ * }
+ * ```
+ *
+ * @param string $name Required.
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
+ * The resource name of the instance, in the format
+ * @param string $targetSnapshotId Required. The snapshot resource ID, in the format 'my-snapshot', where the
+ * specified ID is the {snapshot_id} of the fully qualified name like
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`
+ * @param array $optionalArgs {
+ * 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 \Google\ApiCore\OperationResponse
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function revertInstance(
+ $name,
+ $targetSnapshotId,
+ array $optionalArgs = []
+ ) {
+ $request = new RevertInstanceRequest();
+ $requestParamHeaders = [];
+ $request->setName($name);
+ $request->setTargetSnapshotId($targetSnapshotId);
+ $requestParamHeaders['name'] = $name;
+ $requestParams = new RequestParamsHeaderDescriptor(
+ $requestParamHeaders
+ );
+ $optionalArgs['headers'] = isset($optionalArgs['headers'])
+ ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
+ : $requestParams->getHeader();
+ return $this->startOperationsCall(
+ 'RevertInstance',
+ $optionalArgs,
+ $request,
+ $this->getOperationsClient()
+ )->wait();
+ }
+
/**
* Updates the settings of a specific backup.
*
diff --git a/Filestore/src/V1/Instance.php b/Filestore/src/V1/Instance.php
index 289d2b081a2b..998371324946 100644
--- a/Filestore/src/V1/Instance.php
+++ b/Filestore/src/V1/Instance.php
@@ -85,6 +85,12 @@ class Instance extends \Google\Protobuf\Internal\Message
* Generated from protobuf field .google.protobuf.BoolValue satisfies_pzs = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
private $satisfies_pzs = null;
+ /**
+ * Output only. Reserved for future use.
+ *
+ * Generated from protobuf field bool satisfies_pzi = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $satisfies_pzi = false;
/**
* KMS key name used for data encryption.
*
@@ -131,6 +137,8 @@ class Instance extends \Google\Protobuf\Internal\Message
* updates from overwriting each other.
* @type \Google\Protobuf\BoolValue $satisfies_pzs
* Output only. Reserved for future use.
+ * @type bool $satisfies_pzi
+ * Output only. Reserved for future use.
* @type string $kms_key_name
* KMS key name used for data encryption.
* @type array|\Google\Protobuf\Internal\RepeatedField $suspension_reasons
@@ -484,6 +492,32 @@ public function setSatisfiesPzsValue($var)
$this->writeWrapperValue("satisfies_pzs", $var);
return $this;}
+ /**
+ * Output only. Reserved for future use.
+ *
+ * Generated from protobuf field bool satisfies_pzi = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return bool
+ */
+ public function getSatisfiesPzi()
+ {
+ return $this->satisfies_pzi;
+ }
+
+ /**
+ * Output only. Reserved for future use.
+ *
+ * Generated from protobuf field bool satisfies_pzi = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param bool $var
+ * @return $this
+ */
+ public function setSatisfiesPzi($var)
+ {
+ GPBUtil::checkBool($var);
+ $this->satisfies_pzi = $var;
+
+ return $this;
+ }
+
/**
* KMS key name used for data encryption.
*
diff --git a/Filestore/src/V1/Instance/State.php b/Filestore/src/V1/Instance/State.php
index c6d6494e119e..8a5f3f6273c5 100644
--- a/Filestore/src/V1/Instance/State.php
+++ b/Filestore/src/V1/Instance/State.php
@@ -78,6 +78,12 @@ class State
* Generated from protobuf enum RESUMING = 10;
*/
const RESUMING = 10;
+ /**
+ * The instance is reverting to a snapshot.
+ *
+ * Generated from protobuf enum REVERTING = 12;
+ */
+ const REVERTING = 12;
private static $valueToName = [
self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
@@ -90,6 +96,7 @@ class State
self::SUSPENDED => 'SUSPENDED',
self::SUSPENDING => 'SUSPENDING',
self::RESUMING => 'RESUMING',
+ self::REVERTING => 'REVERTING',
];
public static function name($value)
diff --git a/Filestore/src/V1/Instance/Tier.php b/Filestore/src/V1/Instance/Tier.php
index e2211cde0165..e4257c033079 100644
--- a/Filestore/src/V1/Instance/Tier.php
+++ b/Filestore/src/V1/Instance/Tier.php
@@ -61,6 +61,20 @@ class Tier
* Generated from protobuf enum ENTERPRISE = 6;
*/
const ENTERPRISE = 6;
+ /**
+ * ZONAL instances offer expanded capacity and performance scaling
+ * capabilities.
+ *
+ * Generated from protobuf enum ZONAL = 7;
+ */
+ const ZONAL = 7;
+ /**
+ * REGIONAL instances offer the features and availability needed for
+ * mission-critical workloads.
+ *
+ * Generated from protobuf enum REGIONAL = 8;
+ */
+ const REGIONAL = 8;
private static $valueToName = [
self::TIER_UNSPECIFIED => 'TIER_UNSPECIFIED',
@@ -70,6 +84,8 @@ class Tier
self::BASIC_SSD => 'BASIC_SSD',
self::HIGH_SCALE_SSD => 'HIGH_SCALE_SSD',
self::ENTERPRISE => 'ENTERPRISE',
+ self::ZONAL => 'ZONAL',
+ self::REGIONAL => 'REGIONAL',
];
public static function name($value)
diff --git a/Filestore/src/V1/RevertInstanceRequest.php b/Filestore/src/V1/RevertInstanceRequest.php
new file mode 100644
index 000000000000..f2b8d12a12e6
--- /dev/null
+++ b/Filestore/src/V1/RevertInstanceRequest.php
@@ -0,0 +1,118 @@
+google.cloud.filestore.v1.RevertInstanceRequest
+ */
+class RevertInstanceRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required.
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
+ * The resource name of the instance, in the format
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $name = '';
+ /**
+ * Required. The snapshot resource ID, in the format 'my-snapshot', where the
+ * specified ID is the {snapshot_id} of the fully qualified name like
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`
+ *
+ * Generated from protobuf field string target_snapshot_id = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $target_snapshot_id = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required.
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
+ * The resource name of the instance, in the format
+ * @type string $target_snapshot_id
+ * Required. The snapshot resource ID, in the format 'my-snapshot', where the
+ * specified ID is the {snapshot_id} of the fully qualified name like
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Filestore\V1\CloudFilestoreService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required.
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
+ * The resource name of the instance, in the format
+ *
+ * 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.
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
+ * The resource name of the instance, in the format
+ *
+ * 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;
+ }
+
+ /**
+ * Required. The snapshot resource ID, in the format 'my-snapshot', where the
+ * specified ID is the {snapshot_id} of the fully qualified name like
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`
+ *
+ * Generated from protobuf field string target_snapshot_id = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getTargetSnapshotId()
+ {
+ return $this->target_snapshot_id;
+ }
+
+ /**
+ * Required. The snapshot resource ID, in the format 'my-snapshot', where the
+ * specified ID is the {snapshot_id} of the fully qualified name like
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`
+ *
+ * Generated from protobuf field string target_snapshot_id = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setTargetSnapshotId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->target_snapshot_id = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Filestore/src/V1/gapic_metadata.json b/Filestore/src/V1/gapic_metadata.json
index dce3112de323..f04450681c16 100644
--- a/Filestore/src/V1/gapic_metadata.json
+++ b/Filestore/src/V1/gapic_metadata.json
@@ -75,6 +75,11 @@
"restoreInstance"
]
},
+ "RevertInstance": {
+ "methods": [
+ "revertInstance"
+ ]
+ },
"UpdateBackup": {
"methods": [
"updateBackup"
diff --git a/Filestore/src/V1/resources/cloud_filestore_manager_client_config.json b/Filestore/src/V1/resources/cloud_filestore_manager_client_config.json
index 491a5db57e0a..c30412692363 100644
--- a/Filestore/src/V1/resources/cloud_filestore_manager_client_config.json
+++ b/Filestore/src/V1/resources/cloud_filestore_manager_client_config.json
@@ -123,6 +123,11 @@
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params"
},
+ "RevertInstance": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
"UpdateBackup": {
"timeout_millis": 600000,
"retry_codes_name": "no_retry_3_codes",
diff --git a/Filestore/src/V1/resources/cloud_filestore_manager_descriptor_config.php b/Filestore/src/V1/resources/cloud_filestore_manager_descriptor_config.php
index e246188d3ad9..ffbce121629c 100644
--- a/Filestore/src/V1/resources/cloud_filestore_manager_descriptor_config.php
+++ b/Filestore/src/V1/resources/cloud_filestore_manager_descriptor_config.php
@@ -136,6 +136,25 @@
],
],
],
+ 'RevertInstance' => [
+ 'longRunning' => [
+ 'operationReturnType' => '\Google\Cloud\Filestore\V1\Instance',
+ 'metadataReturnType' => '\Google\Cloud\Common\OperationMetadata',
+ 'initialPollDelayMillis' => '500',
+ 'pollDelayMultiplier' => '1.5',
+ 'maxPollDelayMillis' => '5000',
+ 'totalPollTimeoutMillis' => '300000',
+ ],
+ 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL,
+ 'headerParams' => [
+ [
+ 'keyName' => 'name',
+ 'fieldAccessors' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'UpdateBackup' => [
'longRunning' => [
'operationReturnType' => '\Google\Cloud\Filestore\V1\Backup',
diff --git a/Filestore/src/V1/resources/cloud_filestore_manager_rest_client_config.php b/Filestore/src/V1/resources/cloud_filestore_manager_rest_client_config.php
index 6c92fa6476c5..d6f04a22aaf5 100644
--- a/Filestore/src/V1/resources/cloud_filestore_manager_rest_client_config.php
+++ b/Filestore/src/V1/resources/cloud_filestore_manager_rest_client_config.php
@@ -159,6 +159,18 @@
],
],
],
+ 'RevertInstance' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{name=projects/*/locations/*/instances/*}:revert',
+ 'body' => '*',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'UpdateBackup' => [
'method' => 'patch',
'uriTemplate' => '/v1/{backup.name=projects/*/locations/*/backups/*}',
diff --git a/Filestore/tests/Unit/V1/Client/CloudFilestoreManagerClientTest.php b/Filestore/tests/Unit/V1/Client/CloudFilestoreManagerClientTest.php
index 638bbe64085b..09fba3b7bcd4 100644
--- a/Filestore/tests/Unit/V1/Client/CloudFilestoreManagerClientTest.php
+++ b/Filestore/tests/Unit/V1/Client/CloudFilestoreManagerClientTest.php
@@ -46,6 +46,7 @@
use Google\Cloud\Filestore\V1\ListSnapshotsRequest;
use Google\Cloud\Filestore\V1\ListSnapshotsResponse;
use Google\Cloud\Filestore\V1\RestoreInstanceRequest;
+use Google\Cloud\Filestore\V1\RevertInstanceRequest;
use Google\Cloud\Filestore\V1\Snapshot;
use Google\Cloud\Filestore\V1\UpdateBackupRequest;
use Google\Cloud\Filestore\V1\UpdateInstanceRequest;
@@ -114,6 +115,7 @@ public function createBackupTest()
$sourceInstance = 'sourceInstance-677426119';
$sourceFileShare = 'sourceFileShare-1224476160';
$downloadBytes = 971924980;
+ $satisfiesPzi = false;
$kmsKey = 'kmsKey-591635343';
$expectedResponse = new Backup();
$expectedResponse->setName($name);
@@ -123,6 +125,7 @@ public function createBackupTest()
$expectedResponse->setSourceInstance($sourceInstance);
$expectedResponse->setSourceFileShare($sourceFileShare);
$expectedResponse->setDownloadBytes($downloadBytes);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKey($kmsKey);
$anyResponse = new Any();
$anyResponse->setValue($expectedResponse->serializeToString());
@@ -260,12 +263,14 @@ public function createInstanceTest()
$description = 'description-1724546052';
$statusMessage = 'statusMessage-239442758';
$etag = 'etag3123477';
+ $satisfiesPzi = false;
$kmsKeyName = 'kmsKeyName2094986649';
$expectedResponse = new Instance();
$expectedResponse->setName($name);
$expectedResponse->setDescription($description);
$expectedResponse->setStatusMessage($statusMessage);
$expectedResponse->setEtag($etag);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKeyName($kmsKeyName);
$anyResponse = new Any();
$anyResponse->setValue($expectedResponse->serializeToString());
@@ -896,6 +901,7 @@ public function getBackupTest()
$sourceInstance = 'sourceInstance-677426119';
$sourceFileShare = 'sourceFileShare-1224476160';
$downloadBytes = 971924980;
+ $satisfiesPzi = false;
$kmsKey = 'kmsKey-591635343';
$expectedResponse = new Backup();
$expectedResponse->setName($name2);
@@ -905,6 +911,7 @@ public function getBackupTest()
$expectedResponse->setSourceInstance($sourceInstance);
$expectedResponse->setSourceFileShare($sourceFileShare);
$expectedResponse->setDownloadBytes($downloadBytes);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKey($kmsKey);
$transport->addResponse($expectedResponse);
// Mock request
@@ -971,12 +978,14 @@ public function getInstanceTest()
$description = 'description-1724546052';
$statusMessage = 'statusMessage-239442758';
$etag = 'etag3123477';
+ $satisfiesPzi = false;
$kmsKeyName = 'kmsKeyName2094986649';
$expectedResponse = new Instance();
$expectedResponse->setName($name2);
$expectedResponse->setDescription($description);
$expectedResponse->setStatusMessage($statusMessage);
$expectedResponse->setEtag($etag);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKeyName($kmsKeyName);
$transport->addResponse($expectedResponse);
// Mock request
@@ -1339,12 +1348,14 @@ public function restoreInstanceTest()
$description = 'description-1724546052';
$statusMessage = 'statusMessage-239442758';
$etag = 'etag3123477';
+ $satisfiesPzi = false;
$kmsKeyName = 'kmsKeyName2094986649';
$expectedResponse = new Instance();
$expectedResponse->setName($name2);
$expectedResponse->setDescription($description);
$expectedResponse->setStatusMessage($statusMessage);
$expectedResponse->setEtag($etag);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKeyName($kmsKeyName);
$anyResponse = new Any();
$anyResponse->setValue($expectedResponse->serializeToString());
@@ -1451,6 +1462,145 @@ public function restoreInstanceExceptionTest()
$this->assertTrue($operationsTransport->isExhausted());
}
+ /** @test */
+ public function revertInstanceTest()
+ {
+ $operationsTransport = $this->createTransport();
+ $operationsClient = new OperationsClient([
+ 'apiEndpoint' => '',
+ 'transport' => $operationsTransport,
+ 'credentials' => $this->createCredentials(),
+ ]);
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ 'operationsClient' => $operationsClient,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ // Mock response
+ $incompleteOperation = new Operation();
+ $incompleteOperation->setName('operations/revertInstanceTest');
+ $incompleteOperation->setDone(false);
+ $transport->addResponse($incompleteOperation);
+ $name2 = 'name2-1052831874';
+ $description = 'description-1724546052';
+ $statusMessage = 'statusMessage-239442758';
+ $etag = 'etag3123477';
+ $satisfiesPzi = false;
+ $kmsKeyName = 'kmsKeyName2094986649';
+ $expectedResponse = new Instance();
+ $expectedResponse->setName($name2);
+ $expectedResponse->setDescription($description);
+ $expectedResponse->setStatusMessage($statusMessage);
+ $expectedResponse->setEtag($etag);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
+ $expectedResponse->setKmsKeyName($kmsKeyName);
+ $anyResponse = new Any();
+ $anyResponse->setValue($expectedResponse->serializeToString());
+ $completeOperation = new Operation();
+ $completeOperation->setName('operations/revertInstanceTest');
+ $completeOperation->setDone(true);
+ $completeOperation->setResponse($anyResponse);
+ $operationsTransport->addResponse($completeOperation);
+ // Mock request
+ $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
+ $targetSnapshotId = 'targetSnapshotId1030984648';
+ $request = (new RevertInstanceRequest())
+ ->setName($formattedName)
+ ->setTargetSnapshotId($targetSnapshotId);
+ $response = $gapicClient->revertInstance($request);
+ $this->assertFalse($response->isDone());
+ $this->assertNull($response->getResult());
+ $apiRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($apiRequests));
+ $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
+ $this->assertSame(0, count($operationsRequestsEmpty));
+ $actualApiFuncCall = $apiRequests[0]->getFuncCall();
+ $actualApiRequestObject = $apiRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.filestore.v1.CloudFilestoreManager/RevertInstance', $actualApiFuncCall);
+ $actualValue = $actualApiRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $actualValue = $actualApiRequestObject->getTargetSnapshotId();
+ $this->assertProtobufEquals($targetSnapshotId, $actualValue);
+ $expectedOperationsRequestObject = new GetOperationRequest();
+ $expectedOperationsRequestObject->setName('operations/revertInstanceTest');
+ $response->pollUntilComplete([
+ 'initialPollDelayMillis' => 1,
+ ]);
+ $this->assertTrue($response->isDone());
+ $this->assertEquals($expectedResponse, $response->getResult());
+ $apiRequestsEmpty = $transport->popReceivedCalls();
+ $this->assertSame(0, count($apiRequestsEmpty));
+ $operationsRequests = $operationsTransport->popReceivedCalls();
+ $this->assertSame(1, count($operationsRequests));
+ $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
+ $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
+ $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
+ $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ }
+
+ /** @test */
+ public function revertInstanceExceptionTest()
+ {
+ $operationsTransport = $this->createTransport();
+ $operationsClient = new OperationsClient([
+ 'apiEndpoint' => '',
+ 'transport' => $operationsTransport,
+ 'credentials' => $this->createCredentials(),
+ ]);
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ 'operationsClient' => $operationsClient,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ // Mock response
+ $incompleteOperation = new Operation();
+ $incompleteOperation->setName('operations/revertInstanceTest');
+ $incompleteOperation->setDone(false);
+ $transport->addResponse($incompleteOperation);
+ $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);
+ $operationsTransport->addResponse(null, $status);
+ // Mock request
+ $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
+ $targetSnapshotId = 'targetSnapshotId1030984648';
+ $request = (new RevertInstanceRequest())
+ ->setName($formattedName)
+ ->setTargetSnapshotId($targetSnapshotId);
+ $response = $gapicClient->revertInstance($request);
+ $this->assertFalse($response->isDone());
+ $this->assertNull($response->getResult());
+ $expectedOperationsRequestObject = new GetOperationRequest();
+ $expectedOperationsRequestObject->setName('operations/revertInstanceTest');
+ try {
+ $response->pollUntilComplete([
+ 'initialPollDelayMillis' => 1,
+ ]);
+ // If the pollUntilComplete() 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 stubs are exhausted
+ $transport->popReceivedCalls();
+ $operationsTransport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ }
+
/** @test */
public function updateBackupTest()
{
@@ -1479,6 +1629,7 @@ public function updateBackupTest()
$sourceInstance = 'sourceInstance-677426119';
$sourceFileShare = 'sourceFileShare-1224476160';
$downloadBytes = 971924980;
+ $satisfiesPzi = false;
$kmsKey = 'kmsKey-591635343';
$expectedResponse = new Backup();
$expectedResponse->setName($name);
@@ -1488,6 +1639,7 @@ public function updateBackupTest()
$expectedResponse->setSourceInstance($sourceInstance);
$expectedResponse->setSourceFileShare($sourceFileShare);
$expectedResponse->setDownloadBytes($downloadBytes);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKey($kmsKey);
$anyResponse = new Any();
$anyResponse->setValue($expectedResponse->serializeToString());
@@ -1619,12 +1771,14 @@ public function updateInstanceTest()
$description = 'description-1724546052';
$statusMessage = 'statusMessage-239442758';
$etag = 'etag3123477';
+ $satisfiesPzi = false;
$kmsKeyName = 'kmsKeyName2094986649';
$expectedResponse = new Instance();
$expectedResponse->setName($name);
$expectedResponse->setDescription($description);
$expectedResponse->setStatusMessage($statusMessage);
$expectedResponse->setEtag($etag);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKeyName($kmsKeyName);
$anyResponse = new Any();
$anyResponse->setValue($expectedResponse->serializeToString());
@@ -1878,6 +2032,7 @@ public function createBackupAsyncTest()
$sourceInstance = 'sourceInstance-677426119';
$sourceFileShare = 'sourceFileShare-1224476160';
$downloadBytes = 971924980;
+ $satisfiesPzi = false;
$kmsKey = 'kmsKey-591635343';
$expectedResponse = new Backup();
$expectedResponse->setName($name);
@@ -1887,6 +2042,7 @@ public function createBackupAsyncTest()
$expectedResponse->setSourceInstance($sourceInstance);
$expectedResponse->setSourceFileShare($sourceFileShare);
$expectedResponse->setDownloadBytes($downloadBytes);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKey($kmsKey);
$anyResponse = new Any();
$anyResponse->setValue($expectedResponse->serializeToString());
diff --git a/Filestore/tests/Unit/V1/CloudFilestoreManagerClientTest.php b/Filestore/tests/Unit/V1/CloudFilestoreManagerClientTest.php
index c05cfb63de83..bb206707edc6 100644
--- a/Filestore/tests/Unit/V1/CloudFilestoreManagerClientTest.php
+++ b/Filestore/tests/Unit/V1/CloudFilestoreManagerClientTest.php
@@ -98,6 +98,7 @@ public function createBackupTest()
$sourceInstance = 'sourceInstance-677426119';
$sourceFileShare = 'sourceFileShare-1224476160';
$downloadBytes = 971924980;
+ $satisfiesPzi = false;
$kmsKey = 'kmsKey-591635343';
$expectedResponse = new Backup();
$expectedResponse->setName($name);
@@ -107,6 +108,7 @@ public function createBackupTest()
$expectedResponse->setSourceInstance($sourceInstance);
$expectedResponse->setSourceFileShare($sourceFileShare);
$expectedResponse->setDownloadBytes($downloadBytes);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKey($kmsKey);
$anyResponse = new Any();
$anyResponse->setValue($expectedResponse->serializeToString());
@@ -236,12 +238,14 @@ public function createInstanceTest()
$description = 'description-1724546052';
$statusMessage = 'statusMessage-239442758';
$etag = 'etag3123477';
+ $satisfiesPzi = false;
$kmsKeyName = 'kmsKeyName2094986649';
$expectedResponse = new Instance();
$expectedResponse->setName($name);
$expectedResponse->setDescription($description);
$expectedResponse->setStatusMessage($statusMessage);
$expectedResponse->setEtag($etag);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKeyName($kmsKeyName);
$anyResponse = new Any();
$anyResponse->setValue($expectedResponse->serializeToString());
@@ -844,6 +848,7 @@ public function getBackupTest()
$sourceInstance = 'sourceInstance-677426119';
$sourceFileShare = 'sourceFileShare-1224476160';
$downloadBytes = 971924980;
+ $satisfiesPzi = false;
$kmsKey = 'kmsKey-591635343';
$expectedResponse = new Backup();
$expectedResponse->setName($name2);
@@ -853,6 +858,7 @@ public function getBackupTest()
$expectedResponse->setSourceInstance($sourceInstance);
$expectedResponse->setSourceFileShare($sourceFileShare);
$expectedResponse->setDownloadBytes($downloadBytes);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKey($kmsKey);
$transport->addResponse($expectedResponse);
// Mock request
@@ -915,12 +921,14 @@ public function getInstanceTest()
$description = 'description-1724546052';
$statusMessage = 'statusMessage-239442758';
$etag = 'etag3123477';
+ $satisfiesPzi = false;
$kmsKeyName = 'kmsKeyName2094986649';
$expectedResponse = new Instance();
$expectedResponse->setName($name2);
$expectedResponse->setDescription($description);
$expectedResponse->setStatusMessage($statusMessage);
$expectedResponse->setEtag($etag);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKeyName($kmsKeyName);
$transport->addResponse($expectedResponse);
// Mock request
@@ -1263,12 +1271,14 @@ public function restoreInstanceTest()
$description = 'description-1724546052';
$statusMessage = 'statusMessage-239442758';
$etag = 'etag3123477';
+ $satisfiesPzi = false;
$kmsKeyName = 'kmsKeyName2094986649';
$expectedResponse = new Instance();
$expectedResponse->setName($name2);
$expectedResponse->setDescription($description);
$expectedResponse->setStatusMessage($statusMessage);
$expectedResponse->setEtag($etag);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKeyName($kmsKeyName);
$anyResponse = new Any();
$anyResponse->setValue($expectedResponse->serializeToString());
@@ -1369,6 +1379,139 @@ public function restoreInstanceExceptionTest()
$this->assertTrue($operationsTransport->isExhausted());
}
+ /** @test */
+ public function revertInstanceTest()
+ {
+ $operationsTransport = $this->createTransport();
+ $operationsClient = new OperationsClient([
+ 'apiEndpoint' => '',
+ 'transport' => $operationsTransport,
+ 'credentials' => $this->createCredentials(),
+ ]);
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ 'operationsClient' => $operationsClient,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ // Mock response
+ $incompleteOperation = new Operation();
+ $incompleteOperation->setName('operations/revertInstanceTest');
+ $incompleteOperation->setDone(false);
+ $transport->addResponse($incompleteOperation);
+ $name2 = 'name2-1052831874';
+ $description = 'description-1724546052';
+ $statusMessage = 'statusMessage-239442758';
+ $etag = 'etag3123477';
+ $satisfiesPzi = false;
+ $kmsKeyName = 'kmsKeyName2094986649';
+ $expectedResponse = new Instance();
+ $expectedResponse->setName($name2);
+ $expectedResponse->setDescription($description);
+ $expectedResponse->setStatusMessage($statusMessage);
+ $expectedResponse->setEtag($etag);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
+ $expectedResponse->setKmsKeyName($kmsKeyName);
+ $anyResponse = new Any();
+ $anyResponse->setValue($expectedResponse->serializeToString());
+ $completeOperation = new Operation();
+ $completeOperation->setName('operations/revertInstanceTest');
+ $completeOperation->setDone(true);
+ $completeOperation->setResponse($anyResponse);
+ $operationsTransport->addResponse($completeOperation);
+ // Mock request
+ $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
+ $targetSnapshotId = 'targetSnapshotId1030984648';
+ $response = $gapicClient->revertInstance($formattedName, $targetSnapshotId);
+ $this->assertFalse($response->isDone());
+ $this->assertNull($response->getResult());
+ $apiRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($apiRequests));
+ $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
+ $this->assertSame(0, count($operationsRequestsEmpty));
+ $actualApiFuncCall = $apiRequests[0]->getFuncCall();
+ $actualApiRequestObject = $apiRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.filestore.v1.CloudFilestoreManager/RevertInstance', $actualApiFuncCall);
+ $actualValue = $actualApiRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $actualValue = $actualApiRequestObject->getTargetSnapshotId();
+ $this->assertProtobufEquals($targetSnapshotId, $actualValue);
+ $expectedOperationsRequestObject = new GetOperationRequest();
+ $expectedOperationsRequestObject->setName('operations/revertInstanceTest');
+ $response->pollUntilComplete([
+ 'initialPollDelayMillis' => 1,
+ ]);
+ $this->assertTrue($response->isDone());
+ $this->assertEquals($expectedResponse, $response->getResult());
+ $apiRequestsEmpty = $transport->popReceivedCalls();
+ $this->assertSame(0, count($apiRequestsEmpty));
+ $operationsRequests = $operationsTransport->popReceivedCalls();
+ $this->assertSame(1, count($operationsRequests));
+ $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
+ $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
+ $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
+ $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ }
+
+ /** @test */
+ public function revertInstanceExceptionTest()
+ {
+ $operationsTransport = $this->createTransport();
+ $operationsClient = new OperationsClient([
+ 'apiEndpoint' => '',
+ 'transport' => $operationsTransport,
+ 'credentials' => $this->createCredentials(),
+ ]);
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ 'operationsClient' => $operationsClient,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ // Mock response
+ $incompleteOperation = new Operation();
+ $incompleteOperation->setName('operations/revertInstanceTest');
+ $incompleteOperation->setDone(false);
+ $transport->addResponse($incompleteOperation);
+ $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);
+ $operationsTransport->addResponse(null, $status);
+ // Mock request
+ $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
+ $targetSnapshotId = 'targetSnapshotId1030984648';
+ $response = $gapicClient->revertInstance($formattedName, $targetSnapshotId);
+ $this->assertFalse($response->isDone());
+ $this->assertNull($response->getResult());
+ $expectedOperationsRequestObject = new GetOperationRequest();
+ $expectedOperationsRequestObject->setName('operations/revertInstanceTest');
+ try {
+ $response->pollUntilComplete([
+ 'initialPollDelayMillis' => 1,
+ ]);
+ // If the pollUntilComplete() 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 stubs are exhausted
+ $transport->popReceivedCalls();
+ $operationsTransport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ }
+
/** @test */
public function updateBackupTest()
{
@@ -1397,6 +1540,7 @@ public function updateBackupTest()
$sourceInstance = 'sourceInstance-677426119';
$sourceFileShare = 'sourceFileShare-1224476160';
$downloadBytes = 971924980;
+ $satisfiesPzi = false;
$kmsKey = 'kmsKey-591635343';
$expectedResponse = new Backup();
$expectedResponse->setName($name);
@@ -1406,6 +1550,7 @@ public function updateBackupTest()
$expectedResponse->setSourceInstance($sourceInstance);
$expectedResponse->setSourceFileShare($sourceFileShare);
$expectedResponse->setDownloadBytes($downloadBytes);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKey($kmsKey);
$anyResponse = new Any();
$anyResponse->setValue($expectedResponse->serializeToString());
@@ -1531,12 +1676,14 @@ public function updateInstanceTest()
$description = 'description-1724546052';
$statusMessage = 'statusMessage-239442758';
$etag = 'etag3123477';
+ $satisfiesPzi = false;
$kmsKeyName = 'kmsKeyName2094986649';
$expectedResponse = new Instance();
$expectedResponse->setName($name);
$expectedResponse->setDescription($description);
$expectedResponse->setStatusMessage($statusMessage);
$expectedResponse->setEtag($etag);
+ $expectedResponse->setSatisfiesPzi($satisfiesPzi);
$expectedResponse->setKmsKeyName($kmsKeyName);
$anyResponse = new Any();
$anyResponse->setValue($expectedResponse->serializeToString());