diff --git a/BackupDr/metadata/V1/Backupdr.php b/BackupDr/metadata/V1/Backupdr.php
index fde6b0d8cfbd..a739e1b389ad 100644
Binary files a/BackupDr/metadata/V1/Backupdr.php and b/BackupDr/metadata/V1/Backupdr.php differ
diff --git a/BackupDr/metadata/V1/Backupplanassociation.php b/BackupDr/metadata/V1/Backupplanassociation.php
index f2c6692f67f7..3d9e738420f3 100644
Binary files a/BackupDr/metadata/V1/Backupplanassociation.php and b/BackupDr/metadata/V1/Backupplanassociation.php differ
diff --git a/BackupDr/metadata/V1/Backupvault.php b/BackupDr/metadata/V1/Backupvault.php
index 23fe82324104..523869b8860a 100644
Binary files a/BackupDr/metadata/V1/Backupvault.php and b/BackupDr/metadata/V1/Backupvault.php differ
diff --git a/BackupDr/samples/V1/BackupDRClient/create_backup_plan.php b/BackupDr/samples/V1/BackupDRClient/create_backup_plan.php
index ee29ae4ff1c5..ae67d0588b61 100644
--- a/BackupDr/samples/V1/BackupDRClient/create_backup_plan.php
+++ b/BackupDr/samples/V1/BackupDRClient/create_backup_plan.php
@@ -52,6 +52,12 @@
* @param int $backupPlanBackupRulesBackupRetentionDays Configures the duration for which backup data will be kept. It is
* defined in “days”. The value should be greater than or equal to minimum
* enforced retention of the backup vault.
+ *
+ * Minimum value is 1 and maximum value is 90 for hourly backups.
+ * Minimum value is 1 and maximum value is 90 for daily backups.
+ * Minimum value is 7 and maximum value is 186 for weekly backups.
+ * Minimum value is 30 and maximum value is 732 for monthly backups.
+ * Minimum value is 365 and maximum value is 36159 for yearly backups.
* @param int $backupPlanBackupRulesStandardScheduleRecurrenceType Specifies the `RecurrenceType` for the schedule.
* @param int $backupPlanBackupRulesStandardScheduleBackupWindowStartHourOfDay The hour of day (0-23) when the window starts for e.g. if value
* of start hour of day is 6 that mean backup window start at 6:00.
@@ -68,8 +74,8 @@
* See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for the
* list of valid timezone names. For e.g., Europe/Paris.
* @param string $backupPlanResourceType The resource type to which the `BackupPlan` will be applied.
- * Examples include, "compute.googleapis.com/Instance" and
- * "storage.googleapis.com/Bucket".
+ * Examples include, "compute.googleapis.com/Instance",
+ * "sqladmin.googleapis.com/Instance", or "alloydb.googleapis.com/Cluster".
* @param string $formattedBackupPlanBackupVault Resource name of backup vault which will be used as storage
* location for backups. Format:
* projects/{project}/locations/{location}/backupVaults/{backupvault}
diff --git a/BackupDr/samples/V1/BackupDRClient/create_backup_plan_association.php b/BackupDr/samples/V1/BackupDRClient/create_backup_plan_association.php
index 16cba9b49c8c..48647c005280 100644
--- a/BackupDr/samples/V1/BackupDRClient/create_backup_plan_association.php
+++ b/BackupDr/samples/V1/BackupDRClient/create_backup_plan_association.php
@@ -39,6 +39,8 @@
* {@see BackupDRClient::locationName()} for help formatting this field.
* @param string $backupPlanAssociationId The name of the backup plan association to create. The name must
* be unique for the specified project and location.
+ * @param string $backupPlanAssociationResourceType Immutable. Resource type of workload on which backupplan is
+ * applied
* @param string $backupPlanAssociationResource Immutable. Resource name of workload on which backupplan is
* applied
* @param string $formattedBackupPlanAssociationBackupPlan Resource name of backup plan which needs to be applied on
@@ -49,6 +51,7 @@
function create_backup_plan_association_sample(
string $formattedParent,
string $backupPlanAssociationId,
+ string $backupPlanAssociationResourceType,
string $backupPlanAssociationResource,
string $formattedBackupPlanAssociationBackupPlan
): void {
@@ -57,6 +60,7 @@ function create_backup_plan_association_sample(
// Prepare the request message.
$backupPlanAssociation = (new BackupPlanAssociation())
+ ->setResourceType($backupPlanAssociationResourceType)
->setResource($backupPlanAssociationResource)
->setBackupPlan($formattedBackupPlanAssociationBackupPlan);
$request = (new CreateBackupPlanAssociationRequest())
@@ -97,6 +101,7 @@ function callSample(): void
{
$formattedParent = BackupDRClient::locationName('[PROJECT]', '[LOCATION]');
$backupPlanAssociationId = '[BACKUP_PLAN_ASSOCIATION_ID]';
+ $backupPlanAssociationResourceType = '[RESOURCE_TYPE]';
$backupPlanAssociationResource = '[RESOURCE]';
$formattedBackupPlanAssociationBackupPlan = BackupDRClient::backupPlanName(
'[PROJECT]',
@@ -107,6 +112,7 @@ function callSample(): void
create_backup_plan_association_sample(
$formattedParent,
$backupPlanAssociationId,
+ $backupPlanAssociationResourceType,
$backupPlanAssociationResource,
$formattedBackupPlanAssociationBackupPlan
);
diff --git a/BackupDr/samples/V1/BackupDRClient/create_management_server.php b/BackupDr/samples/V1/BackupDRClient/create_management_server.php
index c453145930c7..71fabbfd95ec 100644
--- a/BackupDr/samples/V1/BackupDRClient/create_management_server.php
+++ b/BackupDr/samples/V1/BackupDRClient/create_management_server.php
@@ -28,7 +28,6 @@
use Google\Cloud\BackupDR\V1\Client\BackupDRClient;
use Google\Cloud\BackupDR\V1\CreateManagementServerRequest;
use Google\Cloud\BackupDR\V1\ManagementServer;
-use Google\Cloud\BackupDR\V1\NetworkConfig;
use Google\Rpc\Status;
/**
@@ -49,9 +48,7 @@ function create_management_server_sample(
$backupDRClient = new BackupDRClient();
// Prepare the request message.
- $managementServerNetworks = [new NetworkConfig()];
- $managementServer = (new ManagementServer())
- ->setNetworks($managementServerNetworks);
+ $managementServer = new ManagementServer();
$request = (new CreateManagementServerRequest())
->setParent($formattedParent)
->setManagementServerId($managementServerId)
diff --git a/BackupDr/samples/V1/BackupDRClient/initialize_service.php b/BackupDr/samples/V1/BackupDRClient/initialize_service.php
new file mode 100644
index 000000000000..4d5633e4e9ca
--- /dev/null
+++ b/BackupDr/samples/V1/BackupDRClient/initialize_service.php
@@ -0,0 +1,89 @@
+setName($name)
+ ->setResourceType($resourceType);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var OperationResponse $response */
+ $response = $backupDRClient->initializeService($request);
+ $response->pollUntilComplete();
+
+ if ($response->operationSucceeded()) {
+ /** @var InitializeServiceResponse $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
+{
+ $name = '[NAME]';
+ $resourceType = '[RESOURCE_TYPE]';
+
+ initialize_service_sample($name, $resourceType);
+}
+// [END backupdr_v1_generated_BackupDR_InitializeService_sync]
diff --git a/BackupDr/src/V1/BackupPlan.php b/BackupDr/src/V1/BackupPlan.php
index 5f4feca856b7..767ba891dd5e 100644
--- a/BackupDr/src/V1/BackupPlan.php
+++ b/BackupDr/src/V1/BackupPlan.php
@@ -69,8 +69,8 @@ class BackupPlan extends \Google\Protobuf\Internal\Message
protected $state = 0;
/**
* Required. The resource type to which the `BackupPlan` will be applied.
- * Examples include, "compute.googleapis.com/Instance" and
- * "storage.googleapis.com/Bucket".
+ * Examples include, "compute.googleapis.com/Instance",
+ * "sqladmin.googleapis.com/Instance", or "alloydb.googleapis.com/Cluster".
*
* Generated from protobuf field string resource_type = 8 [(.google.api.field_behavior) = REQUIRED];
*/
@@ -129,8 +129,8 @@ class BackupPlan extends \Google\Protobuf\Internal\Message
* Output only. The `State` for the `BackupPlan`.
* @type string $resource_type
* Required. The resource type to which the `BackupPlan` will be applied.
- * Examples include, "compute.googleapis.com/Instance" and
- * "storage.googleapis.com/Bucket".
+ * Examples include, "compute.googleapis.com/Instance",
+ * "sqladmin.googleapis.com/Instance", or "alloydb.googleapis.com/Cluster".
* @type string $etag
* Optional. `etag` is returned from the service in the response. As a user of
* the service, you may provide an etag value in this field to prevent stale
@@ -368,8 +368,8 @@ public function setState($var)
/**
* Required. The resource type to which the `BackupPlan` will be applied.
- * Examples include, "compute.googleapis.com/Instance" and
- * "storage.googleapis.com/Bucket".
+ * Examples include, "compute.googleapis.com/Instance",
+ * "sqladmin.googleapis.com/Instance", or "alloydb.googleapis.com/Cluster".
*
* Generated from protobuf field string resource_type = 8 [(.google.api.field_behavior) = REQUIRED];
* @return string
@@ -381,8 +381,8 @@ public function getResourceType()
/**
* Required. The resource type to which the `BackupPlan` will be applied.
- * Examples include, "compute.googleapis.com/Instance" and
- * "storage.googleapis.com/Bucket".
+ * Examples include, "compute.googleapis.com/Instance",
+ * "sqladmin.googleapis.com/Instance", or "alloydb.googleapis.com/Cluster".
*
* Generated from protobuf field string resource_type = 8 [(.google.api.field_behavior) = REQUIRED];
* @param string $var
diff --git a/BackupDr/src/V1/BackupPlanAssociation.php b/BackupDr/src/V1/BackupPlanAssociation.php
index 2a5804c13ae5..8d3a90091826 100644
--- a/BackupDr/src/V1/BackupPlanAssociation.php
+++ b/BackupDr/src/V1/BackupPlanAssociation.php
@@ -25,9 +25,10 @@ class BackupPlanAssociation extends \Google\Protobuf\Internal\Message
*/
protected $name = '';
/**
- * Optional. Resource type of workload on which backupplan is applied
+ * Required. Immutable. Resource type of workload on which backupplan is
+ * applied
*
- * Generated from protobuf field string resource_type = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * Generated from protobuf field string resource_type = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED];
*/
protected $resource_type = '';
/**
@@ -70,10 +71,8 @@ class BackupPlanAssociation extends \Google\Protobuf\Internal\Message
*/
private $rules_config_info;
/**
- * Output only. Output Only.
- * Resource name of data source which will be used as storage location for
- * backups taken.
- * Format :
+ * Output only. Resource name of data source which will be used as storage
+ * location for backups taken. Format :
* projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}
*
* Generated from protobuf field string data_source = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
@@ -91,7 +90,8 @@ class BackupPlanAssociation extends \Google\Protobuf\Internal\Message
* below format Format :
* projects/{project}/locations/{location}/backupPlanAssociations/{backupPlanAssociationId}
* @type string $resource_type
- * Optional. Resource type of workload on which backupplan is applied
+ * Required. Immutable. Resource type of workload on which backupplan is
+ * applied
* @type string $resource
* Required. Immutable. Resource name of workload on which backupplan is
* applied
@@ -108,10 +108,8 @@ class BackupPlanAssociation extends \Google\Protobuf\Internal\Message
* @type array<\Google\Cloud\BackupDR\V1\RuleConfigInfo>|\Google\Protobuf\Internal\RepeatedField $rules_config_info
* Output only. The config info related to backup rules.
* @type string $data_source
- * Output only. Output Only.
- * Resource name of data source which will be used as storage location for
- * backups taken.
- * Format :
+ * Output only. Resource name of data source which will be used as storage
+ * location for backups taken. Format :
* projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}
* }
*/
@@ -151,9 +149,10 @@ public function setName($var)
}
/**
- * Optional. Resource type of workload on which backupplan is applied
+ * Required. Immutable. Resource type of workload on which backupplan is
+ * applied
*
- * Generated from protobuf field string resource_type = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * Generated from protobuf field string resource_type = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED];
* @return string
*/
public function getResourceType()
@@ -162,9 +161,10 @@ public function getResourceType()
}
/**
- * Optional. Resource type of workload on which backupplan is applied
+ * Required. Immutable. Resource type of workload on which backupplan is
+ * applied
*
- * Generated from protobuf field string resource_type = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * Generated from protobuf field string resource_type = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED];
* @param string $var
* @return $this
*/
@@ -359,10 +359,8 @@ public function setRulesConfigInfo($var)
}
/**
- * Output only. Output Only.
- * Resource name of data source which will be used as storage location for
- * backups taken.
- * Format :
+ * Output only. Resource name of data source which will be used as storage
+ * location for backups taken. Format :
* projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}
*
* Generated from protobuf field string data_source = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
@@ -374,10 +372,8 @@ public function getDataSource()
}
/**
- * Output only. Output Only.
- * Resource name of data source which will be used as storage location for
- * backups taken.
- * Format :
+ * Output only. Resource name of data source which will be used as storage
+ * location for backups taken. Format :
* projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}
*
* Generated from protobuf field string data_source = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
diff --git a/BackupDr/src/V1/BackupRule.php b/BackupDr/src/V1/BackupRule.php
index a66eb5362db0..7161aa5bc1be 100644
--- a/BackupDr/src/V1/BackupRule.php
+++ b/BackupDr/src/V1/BackupRule.php
@@ -28,6 +28,11 @@ class BackupRule extends \Google\Protobuf\Internal\Message
* Required. Configures the duration for which backup data will be kept. It is
* defined in “days”. The value should be greater than or equal to minimum
* enforced retention of the backup vault.
+ * Minimum value is 1 and maximum value is 90 for hourly backups.
+ * Minimum value is 1 and maximum value is 90 for daily backups.
+ * Minimum value is 7 and maximum value is 186 for weekly backups.
+ * Minimum value is 30 and maximum value is 732 for monthly backups.
+ * Minimum value is 365 and maximum value is 36159 for yearly backups.
*
* Generated from protobuf field int32 backup_retention_days = 4 [(.google.api.field_behavior) = REQUIRED];
*/
@@ -49,6 +54,11 @@ class BackupRule extends \Google\Protobuf\Internal\Message
* Required. Configures the duration for which backup data will be kept. It is
* defined in “days”. The value should be greater than or equal to minimum
* enforced retention of the backup vault.
+ * Minimum value is 1 and maximum value is 90 for hourly backups.
+ * Minimum value is 1 and maximum value is 90 for daily backups.
+ * Minimum value is 7 and maximum value is 186 for weekly backups.
+ * Minimum value is 30 and maximum value is 732 for monthly backups.
+ * Minimum value is 365 and maximum value is 36159 for yearly backups.
* @type \Google\Cloud\BackupDR\V1\StandardSchedule $standard_schedule
* Required. Defines a schedule that runs within the confines of a defined
* window of time.
@@ -95,6 +105,11 @@ public function setRuleId($var)
* Required. Configures the duration for which backup data will be kept. It is
* defined in “days”. The value should be greater than or equal to minimum
* enforced retention of the backup vault.
+ * Minimum value is 1 and maximum value is 90 for hourly backups.
+ * Minimum value is 1 and maximum value is 90 for daily backups.
+ * Minimum value is 7 and maximum value is 186 for weekly backups.
+ * Minimum value is 30 and maximum value is 732 for monthly backups.
+ * Minimum value is 365 and maximum value is 36159 for yearly backups.
*
* Generated from protobuf field int32 backup_retention_days = 4 [(.google.api.field_behavior) = REQUIRED];
* @return int
@@ -108,6 +123,11 @@ public function getBackupRetentionDays()
* Required. Configures the duration for which backup data will be kept. It is
* defined in “days”. The value should be greater than or equal to minimum
* enforced retention of the backup vault.
+ * Minimum value is 1 and maximum value is 90 for hourly backups.
+ * Minimum value is 1 and maximum value is 90 for daily backups.
+ * Minimum value is 7 and maximum value is 186 for weekly backups.
+ * Minimum value is 30 and maximum value is 732 for monthly backups.
+ * Minimum value is 365 and maximum value is 36159 for yearly backups.
*
* Generated from protobuf field int32 backup_retention_days = 4 [(.google.api.field_behavior) = REQUIRED];
* @param int $var
diff --git a/BackupDr/src/V1/BackupVault.php b/BackupDr/src/V1/BackupVault.php
index 03d965e14bae..bfcec47b46e3 100644
--- a/BackupDr/src/V1/BackupVault.php
+++ b/BackupDr/src/V1/BackupVault.php
@@ -105,8 +105,7 @@ class BackupVault extends \Google\Protobuf\Internal\Message
*/
protected $total_stored_bytes = 0;
/**
- * Output only. Output only
- * Immutable after resource creation until resource deletion.
+ * Output only. Immutable after resource creation until resource deletion.
*
* Generated from protobuf field string uid = 21 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = {
*/
@@ -121,7 +120,6 @@ class BackupVault extends \Google\Protobuf\Internal\Message
/**
* Optional. Note: This field is added for future use case and will not be
* supported in the current release.
- * Optional.
* Access restriction for the backup vault.
* Default value is WITHIN_ORGANIZATION if not provided during creation.
*
@@ -173,15 +171,13 @@ class BackupVault extends \Google\Protobuf\Internal\Message
* @type int|string $total_stored_bytes
* Output only. Total size of the storage used by all backup resources.
* @type string $uid
- * Output only. Output only
- * Immutable after resource creation until resource deletion.
+ * Output only. Immutable after resource creation until resource deletion.
* @type array|\Google\Protobuf\Internal\MapField $annotations
* Optional. User annotations. See https://google.aip.dev/128#annotations
* Stores small amounts of arbitrary data.
* @type int $access_restriction
* Optional. Note: This field is added for future use case and will not be
* supported in the current release.
- * Optional.
* Access restriction for the backup vault.
* Default value is WITHIN_ORGANIZATION if not provided during creation.
* }
@@ -622,8 +618,7 @@ public function setTotalStoredBytes($var)
}
/**
- * Output only. Output only
- * Immutable after resource creation until resource deletion.
+ * Output only. Immutable after resource creation until resource deletion.
*
* Generated from protobuf field string uid = 21 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = {
* @return string
@@ -634,8 +629,7 @@ public function getUid()
}
/**
- * Output only. Output only
- * Immutable after resource creation until resource deletion.
+ * Output only. Immutable after resource creation until resource deletion.
*
* Generated from protobuf field string uid = 21 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = {
* @param string $var
@@ -680,7 +674,6 @@ public function setAnnotations($var)
/**
* Optional. Note: This field is added for future use case and will not be
* supported in the current release.
- * Optional.
* Access restriction for the backup vault.
* Default value is WITHIN_ORGANIZATION if not provided during creation.
*
@@ -695,7 +688,6 @@ public function getAccessRestriction()
/**
* Optional. Note: This field is added for future use case and will not be
* supported in the current release.
- * Optional.
* Access restriction for the backup vault.
* Default value is WITHIN_ORGANIZATION if not provided during creation.
*
diff --git a/BackupDr/src/V1/BackupVault/AccessRestriction.php b/BackupDr/src/V1/BackupVault/AccessRestriction.php
index a48fa59cab20..a276639d7bc4 100644
--- a/BackupDr/src/V1/BackupVault/AccessRestriction.php
+++ b/BackupDr/src/V1/BackupVault/AccessRestriction.php
@@ -14,7 +14,8 @@
class AccessRestriction
{
/**
- * Access restriction not set.
+ * Access restriction not set. If user does not provide any value or pass
+ * this value, it will be changed to WITHIN_ORGANIZATION.
*
* Generated from protobuf enum ACCESS_RESTRICTION_UNSPECIFIED = 0;
*/
@@ -38,12 +39,20 @@ class AccessRestriction
* Generated from protobuf enum UNRESTRICTED = 3;
*/
const UNRESTRICTED = 3;
+ /**
+ * Access to or from resources outside your current organization will be
+ * denied except for backup appliance.
+ *
+ * Generated from protobuf enum WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA = 4;
+ */
+ const WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA = 4;
private static $valueToName = [
self::ACCESS_RESTRICTION_UNSPECIFIED => 'ACCESS_RESTRICTION_UNSPECIFIED',
self::WITHIN_PROJECT => 'WITHIN_PROJECT',
self::WITHIN_ORGANIZATION => 'WITHIN_ORGANIZATION',
self::UNRESTRICTED => 'UNRESTRICTED',
+ self::WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA => 'WITHIN_ORG_BUT_UNRESTRICTED_FOR_BA',
];
public static function name($value)
diff --git a/BackupDr/src/V1/Client/BackupDRClient.php b/BackupDr/src/V1/Client/BackupDRClient.php
index 6c6a9c931401..0b5b2a2285db 100644
--- a/BackupDr/src/V1/Client/BackupDRClient.php
+++ b/BackupDr/src/V1/Client/BackupDRClient.php
@@ -55,6 +55,7 @@
use Google\Cloud\BackupDR\V1\GetBackupVaultRequest;
use Google\Cloud\BackupDR\V1\GetDataSourceRequest;
use Google\Cloud\BackupDR\V1\GetManagementServerRequest;
+use Google\Cloud\BackupDR\V1\InitializeServiceRequest;
use Google\Cloud\BackupDR\V1\ListBackupPlanAssociationsRequest;
use Google\Cloud\BackupDR\V1\ListBackupPlansRequest;
use Google\Cloud\BackupDR\V1\ListBackupVaultsRequest;
@@ -107,6 +108,7 @@
* @method PromiseInterface getBackupVaultAsync(GetBackupVaultRequest $request, array $optionalArgs = [])
* @method PromiseInterface getDataSourceAsync(GetDataSourceRequest $request, array $optionalArgs = [])
* @method PromiseInterface getManagementServerAsync(GetManagementServerRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface initializeServiceAsync(InitializeServiceRequest $request, array $optionalArgs = [])
* @method PromiseInterface listBackupPlanAssociationsAsync(ListBackupPlanAssociationsRequest $request, array $optionalArgs = [])
* @method PromiseInterface listBackupPlansAsync(ListBackupPlansRequest $request, array $optionalArgs = [])
* @method PromiseInterface listBackupVaultsAsync(ListBackupVaultsRequest $request, array $optionalArgs = [])
@@ -906,6 +908,32 @@ public function getManagementServer(GetManagementServerRequest $request, array $
return $this->startApiCall('GetManagementServer', $request, $callOptions)->wait();
}
+ /**
+ * Initializes the service related config for a project.
+ *
+ * The async variant is {@see BackupDRClient::initializeServiceAsync()} .
+ *
+ * @example samples/V1/BackupDRClient/initialize_service.php
+ *
+ * @param InitializeServiceRequest $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 initializeService(InitializeServiceRequest $request, array $callOptions = []): OperationResponse
+ {
+ return $this->startApiCall('InitializeService', $request, $callOptions)->wait();
+ }
+
/**
* Lists BackupPlanAssociations in a given project and location.
*
diff --git a/BackupDr/src/V1/DeleteBackupVaultRequest.php b/BackupDr/src/V1/DeleteBackupVaultRequest.php
index 2408f02e4d27..4de4d6c57201 100644
--- a/BackupDr/src/V1/DeleteBackupVaultRequest.php
+++ b/BackupDr/src/V1/DeleteBackupVaultRequest.php
@@ -66,6 +66,13 @@ class DeleteBackupVaultRequest extends \Google\Protobuf\Internal\Message
* Generated from protobuf field bool allow_missing = 6 [(.google.api.field_behavior) = OPTIONAL];
*/
protected $allow_missing = false;
+ /**
+ * Optional. If set to true, backupvault deletion will proceed even if there
+ * are backup plans referencing the backupvault. The default is 'false'.
+ *
+ * Generated from protobuf field bool ignore_backup_plan_references = 7 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $ignore_backup_plan_references = false;
/**
* @param string $name Required. Name of the resource. Please see
@@ -114,6 +121,9 @@ public static function build(string $name): self
* @type bool $allow_missing
* Optional. If true and the BackupVault is not found, the request will
* succeed but no action will be taken.
+ * @type bool $ignore_backup_plan_references
+ * Optional. If set to true, backupvault deletion will proceed even if there
+ * are backup plans referencing the backupvault. The default is 'false'.
* }
*/
public function __construct($data = NULL) {
@@ -307,5 +317,33 @@ public function setAllowMissing($var)
return $this;
}
+ /**
+ * Optional. If set to true, backupvault deletion will proceed even if there
+ * are backup plans referencing the backupvault. The default is 'false'.
+ *
+ * Generated from protobuf field bool ignore_backup_plan_references = 7 [(.google.api.field_behavior) = OPTIONAL];
+ * @return bool
+ */
+ public function getIgnoreBackupPlanReferences()
+ {
+ return $this->ignore_backup_plan_references;
+ }
+
+ /**
+ * Optional. If set to true, backupvault deletion will proceed even if there
+ * are backup plans referencing the backupvault. The default is 'false'.
+ *
+ * Generated from protobuf field bool ignore_backup_plan_references = 7 [(.google.api.field_behavior) = OPTIONAL];
+ * @param bool $var
+ * @return $this
+ */
+ public function setIgnoreBackupPlanReferences($var)
+ {
+ GPBUtil::checkBool($var);
+ $this->ignore_backup_plan_references = $var;
+
+ return $this;
+ }
+
}
diff --git a/BackupDr/src/V1/InitializeServiceRequest.php b/BackupDr/src/V1/InitializeServiceRequest.php
new file mode 100644
index 000000000000..a128e2091ec7
--- /dev/null
+++ b/BackupDr/src/V1/InitializeServiceRequest.php
@@ -0,0 +1,191 @@
+google.cloud.backupdr.v1.InitializeServiceRequest
+ */
+class InitializeServiceRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The resource name of the serviceConfig used to initialize the
+ * service. Format:
+ * `projects/{project_id}/locations/{location}/serviceConfig`.
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $name = '';
+ /**
+ * Required. The resource type to which the default service config will be
+ * applied. Examples include, "compute.googleapis.com/Instance" and
+ * "storage.googleapis.com/Bucket".
+ *
+ * Generated from protobuf field string resource_type = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $resource_type = '';
+ /**
+ * Optional. An optional request ID to identify requests. Specify a unique
+ * request ID so that if you must retry your request, the server will know to
+ * ignore the request if it has already been completed. The server will
+ * guarantee that for at least 60 minutes since the first request.
+ * For example, consider a situation where you make an initial request and t
+ * he request times out. If you make the request again with the same request
+ * ID, the server can check if original operation with the same request ID
+ * was received, and if so, will ignore the second request. This prevents
+ * clients from accidentally creating duplicate commitments.
+ * The request ID must be a valid UUID with the exception that zero UUID is
+ * not supported (00000000-0000-0000-0000-000000000000).
+ *
+ * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = {
+ */
+ protected $request_id = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required. The resource name of the serviceConfig used to initialize the
+ * service. Format:
+ * `projects/{project_id}/locations/{location}/serviceConfig`.
+ * @type string $resource_type
+ * Required. The resource type to which the default service config will be
+ * applied. Examples include, "compute.googleapis.com/Instance" and
+ * "storage.googleapis.com/Bucket".
+ * @type string $request_id
+ * Optional. An optional request ID to identify requests. Specify a unique
+ * request ID so that if you must retry your request, the server will know to
+ * ignore the request if it has already been completed. The server will
+ * guarantee that for at least 60 minutes since the first request.
+ * For example, consider a situation where you make an initial request and t
+ * he request times out. If you make the request again with the same request
+ * ID, the server can check if original operation with the same request ID
+ * was received, and if so, will ignore the second request. This prevents
+ * clients from accidentally creating duplicate commitments.
+ * The request ID must be a valid UUID with the exception that zero UUID is
+ * not supported (00000000-0000-0000-0000-000000000000).
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The resource name of the serviceConfig used to initialize the
+ * service. Format:
+ * `projects/{project_id}/locations/{location}/serviceConfig`.
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Required. The resource name of the serviceConfig used to initialize the
+ * service. Format:
+ * `projects/{project_id}/locations/{location}/serviceConfig`.
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The resource type to which the default service config will be
+ * applied. Examples include, "compute.googleapis.com/Instance" and
+ * "storage.googleapis.com/Bucket".
+ *
+ * Generated from protobuf field string resource_type = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getResourceType()
+ {
+ return $this->resource_type;
+ }
+
+ /**
+ * Required. The resource type to which the default service config will be
+ * applied. Examples include, "compute.googleapis.com/Instance" and
+ * "storage.googleapis.com/Bucket".
+ *
+ * Generated from protobuf field string resource_type = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setResourceType($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->resource_type = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. An optional request ID to identify requests. Specify a unique
+ * request ID so that if you must retry your request, the server will know to
+ * ignore the request if it has already been completed. The server will
+ * guarantee that for at least 60 minutes since the first request.
+ * For example, consider a situation where you make an initial request and t
+ * he request times out. If you make the request again with the same request
+ * ID, the server can check if original operation with the same request ID
+ * was received, and if so, will ignore the second request. This prevents
+ * clients from accidentally creating duplicate commitments.
+ * The request ID must be a valid UUID with the exception that zero UUID is
+ * not supported (00000000-0000-0000-0000-000000000000).
+ *
+ * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = {
+ * @return string
+ */
+ public function getRequestId()
+ {
+ return $this->request_id;
+ }
+
+ /**
+ * Optional. An optional request ID to identify requests. Specify a unique
+ * request ID so that if you must retry your request, the server will know to
+ * ignore the request if it has already been completed. The server will
+ * guarantee that for at least 60 minutes since the first request.
+ * For example, consider a situation where you make an initial request and t
+ * he request times out. If you make the request again with the same request
+ * ID, the server can check if original operation with the same request ID
+ * was received, and if so, will ignore the second request. This prevents
+ * clients from accidentally creating duplicate commitments.
+ * The request ID must be a valid UUID with the exception that zero UUID is
+ * not supported (00000000-0000-0000-0000-000000000000).
+ *
+ * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setRequestId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->request_id = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/BackupDr/src/V1/InitializeServiceResponse.php b/BackupDr/src/V1/InitializeServiceResponse.php
new file mode 100644
index 000000000000..44270b40a22d
--- /dev/null
+++ b/BackupDr/src/V1/InitializeServiceResponse.php
@@ -0,0 +1,117 @@
+google.cloud.backupdr.v1.InitializeServiceResponse
+ */
+class InitializeServiceResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The resource name of the default `BackupVault` created.
+ * Format:
+ * `projects/{project_id}/locations/{location}/backupVaults/{backup_vault_id}`.
+ *
+ * Generated from protobuf field string backup_vault_name = 1;
+ */
+ protected $backup_vault_name = '';
+ /**
+ * The resource name of the default `BackupPlan` created.
+ * Format:
+ * `projects/{project_id}/locations/{location}/backupPlans/{backup_plan_id}`.
+ *
+ * Generated from protobuf field string backup_plan_name = 2;
+ */
+ protected $backup_plan_name = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $backup_vault_name
+ * The resource name of the default `BackupVault` created.
+ * Format:
+ * `projects/{project_id}/locations/{location}/backupVaults/{backup_vault_id}`.
+ * @type string $backup_plan_name
+ * The resource name of the default `BackupPlan` created.
+ * Format:
+ * `projects/{project_id}/locations/{location}/backupPlans/{backup_plan_id}`.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Backupdr\V1\Backupdr::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The resource name of the default `BackupVault` created.
+ * Format:
+ * `projects/{project_id}/locations/{location}/backupVaults/{backup_vault_id}`.
+ *
+ * Generated from protobuf field string backup_vault_name = 1;
+ * @return string
+ */
+ public function getBackupVaultName()
+ {
+ return $this->backup_vault_name;
+ }
+
+ /**
+ * The resource name of the default `BackupVault` created.
+ * Format:
+ * `projects/{project_id}/locations/{location}/backupVaults/{backup_vault_id}`.
+ *
+ * Generated from protobuf field string backup_vault_name = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setBackupVaultName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->backup_vault_name = $var;
+
+ return $this;
+ }
+
+ /**
+ * The resource name of the default `BackupPlan` created.
+ * Format:
+ * `projects/{project_id}/locations/{location}/backupPlans/{backup_plan_id}`.
+ *
+ * Generated from protobuf field string backup_plan_name = 2;
+ * @return string
+ */
+ public function getBackupPlanName()
+ {
+ return $this->backup_plan_name;
+ }
+
+ /**
+ * The resource name of the default `BackupPlan` created.
+ * Format:
+ * `projects/{project_id}/locations/{location}/backupPlans/{backup_plan_id}`.
+ *
+ * Generated from protobuf field string backup_plan_name = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setBackupPlanName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->backup_plan_name = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/BackupDr/src/V1/ManagementServer.php b/BackupDr/src/V1/ManagementServer.php
index 70295addc1c0..71f9c51abf9d 100644
--- a/BackupDr/src/V1/ManagementServer.php
+++ b/BackupDr/src/V1/ManagementServer.php
@@ -76,10 +76,11 @@ class ManagementServer extends \Google\Protobuf\Internal\Message
*/
protected $state = 0;
/**
- * Required. VPC networks to which the ManagementServer instance is connected.
- * For this version, only a single network is supported.
+ * Optional. VPC networks to which the ManagementServer instance is connected.
+ * For this version, only a single network is supported. This field is
+ * optional if MS is created without PSA
*
- * Generated from protobuf field repeated .google.cloud.backupdr.v1.NetworkConfig networks = 8 [(.google.api.field_behavior) = REQUIRED];
+ * Generated from protobuf field repeated .google.cloud.backupdr.v1.NetworkConfig networks = 8 [(.google.api.field_behavior) = OPTIONAL];
*/
private $networks;
/**
@@ -156,8 +157,9 @@ class ManagementServer extends \Google\Protobuf\Internal\Message
* @type int $state
* Output only. The ManagementServer state.
* @type array<\Google\Cloud\BackupDR\V1\NetworkConfig>|\Google\Protobuf\Internal\RepeatedField $networks
- * Required. VPC networks to which the ManagementServer instance is connected.
- * For this version, only a single network is supported.
+ * Optional. VPC networks to which the ManagementServer instance is connected.
+ * For this version, only a single network is supported. This field is
+ * optional if MS is created without PSA
* @type string $etag
* Optional. Server specified ETag for the ManagementServer resource to
* prevent simultaneous updates from overwiting each other.
@@ -470,10 +472,11 @@ public function setState($var)
}
/**
- * Required. VPC networks to which the ManagementServer instance is connected.
- * For this version, only a single network is supported.
+ * Optional. VPC networks to which the ManagementServer instance is connected.
+ * For this version, only a single network is supported. This field is
+ * optional if MS is created without PSA
*
- * Generated from protobuf field repeated .google.cloud.backupdr.v1.NetworkConfig networks = 8 [(.google.api.field_behavior) = REQUIRED];
+ * Generated from protobuf field repeated .google.cloud.backupdr.v1.NetworkConfig networks = 8 [(.google.api.field_behavior) = OPTIONAL];
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getNetworks()
@@ -482,10 +485,11 @@ public function getNetworks()
}
/**
- * Required. VPC networks to which the ManagementServer instance is connected.
- * For this version, only a single network is supported.
+ * Optional. VPC networks to which the ManagementServer instance is connected.
+ * For this version, only a single network is supported. This field is
+ * optional if MS is created without PSA
*
- * Generated from protobuf field repeated .google.cloud.backupdr.v1.NetworkConfig networks = 8 [(.google.api.field_behavior) = REQUIRED];
+ * Generated from protobuf field repeated .google.cloud.backupdr.v1.NetworkConfig networks = 8 [(.google.api.field_behavior) = OPTIONAL];
* @param array<\Google\Cloud\BackupDR\V1\NetworkConfig>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
diff --git a/BackupDr/src/V1/OperationMetadata.php b/BackupDr/src/V1/OperationMetadata.php
index e880bbc7986d..3490b31f2b87 100644
--- a/BackupDr/src/V1/OperationMetadata.php
+++ b/BackupDr/src/V1/OperationMetadata.php
@@ -48,9 +48,10 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message
/**
* Output only. Identifies whether the user has requested cancellation
* of the operation. Operations that have successfully been cancelled
- * have [Operation.error][] value with a
- * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
- * 'Code.CANCELLED'.
+ * have
+ * [google.longrunning.Operation.error][google.longrunning.Operation.error]
+ * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
+ * corresponding to 'Code.CANCELLED'.
*
* Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
@@ -88,9 +89,10 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message
* @type bool $requested_cancellation
* Output only. Identifies whether the user has requested cancellation
* of the operation. Operations that have successfully been cancelled
- * have [Operation.error][] value with a
- * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
- * 'Code.CANCELLED'.
+ * have
+ * [google.longrunning.Operation.error][google.longrunning.Operation.error]
+ * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
+ * corresponding to 'Code.CANCELLED'.
* @type string $api_version
* Output only. API version used to start the operation.
* @type array|\Google\Protobuf\Internal\MapField $additional_info
@@ -256,9 +258,10 @@ public function setStatusMessage($var)
/**
* Output only. Identifies whether the user has requested cancellation
* of the operation. Operations that have successfully been cancelled
- * have [Operation.error][] value with a
- * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
- * 'Code.CANCELLED'.
+ * have
+ * [google.longrunning.Operation.error][google.longrunning.Operation.error]
+ * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
+ * corresponding to 'Code.CANCELLED'.
*
* Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
* @return bool
@@ -271,9 +274,10 @@ public function getRequestedCancellation()
/**
* Output only. Identifies whether the user has requested cancellation
* of the operation. Operations that have successfully been cancelled
- * have [Operation.error][] value with a
- * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
- * 'Code.CANCELLED'.
+ * have
+ * [google.longrunning.Operation.error][google.longrunning.Operation.error]
+ * value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
+ * corresponding to 'Code.CANCELLED'.
*
* Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
* @param bool $var
diff --git a/BackupDr/src/V1/RuleConfigInfo.php b/BackupDr/src/V1/RuleConfigInfo.php
index 710f042a26d9..36920c8f904b 100644
--- a/BackupDr/src/V1/RuleConfigInfo.php
+++ b/BackupDr/src/V1/RuleConfigInfo.php
@@ -16,8 +16,7 @@
class RuleConfigInfo extends \Google\Protobuf\Internal\Message
{
/**
- * Output only. Output Only.
- * Backup Rule id fetched from backup plan.
+ * Output only. Backup Rule id fetched from backup plan.
*
* Generated from protobuf field string rule_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
@@ -29,8 +28,7 @@ class RuleConfigInfo extends \Google\Protobuf\Internal\Message
*/
protected $last_backup_state = 0;
/**
- * Output only. Output Only.
- * google.rpc.Status object to store the last backup error.
+ * Output only. google.rpc.Status object to store the last backup error.
*
* Generated from protobuf field .google.rpc.Status last_backup_error = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
@@ -50,13 +48,11 @@ class RuleConfigInfo extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type string $rule_id
- * Output only. Output Only.
- * Backup Rule id fetched from backup plan.
+ * Output only. Backup Rule id fetched from backup plan.
* @type int $last_backup_state
* Output only. The last backup state for rule.
* @type \Google\Rpc\Status $last_backup_error
- * Output only. Output Only.
- * google.rpc.Status object to store the last backup error.
+ * Output only. google.rpc.Status object to store the last backup error.
* @type \Google\Protobuf\Timestamp $last_successful_backup_consistency_time
* Output only. The point in time when the last successful backup was captured
* from the source.
@@ -68,8 +64,7 @@ public function __construct($data = NULL) {
}
/**
- * Output only. Output Only.
- * Backup Rule id fetched from backup plan.
+ * Output only. Backup Rule id fetched from backup plan.
*
* Generated from protobuf field string rule_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
* @return string
@@ -80,8 +75,7 @@ public function getRuleId()
}
/**
- * Output only. Output Only.
- * Backup Rule id fetched from backup plan.
+ * Output only. Backup Rule id fetched from backup plan.
*
* Generated from protobuf field string rule_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
* @param string $var
@@ -122,8 +116,7 @@ public function setLastBackupState($var)
}
/**
- * Output only. Output Only.
- * google.rpc.Status object to store the last backup error.
+ * Output only. google.rpc.Status object to store the last backup error.
*
* Generated from protobuf field .google.rpc.Status last_backup_error = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
* @return \Google\Rpc\Status|null
@@ -144,8 +137,7 @@ public function clearLastBackupError()
}
/**
- * Output only. Output Only.
- * google.rpc.Status object to store the last backup error.
+ * Output only. google.rpc.Status object to store the last backup error.
*
* Generated from protobuf field .google.rpc.Status last_backup_error = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
* @param \Google\Rpc\Status $var
diff --git a/BackupDr/src/V1/gapic_metadata.json b/BackupDr/src/V1/gapic_metadata.json
index 130c7f38a667..72fd7c050fb1 100644
--- a/BackupDr/src/V1/gapic_metadata.json
+++ b/BackupDr/src/V1/gapic_metadata.json
@@ -90,6 +90,11 @@
"getManagementServer"
]
},
+ "InitializeService": {
+ "methods": [
+ "initializeService"
+ ]
+ },
"ListBackupPlanAssociations": {
"methods": [
"listBackupPlanAssociations"
diff --git a/BackupDr/src/V1/resources/backup_dr_client_config.json b/BackupDr/src/V1/resources/backup_dr_client_config.json
index c505f44b1add..82a248625ba4 100644
--- a/BackupDr/src/V1/resources/backup_dr_client_config.json
+++ b/BackupDr/src/V1/resources/backup_dr_client_config.json
@@ -118,6 +118,11 @@
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params"
},
+ "InitializeService": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "retry_policy_1_codes",
+ "retry_params_name": "retry_policy_1_params"
+ },
"ListBackupPlanAssociations": {
"timeout_millis": 60000,
"retry_codes_name": "no_retry_codes",
diff --git a/BackupDr/src/V1/resources/backup_dr_descriptor_config.php b/BackupDr/src/V1/resources/backup_dr_descriptor_config.php
index 669fa4bd998c..3e4de59d796e 100644
--- a/BackupDr/src/V1/resources/backup_dr_descriptor_config.php
+++ b/BackupDr/src/V1/resources/backup_dr_descriptor_config.php
@@ -194,6 +194,25 @@
],
],
],
+ 'InitializeService' => [
+ 'longRunning' => [
+ 'operationReturnType' => '\Google\Cloud\BackupDR\V1\InitializeServiceResponse',
+ 'metadataReturnType' => '\Google\Cloud\BackupDR\V1\OperationMetadata',
+ 'initialPollDelayMillis' => '500',
+ 'pollDelayMultiplier' => '1.5',
+ 'maxPollDelayMillis' => '5000',
+ 'totalPollTimeoutMillis' => '300000',
+ ],
+ 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL,
+ 'headerParams' => [
+ [
+ 'keyName' => 'name',
+ 'fieldAccessors' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'RestoreBackup' => [
'longRunning' => [
'operationReturnType' => '\Google\Cloud\BackupDR\V1\RestoreBackupResponse',
diff --git a/BackupDr/src/V1/resources/backup_dr_rest_client_config.php b/BackupDr/src/V1/resources/backup_dr_rest_client_config.php
index 072b35af529f..01f1f4e50d08 100644
--- a/BackupDr/src/V1/resources/backup_dr_rest_client_config.php
+++ b/BackupDr/src/V1/resources/backup_dr_rest_client_config.php
@@ -215,6 +215,18 @@
],
],
],
+ 'InitializeService' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{name=projects/*/locations/*/serviceConfig}:initialize',
+ 'body' => '*',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'ListBackupPlanAssociations' => [
'method' => 'get',
'uriTemplate' => '/v1/{parent=projects/*/locations/*}/backupPlanAssociations',
diff --git a/BackupDr/tests/Unit/V1/Client/BackupDRClientTest.php b/BackupDr/tests/Unit/V1/Client/BackupDRClientTest.php
index f836c6098019..766ca2f37a5b 100644
--- a/BackupDr/tests/Unit/V1/Client/BackupDRClientTest.php
+++ b/BackupDr/tests/Unit/V1/Client/BackupDRClientTest.php
@@ -49,6 +49,8 @@
use Google\Cloud\BackupDR\V1\GetBackupVaultRequest;
use Google\Cloud\BackupDR\V1\GetDataSourceRequest;
use Google\Cloud\BackupDR\V1\GetManagementServerRequest;
+use Google\Cloud\BackupDR\V1\InitializeServiceRequest;
+use Google\Cloud\BackupDR\V1\InitializeServiceResponse;
use Google\Cloud\BackupDR\V1\ListBackupPlanAssociationsRequest;
use Google\Cloud\BackupDR\V1\ListBackupPlanAssociationsResponse;
use Google\Cloud\BackupDR\V1\ListBackupPlansRequest;
@@ -320,6 +322,8 @@ public function createBackupPlanAssociationTest()
$formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
$backupPlanAssociationId = 'backupPlanAssociationId133124978';
$backupPlanAssociation = new BackupPlanAssociation();
+ $backupPlanAssociationResourceType = 'backupPlanAssociationResourceType-149471490';
+ $backupPlanAssociation->setResourceType($backupPlanAssociationResourceType);
$backupPlanAssociationResource = 'backupPlanAssociationResource1527164324';
$backupPlanAssociation->setResource($backupPlanAssociationResource);
$backupPlanAssociationBackupPlan = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]');
@@ -401,6 +405,8 @@ public function createBackupPlanAssociationExceptionTest()
$formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
$backupPlanAssociationId = 'backupPlanAssociationId133124978';
$backupPlanAssociation = new BackupPlanAssociation();
+ $backupPlanAssociationResourceType = 'backupPlanAssociationResourceType-149471490';
+ $backupPlanAssociation->setResourceType($backupPlanAssociationResourceType);
$backupPlanAssociationResource = 'backupPlanAssociationResource1527164324';
$backupPlanAssociation->setResource($backupPlanAssociationResource);
$backupPlanAssociationBackupPlan = $gapicClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]');
@@ -630,8 +636,6 @@ public function createManagementServerTest()
$formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
$managementServerId = 'managementServerId1884787355';
$managementServer = new ManagementServer();
- $managementServerNetworks = [];
- $managementServer->setNetworks($managementServerNetworks);
$request = (new CreateManagementServerRequest())
->setParent($formattedParent)
->setManagementServerId($managementServerId)
@@ -709,8 +713,6 @@ public function createManagementServerExceptionTest()
$formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
$managementServerId = 'managementServerId1884787355';
$managementServer = new ManagementServer();
- $managementServerNetworks = [];
- $managementServer->setNetworks($managementServerNetworks);
$request = (new CreateManagementServerRequest())
->setParent($formattedParent)
->setManagementServerId($managementServerId)
@@ -1908,6 +1910,136 @@ public function getManagementServerExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function initializeServiceTest()
+ {
+ $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/initializeServiceTest');
+ $incompleteOperation->setDone(false);
+ $transport->addResponse($incompleteOperation);
+ $backupVaultName = 'backupVaultName2139431701';
+ $backupPlanName = 'backupPlanName1011998628';
+ $expectedResponse = new InitializeServiceResponse();
+ $expectedResponse->setBackupVaultName($backupVaultName);
+ $expectedResponse->setBackupPlanName($backupPlanName);
+ $anyResponse = new Any();
+ $anyResponse->setValue($expectedResponse->serializeToString());
+ $completeOperation = new Operation();
+ $completeOperation->setName('operations/initializeServiceTest');
+ $completeOperation->setDone(true);
+ $completeOperation->setResponse($anyResponse);
+ $operationsTransport->addResponse($completeOperation);
+ // Mock request
+ $name = 'name3373707';
+ $resourceType = 'resourceType979623115';
+ $request = (new InitializeServiceRequest())->setName($name)->setResourceType($resourceType);
+ $response = $gapicClient->initializeService($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.backupdr.v1.BackupDR/InitializeService', $actualApiFuncCall);
+ $actualValue = $actualApiRequestObject->getName();
+ $this->assertProtobufEquals($name, $actualValue);
+ $actualValue = $actualApiRequestObject->getResourceType();
+ $this->assertProtobufEquals($resourceType, $actualValue);
+ $expectedOperationsRequestObject = new GetOperationRequest();
+ $expectedOperationsRequestObject->setName('operations/initializeServiceTest');
+ $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 initializeServiceExceptionTest()
+ {
+ $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/initializeServiceTest');
+ $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
+ $name = 'name3373707';
+ $resourceType = 'resourceType979623115';
+ $request = (new InitializeServiceRequest())->setName($name)->setResourceType($resourceType);
+ $response = $gapicClient->initializeService($request);
+ $this->assertFalse($response->isDone());
+ $this->assertNull($response->getResult());
+ $expectedOperationsRequestObject = new GetOperationRequest();
+ $expectedOperationsRequestObject->setName('operations/initializeServiceTest');
+ 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 listBackupPlanAssociationsTest()
{