diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index ca1ae44a1ff9..a3d2e7c5c5d5 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -1505,7 +1505,7 @@ "VmMigration": { "language": "php", "distribution_name": "google/cloud-vm-migration", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-vm-migration/latest", "library_type": "GAPIC_AUTO", "api_shortname": "vmmigration" diff --git a/VmMigration/README.md b/VmMigration/README.md index 556e300c6431..076f68711644 100644 --- a/VmMigration/README.md +++ b/VmMigration/README.md @@ -30,9 +30,8 @@ on authenticating your client. Once authenticated, you'll be ready to start maki ### Version -This component is considered beta. As such, it should be expected to be mostly -stable and we're working towards a release candidate. We will address issues -and requests with a higher priority. +This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in +any minor or patch releases. We will address issues and requests with the highest priority. ### Next Steps diff --git a/VmMigration/owlbot.py b/VmMigration/owlbot.py index 6e2638682f4a..facb777b5da6 100644 --- a/VmMigration/owlbot.py +++ b/VmMigration/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,13 +30,7 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "**/[A-Z]*_*.php" - ] -) +php.owlbot_main(src=src, dest=dest) # remove class_alias code s.replace( @@ -47,32 +41,6 @@ + "\n", '') -### [START] protoc backwards compatibility fixes - -# roll back to private properties. -s.replace( - "src/**/V*/**/*.php", - r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$", - r"""Generated from protobuf field \1 - */ - private $""") - -# Replace "Unwrapped" with "Value" for method names. -s.replace( - "src/**/V*/**/*.php", - r"public function ([s|g]\w{3,})Unwrapped", - r"public function \1Value" -) - -### [END] protoc backwards compatibility fixes - -# fix relative cloud.google.com links -s.replace( - "src/**/V*/**/*.php", - r"(.{0,})\]\((/.{0,})\)", - r"\1](https://cloud.google.com\2)" -) - # format generated clients subprocess.run([ 'npm', @@ -81,8 +49,8 @@ '--package=@prettier/plugin-php@^0.16', '--', 'prettier', - '**/Gapic/*', + '**/Client/*', '--write', '--parser=php', '--single-quote', - '--print-width=80']) + '--print-width=120']) diff --git a/VmMigration/src/V1/AddGroupMigrationRequest.php b/VmMigration/src/V1/AddGroupMigrationRequest.php index 5d5a21fd908e..d4a9f9a19d65 100644 --- a/VmMigration/src/V1/AddGroupMigrationRequest.php +++ b/VmMigration/src/V1/AddGroupMigrationRequest.php @@ -20,13 +20,13 @@ class AddGroupMigrationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string group = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $group = ''; + protected $group = ''; /** * The full path name of the MigratingVm to add. * * Generated from protobuf field string migrating_vm = 2 [(.google.api.resource_reference) = { */ - private $migrating_vm = ''; + protected $migrating_vm = ''; /** * @param string $group Required. The full path name of the Group to add to. Please see diff --git a/VmMigration/src/V1/ApplianceVersion.php b/VmMigration/src/V1/ApplianceVersion.php index f022a0119498..da08b27da901 100644 --- a/VmMigration/src/V1/ApplianceVersion.php +++ b/VmMigration/src/V1/ApplianceVersion.php @@ -20,25 +20,25 @@ class ApplianceVersion extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version = 1; */ - private $version = ''; + protected $version = ''; /** * A link for downloading the version. * * Generated from protobuf field string uri = 2; */ - private $uri = ''; + protected $uri = ''; /** * Determine whether it's critical to upgrade the appliance to this version. * * Generated from protobuf field bool critical = 3; */ - private $critical = false; + protected $critical = false; /** * Link to a page that contains the version release notes. * * Generated from protobuf field string release_notes_uri = 4; */ - private $release_notes_uri = ''; + protected $release_notes_uri = ''; /** * Constructor. diff --git a/VmMigration/src/V1/AppliedLicense.php b/VmMigration/src/V1/AppliedLicense.php index c5a113d19b93..c015b9cf1649 100644 --- a/VmMigration/src/V1/AppliedLicense.php +++ b/VmMigration/src/V1/AppliedLicense.php @@ -20,13 +20,13 @@ class AppliedLicense extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense.Type type = 1; */ - private $type = 0; + protected $type = 0; /** * The OS license returned from the adaptation module's report. * * Generated from protobuf field string os_license = 2; */ - private $os_license = ''; + protected $os_license = ''; /** * Constructor. diff --git a/VmMigration/src/V1/AvailableUpdates.php b/VmMigration/src/V1/AvailableUpdates.php index a69c68d42630..a32202170f8c 100644 --- a/VmMigration/src/V1/AvailableUpdates.php +++ b/VmMigration/src/V1/AvailableUpdates.php @@ -22,7 +22,7 @@ class AvailableUpdates extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmmigration.v1.ApplianceVersion new_deployable_appliance = 1; */ - private $new_deployable_appliance = null; + protected $new_deployable_appliance = null; /** * The latest version for in place update. * The current appliance can be updated to this version using the API or m4c @@ -30,7 +30,7 @@ class AvailableUpdates extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmmigration.v1.ApplianceVersion in_place_update = 2; */ - private $in_place_update = null; + protected $in_place_update = null; /** * Constructor. diff --git a/VmMigration/src/V1/AwsSecurityGroup.php b/VmMigration/src/V1/AwsSecurityGroup.php index 480c39f44ea6..ee8d6768c507 100644 --- a/VmMigration/src/V1/AwsSecurityGroup.php +++ b/VmMigration/src/V1/AwsSecurityGroup.php @@ -20,13 +20,13 @@ class AwsSecurityGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string id = 1; */ - private $id = ''; + protected $id = ''; /** * The AWS security group name. * * Generated from protobuf field string name = 2; */ - private $name = ''; + protected $name = ''; /** * Constructor. diff --git a/VmMigration/src/V1/AwsSourceDetails.php b/VmMigration/src/V1/AwsSourceDetails.php index d113bc6d584d..31c465db770b 100644 --- a/VmMigration/src/V1/AwsSourceDetails.php +++ b/VmMigration/src/V1/AwsSourceDetails.php @@ -21,20 +21,20 @@ class AwsSourceDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string aws_region = 3 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $aws_region = ''; + protected $aws_region = ''; /** * Output only. State of the source as determined by the health check. * * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceDetails.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. Provides details on the state of the Source in case of an * error. * * Generated from protobuf field .google.rpc.Status error = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * AWS resource tags to limit the scope of the source inventory. * @@ -63,7 +63,7 @@ class AwsSourceDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string public_ip = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $public_ip = ''; + protected $public_ip = ''; protected $credentials_type; /** diff --git a/VmMigration/src/V1/AwsSourceDetails/AccessKeyCredentials.php b/VmMigration/src/V1/AwsSourceDetails/AccessKeyCredentials.php index 6727ba28ccc5..6833136f1cfb 100644 --- a/VmMigration/src/V1/AwsSourceDetails/AccessKeyCredentials.php +++ b/VmMigration/src/V1/AwsSourceDetails/AccessKeyCredentials.php @@ -20,13 +20,13 @@ class AccessKeyCredentials extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string access_key_id = 1; */ - private $access_key_id = ''; + protected $access_key_id = ''; /** * Input only. AWS secret access key. * * Generated from protobuf field string secret_access_key = 2 [(.google.api.field_behavior) = INPUT_ONLY]; */ - private $secret_access_key = ''; + protected $secret_access_key = ''; /** * Constructor. diff --git a/VmMigration/src/V1/AwsSourceDetails/Tag.php b/VmMigration/src/V1/AwsSourceDetails/Tag.php index 4ea016f3d4e9..2c366e5c7613 100644 --- a/VmMigration/src/V1/AwsSourceDetails/Tag.php +++ b/VmMigration/src/V1/AwsSourceDetails/Tag.php @@ -20,13 +20,13 @@ class Tag extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string key = 1; */ - private $key = ''; + protected $key = ''; /** * Value of tag. * * Generated from protobuf field string value = 2; */ - private $value = ''; + protected $value = ''; /** * Constructor. diff --git a/VmMigration/src/V1/AwsSourceVmDetails.php b/VmMigration/src/V1/AwsSourceVmDetails.php index 8627654a2899..b8365eebfd4d 100644 --- a/VmMigration/src/V1/AwsSourceVmDetails.php +++ b/VmMigration/src/V1/AwsSourceVmDetails.php @@ -20,13 +20,13 @@ class AwsSourceVmDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceVmDetails.Firmware firmware = 1; */ - private $firmware = 0; + protected $firmware = 0; /** * The total size of the disks being migrated in bytes. * * Generated from protobuf field int64 committed_storage_bytes = 2; */ - private $committed_storage_bytes = 0; + protected $committed_storage_bytes = 0; /** * Constructor. diff --git a/VmMigration/src/V1/AwsVmDetails.php b/VmMigration/src/V1/AwsVmDetails.php index 4c0f04606e01..7535504cdd78 100644 --- a/VmMigration/src/V1/AwsVmDetails.php +++ b/VmMigration/src/V1/AwsVmDetails.php @@ -20,79 +20,79 @@ class AwsVmDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vm_id = 1; */ - private $vm_id = ''; + protected $vm_id = ''; /** * The display name of the VM. Note that this value is not necessarily unique. * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * The id of the AWS's source this VM is connected to. * * Generated from protobuf field string source_id = 3; */ - private $source_id = ''; + protected $source_id = ''; /** * The descriptive name of the AWS's source this VM is connected to. * * Generated from protobuf field string source_description = 4; */ - private $source_description = ''; + protected $source_description = ''; /** * Output only. The power state of the VM at the moment list was taken. * * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.PowerState power_state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $power_state = 0; + protected $power_state = 0; /** * The number of cpus the VM has. * * Generated from protobuf field int32 cpu_count = 6; */ - private $cpu_count = 0; + protected $cpu_count = 0; /** * The memory size of the VM in MB. * * Generated from protobuf field int32 memory_mb = 7; */ - private $memory_mb = 0; + protected $memory_mb = 0; /** * The number of disks the VM has. * * Generated from protobuf field int32 disk_count = 8; */ - private $disk_count = 0; + protected $disk_count = 0; /** * The total size of the storage allocated to the VM in MB. * * Generated from protobuf field int64 committed_storage_mb = 9; */ - private $committed_storage_mb = 0; + protected $committed_storage_mb = 0; /** * The VM's OS. * * Generated from protobuf field string os_description = 10; */ - private $os_description = ''; + protected $os_description = ''; /** * The VM Boot Option. * * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.BootOption boot_option = 11; */ - private $boot_option = 0; + protected $boot_option = 0; /** * The instance type of the VM. * * Generated from protobuf field string instance_type = 12; */ - private $instance_type = ''; + protected $instance_type = ''; /** * The VPC ID the VM belongs to. * * Generated from protobuf field string vpc_id = 13; */ - private $vpc_id = ''; + protected $vpc_id = ''; /** * The security groups the VM belongs to. * @@ -110,19 +110,19 @@ class AwsVmDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string zone = 16; */ - private $zone = ''; + protected $zone = ''; /** * The virtualization type. * * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.VmVirtualizationType virtualization_type = 17; */ - private $virtualization_type = 0; + protected $virtualization_type = 0; /** * The CPU architecture. * * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.VmArchitecture architecture = 18; */ - private $architecture = 0; + protected $architecture = 0; /** * Constructor. diff --git a/VmMigration/src/V1/CancelCloneJobRequest.php b/VmMigration/src/V1/CancelCloneJobRequest.php index cde00ce199f4..77cdadd56226 100644 --- a/VmMigration/src/V1/CancelCloneJobRequest.php +++ b/VmMigration/src/V1/CancelCloneJobRequest.php @@ -20,7 +20,7 @@ class CancelCloneJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The clone job id diff --git a/VmMigration/src/V1/CancelCutoverJobRequest.php b/VmMigration/src/V1/CancelCutoverJobRequest.php index cd03359e11cf..71738014938e 100644 --- a/VmMigration/src/V1/CancelCutoverJobRequest.php +++ b/VmMigration/src/V1/CancelCutoverJobRequest.php @@ -20,7 +20,7 @@ class CancelCutoverJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The cutover job id diff --git a/VmMigration/src/V1/Client/VmMigrationClient.php b/VmMigration/src/V1/Client/VmMigrationClient.php index db4f4dbe446d..6770977e510e 100644 --- a/VmMigration/src/V1/Client/VmMigrationClient.php +++ b/VmMigration/src/V1/Client/VmMigrationClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a clone_job * resource. @@ -248,8 +267,13 @@ public function resumeOperation($operationName, $methodName = null) * * @return string The formatted clone_job resource. */ - public static function cloneJobName(string $project, string $location, string $source, string $migratingVm, string $cloneJob): string - { + public static function cloneJobName( + string $project, + string $location, + string $source, + string $migratingVm, + string $cloneJob + ): string { return self::getPathTemplate('cloneJob')->render([ 'project' => $project, 'location' => $location, @@ -271,8 +295,13 @@ public static function cloneJobName(string $project, string $location, string $s * * @return string The formatted cutover_job resource. */ - public static function cutoverJobName(string $project, string $location, string $source, string $migratingVm, string $cutoverJob): string - { + public static function cutoverJobName( + string $project, + string $location, + string $source, + string $migratingVm, + string $cutoverJob + ): string { return self::getPathTemplate('cutoverJob')->render([ 'project' => $project, 'location' => $location, @@ -293,8 +322,12 @@ public static function cutoverJobName(string $project, string $location, string * * @return string The formatted datacenter_connector resource. */ - public static function datacenterConnectorName(string $project, string $location, string $source, string $datacenterConnector): string - { + public static function datacenterConnectorName( + string $project, + string $location, + string $source, + string $datacenterConnector + ): string { return self::getPathTemplate('datacenterConnector')->render([ 'project' => $project, 'location' => $location, @@ -350,8 +383,12 @@ public static function locationName(string $project, string $location): string * * @return string The formatted migrating_vm resource. */ - public static function migratingVmName(string $project, string $location, string $source, string $migratingVm): string - { + public static function migratingVmName( + string $project, + string $location, + string $source, + string $migratingVm + ): string { return self::getPathTemplate('migratingVm')->render([ 'project' => $project, 'location' => $location, @@ -372,8 +409,13 @@ public static function migratingVmName(string $project, string $location, string * * @return string The formatted replication_cycle resource. */ - public static function replicationCycleName(string $project, string $location, string $source, string $migratingVm, string $replicationCycle): string - { + public static function replicationCycleName( + string $project, + string $location, + string $source, + string $migratingVm, + string $replicationCycle + ): string { return self::getPathTemplate('replicationCycle')->render([ 'project' => $project, 'location' => $location, @@ -432,8 +474,12 @@ public static function targetProjectName(string $project, string $location, stri * * @return string The formatted utilization_report resource. */ - public static function utilizationReportName(string $project, string $location, string $source, string $utilizationReport): string - { + public static function utilizationReportName( + string $project, + string $location, + string $source, + string $utilizationReport + ): string { return self::getPathTemplate('utilizationReport')->render([ 'project' => $project, 'location' => $location, @@ -701,8 +747,10 @@ public function createCutoverJob(CreateCutoverJobRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function createDatacenterConnector(CreateDatacenterConnectorRequest $request, array $callOptions = []): OperationResponse - { + public function createDatacenterConnector( + CreateDatacenterConnectorRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateDatacenterConnector', $request, $callOptions)->wait(); } @@ -834,8 +882,10 @@ public function createTargetProject(CreateTargetProjectRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function createUtilizationReport(CreateUtilizationReportRequest $request, array $callOptions = []): OperationResponse - { + public function createUtilizationReport( + CreateUtilizationReportRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateUtilizationReport', $request, $callOptions)->wait(); } @@ -861,8 +911,10 @@ public function createUtilizationReport(CreateUtilizationReportRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function deleteDatacenterConnector(DeleteDatacenterConnectorRequest $request, array $callOptions = []): OperationResponse - { + public function deleteDatacenterConnector( + DeleteDatacenterConnectorRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteDatacenterConnector', $request, $callOptions)->wait(); } @@ -994,8 +1046,10 @@ public function deleteTargetProject(DeleteTargetProjectRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function deleteUtilizationReport(DeleteUtilizationReportRequest $request, array $callOptions = []): OperationResponse - { + public function deleteUtilizationReport( + DeleteUtilizationReportRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteUtilizationReport', $request, $callOptions)->wait(); } @@ -1129,8 +1183,10 @@ public function getCutoverJob(GetCutoverJobRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function getDatacenterConnector(GetDatacenterConnectorRequest $request, array $callOptions = []): DatacenterConnector - { + public function getDatacenterConnector( + GetDatacenterConnectorRequest $request, + array $callOptions = [] + ): DatacenterConnector { return $this->startApiCall('GetDatacenterConnector', $request, $callOptions)->wait(); } @@ -1288,8 +1344,10 @@ public function getTargetProject(GetTargetProjectRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function getUtilizationReport(GetUtilizationReportRequest $request, array $callOptions = []): UtilizationReport - { + public function getUtilizationReport( + GetUtilizationReportRequest $request, + array $callOptions = [] + ): UtilizationReport { return $this->startApiCall('GetUtilizationReport', $request, $callOptions)->wait(); } @@ -1366,8 +1424,10 @@ public function listCutoverJobs(ListCutoverJobsRequest $request, array $callOpti * * @throws ApiException Thrown if the API call fails. */ - public function listDatacenterConnectors(ListDatacenterConnectorsRequest $request, array $callOptions = []): PagedListResponse - { + public function listDatacenterConnectors( + ListDatacenterConnectorsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListDatacenterConnectors', $request, $callOptions); } @@ -1444,8 +1504,10 @@ public function listMigratingVms(ListMigratingVmsRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function listReplicationCycles(ListReplicationCyclesRequest $request, array $callOptions = []): PagedListResponse - { + public function listReplicationCycles( + ListReplicationCyclesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListReplicationCycles', $request, $callOptions); } @@ -1525,8 +1587,10 @@ public function listTargetProjects(ListTargetProjectsRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function listUtilizationReports(ListUtilizationReportsRequest $request, array $callOptions = []): PagedListResponse - { + public function listUtilizationReports( + ListUtilizationReportsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListUtilizationReports', $request, $callOptions); } @@ -1579,8 +1643,10 @@ public function pauseMigration(PauseMigrationRequest $request, array $callOption * * @throws ApiException Thrown if the API call fails. */ - public function removeGroupMigration(RemoveGroupMigrationRequest $request, array $callOptions = []): OperationResponse - { + public function removeGroupMigration( + RemoveGroupMigrationRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveGroupMigration', $request, $callOptions)->wait(); } diff --git a/VmMigration/src/V1/CloneJob.php b/VmMigration/src/V1/CloneJob.php index b0b8eb0c2f87..dd34db7de2c9 100644 --- a/VmMigration/src/V1/CloneJob.php +++ b/VmMigration/src/V1/CloneJob.php @@ -30,38 +30,38 @@ class CloneJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The time the clone job was ended. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. The name of the clone. * * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. State of the clone job. * * Generated from protobuf field .google.cloud.vmmigration.v1.CloneJob.State state = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The time the state was last updated. * * Generated from protobuf field .google.protobuf.Timestamp state_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state_time = null; + protected $state_time = null; /** * Output only. Provides details for the errors that led to the Clone Job's * state. * * Generated from protobuf field .google.rpc.Status error = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Output only. The clone steps list representing its progress. * diff --git a/VmMigration/src/V1/CloneStep.php b/VmMigration/src/V1/CloneStep.php index 3cac101c16d2..38ffc545d9b1 100644 --- a/VmMigration/src/V1/CloneStep.php +++ b/VmMigration/src/V1/CloneStep.php @@ -20,13 +20,13 @@ class CloneStep extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; */ - private $start_time = null; + protected $start_time = null; /** * The time the step has ended. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; */ - private $end_time = null; + protected $end_time = null; protected $step; /** diff --git a/VmMigration/src/V1/ComputeEngineTargetDefaults.php b/VmMigration/src/V1/ComputeEngineTargetDefaults.php index a4d49184f91a..2745c0b602a8 100644 --- a/VmMigration/src/V1/ComputeEngineTargetDefaults.php +++ b/VmMigration/src/V1/ComputeEngineTargetDefaults.php @@ -21,32 +21,32 @@ class ComputeEngineTargetDefaults extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vm_name = 1; */ - private $vm_name = ''; + protected $vm_name = ''; /** * The full path of the resource of type TargetProject which represents the * Compute Engine project in which to create this VM. * * Generated from protobuf field string target_project = 2 [(.google.api.resource_reference) = { */ - private $target_project = ''; + protected $target_project = ''; /** * The zone in which to create the VM. * * Generated from protobuf field string zone = 3; */ - private $zone = ''; + protected $zone = ''; /** * The machine type series to create the VM with. * * Generated from protobuf field string machine_type_series = 4; */ - private $machine_type_series = ''; + protected $machine_type_series = ''; /** * The machine type to create the VM with. * * Generated from protobuf field string machine_type = 5; */ - private $machine_type = ''; + protected $machine_type = ''; /** * A map of network tags to associate with the VM. * @@ -64,13 +64,13 @@ class ComputeEngineTargetDefaults extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 8; */ - private $service_account = ''; + protected $service_account = ''; /** * The disk type to use in the VM. * * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineDiskType disk_type = 9; */ - private $disk_type = 0; + protected $disk_type = 0; /** * A map of labels to associate with the VM. * @@ -82,32 +82,32 @@ class ComputeEngineTargetDefaults extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineLicenseType license_type = 11; */ - private $license_type = 0; + protected $license_type = 0; /** * Output only. The OS license returned from the adaptation module report. * * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense applied_license = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $applied_license = null; + protected $applied_license = null; /** * Compute instance scheduling information (if empty default is used). * * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling compute_scheduling = 13; */ - private $compute_scheduling = null; + protected $compute_scheduling = null; /** * Defines whether the instance has Secure Boot enabled. * This can be set to true only if the vm boot option is EFI. * * Generated from protobuf field bool secure_boot = 14; */ - private $secure_boot = false; + protected $secure_boot = false; /** * Output only. The VM Boot Option, as set in the source vm. * * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineBootOption boot_option = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $boot_option = 0; + protected $boot_option = 0; /** * The metadata key/value pairs to assign to the VM. * @@ -125,7 +125,7 @@ class ComputeEngineTargetDefaults extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string hostname = 18; */ - private $hostname = ''; + protected $hostname = ''; /** * Constructor. diff --git a/VmMigration/src/V1/ComputeEngineTargetDetails.php b/VmMigration/src/V1/ComputeEngineTargetDetails.php index 98f744d4ddf5..aaca78c78818 100644 --- a/VmMigration/src/V1/ComputeEngineTargetDetails.php +++ b/VmMigration/src/V1/ComputeEngineTargetDetails.php @@ -21,31 +21,31 @@ class ComputeEngineTargetDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vm_name = 1; */ - private $vm_name = ''; + protected $vm_name = ''; /** * The Google Cloud target project ID or project name. * * Generated from protobuf field string project = 2; */ - private $project = ''; + protected $project = ''; /** * The zone in which to create the VM. * * Generated from protobuf field string zone = 3; */ - private $zone = ''; + protected $zone = ''; /** * The machine type series to create the VM with. * * Generated from protobuf field string machine_type_series = 4; */ - private $machine_type_series = ''; + protected $machine_type_series = ''; /** * The machine type to create the VM with. * * Generated from protobuf field string machine_type = 5; */ - private $machine_type = ''; + protected $machine_type = ''; /** * A map of network tags to associate with the VM. * @@ -63,13 +63,13 @@ class ComputeEngineTargetDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string service_account = 8; */ - private $service_account = ''; + protected $service_account = ''; /** * The disk type to use in the VM. * * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineDiskType disk_type = 9; */ - private $disk_type = 0; + protected $disk_type = 0; /** * A map of labels to associate with the VM. * @@ -81,32 +81,32 @@ class ComputeEngineTargetDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineLicenseType license_type = 11; */ - private $license_type = 0; + protected $license_type = 0; /** * The OS license returned from the adaptation module report. * * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense applied_license = 12; */ - private $applied_license = null; + protected $applied_license = null; /** * Compute instance scheduling information (if empty default is used). * * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling compute_scheduling = 13; */ - private $compute_scheduling = null; + protected $compute_scheduling = null; /** * Defines whether the instance has Secure Boot enabled. * This can be set to true only if the vm boot option is EFI. * * Generated from protobuf field bool secure_boot = 14; */ - private $secure_boot = false; + protected $secure_boot = false; /** * The VM Boot Option, as set in the source vm. * * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineBootOption boot_option = 15; */ - private $boot_option = 0; + protected $boot_option = 0; /** * The metadata key/value pairs to assign to the VM. * @@ -124,7 +124,7 @@ class ComputeEngineTargetDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string hostname = 18; */ - private $hostname = ''; + protected $hostname = ''; /** * Constructor. diff --git a/VmMigration/src/V1/ComputeScheduling.php b/VmMigration/src/V1/ComputeScheduling.php index 5e32757597ee..bc30aaa06e34 100644 --- a/VmMigration/src/V1/ComputeScheduling.php +++ b/VmMigration/src/V1/ComputeScheduling.php @@ -22,7 +22,7 @@ class ComputeScheduling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance on_host_maintenance = 1; */ - private $on_host_maintenance = 0; + protected $on_host_maintenance = 0; /** * Whether the Instance should be automatically restarted whenever it is * terminated by Compute Engine (not terminated by user). @@ -33,7 +33,7 @@ class ComputeScheduling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling.RestartType restart_type = 5; */ - private $restart_type = 0; + protected $restart_type = 0; /** * A set of node affinity and anti-affinity configurations for sole tenant * nodes. @@ -48,7 +48,7 @@ class ComputeScheduling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 min_node_cpus = 4; */ - private $min_node_cpus = 0; + protected $min_node_cpus = 0; /** * Constructor. diff --git a/VmMigration/src/V1/CreateCloneJobRequest.php b/VmMigration/src/V1/CreateCloneJobRequest.php index fba304995a1d..41851b8961e2 100644 --- a/VmMigration/src/V1/CreateCloneJobRequest.php +++ b/VmMigration/src/V1/CreateCloneJobRequest.php @@ -20,19 +20,19 @@ class CreateCloneJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The clone job identifier. * * Generated from protobuf field string clone_job_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $clone_job_id = ''; + protected $clone_job_id = ''; /** * Required. The clone request body. * * Generated from protobuf field .google.cloud.vmmigration.v1.CloneJob clone_job = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $clone_job = null; + protected $clone_job = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class CreateCloneJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The Clone's parent. Please see diff --git a/VmMigration/src/V1/CreateCutoverJobRequest.php b/VmMigration/src/V1/CreateCutoverJobRequest.php index 2932f98f357a..ca9cc7598345 100644 --- a/VmMigration/src/V1/CreateCutoverJobRequest.php +++ b/VmMigration/src/V1/CreateCutoverJobRequest.php @@ -20,19 +20,19 @@ class CreateCutoverJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The cutover job identifier. * * Generated from protobuf field string cutover_job_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $cutover_job_id = ''; + protected $cutover_job_id = ''; /** * Required. The cutover request body. * * Generated from protobuf field .google.cloud.vmmigration.v1.CutoverJob cutover_job = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $cutover_job = null; + protected $cutover_job = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class CreateCutoverJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The Cutover's parent. Please see diff --git a/VmMigration/src/V1/CreateDatacenterConnectorRequest.php b/VmMigration/src/V1/CreateDatacenterConnectorRequest.php index 66acc831cb58..ec4aaf84d99f 100644 --- a/VmMigration/src/V1/CreateDatacenterConnectorRequest.php +++ b/VmMigration/src/V1/CreateDatacenterConnectorRequest.php @@ -23,19 +23,19 @@ class CreateDatacenterConnectorRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The datacenterConnector identifier. * * Generated from protobuf field string datacenter_connector_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $datacenter_connector_id = ''; + protected $datacenter_connector_id = ''; /** * Required. The create request body. * * Generated from protobuf field .google.cloud.vmmigration.v1.DatacenterConnector datacenter_connector = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $datacenter_connector = null; + protected $datacenter_connector = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -51,7 +51,7 @@ class CreateDatacenterConnectorRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The DatacenterConnector's parent. diff --git a/VmMigration/src/V1/CreateGroupRequest.php b/VmMigration/src/V1/CreateGroupRequest.php index 20cd3bddc46e..de9bfaea8932 100644 --- a/VmMigration/src/V1/CreateGroupRequest.php +++ b/VmMigration/src/V1/CreateGroupRequest.php @@ -20,19 +20,19 @@ class CreateGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The group identifier. * * Generated from protobuf field string group_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $group_id = ''; + protected $group_id = ''; /** * Required. The create request body. * * Generated from protobuf field .google.cloud.vmmigration.v1.Group group = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $group = null; + protected $group = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class CreateGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The Group's parent. Please see diff --git a/VmMigration/src/V1/CreateMigratingVmRequest.php b/VmMigration/src/V1/CreateMigratingVmRequest.php index 8f74f5c97229..c12c649f5023 100644 --- a/VmMigration/src/V1/CreateMigratingVmRequest.php +++ b/VmMigration/src/V1/CreateMigratingVmRequest.php @@ -20,19 +20,19 @@ class CreateMigratingVmRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The migratingVm identifier. * * Generated from protobuf field string migrating_vm_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $migrating_vm_id = ''; + protected $migrating_vm_id = ''; /** * Required. The create request body. * * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $migrating_vm = null; + protected $migrating_vm = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class CreateMigratingVmRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The MigratingVm's parent. Please see diff --git a/VmMigration/src/V1/CreateSourceRequest.php b/VmMigration/src/V1/CreateSourceRequest.php index 5b7c694d8316..525bb5819b4a 100644 --- a/VmMigration/src/V1/CreateSourceRequest.php +++ b/VmMigration/src/V1/CreateSourceRequest.php @@ -20,19 +20,19 @@ class CreateSourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The source identifier. * * Generated from protobuf field string source_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $source_id = ''; + protected $source_id = ''; /** * Required. The create request body. * * Generated from protobuf field .google.cloud.vmmigration.v1.Source source = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $source = null; + protected $source = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class CreateSourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The Source's parent. Please see diff --git a/VmMigration/src/V1/CreateTargetProjectRequest.php b/VmMigration/src/V1/CreateTargetProjectRequest.php index da4d182c1d35..fa7e25ef6158 100644 --- a/VmMigration/src/V1/CreateTargetProjectRequest.php +++ b/VmMigration/src/V1/CreateTargetProjectRequest.php @@ -20,19 +20,19 @@ class CreateTargetProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The target_project identifier. * * Generated from protobuf field string target_project_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_project_id = ''; + protected $target_project_id = ''; /** * Required. The create request body. * * Generated from protobuf field .google.cloud.vmmigration.v1.TargetProject target_project = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_project = null; + protected $target_project = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -48,7 +48,7 @@ class CreateTargetProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The TargetProject's parent. Please see diff --git a/VmMigration/src/V1/CreateUtilizationReportRequest.php b/VmMigration/src/V1/CreateUtilizationReportRequest.php index d0c3fb4249d0..80a507c49703 100644 --- a/VmMigration/src/V1/CreateUtilizationReportRequest.php +++ b/VmMigration/src/V1/CreateUtilizationReportRequest.php @@ -20,13 +20,13 @@ class CreateUtilizationReportRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The report to create. * * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport utilization_report = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $utilization_report = null; + protected $utilization_report = null; /** * Required. The ID to use for the report, which will become the final * component of the reports's resource name. @@ -36,7 +36,7 @@ class CreateUtilizationReportRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string utilization_report_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $utilization_report_id = ''; + protected $utilization_report_id = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -52,7 +52,7 @@ class CreateUtilizationReportRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 4; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $parent Required. The Utilization Report's parent. Please see diff --git a/VmMigration/src/V1/CutoverJob.php b/VmMigration/src/V1/CutoverJob.php index 3a4cbaee6eea..3fafe9c8c7e7 100644 --- a/VmMigration/src/V1/CutoverJob.php +++ b/VmMigration/src/V1/CutoverJob.php @@ -23,51 +23,51 @@ class CutoverJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The time the cutover job had finished. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. The name of the cutover job. * * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. State of the cutover job. * * Generated from protobuf field .google.cloud.vmmigration.v1.CutoverJob.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The time the state was last updated. * * Generated from protobuf field .google.protobuf.Timestamp state_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state_time = null; + protected $state_time = null; /** * Output only. The current progress in percentage of the cutover job. * * Generated from protobuf field int32 progress_percent = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $progress_percent = 0; + protected $progress_percent = 0; /** * Output only. Provides details for the errors that led to the Cutover Job's * state. * * Generated from protobuf field .google.rpc.Status error = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Output only. A message providing possible extra details about the current * state. * * Generated from protobuf field string state_message = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state_message = ''; + protected $state_message = ''; /** * Output only. The cutover steps list representing its progress. * diff --git a/VmMigration/src/V1/CutoverStep.php b/VmMigration/src/V1/CutoverStep.php index 452b660d77ec..68550eca3b97 100644 --- a/VmMigration/src/V1/CutoverStep.php +++ b/VmMigration/src/V1/CutoverStep.php @@ -20,13 +20,13 @@ class CutoverStep extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; */ - private $start_time = null; + protected $start_time = null; /** * The time the step has ended. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; */ - private $end_time = null; + protected $end_time = null; protected $step; /** diff --git a/VmMigration/src/V1/CycleStep.php b/VmMigration/src/V1/CycleStep.php index f034b17a9d57..a081411451d2 100644 --- a/VmMigration/src/V1/CycleStep.php +++ b/VmMigration/src/V1/CycleStep.php @@ -20,13 +20,13 @@ class CycleStep extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; */ - private $start_time = null; + protected $start_time = null; /** * The time the cycle step has ended. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; */ - private $end_time = null; + protected $end_time = null; protected $step; /** diff --git a/VmMigration/src/V1/DatacenterConnector.php b/VmMigration/src/V1/DatacenterConnector.php index 14d971981fb6..20244d65ed0b 100644 --- a/VmMigration/src/V1/DatacenterConnector.php +++ b/VmMigration/src/V1/DatacenterConnector.php @@ -24,19 +24,19 @@ class DatacenterConnector extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The last time the connector was updated with an API call. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. The connector's name. * * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Immutable. A unique key for this connector. This key is internal to the OVA * connector and is supplied with its creation during the registration process @@ -44,48 +44,48 @@ class DatacenterConnector extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string registration_id = 12 [(.google.api.field_behavior) = IMMUTABLE]; */ - private $registration_id = ''; + protected $registration_id = ''; /** * The service account to use in the connector when communicating with the * cloud. * * Generated from protobuf field string service_account = 5; */ - private $service_account = ''; + protected $service_account = ''; /** * The version running in the DatacenterConnector. This is supplied by the OVA * connector during the registration process and can not be modified. * * Generated from protobuf field string version = 6; */ - private $version = ''; + protected $version = ''; /** * Output only. The communication channel between the datacenter connector and * Google Cloud. * * Generated from protobuf field string bucket = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $bucket = ''; + protected $bucket = ''; /** * Output only. State of the DatacenterConnector, as determined by the health * checks. * * Generated from protobuf field .google.cloud.vmmigration.v1.DatacenterConnector.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The time the state was last set. * * Generated from protobuf field .google.protobuf.Timestamp state_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state_time = null; + protected $state_time = null; /** * Output only. Provides details on the state of the Datacenter Connector in * case of an error. * * Generated from protobuf field .google.rpc.Status error = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Output only. Appliance OVA version. * This is the OVA which is manually installed by the user and contains the @@ -93,7 +93,7 @@ class DatacenterConnector extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string appliance_infrastructure_version = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $appliance_infrastructure_version = ''; + protected $appliance_infrastructure_version = ''; /** * Output only. Appliance last installed update bundle version. * This is the version of the automatically updatable components on the @@ -101,19 +101,19 @@ class DatacenterConnector extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string appliance_software_version = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $appliance_software_version = ''; + protected $appliance_software_version = ''; /** * Output only. The available versions for updating this appliance. * * Generated from protobuf field .google.cloud.vmmigration.v1.AvailableUpdates available_versions = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $available_versions = null; + protected $available_versions = null; /** * Output only. The status of the current / last upgradeAppliance operation. * * Generated from protobuf field .google.cloud.vmmigration.v1.UpgradeStatus upgrade_status = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $upgrade_status = null; + protected $upgrade_status = null; /** * Constructor. diff --git a/VmMigration/src/V1/DeleteDatacenterConnectorRequest.php b/VmMigration/src/V1/DeleteDatacenterConnectorRequest.php index 187c82be34e6..3a18f26d864c 100644 --- a/VmMigration/src/V1/DeleteDatacenterConnectorRequest.php +++ b/VmMigration/src/V1/DeleteDatacenterConnectorRequest.php @@ -20,7 +20,7 @@ class DeleteDatacenterConnectorRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -36,7 +36,7 @@ class DeleteDatacenterConnectorRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The DatacenterConnector name. Please see diff --git a/VmMigration/src/V1/DeleteGroupRequest.php b/VmMigration/src/V1/DeleteGroupRequest.php index cb8a9990a470..58ed1909db6e 100644 --- a/VmMigration/src/V1/DeleteGroupRequest.php +++ b/VmMigration/src/V1/DeleteGroupRequest.php @@ -20,7 +20,7 @@ class DeleteGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -36,7 +36,7 @@ class DeleteGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The Group name. Please see diff --git a/VmMigration/src/V1/DeleteMigratingVmRequest.php b/VmMigration/src/V1/DeleteMigratingVmRequest.php index 56862dfda748..d92845c4cd69 100644 --- a/VmMigration/src/V1/DeleteMigratingVmRequest.php +++ b/VmMigration/src/V1/DeleteMigratingVmRequest.php @@ -20,7 +20,7 @@ class DeleteMigratingVmRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the MigratingVm. Please see diff --git a/VmMigration/src/V1/DeleteSourceRequest.php b/VmMigration/src/V1/DeleteSourceRequest.php index c4f438fd2d7d..73363cfd5bc7 100644 --- a/VmMigration/src/V1/DeleteSourceRequest.php +++ b/VmMigration/src/V1/DeleteSourceRequest.php @@ -20,7 +20,7 @@ class DeleteSourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -36,7 +36,7 @@ class DeleteSourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The Source name. Please see diff --git a/VmMigration/src/V1/DeleteTargetProjectRequest.php b/VmMigration/src/V1/DeleteTargetProjectRequest.php index 00c148d89868..d1c390849152 100644 --- a/VmMigration/src/V1/DeleteTargetProjectRequest.php +++ b/VmMigration/src/V1/DeleteTargetProjectRequest.php @@ -20,7 +20,7 @@ class DeleteTargetProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -36,7 +36,7 @@ class DeleteTargetProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The TargetProject name. Please see diff --git a/VmMigration/src/V1/DeleteUtilizationReportRequest.php b/VmMigration/src/V1/DeleteUtilizationReportRequest.php index ec9ca7c1def7..8341c1a7702f 100644 --- a/VmMigration/src/V1/DeleteUtilizationReportRequest.php +++ b/VmMigration/src/V1/DeleteUtilizationReportRequest.php @@ -20,7 +20,7 @@ class DeleteUtilizationReportRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -36,7 +36,7 @@ class DeleteUtilizationReportRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $request_id = ''; + protected $request_id = ''; /** * @param string $name Required. The Utilization Report name. Please see diff --git a/VmMigration/src/V1/FetchInventoryRequest.php b/VmMigration/src/V1/FetchInventoryRequest.php index c2ae20898169..3ccec18360e1 100644 --- a/VmMigration/src/V1/FetchInventoryRequest.php +++ b/VmMigration/src/V1/FetchInventoryRequest.php @@ -21,14 +21,14 @@ class FetchInventoryRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string source = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $source = ''; + protected $source = ''; /** * If this flag is set to true, the source will be queried instead of using * cached results. Using this flag will make the call slower. * * Generated from protobuf field bool force_refresh = 2; */ - private $force_refresh = false; + protected $force_refresh = false; /** * @param string $source Required. The name of the Source. Please see diff --git a/VmMigration/src/V1/FetchInventoryResponse.php b/VmMigration/src/V1/FetchInventoryResponse.php index a826e2e90a36..ce1bdac4c8c1 100644 --- a/VmMigration/src/V1/FetchInventoryResponse.php +++ b/VmMigration/src/V1/FetchInventoryResponse.php @@ -22,7 +22,7 @@ class FetchInventoryResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; protected $SourceVms; /** diff --git a/VmMigration/src/V1/FinalizeMigrationRequest.php b/VmMigration/src/V1/FinalizeMigrationRequest.php index 8e13177e319e..d71b82ccb9b5 100644 --- a/VmMigration/src/V1/FinalizeMigrationRequest.php +++ b/VmMigration/src/V1/FinalizeMigrationRequest.php @@ -20,7 +20,7 @@ class FinalizeMigrationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $migrating_vm = ''; + protected $migrating_vm = ''; /** * @param string $migratingVm Required. The name of the MigratingVm. Please see diff --git a/VmMigration/src/V1/Gapic/VmMigrationGapicClient.php b/VmMigration/src/V1/Gapic/VmMigrationGapicClient.php deleted file mode 100644 index 50aae90d5e53..000000000000 --- a/VmMigration/src/V1/Gapic/VmMigrationGapicClient.php +++ /dev/null @@ -1,4656 +0,0 @@ -groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - * $operationResponse = $vmMigrationClient->addGroupMigration($formattedGroup); - * $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 = $vmMigrationClient->addGroupMigration($formattedGroup); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'addGroupMigration'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\VMMigration\V1\Client\VmMigrationClient}. - */ -class VmMigrationGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.vmmigration.v1.VmMigration'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'vmmigration.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'vmmigration.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $cloneJobNameTemplate; - - private static $cutoverJobNameTemplate; - - private static $datacenterConnectorNameTemplate; - - private static $groupNameTemplate; - - private static $locationNameTemplate; - - private static $migratingVmNameTemplate; - - private static $replicationCycleNameTemplate; - - private static $sourceNameTemplate; - - private static $targetProjectNameTemplate; - - private static $utilizationReportNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/vm_migration_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/vm_migration_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/vm_migration_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/vm_migration_rest_client_config.php', - ], - ], - ]; - } - - private static function getCloneJobNameTemplate() - { - if (self::$cloneJobNameTemplate == null) { - self::$cloneJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cloneJobs/{clone_job}' - ); - } - - return self::$cloneJobNameTemplate; - } - - private static function getCutoverJobNameTemplate() - { - if (self::$cutoverJobNameTemplate == null) { - self::$cutoverJobNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cutoverJobs/{cutover_job}' - ); - } - - return self::$cutoverJobNameTemplate; - } - - private static function getDatacenterConnectorNameTemplate() - { - if (self::$datacenterConnectorNameTemplate == null) { - self::$datacenterConnectorNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/datacenterConnectors/{datacenter_connector}' - ); - } - - return self::$datacenterConnectorNameTemplate; - } - - private static function getGroupNameTemplate() - { - if (self::$groupNameTemplate == null) { - self::$groupNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/groups/{group}' - ); - } - - return self::$groupNameTemplate; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}' - ); - } - - return self::$locationNameTemplate; - } - - private static function getMigratingVmNameTemplate() - { - if (self::$migratingVmNameTemplate == null) { - self::$migratingVmNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}' - ); - } - - return self::$migratingVmNameTemplate; - } - - private static function getReplicationCycleNameTemplate() - { - if (self::$replicationCycleNameTemplate == null) { - self::$replicationCycleNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/replicationCycles/{replication_cycle}' - ); - } - - return self::$replicationCycleNameTemplate; - } - - private static function getSourceNameTemplate() - { - if (self::$sourceNameTemplate == null) { - self::$sourceNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}' - ); - } - - return self::$sourceNameTemplate; - } - - private static function getTargetProjectNameTemplate() - { - if (self::$targetProjectNameTemplate == null) { - self::$targetProjectNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/targetProjects/{target_project}' - ); - } - - return self::$targetProjectNameTemplate; - } - - private static function getUtilizationReportNameTemplate() - { - if (self::$utilizationReportNameTemplate == null) { - self::$utilizationReportNameTemplate = new PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/utilizationReports/{utilization_report}' - ); - } - - return self::$utilizationReportNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'cloneJob' => self::getCloneJobNameTemplate(), - 'cutoverJob' => self::getCutoverJobNameTemplate(), - 'datacenterConnector' => self::getDatacenterConnectorNameTemplate(), - 'group' => self::getGroupNameTemplate(), - 'location' => self::getLocationNameTemplate(), - 'migratingVm' => self::getMigratingVmNameTemplate(), - 'replicationCycle' => self::getReplicationCycleNameTemplate(), - 'source' => self::getSourceNameTemplate(), - 'targetProject' => self::getTargetProjectNameTemplate(), - 'utilizationReport' => self::getUtilizationReportNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a clone_job - * resource. - * - * @param string $project - * @param string $location - * @param string $source - * @param string $migratingVm - * @param string $cloneJob - * - * @return string The formatted clone_job resource. - */ - public static function cloneJobName( - $project, - $location, - $source, - $migratingVm, - $cloneJob - ) { - return self::getCloneJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'source' => $source, - 'migrating_vm' => $migratingVm, - 'clone_job' => $cloneJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a cutover_job - * resource. - * - * @param string $project - * @param string $location - * @param string $source - * @param string $migratingVm - * @param string $cutoverJob - * - * @return string The formatted cutover_job resource. - */ - public static function cutoverJobName( - $project, - $location, - $source, - $migratingVm, - $cutoverJob - ) { - return self::getCutoverJobNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'source' => $source, - 'migrating_vm' => $migratingVm, - 'cutover_job' => $cutoverJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * datacenter_connector resource. - * - * @param string $project - * @param string $location - * @param string $source - * @param string $datacenterConnector - * - * @return string The formatted datacenter_connector resource. - */ - public static function datacenterConnectorName( - $project, - $location, - $source, - $datacenterConnector - ) { - return self::getDatacenterConnectorNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'source' => $source, - 'datacenter_connector' => $datacenterConnector, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a group - * resource. - * - * @param string $project - * @param string $location - * @param string $group - * - * @return string The formatted group resource. - */ - public static function groupName($project, $location, $group) - { - return self::getGroupNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'group' => $group, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName($project, $location) - { - return self::getLocationNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a migrating_vm - * resource. - * - * @param string $project - * @param string $location - * @param string $source - * @param string $migratingVm - * - * @return string The formatted migrating_vm resource. - */ - public static function migratingVmName( - $project, - $location, - $source, - $migratingVm - ) { - return self::getMigratingVmNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'source' => $source, - 'migrating_vm' => $migratingVm, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * replication_cycle resource. - * - * @param string $project - * @param string $location - * @param string $source - * @param string $migratingVm - * @param string $replicationCycle - * - * @return string The formatted replication_cycle resource. - */ - public static function replicationCycleName( - $project, - $location, - $source, - $migratingVm, - $replicationCycle - ) { - return self::getReplicationCycleNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'source' => $source, - 'migrating_vm' => $migratingVm, - 'replication_cycle' => $replicationCycle, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a source - * resource. - * - * @param string $project - * @param string $location - * @param string $source - * - * @return string The formatted source resource. - */ - public static function sourceName($project, $location, $source) - { - return self::getSourceNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'source' => $source, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * target_project resource. - * - * @param string $project - * @param string $location - * @param string $targetProject - * - * @return string The formatted target_project resource. - */ - public static function targetProjectName( - $project, - $location, - $targetProject - ) { - return self::getTargetProjectNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'target_project' => $targetProject, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * utilization_report resource. - * - * @param string $project - * @param string $location - * @param string $source - * @param string $utilizationReport - * - * @return string The formatted utilization_report resource. - */ - public static function utilizationReportName( - $project, - $location, - $source, - $utilizationReport - ) { - return self::getUtilizationReportNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'source' => $source, - 'utilization_report' => $utilizationReport, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - cloneJob: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cloneJobs/{clone_job} - * - cutoverJob: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cutoverJobs/{cutover_job} - * - datacenterConnector: projects/{project}/locations/{location}/sources/{source}/datacenterConnectors/{datacenter_connector} - * - group: projects/{project}/locations/{location}/groups/{group} - * - location: projects/{project}/locations/{location} - * - migratingVm: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm} - * - replicationCycle: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/replicationCycles/{replication_cycle} - * - source: projects/{project}/locations/{location}/sources/{source} - * - targetProject: projects/{project}/locations/{location}/targetProjects/{target_project} - * - utilizationReport: projects/{project}/locations/{location}/sources/{source}/utilizationReports/{utilization_report} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException( - "Template name $template does not exist" - ); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException( - "Input did not match any known format. Input: $formattedName" - ); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'vmmigration.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds a MigratingVm to a Group. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedGroup = $vmMigrationClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - * $operationResponse = $vmMigrationClient->addGroupMigration($formattedGroup); - * $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 = $vmMigrationClient->addGroupMigration($formattedGroup); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'addGroupMigration'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $group Required. The full path name of the Group to add to. - * @param array $optionalArgs { - * Optional. - * - * @type string $migratingVm - * The full path name of the MigratingVm to add. - * @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 addGroupMigration($group, array $optionalArgs = []) - { - $request = new AddGroupMigrationRequest(); - $requestParamHeaders = []; - $request->setGroup($group); - $requestParamHeaders['group'] = $group; - if (isset($optionalArgs['migratingVm'])) { - $request->setMigratingVm($optionalArgs['migratingVm']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'AddGroupMigration', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Initiates the cancellation of a running clone job. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); - * $operationResponse = $vmMigrationClient->cancelCloneJob($formattedName); - * $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 = $vmMigrationClient->cancelCloneJob($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'cancelCloneJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The clone job 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 cancelCloneJob($name, array $optionalArgs = []) - { - $request = new CancelCloneJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CancelCloneJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Initiates the cancellation of a running cutover job. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); - * $operationResponse = $vmMigrationClient->cancelCutoverJob($formattedName); - * $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 = $vmMigrationClient->cancelCutoverJob($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'cancelCutoverJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The cutover job 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 cancelCutoverJob($name, array $optionalArgs = []) - { - $request = new CancelCutoverJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CancelCutoverJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Initiates a Clone of a specific migrating VM. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - * $cloneJobId = 'clone_job_id'; - * $cloneJob = new CloneJob(); - * $operationResponse = $vmMigrationClient->createCloneJob($formattedParent, $cloneJobId, $cloneJob); - * $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 = $vmMigrationClient->createCloneJob($formattedParent, $cloneJobId, $cloneJob); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createCloneJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The Clone's parent. - * @param string $cloneJobId Required. The clone job identifier. - * @param CloneJob $cloneJob Required. The clone request body. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A 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). - * @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 createCloneJob( - $parent, - $cloneJobId, - $cloneJob, - array $optionalArgs = [] - ) { - $request = new CreateCloneJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setCloneJobId($cloneJobId); - $request->setCloneJob($cloneJob); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateCloneJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Initiates a Cutover of a specific migrating VM. - * The returned LRO is completed when the cutover job resource is created - * and the job is initiated. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - * $cutoverJobId = 'cutover_job_id'; - * $cutoverJob = new CutoverJob(); - * $operationResponse = $vmMigrationClient->createCutoverJob($formattedParent, $cutoverJobId, $cutoverJob); - * $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 = $vmMigrationClient->createCutoverJob($formattedParent, $cutoverJobId, $cutoverJob); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createCutoverJob'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The Cutover's parent. - * @param string $cutoverJobId Required. The cutover job identifier. - * @param CutoverJob $cutoverJob Required. The cutover request body. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A 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). - * @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 createCutoverJob( - $parent, - $cutoverJobId, - $cutoverJob, - array $optionalArgs = [] - ) { - $request = new CreateCutoverJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setCutoverJobId($cutoverJobId); - $request->setCutoverJob($cutoverJob); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateCutoverJob', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new DatacenterConnector in a given Source. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - * $datacenterConnectorId = 'datacenter_connector_id'; - * $datacenterConnector = new DatacenterConnector(); - * $operationResponse = $vmMigrationClient->createDatacenterConnector($formattedParent, $datacenterConnectorId, $datacenterConnector); - * $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 = $vmMigrationClient->createDatacenterConnector($formattedParent, $datacenterConnectorId, $datacenterConnector); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createDatacenterConnector'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The DatacenterConnector's parent. - * Required. The Source in where the new DatacenterConnector will be created. - * For example: - * `projects/my-project/locations/us-central1/sources/my-source` - * @param string $datacenterConnectorId Required. The datacenterConnector identifier. - * @param DatacenterConnector $datacenterConnector Required. The create request body. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A 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). - * @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 createDatacenterConnector( - $parent, - $datacenterConnectorId, - $datacenterConnector, - array $optionalArgs = [] - ) { - $request = new CreateDatacenterConnectorRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setDatacenterConnectorId($datacenterConnectorId); - $request->setDatacenterConnector($datacenterConnector); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateDatacenterConnector', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new Group in a given project and location. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); - * $groupId = 'group_id'; - * $group = new Group(); - * $operationResponse = $vmMigrationClient->createGroup($formattedParent, $groupId, $group); - * $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 = $vmMigrationClient->createGroup($formattedParent, $groupId, $group); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createGroup'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The Group's parent. - * @param string $groupId Required. The group identifier. - * @param Group $group Required. The create request body. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A 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). - * @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 createGroup( - $parent, - $groupId, - $group, - array $optionalArgs = [] - ) { - $request = new CreateGroupRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setGroupId($groupId); - $request->setGroup($group); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateGroup', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new MigratingVm in a given Source. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - * $migratingVmId = 'migrating_vm_id'; - * $migratingVm = new MigratingVm(); - * $operationResponse = $vmMigrationClient->createMigratingVm($formattedParent, $migratingVmId, $migratingVm); - * $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 = $vmMigrationClient->createMigratingVm($formattedParent, $migratingVmId, $migratingVm); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createMigratingVm'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The MigratingVm's parent. - * @param string $migratingVmId Required. The migratingVm identifier. - * @param MigratingVm $migratingVm Required. The create request body. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A 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). - * @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 createMigratingVm( - $parent, - $migratingVmId, - $migratingVm, - array $optionalArgs = [] - ) { - $request = new CreateMigratingVmRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setMigratingVmId($migratingVmId); - $request->setMigratingVm($migratingVm); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateMigratingVm', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new Source in a given project and location. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); - * $sourceId = 'source_id'; - * $source = new Source(); - * $operationResponse = $vmMigrationClient->createSource($formattedParent, $sourceId, $source); - * $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 = $vmMigrationClient->createSource($formattedParent, $sourceId, $source); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createSource'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The Source's parent. - * @param string $sourceId Required. The source identifier. - * @param Source $source Required. The create request body. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A 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). - * @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 createSource( - $parent, - $sourceId, - $source, - array $optionalArgs = [] - ) { - $request = new CreateSourceRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setSourceId($sourceId); - $request->setSource($source); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateSource', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new TargetProject in a given project. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); - * $targetProjectId = 'target_project_id'; - * $targetProject = new TargetProject(); - * $operationResponse = $vmMigrationClient->createTargetProject($formattedParent, $targetProjectId, $targetProject); - * $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 = $vmMigrationClient->createTargetProject($formattedParent, $targetProjectId, $targetProject); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createTargetProject'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The TargetProject's parent. - * @param string $targetProjectId Required. The target_project identifier. - * @param TargetProject $targetProject Required. The create request body. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A 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). - * @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 createTargetProject( - $parent, - $targetProjectId, - $targetProject, - array $optionalArgs = [] - ) { - $request = new CreateTargetProjectRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setTargetProjectId($targetProjectId); - $request->setTargetProject($targetProject); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateTargetProject', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Creates a new UtilizationReport. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - * $utilizationReport = new UtilizationReport(); - * $utilizationReportId = 'utilization_report_id'; - * $operationResponse = $vmMigrationClient->createUtilizationReport($formattedParent, $utilizationReport, $utilizationReportId); - * $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 = $vmMigrationClient->createUtilizationReport($formattedParent, $utilizationReport, $utilizationReportId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createUtilizationReport'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The Utilization Report's parent. - * @param UtilizationReport $utilizationReport Required. The report to create. - * @param string $utilizationReportId Required. The ID to use for the report, which will become the final - * component of the reports's resource name. - * - * This value maximum length is 63 characters, and valid characters - * are /[a-z][0-9]-/. It must start with an english letter and must not - * end with a hyphen. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A 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). - * @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 createUtilizationReport( - $parent, - $utilizationReport, - $utilizationReportId, - array $optionalArgs = [] - ) { - $request = new CreateUtilizationReportRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setUtilizationReport($utilizationReport); - $request->setUtilizationReportId($utilizationReportId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'CreateUtilizationReport', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single DatacenterConnector. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - * $operationResponse = $vmMigrationClient->deleteDatacenterConnector($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vmMigrationClient->deleteDatacenterConnector($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteDatacenterConnector'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The DatacenterConnector name. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A 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 after 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). - * @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 deleteDatacenterConnector($name, array $optionalArgs = []) - { - $request = new DeleteDatacenterConnectorRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteDatacenterConnector', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single Group. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - * $operationResponse = $vmMigrationClient->deleteGroup($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vmMigrationClient->deleteGroup($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteGroup'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The Group name. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A 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 after 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). - * @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 deleteGroup($name, array $optionalArgs = []) - { - $request = new DeleteGroupRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteGroup', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single MigratingVm. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - * $operationResponse = $vmMigrationClient->deleteMigratingVm($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vmMigrationClient->deleteMigratingVm($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteMigratingVm'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the MigratingVm. - * @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 deleteMigratingVm($name, array $optionalArgs = []) - { - $request = new DeleteMigratingVmRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteMigratingVm', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single Source. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - * $operationResponse = $vmMigrationClient->deleteSource($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vmMigrationClient->deleteSource($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteSource'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The Source name. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A 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 after 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). - * @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 deleteSource($name, array $optionalArgs = []) - { - $request = new DeleteSourceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteSource', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single TargetProject. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); - * $operationResponse = $vmMigrationClient->deleteTargetProject($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vmMigrationClient->deleteTargetProject($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteTargetProject'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The TargetProject name. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A 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 after 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). - * @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 deleteTargetProject($name, array $optionalArgs = []) - { - $request = new DeleteTargetProjectRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteTargetProject', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Deletes a single Utilization Report. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); - * $operationResponse = $vmMigrationClient->deleteUtilizationReport($formattedName); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vmMigrationClient->deleteUtilizationReport($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteUtilizationReport'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The Utilization Report name. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * Optional. A 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 after 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). - * @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 deleteUtilizationReport($name, array $optionalArgs = []) - { - $request = new DeleteUtilizationReportRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'DeleteUtilizationReport', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * List remote source's inventory of VMs. - * The remote source is the onprem vCenter (remote in the sense it's not in - * Compute Engine). The inventory describes the list of existing VMs in that - * source. Note that this operation lists the VMs on the remote source, as - * opposed to listing the MigratingVms resources in the vmmigration service. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedSource = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - * $response = $vmMigrationClient->fetchInventory($formattedSource); - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $source Required. The name of the Source. - * @param array $optionalArgs { - * Optional. - * - * @type bool $forceRefresh - * If this flag is set to true, the source will be queried instead of using - * cached results. Using this flag will make the call slower. - * @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\Cloud\VMMigration\V1\FetchInventoryResponse - * - * @throws ApiException if the remote call fails - */ - public function fetchInventory($source, array $optionalArgs = []) - { - $request = new FetchInventoryRequest(); - $requestParamHeaders = []; - $request->setSource($source); - $requestParamHeaders['source'] = $source; - if (isset($optionalArgs['forceRefresh'])) { - $request->setForceRefresh($optionalArgs['forceRefresh']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'FetchInventory', - FetchInventoryResponse::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Marks a migration as completed, deleting migration resources that are no - * longer being used. Only applicable after cutover is done. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedMigratingVm = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - * $operationResponse = $vmMigrationClient->finalizeMigration($formattedMigratingVm); - * $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 = $vmMigrationClient->finalizeMigration($formattedMigratingVm); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'finalizeMigration'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $migratingVm Required. The name of the MigratingVm. - * @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 finalizeMigration($migratingVm, array $optionalArgs = []) - { - $request = new FinalizeMigrationRequest(); - $requestParamHeaders = []; - $request->setMigratingVm($migratingVm); - $requestParamHeaders['migrating_vm'] = $migratingVm; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'FinalizeMigration', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets details of a single CloneJob. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); - * $response = $vmMigrationClient->getCloneJob($formattedName); - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the CloneJob. - * @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\Cloud\VMMigration\V1\CloneJob - * - * @throws ApiException if the remote call fails - */ - public function getCloneJob($name, array $optionalArgs = []) - { - $request = new GetCloneJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetCloneJob', - CloneJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single CutoverJob. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); - * $response = $vmMigrationClient->getCutoverJob($formattedName); - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the CutoverJob. - * @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\Cloud\VMMigration\V1\CutoverJob - * - * @throws ApiException if the remote call fails - */ - public function getCutoverJob($name, array $optionalArgs = []) - { - $request = new GetCutoverJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetCutoverJob', - CutoverJob::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single DatacenterConnector. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - * $response = $vmMigrationClient->getDatacenterConnector($formattedName); - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the DatacenterConnector. - * @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\Cloud\VMMigration\V1\DatacenterConnector - * - * @throws ApiException if the remote call fails - */ - public function getDatacenterConnector($name, array $optionalArgs = []) - { - $request = new GetDatacenterConnectorRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetDatacenterConnector', - DatacenterConnector::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single Group. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - * $response = $vmMigrationClient->getGroup($formattedName); - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The group name. - * @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\Cloud\VMMigration\V1\Group - * - * @throws ApiException if the remote call fails - */ - public function getGroup($name, array $optionalArgs = []) - { - $request = new GetGroupRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetGroup', - Group::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single MigratingVm. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - * $response = $vmMigrationClient->getMigratingVm($formattedName); - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the MigratingVm. - * @param array $optionalArgs { - * Optional. - * - * @type int $view - * Optional. The level of details of the migrating VM. - * For allowed values, use constants defined on {@see \Google\Cloud\VMMigration\V1\MigratingVmView} - * @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\Cloud\VMMigration\V1\MigratingVm - * - * @throws ApiException if the remote call fails - */ - public function getMigratingVm($name, array $optionalArgs = []) - { - $request = new GetMigratingVmRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetMigratingVm', - MigratingVm::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single ReplicationCycle. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->replicationCycleName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[REPLICATION_CYCLE]'); - * $response = $vmMigrationClient->getReplicationCycle($formattedName); - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the ReplicationCycle. - * @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\Cloud\VMMigration\V1\ReplicationCycle - * - * @throws ApiException if the remote call fails - */ - public function getReplicationCycle($name, array $optionalArgs = []) - { - $request = new GetReplicationCycleRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetReplicationCycle', - ReplicationCycle::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single Source. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - * $response = $vmMigrationClient->getSource($formattedName); - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The Source name. - * @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\Cloud\VMMigration\V1\Source - * - * @throws ApiException if the remote call fails - */ - public function getSource($name, array $optionalArgs = []) - { - $request = new GetSourceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetSource', - Source::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets details of a single TargetProject. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); - * $response = $vmMigrationClient->getTargetProject($formattedName); - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The TargetProject name. - * @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\Cloud\VMMigration\V1\TargetProject - * - * @throws ApiException if the remote call fails - */ - public function getTargetProject($name, array $optionalArgs = []) - { - $request = new GetTargetProjectRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetTargetProject', - TargetProject::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Gets a single Utilization Report. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedName = $vmMigrationClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); - * $response = $vmMigrationClient->getUtilizationReport($formattedName); - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $name Required. The Utilization Report name. - * @param array $optionalArgs { - * Optional. - * - * @type int $view - * Optional. The level of details of the report. - * Defaults to FULL - * For allowed values, use constants defined on {@see \Google\Cloud\VMMigration\V1\UtilizationReportView} - * @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\Cloud\VMMigration\V1\UtilizationReport - * - * @throws ApiException if the remote call fails - */ - public function getUtilizationReport($name, array $optionalArgs = []) - { - $request = new GetUtilizationReportRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetUtilizationReport', - UtilizationReport::class, - $optionalArgs, - $request - )->wait(); - } - - /** - * Lists CloneJobs of a given migrating VM. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - * $pageToken = 'page_token'; - * // Iterate over pages of elements - * $pagedResponse = $vmMigrationClient->listCloneJobs($formattedParent, $pageToken); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmMigrationClient->listCloneJobs($formattedParent, $pageToken); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent, which owns this collection of source VMs. - * @param string $pageToken A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $filter - * Optional. The filter request. - * @type string $orderBy - * Optional. the order by fields for the result. - * @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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listCloneJobs($parent, $pageToken, array $optionalArgs = []) - { - $request = new ListCloneJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPageToken($pageToken); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListCloneJobs', - $optionalArgs, - ListCloneJobsResponse::class, - $request - ); - } - - /** - * Lists CutoverJobs of a given migrating VM. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - * $pageToken = 'page_token'; - * // Iterate over pages of elements - * $pagedResponse = $vmMigrationClient->listCutoverJobs($formattedParent, $pageToken); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmMigrationClient->listCutoverJobs($formattedParent, $pageToken); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent, which owns this collection of migrating VMs. - * @param string $pageToken A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $filter - * Optional. The filter request. - * @type string $orderBy - * Optional. the order by fields for the result. - * @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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listCutoverJobs( - $parent, - $pageToken, - array $optionalArgs = [] - ) { - $request = new ListCutoverJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPageToken($pageToken); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListCutoverJobs', - $optionalArgs, - ListCutoverJobsResponse::class, - $request - ); - } - - /** - * Lists DatacenterConnectors in a given Source. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - * $pageToken = 'page_token'; - * // Iterate over pages of elements - * $pagedResponse = $vmMigrationClient->listDatacenterConnectors($formattedParent, $pageToken); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmMigrationClient->listDatacenterConnectors($formattedParent, $pageToken); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent, which owns this collection of connectors. - * @param string $pageToken A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $filter - * Optional. The filter request. - * @type string $orderBy - * Optional. the order by fields for the result. - * @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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listDatacenterConnectors( - $parent, - $pageToken, - array $optionalArgs = [] - ) { - $request = new ListDatacenterConnectorsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPageToken($pageToken); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListDatacenterConnectors', - $optionalArgs, - ListDatacenterConnectorsResponse::class, - $request - ); - } - - /** - * Lists Groups in a given project and location. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); - * $pageToken = 'page_token'; - * // Iterate over pages of elements - * $pagedResponse = $vmMigrationClient->listGroups($formattedParent, $pageToken); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmMigrationClient->listGroups($formattedParent, $pageToken); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent, which owns this collection of groups. - * @param string $pageToken A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $filter - * Optional. The filter request. - * @type string $orderBy - * Optional. the order by fields for the result. - * @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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listGroups($parent, $pageToken, array $optionalArgs = []) - { - $request = new ListGroupsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPageToken($pageToken); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListGroups', - $optionalArgs, - ListGroupsResponse::class, - $request - ); - } - - /** - * Lists MigratingVms in a given Source. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - * $pageToken = 'page_token'; - * // Iterate over pages of elements - * $pagedResponse = $vmMigrationClient->listMigratingVms($formattedParent, $pageToken); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmMigrationClient->listMigratingVms($formattedParent, $pageToken); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent, which owns this collection of MigratingVms. - * @param string $pageToken A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $filter - * Optional. The filter request. - * @type string $orderBy - * Optional. the order by fields for the result. - * @type int $view - * Optional. The level of details of each migrating VM. - * For allowed values, use constants defined on {@see \Google\Cloud\VMMigration\V1\MigratingVmView} - * @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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listMigratingVms( - $parent, - $pageToken, - array $optionalArgs = [] - ) { - $request = new ListMigratingVmsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPageToken($pageToken); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListMigratingVms', - $optionalArgs, - ListMigratingVmsResponse::class, - $request - ); - } - - /** - * Lists ReplicationCycles in a given MigratingVM. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - * $pageToken = 'page_token'; - * // Iterate over pages of elements - * $pagedResponse = $vmMigrationClient->listReplicationCycles($formattedParent, $pageToken); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmMigrationClient->listReplicationCycles($formattedParent, $pageToken); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent, which owns this collection of ReplicationCycles. - * @param string $pageToken A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $filter - * Optional. The filter request. - * @type string $orderBy - * Optional. the order by fields for the result. - * @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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listReplicationCycles( - $parent, - $pageToken, - array $optionalArgs = [] - ) { - $request = new ListReplicationCyclesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPageToken($pageToken); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListReplicationCycles', - $optionalArgs, - ListReplicationCyclesResponse::class, - $request - ); - } - - /** - * Lists Sources in a given project and location. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); - * $pageToken = 'page_token'; - * // Iterate over pages of elements - * $pagedResponse = $vmMigrationClient->listSources($formattedParent, $pageToken); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmMigrationClient->listSources($formattedParent, $pageToken); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent, which owns this collection of sources. - * @param string $pageToken A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $filter - * Optional. The filter request. - * @type string $orderBy - * Optional. the order by fields for the result. - * @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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listSources($parent, $pageToken, array $optionalArgs = []) - { - $request = new ListSourcesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPageToken($pageToken); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListSources', - $optionalArgs, - ListSourcesResponse::class, - $request - ); - } - - /** - * Lists TargetProjects in a given project. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); - * $pageToken = 'page_token'; - * // Iterate over pages of elements - * $pagedResponse = $vmMigrationClient->listTargetProjects($formattedParent, $pageToken); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmMigrationClient->listTargetProjects($formattedParent, $pageToken); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent, which owns this collection of targets. - * @param string $pageToken A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $filter - * Optional. The filter request. - * @type string $orderBy - * Optional. the order by fields for the result. - * @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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listTargetProjects( - $parent, - $pageToken, - array $optionalArgs = [] - ) { - $request = new ListTargetProjectsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPageToken($pageToken); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListTargetProjects', - $optionalArgs, - ListTargetProjectsResponse::class, - $request - ); - } - - /** - * Lists Utilization Reports of the given Source. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - * $pageToken = 'page_token'; - * // Iterate over pages of elements - * $pagedResponse = $vmMigrationClient->listUtilizationReports($formattedParent, $pageToken); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmMigrationClient->listUtilizationReports($formattedParent, $pageToken); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $parent Required. The Utilization Reports parent. - * @param string $pageToken A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @param array $optionalArgs { - * Optional. - * - * @type int $view - * Optional. The level of details of each report. - * Defaults to BASIC. - * For allowed values, use constants defined on {@see \Google\Cloud\VMMigration\V1\UtilizationReportView} - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $filter - * Optional. The filter request. - * @type string $orderBy - * Optional. the order by fields for the result. - * @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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listUtilizationReports( - $parent, - $pageToken, - array $optionalArgs = [] - ) { - $request = new ListUtilizationReportsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setPageToken($pageToken); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListUtilizationReports', - $optionalArgs, - ListUtilizationReportsResponse::class, - $request - ); - } - - /** - * Pauses a migration for a VM. If cycle tasks are running they will be - * cancelled, preserving source task data. Further replication cycles will not - * be triggered while the VM is paused. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedMigratingVm = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - * $operationResponse = $vmMigrationClient->pauseMigration($formattedMigratingVm); - * $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 = $vmMigrationClient->pauseMigration($formattedMigratingVm); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'pauseMigration'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $migratingVm Required. The name of the MigratingVm. - * @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 pauseMigration($migratingVm, array $optionalArgs = []) - { - $request = new PauseMigrationRequest(); - $requestParamHeaders = []; - $request->setMigratingVm($migratingVm); - $requestParamHeaders['migrating_vm'] = $migratingVm; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'PauseMigration', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Removes a MigratingVm from a Group. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedGroup = $vmMigrationClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - * $operationResponse = $vmMigrationClient->removeGroupMigration($formattedGroup); - * $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 = $vmMigrationClient->removeGroupMigration($formattedGroup); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'removeGroupMigration'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $group Required. The name of the Group. - * @param array $optionalArgs { - * Optional. - * - * @type string $migratingVm - * The MigratingVm to remove. - * @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 removeGroupMigration($group, array $optionalArgs = []) - { - $request = new RemoveGroupMigrationRequest(); - $requestParamHeaders = []; - $request->setGroup($group); - $requestParamHeaders['group'] = $group; - if (isset($optionalArgs['migratingVm'])) { - $request->setMigratingVm($optionalArgs['migratingVm']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'RemoveGroupMigration', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Resumes a migration for a VM. When called on a paused migration, will start - * the process of uploading data and creating snapshots; when called on a - * completed cut-over migration, will update the migration to active state and - * start the process of uploading data and creating snapshots. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedMigratingVm = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - * $operationResponse = $vmMigrationClient->resumeMigration($formattedMigratingVm); - * $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 = $vmMigrationClient->resumeMigration($formattedMigratingVm); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'resumeMigration'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $migratingVm Required. The name of the MigratingVm. - * @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 resumeMigration($migratingVm, array $optionalArgs = []) - { - $request = new ResumeMigrationRequest(); - $requestParamHeaders = []; - $request->setMigratingVm($migratingVm); - $requestParamHeaders['migrating_vm'] = $migratingVm; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'ResumeMigration', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Starts migration for a VM. Starts the process of uploading - * data and creating snapshots, in replication cycles scheduled by the policy. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedMigratingVm = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - * $operationResponse = $vmMigrationClient->startMigration($formattedMigratingVm); - * $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 = $vmMigrationClient->startMigration($formattedMigratingVm); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'startMigration'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $migratingVm Required. The name of the MigratingVm. - * @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 startMigration($migratingVm, array $optionalArgs = []) - { - $request = new StartMigrationRequest(); - $requestParamHeaders = []; - $request->setMigratingVm($migratingVm); - $requestParamHeaders['migrating_vm'] = $migratingVm; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'StartMigration', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the parameters of a single Group. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $group = new Group(); - * $operationResponse = $vmMigrationClient->updateGroup($group); - * $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 = $vmMigrationClient->updateGroup($group); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'updateGroup'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param Group $group Required. The update request body. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the - * Group resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @type string $requestId - * A 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). - * @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 updateGroup($group, array $optionalArgs = []) - { - $request = new UpdateGroupRequest(); - $requestParamHeaders = []; - $request->setGroup($group); - $requestParamHeaders['group.name'] = $group->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateGroup', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the parameters of a single MigratingVm. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $migratingVm = new MigratingVm(); - * $operationResponse = $vmMigrationClient->updateMigratingVm($migratingVm); - * $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 = $vmMigrationClient->updateMigratingVm($migratingVm); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'updateMigratingVm'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param MigratingVm $migratingVm Required. The update request body. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the - * MigratingVm resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @type string $requestId - * A 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). - * @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 updateMigratingVm($migratingVm, array $optionalArgs = []) - { - $request = new UpdateMigratingVmRequest(); - $requestParamHeaders = []; - $request->setMigratingVm($migratingVm); - $requestParamHeaders['migrating_vm.name'] = $migratingVm->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateMigratingVm', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the parameters of a single Source. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $source = new Source(); - * $operationResponse = $vmMigrationClient->updateSource($source); - * $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 = $vmMigrationClient->updateSource($source); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'updateSource'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param Source $source Required. The update request body. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the - * Source resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @type string $requestId - * A 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). - * @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 updateSource($source, array $optionalArgs = []) - { - $request = new UpdateSourceRequest(); - $requestParamHeaders = []; - $request->setSource($source); - $requestParamHeaders['source.name'] = $source->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateSource', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Updates the parameters of a single TargetProject. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $targetProject = new TargetProject(); - * $operationResponse = $vmMigrationClient->updateTargetProject($targetProject); - * $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 = $vmMigrationClient->updateTargetProject($targetProject); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'updateTargetProject'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param TargetProject $targetProject Required. The update request body. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Field mask is used to specify the fields to be overwritten in the - * TargetProject resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @type string $requestId - * A 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). - * @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 updateTargetProject( - $targetProject, - array $optionalArgs = [] - ) { - $request = new UpdateTargetProjectRequest(); - $requestParamHeaders = []; - $request->setTargetProject($targetProject); - $requestParamHeaders['target_project.name'] = $targetProject->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpdateTargetProject', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Upgrades the appliance relate to this DatacenterConnector to the in-place - * updateable version. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $formattedDatacenterConnector = $vmMigrationClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - * $operationResponse = $vmMigrationClient->upgradeAppliance($formattedDatacenterConnector); - * $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 = $vmMigrationClient->upgradeAppliance($formattedDatacenterConnector); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'upgradeAppliance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param string $datacenterConnector Required. The DatacenterConnector name. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * A 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 after 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). - * @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 upgradeAppliance( - $datacenterConnector, - array $optionalArgs = [] - ) { - $request = new UpgradeApplianceRequest(); - $requestParamHeaders = []; - $request->setDatacenterConnector($datacenterConnector); - $requestParamHeaders['datacenter_connector'] = $datacenterConnector; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'UpgradeAppliance', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Gets information about a location. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * $response = $vmMigrationClient->getLocation(); - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Resource name for the location. - * @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\Cloud\Location\Location - * - * @throws ApiException if the remote call fails - */ - public function getLocation(array $optionalArgs = []) - { - $request = new GetLocationRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'GetLocation', - Location::class, - $optionalArgs, - $request, - Call::UNARY_CALL, - 'google.cloud.location.Locations' - )->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * Sample code: - * ``` - * $vmMigrationClient = new VmMigrationClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $vmMigrationClient->listLocations(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vmMigrationClient->listLocations(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vmMigrationClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The resource that owns the locations collection, if applicable. - * @type string $filter - * The standard list filter. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @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\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listLocations(array $optionalArgs = []) - { - $request = new ListLocationsRequest(); - $requestParamHeaders = []; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - $requestParamHeaders['name'] = $optionalArgs['name']; - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->getPagedListResponse( - 'ListLocations', - $optionalArgs, - ListLocationsResponse::class, - $request, - 'google.cloud.location.Locations' - ); - } -} diff --git a/VmMigration/src/V1/GetCloneJobRequest.php b/VmMigration/src/V1/GetCloneJobRequest.php index 927068bd8e6a..48dce1bf1c80 100644 --- a/VmMigration/src/V1/GetCloneJobRequest.php +++ b/VmMigration/src/V1/GetCloneJobRequest.php @@ -20,7 +20,7 @@ class GetCloneJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the CloneJob. Please see diff --git a/VmMigration/src/V1/GetCutoverJobRequest.php b/VmMigration/src/V1/GetCutoverJobRequest.php index b764f18396b0..9d30019287a5 100644 --- a/VmMigration/src/V1/GetCutoverJobRequest.php +++ b/VmMigration/src/V1/GetCutoverJobRequest.php @@ -20,7 +20,7 @@ class GetCutoverJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the CutoverJob. Please see diff --git a/VmMigration/src/V1/GetDatacenterConnectorRequest.php b/VmMigration/src/V1/GetDatacenterConnectorRequest.php index 1ade9a21dfea..7aa5823e702a 100644 --- a/VmMigration/src/V1/GetDatacenterConnectorRequest.php +++ b/VmMigration/src/V1/GetDatacenterConnectorRequest.php @@ -20,7 +20,7 @@ class GetDatacenterConnectorRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the DatacenterConnector. Please see diff --git a/VmMigration/src/V1/GetGroupRequest.php b/VmMigration/src/V1/GetGroupRequest.php index ed1bbcf3f4be..fbf5c771c2d6 100644 --- a/VmMigration/src/V1/GetGroupRequest.php +++ b/VmMigration/src/V1/GetGroupRequest.php @@ -20,7 +20,7 @@ class GetGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The group name. Please see diff --git a/VmMigration/src/V1/GetMigratingVmRequest.php b/VmMigration/src/V1/GetMigratingVmRequest.php index 3095d7fd2686..3e59f540c798 100644 --- a/VmMigration/src/V1/GetMigratingVmRequest.php +++ b/VmMigration/src/V1/GetMigratingVmRequest.php @@ -20,13 +20,13 @@ class GetMigratingVmRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. The level of details of the migrating VM. * * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVmView view = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $view = 0; + protected $view = 0; /** * @param string $name Required. The name of the MigratingVm. Please see diff --git a/VmMigration/src/V1/GetReplicationCycleRequest.php b/VmMigration/src/V1/GetReplicationCycleRequest.php index 5178bd2d71a0..c86a34b32a7b 100644 --- a/VmMigration/src/V1/GetReplicationCycleRequest.php +++ b/VmMigration/src/V1/GetReplicationCycleRequest.php @@ -20,7 +20,7 @@ class GetReplicationCycleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the ReplicationCycle. Please see diff --git a/VmMigration/src/V1/GetSourceRequest.php b/VmMigration/src/V1/GetSourceRequest.php index f5535afc1488..28346a94ac29 100644 --- a/VmMigration/src/V1/GetSourceRequest.php +++ b/VmMigration/src/V1/GetSourceRequest.php @@ -20,7 +20,7 @@ class GetSourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The Source name. Please see diff --git a/VmMigration/src/V1/GetTargetProjectRequest.php b/VmMigration/src/V1/GetTargetProjectRequest.php index 0c08359ae4ed..244edd28be21 100644 --- a/VmMigration/src/V1/GetTargetProjectRequest.php +++ b/VmMigration/src/V1/GetTargetProjectRequest.php @@ -20,7 +20,7 @@ class GetTargetProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The TargetProject name. Please see diff --git a/VmMigration/src/V1/GetUtilizationReportRequest.php b/VmMigration/src/V1/GetUtilizationReportRequest.php index b821061e5d0a..eb7bac23ec7d 100644 --- a/VmMigration/src/V1/GetUtilizationReportRequest.php +++ b/VmMigration/src/V1/GetUtilizationReportRequest.php @@ -20,14 +20,14 @@ class GetUtilizationReportRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. The level of details of the report. * Defaults to FULL * * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReportView view = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $view = 0; + protected $view = 0; /** * @param string $name Required. The Utilization Report name. Please see diff --git a/VmMigration/src/V1/Group.php b/VmMigration/src/V1/Group.php index 293b238e2e39..ea661a9c1fef 100644 --- a/VmMigration/src/V1/Group.php +++ b/VmMigration/src/V1/Group.php @@ -21,31 +21,31 @@ class Group extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. The create time timestamp. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The update time timestamp. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * User-provided description of the group. * * Generated from protobuf field string description = 4; */ - private $description = ''; + protected $description = ''; /** * Display name is a user defined name for this group which can be updated. * * Generated from protobuf field string display_name = 5; */ - private $display_name = ''; + protected $display_name = ''; /** * Constructor. diff --git a/VmMigration/src/V1/ListCloneJobsRequest.php b/VmMigration/src/V1/ListCloneJobsRequest.php index ebd6e1e24df9..3d8d4efa2f3e 100644 --- a/VmMigration/src/V1/ListCloneJobsRequest.php +++ b/VmMigration/src/V1/ListCloneJobsRequest.php @@ -20,7 +20,7 @@ class ListCloneJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The maximum number of clone jobs to return. The service may * return fewer than this value. If unspecified, at most 500 clone jobs will @@ -29,7 +29,7 @@ class ListCloneJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Required. A page token, received from a previous `ListCloneJobs` call. * Provide this to retrieve the subsequent page. @@ -38,19 +38,19 @@ class ListCloneJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The filter request. * * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. the order by fields for the result. * * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent, which owns this collection of source VMs. Please see diff --git a/VmMigration/src/V1/ListCloneJobsResponse.php b/VmMigration/src/V1/ListCloneJobsResponse.php index 60c9597103e0..5c89b1f50d7c 100644 --- a/VmMigration/src/V1/ListCloneJobsResponse.php +++ b/VmMigration/src/V1/ListCloneJobsResponse.php @@ -27,7 +27,7 @@ class ListCloneJobsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Output only. Locations that could not be reached. * diff --git a/VmMigration/src/V1/ListCutoverJobsRequest.php b/VmMigration/src/V1/ListCutoverJobsRequest.php index 42fc0a599092..07b28f2c7d31 100644 --- a/VmMigration/src/V1/ListCutoverJobsRequest.php +++ b/VmMigration/src/V1/ListCutoverJobsRequest.php @@ -20,7 +20,7 @@ class ListCutoverJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The maximum number of cutover jobs to return. The service may * return fewer than this value. If unspecified, at most 500 cutover jobs will @@ -29,7 +29,7 @@ class ListCutoverJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Required. A page token, received from a previous `ListCutoverJobs` call. * Provide this to retrieve the subsequent page. @@ -38,19 +38,19 @@ class ListCutoverJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The filter request. * * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. the order by fields for the result. * * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent, which owns this collection of migrating VMs. Please see diff --git a/VmMigration/src/V1/ListCutoverJobsResponse.php b/VmMigration/src/V1/ListCutoverJobsResponse.php index adb82522aa5b..0eb0adebbb36 100644 --- a/VmMigration/src/V1/ListCutoverJobsResponse.php +++ b/VmMigration/src/V1/ListCutoverJobsResponse.php @@ -27,7 +27,7 @@ class ListCutoverJobsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Output only. Locations that could not be reached. * diff --git a/VmMigration/src/V1/ListDatacenterConnectorsRequest.php b/VmMigration/src/V1/ListDatacenterConnectorsRequest.php index dc5d07f8ea40..ec0686fe621f 100644 --- a/VmMigration/src/V1/ListDatacenterConnectorsRequest.php +++ b/VmMigration/src/V1/ListDatacenterConnectorsRequest.php @@ -20,7 +20,7 @@ class ListDatacenterConnectorsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The maximum number of connectors to return. The service may * return fewer than this value. If unspecified, at most 500 sources will be @@ -29,7 +29,7 @@ class ListDatacenterConnectorsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Required. A page token, received from a previous `ListDatacenterConnectors` * call. Provide this to retrieve the subsequent page. @@ -39,19 +39,19 @@ class ListDatacenterConnectorsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The filter request. * * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. the order by fields for the result. * * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent, which owns this collection of connectors. Please see diff --git a/VmMigration/src/V1/ListDatacenterConnectorsResponse.php b/VmMigration/src/V1/ListDatacenterConnectorsResponse.php index b4fe60bfed81..8aa1c27e3113 100644 --- a/VmMigration/src/V1/ListDatacenterConnectorsResponse.php +++ b/VmMigration/src/V1/ListDatacenterConnectorsResponse.php @@ -27,7 +27,7 @@ class ListDatacenterConnectorsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Output only. Locations that could not be reached. * diff --git a/VmMigration/src/V1/ListGroupsRequest.php b/VmMigration/src/V1/ListGroupsRequest.php index d9c8e417cc19..11b8be3b9a9b 100644 --- a/VmMigration/src/V1/ListGroupsRequest.php +++ b/VmMigration/src/V1/ListGroupsRequest.php @@ -20,7 +20,7 @@ class ListGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The maximum number of groups to return. The service may return * fewer than this value. If unspecified, at most 500 groups will be @@ -29,7 +29,7 @@ class ListGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Required. A page token, received from a previous `ListGroups` call. * Provide this to retrieve the subsequent page. @@ -38,19 +38,19 @@ class ListGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The filter request. * * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. the order by fields for the result. * * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent, which owns this collection of groups. Please see diff --git a/VmMigration/src/V1/ListGroupsResponse.php b/VmMigration/src/V1/ListGroupsResponse.php index 75dd89644524..3296fe31b740 100644 --- a/VmMigration/src/V1/ListGroupsResponse.php +++ b/VmMigration/src/V1/ListGroupsResponse.php @@ -27,7 +27,7 @@ class ListGroupsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Output only. Locations that could not be reached. * diff --git a/VmMigration/src/V1/ListMigratingVmsRequest.php b/VmMigration/src/V1/ListMigratingVmsRequest.php index 290c029bd0e5..51052e3a9534 100644 --- a/VmMigration/src/V1/ListMigratingVmsRequest.php +++ b/VmMigration/src/V1/ListMigratingVmsRequest.php @@ -20,7 +20,7 @@ class ListMigratingVmsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The maximum number of migrating VMs to return. The service may * return fewer than this value. If unspecified, at most 500 migrating VMs @@ -29,7 +29,7 @@ class ListMigratingVmsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Required. A page token, received from a previous `ListMigratingVms` call. * Provide this to retrieve the subsequent page. @@ -38,25 +38,25 @@ class ListMigratingVmsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The filter request. * * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. the order by fields for the result. * * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * Optional. The level of details of each migrating VM. * * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVmView view = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $view = 0; + protected $view = 0; /** * @param string $parent Required. The parent, which owns this collection of MigratingVms. Please see diff --git a/VmMigration/src/V1/ListMigratingVmsResponse.php b/VmMigration/src/V1/ListMigratingVmsResponse.php index ec3c590b37bd..3f42ab8737dc 100644 --- a/VmMigration/src/V1/ListMigratingVmsResponse.php +++ b/VmMigration/src/V1/ListMigratingVmsResponse.php @@ -27,7 +27,7 @@ class ListMigratingVmsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Output only. Locations that could not be reached. * diff --git a/VmMigration/src/V1/ListReplicationCyclesRequest.php b/VmMigration/src/V1/ListReplicationCyclesRequest.php index f48770d1c01c..816d448a57c1 100644 --- a/VmMigration/src/V1/ListReplicationCyclesRequest.php +++ b/VmMigration/src/V1/ListReplicationCyclesRequest.php @@ -20,7 +20,7 @@ class ListReplicationCyclesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The maximum number of replication cycles to return. The service * may return fewer than this value. If unspecified, at most 100 migrating VMs @@ -29,7 +29,7 @@ class ListReplicationCyclesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Required. A page token, received from a previous `ListReplicationCycles` * call. Provide this to retrieve the subsequent page. @@ -38,19 +38,19 @@ class ListReplicationCyclesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The filter request. * * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. the order by fields for the result. * * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent, which owns this collection of ReplicationCycles. Please see diff --git a/VmMigration/src/V1/ListReplicationCyclesResponse.php b/VmMigration/src/V1/ListReplicationCyclesResponse.php index 8217c32ad4bb..2e8b8b96042f 100644 --- a/VmMigration/src/V1/ListReplicationCyclesResponse.php +++ b/VmMigration/src/V1/ListReplicationCyclesResponse.php @@ -27,7 +27,7 @@ class ListReplicationCyclesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Output only. Locations that could not be reached. * diff --git a/VmMigration/src/V1/ListSourcesRequest.php b/VmMigration/src/V1/ListSourcesRequest.php index 94cf659ca378..8286f34c3e6c 100644 --- a/VmMigration/src/V1/ListSourcesRequest.php +++ b/VmMigration/src/V1/ListSourcesRequest.php @@ -20,7 +20,7 @@ class ListSourcesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The maximum number of sources to return. The service may return * fewer than this value. If unspecified, at most 500 sources will be @@ -29,7 +29,7 @@ class ListSourcesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Required. A page token, received from a previous `ListSources` call. * Provide this to retrieve the subsequent page. @@ -38,19 +38,19 @@ class ListSourcesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The filter request. * * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. the order by fields for the result. * * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent, which owns this collection of sources. Please see diff --git a/VmMigration/src/V1/ListSourcesResponse.php b/VmMigration/src/V1/ListSourcesResponse.php index 660ab8febfa6..413cd7b0d15d 100644 --- a/VmMigration/src/V1/ListSourcesResponse.php +++ b/VmMigration/src/V1/ListSourcesResponse.php @@ -27,7 +27,7 @@ class ListSourcesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Output only. Locations that could not be reached. * diff --git a/VmMigration/src/V1/ListTargetProjectsRequest.php b/VmMigration/src/V1/ListTargetProjectsRequest.php index 82fcf0072007..82fa22a9be68 100644 --- a/VmMigration/src/V1/ListTargetProjectsRequest.php +++ b/VmMigration/src/V1/ListTargetProjectsRequest.php @@ -20,7 +20,7 @@ class ListTargetProjectsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The maximum number of targets to return. The service may return * fewer than this value. If unspecified, at most 500 targets will be @@ -29,7 +29,7 @@ class ListTargetProjectsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Required. A page token, received from a previous `ListTargets` call. * Provide this to retrieve the subsequent page. @@ -38,19 +38,19 @@ class ListTargetProjectsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The filter request. * * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. the order by fields for the result. * * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The parent, which owns this collection of targets. Please see diff --git a/VmMigration/src/V1/ListTargetProjectsResponse.php b/VmMigration/src/V1/ListTargetProjectsResponse.php index a12de9c559d1..a51c7c607f95 100644 --- a/VmMigration/src/V1/ListTargetProjectsResponse.php +++ b/VmMigration/src/V1/ListTargetProjectsResponse.php @@ -27,7 +27,7 @@ class ListTargetProjectsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Output only. Locations that could not be reached. * diff --git a/VmMigration/src/V1/ListUtilizationReportsRequest.php b/VmMigration/src/V1/ListUtilizationReportsRequest.php index b24548cbe33a..a1b2d9ef827f 100644 --- a/VmMigration/src/V1/ListUtilizationReportsRequest.php +++ b/VmMigration/src/V1/ListUtilizationReportsRequest.php @@ -20,14 +20,14 @@ class ListUtilizationReportsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. The level of details of each report. * Defaults to BASIC. * * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReportView view = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $view = 0; + protected $view = 0; /** * Optional. The maximum number of reports to return. The service may return * fewer than this value. If unspecified, at most 500 reports will be @@ -36,7 +36,7 @@ class ListUtilizationReportsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Required. A page token, received from a previous `ListUtilizationReports` * call. Provide this to retrieve the subsequent page. @@ -45,19 +45,19 @@ class ListUtilizationReportsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $page_token = ''; + protected $page_token = ''; /** * Optional. The filter request. * * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. the order by fields for the result. * * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $order_by = ''; + protected $order_by = ''; /** * @param string $parent Required. The Utilization Reports parent. Please see diff --git a/VmMigration/src/V1/ListUtilizationReportsResponse.php b/VmMigration/src/V1/ListUtilizationReportsResponse.php index be3a71b3ccca..a82c22f473b4 100644 --- a/VmMigration/src/V1/ListUtilizationReportsResponse.php +++ b/VmMigration/src/V1/ListUtilizationReportsResponse.php @@ -27,7 +27,7 @@ class ListUtilizationReportsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Output only. Locations that could not be reached. * diff --git a/VmMigration/src/V1/MigratingVm.php b/VmMigration/src/V1/MigratingVm.php index c6e5be7f264c..a86771ba3c43 100644 --- a/VmMigration/src/V1/MigratingVm.php +++ b/VmMigration/src/V1/MigratingVm.php @@ -21,7 +21,7 @@ class MigratingVm extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * The unique ID of the VM in the source. * The VM's name in vSphere can be changed, so this is not the VM's name but @@ -29,64 +29,64 @@ class MigratingVm extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string source_vm_id = 2; */ - private $source_vm_id = ''; + protected $source_vm_id = ''; /** * The display name attached to the MigratingVm by the user. * * Generated from protobuf field string display_name = 18; */ - private $display_name = ''; + protected $display_name = ''; /** * The description attached to the migrating VM by the user. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * The replication schedule policy. * * Generated from protobuf field .google.cloud.vmmigration.v1.SchedulePolicy policy = 8; */ - private $policy = null; + protected $policy = null; /** * Output only. The time the migrating VM was created (this refers to this * resource and not to the time it was installed in the source). * * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The last time the migrating VM resource was updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Output only. The most updated snapshot created time in the source that * finished replication. * * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationSync last_sync = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $last_sync = null; + protected $last_sync = null; /** * Output only. State of the MigratingVm. * * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm.State state = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The last time the migrating VM state was updated. * * Generated from protobuf field .google.protobuf.Timestamp state_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state_time = null; + protected $state_time = null; /** * Output only. The percentage progress of the current running replication * cycle. * * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle current_sync_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $current_sync_info = null; + protected $current_sync_info = null; /** * Output only. The group this migrating vm is included in, if any. The group * is represented by the full path of the appropriate @@ -94,7 +94,7 @@ class MigratingVm extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string group = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { */ - private $group = ''; + protected $group = ''; /** * The labels of the migrating VM. * @@ -117,7 +117,7 @@ class MigratingVm extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.rpc.Status error = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Output only. The recent cutover jobs performed on the migrating VM. * This field holds the vm's last completed cutover job and the vm's diff --git a/VmMigration/src/V1/MigrationError.php b/VmMigration/src/V1/MigrationError.php index a897dd07fe2f..55181c0327d9 100644 --- a/VmMigration/src/V1/MigrationError.php +++ b/VmMigration/src/V1/MigrationError.php @@ -22,19 +22,19 @@ class MigrationError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmmigration.v1.MigrationError.ErrorCode code = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $code = 0; + protected $code = 0; /** * Output only. The localized error message. * * Generated from protobuf field .google.rpc.LocalizedMessage error_message = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error_message = null; + protected $error_message = null; /** * Output only. Suggested action for solving the error. * * Generated from protobuf field .google.rpc.LocalizedMessage action_item = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $action_item = null; + protected $action_item = null; /** * Output only. URL(s) pointing to additional information on handling the * current error. @@ -47,7 +47,7 @@ class MigrationError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp error_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error_time = null; + protected $error_time = null; /** * Constructor. diff --git a/VmMigration/src/V1/NetworkInterface.php b/VmMigration/src/V1/NetworkInterface.php index 49eead118adf..e70ad652db3a 100644 --- a/VmMigration/src/V1/NetworkInterface.php +++ b/VmMigration/src/V1/NetworkInterface.php @@ -20,13 +20,13 @@ class NetworkInterface extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 1; */ - private $network = ''; + protected $network = ''; /** * The subnetwork to connect the NIC to. * * Generated from protobuf field string subnetwork = 2; */ - private $subnetwork = ''; + protected $subnetwork = ''; /** * The internal IP to define in the NIC. * The formats accepted are: `ephemeral` \ ipv4 address \ a named address @@ -34,13 +34,13 @@ class NetworkInterface extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string internal_ip = 3; */ - private $internal_ip = ''; + protected $internal_ip = ''; /** * The external IP to define in the NIC. * * Generated from protobuf field string external_ip = 4; */ - private $external_ip = ''; + protected $external_ip = ''; /** * Constructor. diff --git a/VmMigration/src/V1/OperationMetadata.php b/VmMigration/src/V1/OperationMetadata.php index 54f4ed13bcb1..3174fc524175 100644 --- a/VmMigration/src/V1/OperationMetadata.php +++ b/VmMigration/src/V1/OperationMetadata.php @@ -20,31 +20,31 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The time the operation finished running. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $end_time = null; + protected $end_time = null; /** * Output only. Server-defined resource path for the target of the operation. * * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $target = ''; + protected $target = ''; /** * Output only. Name of the verb executed by the operation. * * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $verb = ''; + protected $verb = ''; /** * Output only. Human-readable status of the operation, if any. * * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $status_message = ''; + protected $status_message = ''; /** * Output only. Identifies whether the user has requested cancellation * of the operation. Operations that have successfully been cancelled @@ -54,13 +54,13 @@ class OperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $requested_cancellation = false; + protected $requested_cancellation = false; /** * Output only. API version used to start the operation. * * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $api_version = ''; + protected $api_version = ''; /** * Constructor. diff --git a/VmMigration/src/V1/PauseMigrationRequest.php b/VmMigration/src/V1/PauseMigrationRequest.php index 76fcb8fa1ce1..bd578e77b383 100644 --- a/VmMigration/src/V1/PauseMigrationRequest.php +++ b/VmMigration/src/V1/PauseMigrationRequest.php @@ -20,7 +20,7 @@ class PauseMigrationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $migrating_vm = ''; + protected $migrating_vm = ''; /** * Constructor. diff --git a/VmMigration/src/V1/RemoveGroupMigrationRequest.php b/VmMigration/src/V1/RemoveGroupMigrationRequest.php index aa1a961c387e..5aa1a199ff07 100644 --- a/VmMigration/src/V1/RemoveGroupMigrationRequest.php +++ b/VmMigration/src/V1/RemoveGroupMigrationRequest.php @@ -20,13 +20,13 @@ class RemoveGroupMigrationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string group = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $group = ''; + protected $group = ''; /** * The MigratingVm to remove. * * Generated from protobuf field string migrating_vm = 2 [(.google.api.resource_reference) = { */ - private $migrating_vm = ''; + protected $migrating_vm = ''; /** * @param string $group Required. The name of the Group. Please see diff --git a/VmMigration/src/V1/ReplicatingStep.php b/VmMigration/src/V1/ReplicatingStep.php index 92f21f1681b0..c0191fc596f3 100644 --- a/VmMigration/src/V1/ReplicatingStep.php +++ b/VmMigration/src/V1/ReplicatingStep.php @@ -20,27 +20,27 @@ class ReplicatingStep extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 total_bytes = 1; */ - private $total_bytes = 0; + protected $total_bytes = 0; /** * Replicated bytes in the step. * * Generated from protobuf field int64 replicated_bytes = 2; */ - private $replicated_bytes = 0; + protected $replicated_bytes = 0; /** * The source disks replication rate for the last 2 minutes in bytes per * second. * * Generated from protobuf field int64 last_two_minutes_average_bytes_per_second = 3; */ - private $last_two_minutes_average_bytes_per_second = 0; + protected $last_two_minutes_average_bytes_per_second = 0; /** * The source disks replication rate for the last 30 minutes in bytes per * second. * * Generated from protobuf field int64 last_thirty_minutes_average_bytes_per_second = 4; */ - private $last_thirty_minutes_average_bytes_per_second = 0; + protected $last_thirty_minutes_average_bytes_per_second = 0; /** * Constructor. diff --git a/VmMigration/src/V1/ReplicationCycle.php b/VmMigration/src/V1/ReplicationCycle.php index 32ee6868a08b..54c3bf4c6ee3 100644 --- a/VmMigration/src/V1/ReplicationCycle.php +++ b/VmMigration/src/V1/ReplicationCycle.php @@ -21,31 +21,31 @@ class ReplicationCycle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 13; */ - private $name = ''; + protected $name = ''; /** * The cycle's ordinal number. * * Generated from protobuf field int32 cycle_number = 10; */ - private $cycle_number = 0; + protected $cycle_number = 0; /** * The time the replication cycle has started. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; */ - private $start_time = null; + protected $start_time = null; /** * The time the replication cycle has ended. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 6; */ - private $end_time = null; + protected $end_time = null; /** * The accumulated duration the replication cycle was paused. * * Generated from protobuf field .google.protobuf.Duration total_pause_duration = 7; */ - private $total_pause_duration = null; + protected $total_pause_duration = null; /** * The current progress in percentage of this cycle. * Was replaced by 'steps' field, which breaks down the cycle progression more @@ -66,13 +66,13 @@ class ReplicationCycle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle.State state = 11; */ - private $state = 0; + protected $state = 0; /** * Provides details on the state of the cycle in case of an error. * * Generated from protobuf field .google.rpc.Status error = 12; */ - private $error = null; + protected $error = null; /** * Constructor. diff --git a/VmMigration/src/V1/ReplicationSync.php b/VmMigration/src/V1/ReplicationSync.php index 0f3e863619ac..5723d6e67f45 100644 --- a/VmMigration/src/V1/ReplicationSync.php +++ b/VmMigration/src/V1/ReplicationSync.php @@ -21,7 +21,7 @@ class ReplicationSync extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp last_sync_time = 1; */ - private $last_sync_time = null; + protected $last_sync_time = null; /** * Constructor. diff --git a/VmMigration/src/V1/ResumeMigrationRequest.php b/VmMigration/src/V1/ResumeMigrationRequest.php index b7a0a6a27b30..b907eb8348b4 100644 --- a/VmMigration/src/V1/ResumeMigrationRequest.php +++ b/VmMigration/src/V1/ResumeMigrationRequest.php @@ -20,7 +20,7 @@ class ResumeMigrationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $migrating_vm = ''; + protected $migrating_vm = ''; /** * Constructor. diff --git a/VmMigration/src/V1/SchedulePolicy.php b/VmMigration/src/V1/SchedulePolicy.php index dc46baf83cad..0ef6fde8d9da 100644 --- a/VmMigration/src/V1/SchedulePolicy.php +++ b/VmMigration/src/V1/SchedulePolicy.php @@ -20,7 +20,7 @@ class SchedulePolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration idle_duration = 1; */ - private $idle_duration = null; + protected $idle_duration = null; /** * A flag to indicate whether to skip OS adaptation during the replication * sync. OS adaptation is a process where the VM's operating system undergoes @@ -28,7 +28,7 @@ class SchedulePolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool skip_os_adaptation = 2; */ - private $skip_os_adaptation = false; + protected $skip_os_adaptation = false; /** * Constructor. diff --git a/VmMigration/src/V1/SchedulingNodeAffinity.php b/VmMigration/src/V1/SchedulingNodeAffinity.php index 4d0ceb2b1354..d66ecb3f057e 100644 --- a/VmMigration/src/V1/SchedulingNodeAffinity.php +++ b/VmMigration/src/V1/SchedulingNodeAffinity.php @@ -22,14 +22,14 @@ class SchedulingNodeAffinity extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string key = 1; */ - private $key = ''; + protected $key = ''; /** * The operator to use for the node resources specified in the `values` * parameter. * * Generated from protobuf field .google.cloud.vmmigration.v1.SchedulingNodeAffinity.Operator operator = 2; */ - private $operator = 0; + protected $operator = 0; /** * Corresponds to the label values of Node resource. * diff --git a/VmMigration/src/V1/Source.php b/VmMigration/src/V1/Source.php index 3ac3026413e5..ae1ab78c28ca 100644 --- a/VmMigration/src/V1/Source.php +++ b/VmMigration/src/V1/Source.php @@ -21,19 +21,19 @@ class Source extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * Output only. The create time timestamp. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The update time timestamp. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * The labels of the source. * @@ -45,7 +45,7 @@ class Source extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string description = 6; */ - private $description = ''; + protected $description = ''; protected $source_details; /** diff --git a/VmMigration/src/V1/StartMigrationRequest.php b/VmMigration/src/V1/StartMigrationRequest.php index 5788a100b433..4e456d7c4f89 100644 --- a/VmMigration/src/V1/StartMigrationRequest.php +++ b/VmMigration/src/V1/StartMigrationRequest.php @@ -20,7 +20,7 @@ class StartMigrationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $migrating_vm = ''; + protected $migrating_vm = ''; /** * @param string $migratingVm Required. The name of the MigratingVm. Please see diff --git a/VmMigration/src/V1/TargetProject.php b/VmMigration/src/V1/TargetProject.php index 40587b8c7891..d19fb184997d 100644 --- a/VmMigration/src/V1/TargetProject.php +++ b/VmMigration/src/V1/TargetProject.php @@ -21,32 +21,32 @@ class TargetProject extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * The target project ID (number) or project name. * * Generated from protobuf field string project = 2; */ - private $project = ''; + protected $project = ''; /** * The target project's description. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Output only. The time this target project resource was created (not related * to when the Compute Engine project it points to was created). * * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Output only. The last time the target project resource was updated. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $update_time = null; + protected $update_time = null; /** * Constructor. diff --git a/VmMigration/src/V1/UpdateGroupRequest.php b/VmMigration/src/V1/UpdateGroupRequest.php index ec9d77d28412..c3566d1bd515 100644 --- a/VmMigration/src/V1/UpdateGroupRequest.php +++ b/VmMigration/src/V1/UpdateGroupRequest.php @@ -24,13 +24,13 @@ class UpdateGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The update request body. * * Generated from protobuf field .google.cloud.vmmigration.v1.Group group = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $group = null; + protected $group = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -46,7 +46,7 @@ class UpdateGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VMMigration\V1\Group $group Required. The update request body. diff --git a/VmMigration/src/V1/UpdateMigratingVmRequest.php b/VmMigration/src/V1/UpdateMigratingVmRequest.php index 6b86ccc9c162..4dc83e8dfef2 100644 --- a/VmMigration/src/V1/UpdateMigratingVmRequest.php +++ b/VmMigration/src/V1/UpdateMigratingVmRequest.php @@ -24,13 +24,13 @@ class UpdateMigratingVmRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The update request body. * * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $migrating_vm = null; + protected $migrating_vm = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -46,7 +46,7 @@ class UpdateMigratingVmRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VMMigration\V1\MigratingVm $migratingVm Required. The update request body. diff --git a/VmMigration/src/V1/UpdateSourceRequest.php b/VmMigration/src/V1/UpdateSourceRequest.php index fa1e2a4d5d83..6fedf6b84370 100644 --- a/VmMigration/src/V1/UpdateSourceRequest.php +++ b/VmMigration/src/V1/UpdateSourceRequest.php @@ -24,13 +24,13 @@ class UpdateSourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The update request body. * * Generated from protobuf field .google.cloud.vmmigration.v1.Source source = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $source = null; + protected $source = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -46,7 +46,7 @@ class UpdateSourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VMMigration\V1\Source $source Required. The update request body. diff --git a/VmMigration/src/V1/UpdateTargetProjectRequest.php b/VmMigration/src/V1/UpdateTargetProjectRequest.php index 503c88793186..64f7eaec9709 100644 --- a/VmMigration/src/V1/UpdateTargetProjectRequest.php +++ b/VmMigration/src/V1/UpdateTargetProjectRequest.php @@ -24,13 +24,13 @@ class UpdateTargetProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; */ - private $update_mask = null; + protected $update_mask = null; /** * Required. The update request body. * * Generated from protobuf field .google.cloud.vmmigration.v1.TargetProject target_project = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_project = null; + protected $target_project = null; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -46,7 +46,7 @@ class UpdateTargetProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 3; */ - private $request_id = ''; + protected $request_id = ''; /** * @param \Google\Cloud\VMMigration\V1\TargetProject $targetProject Required. The update request body. diff --git a/VmMigration/src/V1/UpgradeApplianceRequest.php b/VmMigration/src/V1/UpgradeApplianceRequest.php index 98cc90917453..ceb9df3af2cf 100644 --- a/VmMigration/src/V1/UpgradeApplianceRequest.php +++ b/VmMigration/src/V1/UpgradeApplianceRequest.php @@ -20,7 +20,7 @@ class UpgradeApplianceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string datacenter_connector = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $datacenter_connector = ''; + protected $datacenter_connector = ''; /** * A request ID to identify requests. Specify a unique request ID * so that if you must retry your request, the server will know to ignore @@ -36,7 +36,7 @@ class UpgradeApplianceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_id = 2; */ - private $request_id = ''; + protected $request_id = ''; /** * Constructor. diff --git a/VmMigration/src/V1/UpgradeStatus.php b/VmMigration/src/V1/UpgradeStatus.php index 35c1fe62a969..ed6bf097167b 100644 --- a/VmMigration/src/V1/UpgradeStatus.php +++ b/VmMigration/src/V1/UpgradeStatus.php @@ -20,31 +20,31 @@ class UpgradeStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string version = 1; */ - private $version = ''; + protected $version = ''; /** * The state of the upgradeAppliance operation. * * Generated from protobuf field .google.cloud.vmmigration.v1.UpgradeStatus.State state = 2; */ - private $state = 0; + protected $state = 0; /** * Provides details on the state of the upgrade operation in case of an error. * * Generated from protobuf field .google.rpc.Status error = 3; */ - private $error = null; + protected $error = null; /** * The time the operation was started. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; */ - private $start_time = null; + protected $start_time = null; /** * The version from which we upgraded. * * Generated from protobuf field string previous_version = 5; */ - private $previous_version = ''; + protected $previous_version = ''; /** * Constructor. diff --git a/VmMigration/src/V1/UtilizationReport.php b/VmMigration/src/V1/UtilizationReport.php index cefa9571508d..322d7e9820a8 100644 --- a/VmMigration/src/V1/UtilizationReport.php +++ b/VmMigration/src/V1/UtilizationReport.php @@ -21,45 +21,45 @@ class UtilizationReport extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $name = ''; + protected $name = ''; /** * The report display name, as assigned by the user. * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * Output only. Current state of the report. * * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state = 0; + protected $state = 0; /** * Output only. The time the state was last set. * * Generated from protobuf field .google.protobuf.Timestamp state_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $state_time = null; + protected $state_time = null; /** * Output only. Provides details on the state of the report in case of an * error. * * Generated from protobuf field .google.rpc.Status error = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $error = null; + protected $error = null; /** * Output only. The time the report was created (this refers to the time of * the request, not the time the report creation completed). * * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $create_time = null; + protected $create_time = null; /** * Time frame of the report. * * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport.TimeFrame time_frame = 7; */ - private $time_frame = 0; + protected $time_frame = 0; /** * Output only. The point in time when the time frame ends. Notice that the * time frame is counted backwards. For instance if the "frame_end_time" value @@ -68,13 +68,13 @@ class UtilizationReport extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp frame_end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $frame_end_time = null; + protected $frame_end_time = null; /** * Output only. Total number of VMs included in the report. * * Generated from protobuf field int32 vm_count = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $vm_count = 0; + protected $vm_count = 0; /** * List of utilization information per VM. * When sent as part of the request, the "vm_id" field is used in order to diff --git a/VmMigration/src/V1/VmMigrationClient.php b/VmMigration/src/V1/VmMigrationClient.php deleted file mode 100644 index 41c1ac400a7b..000000000000 --- a/VmMigration/src/V1/VmMigrationClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/ListSources', - $argument, - ['\Google\Cloud\VMMigration\V1\ListSourcesResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets details of a single Source. - * @param \Google\Cloud\VMMigration\V1\GetSourceRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetSource(\Google\Cloud\VMMigration\V1\GetSourceRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/GetSource', - $argument, - ['\Google\Cloud\VMMigration\V1\Source', 'decode'], - $metadata, $options); - } - - /** - * Creates a new Source in a given project and location. - * @param \Google\Cloud\VMMigration\V1\CreateSourceRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateSource(\Google\Cloud\VMMigration\V1\CreateSourceRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/CreateSource', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates the parameters of a single Source. - * @param \Google\Cloud\VMMigration\V1\UpdateSourceRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateSource(\Google\Cloud\VMMigration\V1\UpdateSourceRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/UpdateSource', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes a single Source. - * @param \Google\Cloud\VMMigration\V1\DeleteSourceRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteSource(\Google\Cloud\VMMigration\V1\DeleteSourceRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/DeleteSource', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * List remote source's inventory of VMs. - * The remote source is the onprem vCenter (remote in the sense it's not in - * Compute Engine). The inventory describes the list of existing VMs in that - * source. Note that this operation lists the VMs on the remote source, as - * opposed to listing the MigratingVms resources in the vmmigration service. - * @param \Google\Cloud\VMMigration\V1\FetchInventoryRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function FetchInventory(\Google\Cloud\VMMigration\V1\FetchInventoryRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/FetchInventory', - $argument, - ['\Google\Cloud\VMMigration\V1\FetchInventoryResponse', 'decode'], - $metadata, $options); - } - - /** - * Lists Utilization Reports of the given Source. - * @param \Google\Cloud\VMMigration\V1\ListUtilizationReportsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListUtilizationReports(\Google\Cloud\VMMigration\V1\ListUtilizationReportsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/ListUtilizationReports', - $argument, - ['\Google\Cloud\VMMigration\V1\ListUtilizationReportsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets a single Utilization Report. - * @param \Google\Cloud\VMMigration\V1\GetUtilizationReportRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetUtilizationReport(\Google\Cloud\VMMigration\V1\GetUtilizationReportRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/GetUtilizationReport', - $argument, - ['\Google\Cloud\VMMigration\V1\UtilizationReport', 'decode'], - $metadata, $options); - } - - /** - * Creates a new UtilizationReport. - * @param \Google\Cloud\VMMigration\V1\CreateUtilizationReportRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateUtilizationReport(\Google\Cloud\VMMigration\V1\CreateUtilizationReportRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/CreateUtilizationReport', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes a single Utilization Report. - * @param \Google\Cloud\VMMigration\V1\DeleteUtilizationReportRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteUtilizationReport(\Google\Cloud\VMMigration\V1\DeleteUtilizationReportRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/DeleteUtilizationReport', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists DatacenterConnectors in a given Source. - * @param \Google\Cloud\VMMigration\V1\ListDatacenterConnectorsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListDatacenterConnectors(\Google\Cloud\VMMigration\V1\ListDatacenterConnectorsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/ListDatacenterConnectors', - $argument, - ['\Google\Cloud\VMMigration\V1\ListDatacenterConnectorsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets details of a single DatacenterConnector. - * @param \Google\Cloud\VMMigration\V1\GetDatacenterConnectorRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetDatacenterConnector(\Google\Cloud\VMMigration\V1\GetDatacenterConnectorRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/GetDatacenterConnector', - $argument, - ['\Google\Cloud\VMMigration\V1\DatacenterConnector', 'decode'], - $metadata, $options); - } - - /** - * Creates a new DatacenterConnector in a given Source. - * @param \Google\Cloud\VMMigration\V1\CreateDatacenterConnectorRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateDatacenterConnector(\Google\Cloud\VMMigration\V1\CreateDatacenterConnectorRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/CreateDatacenterConnector', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes a single DatacenterConnector. - * @param \Google\Cloud\VMMigration\V1\DeleteDatacenterConnectorRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteDatacenterConnector(\Google\Cloud\VMMigration\V1\DeleteDatacenterConnectorRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/DeleteDatacenterConnector', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Upgrades the appliance relate to this DatacenterConnector to the in-place - * updateable version. - * @param \Google\Cloud\VMMigration\V1\UpgradeApplianceRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpgradeAppliance(\Google\Cloud\VMMigration\V1\UpgradeApplianceRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/UpgradeAppliance', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Creates a new MigratingVm in a given Source. - * @param \Google\Cloud\VMMigration\V1\CreateMigratingVmRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateMigratingVm(\Google\Cloud\VMMigration\V1\CreateMigratingVmRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/CreateMigratingVm', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists MigratingVms in a given Source. - * @param \Google\Cloud\VMMigration\V1\ListMigratingVmsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListMigratingVms(\Google\Cloud\VMMigration\V1\ListMigratingVmsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/ListMigratingVms', - $argument, - ['\Google\Cloud\VMMigration\V1\ListMigratingVmsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets details of a single MigratingVm. - * @param \Google\Cloud\VMMigration\V1\GetMigratingVmRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetMigratingVm(\Google\Cloud\VMMigration\V1\GetMigratingVmRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/GetMigratingVm', - $argument, - ['\Google\Cloud\VMMigration\V1\MigratingVm', 'decode'], - $metadata, $options); - } - - /** - * Updates the parameters of a single MigratingVm. - * @param \Google\Cloud\VMMigration\V1\UpdateMigratingVmRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateMigratingVm(\Google\Cloud\VMMigration\V1\UpdateMigratingVmRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/UpdateMigratingVm', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes a single MigratingVm. - * @param \Google\Cloud\VMMigration\V1\DeleteMigratingVmRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteMigratingVm(\Google\Cloud\VMMigration\V1\DeleteMigratingVmRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/DeleteMigratingVm', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Starts migration for a VM. Starts the process of uploading - * data and creating snapshots, in replication cycles scheduled by the policy. - * @param \Google\Cloud\VMMigration\V1\StartMigrationRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function StartMigration(\Google\Cloud\VMMigration\V1\StartMigrationRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/StartMigration', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Resumes a migration for a VM. When called on a paused migration, will start - * the process of uploading data and creating snapshots; when called on a - * completed cut-over migration, will update the migration to active state and - * start the process of uploading data and creating snapshots. - * @param \Google\Cloud\VMMigration\V1\ResumeMigrationRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ResumeMigration(\Google\Cloud\VMMigration\V1\ResumeMigrationRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/ResumeMigration', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Pauses a migration for a VM. If cycle tasks are running they will be - * cancelled, preserving source task data. Further replication cycles will not - * be triggered while the VM is paused. - * @param \Google\Cloud\VMMigration\V1\PauseMigrationRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function PauseMigration(\Google\Cloud\VMMigration\V1\PauseMigrationRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/PauseMigration', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Marks a migration as completed, deleting migration resources that are no - * longer being used. Only applicable after cutover is done. - * @param \Google\Cloud\VMMigration\V1\FinalizeMigrationRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function FinalizeMigration(\Google\Cloud\VMMigration\V1\FinalizeMigrationRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/FinalizeMigration', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Initiates a Clone of a specific migrating VM. - * @param \Google\Cloud\VMMigration\V1\CreateCloneJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateCloneJob(\Google\Cloud\VMMigration\V1\CreateCloneJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/CreateCloneJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Initiates the cancellation of a running clone job. - * @param \Google\Cloud\VMMigration\V1\CancelCloneJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CancelCloneJob(\Google\Cloud\VMMigration\V1\CancelCloneJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/CancelCloneJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists CloneJobs of a given migrating VM. - * @param \Google\Cloud\VMMigration\V1\ListCloneJobsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListCloneJobs(\Google\Cloud\VMMigration\V1\ListCloneJobsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/ListCloneJobs', - $argument, - ['\Google\Cloud\VMMigration\V1\ListCloneJobsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets details of a single CloneJob. - * @param \Google\Cloud\VMMigration\V1\GetCloneJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetCloneJob(\Google\Cloud\VMMigration\V1\GetCloneJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/GetCloneJob', - $argument, - ['\Google\Cloud\VMMigration\V1\CloneJob', 'decode'], - $metadata, $options); - } - - /** - * Initiates a Cutover of a specific migrating VM. - * The returned LRO is completed when the cutover job resource is created - * and the job is initiated. - * @param \Google\Cloud\VMMigration\V1\CreateCutoverJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateCutoverJob(\Google\Cloud\VMMigration\V1\CreateCutoverJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/CreateCutoverJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Initiates the cancellation of a running cutover job. - * @param \Google\Cloud\VMMigration\V1\CancelCutoverJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CancelCutoverJob(\Google\Cloud\VMMigration\V1\CancelCutoverJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/CancelCutoverJob', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists CutoverJobs of a given migrating VM. - * @param \Google\Cloud\VMMigration\V1\ListCutoverJobsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListCutoverJobs(\Google\Cloud\VMMigration\V1\ListCutoverJobsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/ListCutoverJobs', - $argument, - ['\Google\Cloud\VMMigration\V1\ListCutoverJobsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets details of a single CutoverJob. - * @param \Google\Cloud\VMMigration\V1\GetCutoverJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetCutoverJob(\Google\Cloud\VMMigration\V1\GetCutoverJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/GetCutoverJob', - $argument, - ['\Google\Cloud\VMMigration\V1\CutoverJob', 'decode'], - $metadata, $options); - } - - /** - * Lists Groups in a given project and location. - * @param \Google\Cloud\VMMigration\V1\ListGroupsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListGroups(\Google\Cloud\VMMigration\V1\ListGroupsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/ListGroups', - $argument, - ['\Google\Cloud\VMMigration\V1\ListGroupsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets details of a single Group. - * @param \Google\Cloud\VMMigration\V1\GetGroupRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetGroup(\Google\Cloud\VMMigration\V1\GetGroupRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/GetGroup', - $argument, - ['\Google\Cloud\VMMigration\V1\Group', 'decode'], - $metadata, $options); - } - - /** - * Creates a new Group in a given project and location. - * @param \Google\Cloud\VMMigration\V1\CreateGroupRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateGroup(\Google\Cloud\VMMigration\V1\CreateGroupRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/CreateGroup', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates the parameters of a single Group. - * @param \Google\Cloud\VMMigration\V1\UpdateGroupRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateGroup(\Google\Cloud\VMMigration\V1\UpdateGroupRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/UpdateGroup', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes a single Group. - * @param \Google\Cloud\VMMigration\V1\DeleteGroupRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteGroup(\Google\Cloud\VMMigration\V1\DeleteGroupRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/DeleteGroup', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Adds a MigratingVm to a Group. - * @param \Google\Cloud\VMMigration\V1\AddGroupMigrationRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function AddGroupMigration(\Google\Cloud\VMMigration\V1\AddGroupMigrationRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/AddGroupMigration', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Removes a MigratingVm from a Group. - * @param \Google\Cloud\VMMigration\V1\RemoveGroupMigrationRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function RemoveGroupMigration(\Google\Cloud\VMMigration\V1\RemoveGroupMigrationRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/RemoveGroupMigration', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists TargetProjects in a given project. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * @param \Google\Cloud\VMMigration\V1\ListTargetProjectsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListTargetProjects(\Google\Cloud\VMMigration\V1\ListTargetProjectsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/ListTargetProjects', - $argument, - ['\Google\Cloud\VMMigration\V1\ListTargetProjectsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets details of a single TargetProject. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * @param \Google\Cloud\VMMigration\V1\GetTargetProjectRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetTargetProject(\Google\Cloud\VMMigration\V1\GetTargetProjectRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/GetTargetProject', - $argument, - ['\Google\Cloud\VMMigration\V1\TargetProject', 'decode'], - $metadata, $options); - } - - /** - * Creates a new TargetProject in a given project. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * @param \Google\Cloud\VMMigration\V1\CreateTargetProjectRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateTargetProject(\Google\Cloud\VMMigration\V1\CreateTargetProjectRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/CreateTargetProject', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Updates the parameters of a single TargetProject. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * @param \Google\Cloud\VMMigration\V1\UpdateTargetProjectRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateTargetProject(\Google\Cloud\VMMigration\V1\UpdateTargetProjectRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/UpdateTargetProject', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Deletes a single TargetProject. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * @param \Google\Cloud\VMMigration\V1\DeleteTargetProjectRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteTargetProject(\Google\Cloud\VMMigration\V1\DeleteTargetProjectRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/DeleteTargetProject', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Lists ReplicationCycles in a given MigratingVM. - * @param \Google\Cloud\VMMigration\V1\ListReplicationCyclesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListReplicationCycles(\Google\Cloud\VMMigration\V1\ListReplicationCyclesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/ListReplicationCycles', - $argument, - ['\Google\Cloud\VMMigration\V1\ListReplicationCyclesResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets details of a single ReplicationCycle. - * @param \Google\Cloud\VMMigration\V1\GetReplicationCycleRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetReplicationCycle(\Google\Cloud\VMMigration\V1\GetReplicationCycleRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.vmmigration.v1.VmMigration/GetReplicationCycle', - $argument, - ['\Google\Cloud\VMMigration\V1\ReplicationCycle', 'decode'], - $metadata, $options); - } - -} diff --git a/VmMigration/src/V1/VmUtilizationInfo.php b/VmMigration/src/V1/VmUtilizationInfo.php index 597771cc9686..8ba1b02d4c1d 100644 --- a/VmMigration/src/V1/VmUtilizationInfo.php +++ b/VmMigration/src/V1/VmUtilizationInfo.php @@ -20,13 +20,13 @@ class VmUtilizationInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vm_id = 3; */ - private $vm_id = ''; + protected $vm_id = ''; /** * Utilization metrics for this VM. * * Generated from protobuf field .google.cloud.vmmigration.v1.VmUtilizationMetrics utilization = 2; */ - private $utilization = null; + protected $utilization = null; protected $VmDetails; /** diff --git a/VmMigration/src/V1/VmUtilizationMetrics.php b/VmMigration/src/V1/VmUtilizationMetrics.php index 43a13e3c383c..e81a156532d9 100644 --- a/VmMigration/src/V1/VmUtilizationMetrics.php +++ b/VmMigration/src/V1/VmUtilizationMetrics.php @@ -20,51 +20,51 @@ class VmUtilizationMetrics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 cpu_max_percent = 9; */ - private $cpu_max_percent = 0; + protected $cpu_max_percent = 0; /** * Average CPU usage, percent. * * Generated from protobuf field int32 cpu_average_percent = 10; */ - private $cpu_average_percent = 0; + protected $cpu_average_percent = 0; /** * Max memory usage, percent. * * Generated from protobuf field int32 memory_max_percent = 11; */ - private $memory_max_percent = 0; + protected $memory_max_percent = 0; /** * Average memory usage, percent. * * Generated from protobuf field int32 memory_average_percent = 12; */ - private $memory_average_percent = 0; + protected $memory_average_percent = 0; /** * Max disk IO rate, in kilobytes per second. * * Generated from protobuf field int64 disk_io_rate_max_kbps = 13; */ - private $disk_io_rate_max_kbps = 0; + protected $disk_io_rate_max_kbps = 0; /** * Average disk IO rate, in kilobytes per second. * * Generated from protobuf field int64 disk_io_rate_average_kbps = 14; */ - private $disk_io_rate_average_kbps = 0; + protected $disk_io_rate_average_kbps = 0; /** * Max network throughput (combined transmit-rates and receive-rates), in * kilobytes per second. * * Generated from protobuf field int64 network_throughput_max_kbps = 15; */ - private $network_throughput_max_kbps = 0; + protected $network_throughput_max_kbps = 0; /** * Average network throughput (combined transmit-rates and receive-rates), in * kilobytes per second. * * Generated from protobuf field int64 network_throughput_average_kbps = 16; */ - private $network_throughput_average_kbps = 0; + protected $network_throughput_average_kbps = 0; /** * Constructor. diff --git a/VmMigration/src/V1/VmwareSourceDetails.php b/VmMigration/src/V1/VmwareSourceDetails.php index b1179c365935..751c4aebdc1a 100644 --- a/VmMigration/src/V1/VmwareSourceDetails.php +++ b/VmMigration/src/V1/VmwareSourceDetails.php @@ -21,26 +21,26 @@ class VmwareSourceDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string username = 1; */ - private $username = ''; + protected $username = ''; /** * Input only. The credentials password. This is write only and can not be * read in a GET operation. * * Generated from protobuf field string password = 2 [(.google.api.field_behavior) = INPUT_ONLY]; */ - private $password = ''; + protected $password = ''; /** * The ip address of the vcenter this Source represents. * * Generated from protobuf field string vcenter_ip = 3; */ - private $vcenter_ip = ''; + protected $vcenter_ip = ''; /** * The thumbprint representing the certificate for the vcenter. * * Generated from protobuf field string thumbprint = 4; */ - private $thumbprint = ''; + protected $thumbprint = ''; /** * Constructor. diff --git a/VmMigration/src/V1/VmwareVmDetails.php b/VmMigration/src/V1/VmwareVmDetails.php index 425c50c50fda..d35cf1bfd3eb 100644 --- a/VmMigration/src/V1/VmwareVmDetails.php +++ b/VmMigration/src/V1/VmwareVmDetails.php @@ -21,61 +21,61 @@ class VmwareVmDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vm_id = 1; */ - private $vm_id = ''; + protected $vm_id = ''; /** * The id of the vCenter's datacenter this VM is contained in. * * Generated from protobuf field string datacenter_id = 2; */ - private $datacenter_id = ''; + protected $datacenter_id = ''; /** * The descriptive name of the vCenter's datacenter this VM is contained in. * * Generated from protobuf field string datacenter_description = 3; */ - private $datacenter_description = ''; + protected $datacenter_description = ''; /** * The unique identifier of the VM in vCenter. * * Generated from protobuf field string uuid = 4; */ - private $uuid = ''; + protected $uuid = ''; /** * The display name of the VM. Note that this is not necessarily unique. * * Generated from protobuf field string display_name = 5; */ - private $display_name = ''; + protected $display_name = ''; /** * The power state of the VM at the moment list was taken. * * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmDetails.PowerState power_state = 6; */ - private $power_state = 0; + protected $power_state = 0; /** * The number of cpus in the VM. * * Generated from protobuf field int32 cpu_count = 7; */ - private $cpu_count = 0; + protected $cpu_count = 0; /** * The size of the memory of the VM in MB. * * Generated from protobuf field int32 memory_mb = 8; */ - private $memory_mb = 0; + protected $memory_mb = 0; /** * The number of disks the VM has. * * Generated from protobuf field int32 disk_count = 9; */ - private $disk_count = 0; + protected $disk_count = 0; /** * The total size of the storage allocated to the VM in MB. * * Generated from protobuf field int64 committed_storage_mb = 12; */ - private $committed_storage_mb = 0; + protected $committed_storage_mb = 0; /** * The VM's OS. See for example * https://vdc-repo.vmware.com/vmwb-repository/dcr-public/da47f910-60ac-438b-8b9b-6122f4d14524/16b7274a-bf8b-4b4c-a05e-746f2aa93c8c/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html @@ -83,13 +83,13 @@ class VmwareVmDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string guest_description = 11; */ - private $guest_description = ''; + protected $guest_description = ''; /** * Output only. The VM Boot Option. * * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmDetails.BootOption boot_option = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - private $boot_option = 0; + protected $boot_option = 0; /** * Constructor. diff --git a/VmMigration/tests/Unit/V1/Client/VmMigrationClientTest.php b/VmMigration/tests/Unit/V1/Client/VmMigrationClientTest.php index ec429bc784e9..62134d1c851f 100644 --- a/VmMigration/tests/Unit/V1/Client/VmMigrationClientTest.php +++ b/VmMigration/tests/Unit/V1/Client/VmMigrationClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return VmMigrationClient */ @@ -172,8 +174,7 @@ public function addGroupMigrationTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $request = (new AddGroupMigrationRequest()) - ->setGroup($formattedGroup); + $request = (new AddGroupMigrationRequest())->setGroup($formattedGroup); $response = $gapicClient->addGroupMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -229,17 +230,19 @@ public function addGroupMigrationExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $request = (new AddGroupMigrationRequest()) - ->setGroup($formattedGroup); + $request = (new AddGroupMigrationRequest())->setGroup($formattedGroup); $response = $gapicClient->addGroupMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -292,9 +295,14 @@ public function cancelCloneJobTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); - $request = (new CancelCloneJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->cloneJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CLONE_JOB]' + ); + $request = (new CancelCloneJobRequest())->setName($formattedName); $response = $gapicClient->cancelCloneJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -350,17 +358,25 @@ public function cancelCloneJobExceptionTest() $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); + $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->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); - $request = (new CancelCloneJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->cloneJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CLONE_JOB]' + ); + $request = (new CancelCloneJobRequest())->setName($formattedName); $response = $gapicClient->cancelCloneJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -413,9 +429,14 @@ public function cancelCutoverJobTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); - $request = (new CancelCutoverJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->cutoverJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CUTOVER_JOB]' + ); + $request = (new CancelCutoverJobRequest())->setName($formattedName); $response = $gapicClient->cancelCutoverJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -471,17 +492,25 @@ public function cancelCutoverJobExceptionTest() $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); + $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->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); - $request = (new CancelCutoverJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->cutoverJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CUTOVER_JOB]' + ); + $request = (new CancelCutoverJobRequest())->setName($formattedName); $response = $gapicClient->cancelCutoverJob($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -602,12 +631,15 @@ public function createCloneJobExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); @@ -741,12 +773,15 @@ public function createCutoverJobExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); @@ -888,12 +923,15 @@ public function createDatacenterConnectorExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); @@ -1027,12 +1065,15 @@ public function createGroupExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -1170,12 +1211,15 @@ public function createMigratingVmExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); @@ -1307,12 +1351,15 @@ public function createSourceExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -1446,12 +1493,15 @@ public function createTargetProjectExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -1585,12 +1635,15 @@ public function createUtilizationReportExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); @@ -1652,9 +1705,13 @@ public function deleteDatacenterConnectorTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - $request = (new DeleteDatacenterConnectorRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->datacenterConnectorName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[DATACENTER_CONNECTOR]' + ); + $request = (new DeleteDatacenterConnectorRequest())->setName($formattedName); $response = $gapicClient->deleteDatacenterConnector($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1710,17 +1767,24 @@ public function deleteDatacenterConnectorExceptionTest() $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); + $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->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - $request = (new DeleteDatacenterConnectorRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->datacenterConnectorName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[DATACENTER_CONNECTOR]' + ); + $request = (new DeleteDatacenterConnectorRequest())->setName($formattedName); $response = $gapicClient->deleteDatacenterConnector($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1774,8 +1838,7 @@ public function deleteGroupTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $request = (new DeleteGroupRequest()) - ->setName($formattedName); + $request = (new DeleteGroupRequest())->setName($formattedName); $response = $gapicClient->deleteGroup($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1831,17 +1894,19 @@ public function deleteGroupExceptionTest() $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); + $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->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $request = (new DeleteGroupRequest()) - ->setName($formattedName); + $request = (new DeleteGroupRequest())->setName($formattedName); $response = $gapicClient->deleteGroup($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1895,8 +1960,7 @@ public function deleteMigratingVmTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new DeleteMigratingVmRequest()) - ->setName($formattedName); + $request = (new DeleteMigratingVmRequest())->setName($formattedName); $response = $gapicClient->deleteMigratingVm($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1952,17 +2016,19 @@ public function deleteMigratingVmExceptionTest() $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); + $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->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new DeleteMigratingVmRequest()) - ->setName($formattedName); + $request = (new DeleteMigratingVmRequest())->setName($formattedName); $response = $gapicClient->deleteMigratingVm($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2016,8 +2082,7 @@ public function deleteSourceTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $request = (new DeleteSourceRequest()) - ->setName($formattedName); + $request = (new DeleteSourceRequest())->setName($formattedName); $response = $gapicClient->deleteSource($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2073,17 +2138,19 @@ public function deleteSourceExceptionTest() $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); + $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->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $request = (new DeleteSourceRequest()) - ->setName($formattedName); + $request = (new DeleteSourceRequest())->setName($formattedName); $response = $gapicClient->deleteSource($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2137,8 +2204,7 @@ public function deleteTargetProjectTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); - $request = (new DeleteTargetProjectRequest()) - ->setName($formattedName); + $request = (new DeleteTargetProjectRequest())->setName($formattedName); $response = $gapicClient->deleteTargetProject($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2194,17 +2260,19 @@ public function deleteTargetProjectExceptionTest() $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); + $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->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); - $request = (new DeleteTargetProjectRequest()) - ->setName($formattedName); + $request = (new DeleteTargetProjectRequest())->setName($formattedName); $response = $gapicClient->deleteTargetProject($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2257,9 +2325,13 @@ public function deleteUtilizationReportTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); - $request = (new DeleteUtilizationReportRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->utilizationReportName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[UTILIZATION_REPORT]' + ); + $request = (new DeleteUtilizationReportRequest())->setName($formattedName); $response = $gapicClient->deleteUtilizationReport($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2315,17 +2387,24 @@ public function deleteUtilizationReportExceptionTest() $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); + $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->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); - $request = (new DeleteUtilizationReportRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->utilizationReportName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[UTILIZATION_REPORT]' + ); + $request = (new DeleteUtilizationReportRequest())->setName($formattedName); $response = $gapicClient->deleteUtilizationReport($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2361,8 +2440,7 @@ public function fetchInventoryTest() $transport->addResponse($expectedResponse); // Mock request $formattedSource = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $request = (new FetchInventoryRequest()) - ->setSource($formattedSource); + $request = (new FetchInventoryRequest())->setSource($formattedSource); $response = $gapicClient->fetchInventory($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2386,17 +2464,19 @@ public function fetchInventoryExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedSource = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $request = (new FetchInventoryRequest()) - ->setSource($formattedSource); + $request = (new FetchInventoryRequest())->setSource($formattedSource); try { $gapicClient->fetchInventory($request); // If the $gapicClient method call did not throw, fail the test @@ -2441,8 +2521,7 @@ public function finalizeMigrationTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new FinalizeMigrationRequest()) - ->setMigratingVm($formattedMigratingVm); + $request = (new FinalizeMigrationRequest())->setMigratingVm($formattedMigratingVm); $response = $gapicClient->finalizeMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2498,17 +2577,19 @@ public function finalizeMigrationExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new FinalizeMigrationRequest()) - ->setMigratingVm($formattedMigratingVm); + $request = (new FinalizeMigrationRequest())->setMigratingVm($formattedMigratingVm); $response = $gapicClient->finalizeMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2545,9 +2626,14 @@ public function getCloneJobTest() $expectedResponse->setName($name2); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); - $request = (new GetCloneJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->cloneJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CLONE_JOB]' + ); + $request = (new GetCloneJobRequest())->setName($formattedName); $response = $gapicClient->getCloneJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2571,17 +2657,25 @@ public function getCloneJobExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); - $request = (new GetCloneJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->cloneJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CLONE_JOB]' + ); + $request = (new GetCloneJobRequest())->setName($formattedName); try { $gapicClient->getCloneJob($request); // If the $gapicClient method call did not throw, fail the test @@ -2613,9 +2707,14 @@ public function getCutoverJobTest() $expectedResponse->setStateMessage($stateMessage); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); - $request = (new GetCutoverJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->cutoverJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CUTOVER_JOB]' + ); + $request = (new GetCutoverJobRequest())->setName($formattedName); $response = $gapicClient->getCutoverJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2639,17 +2738,25 @@ public function getCutoverJobExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); - $request = (new GetCutoverJobRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->cutoverJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CUTOVER_JOB]' + ); + $request = (new GetCutoverJobRequest())->setName($formattedName); try { $gapicClient->getCutoverJob($request); // If the $gapicClient method call did not throw, fail the test @@ -2689,9 +2796,13 @@ public function getDatacenterConnectorTest() $expectedResponse->setApplianceSoftwareVersion($applianceSoftwareVersion); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - $request = (new GetDatacenterConnectorRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->datacenterConnectorName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[DATACENTER_CONNECTOR]' + ); + $request = (new GetDatacenterConnectorRequest())->setName($formattedName); $response = $gapicClient->getDatacenterConnector($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2715,17 +2826,24 @@ public function getDatacenterConnectorExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - $request = (new GetDatacenterConnectorRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->datacenterConnectorName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[DATACENTER_CONNECTOR]' + ); + $request = (new GetDatacenterConnectorRequest())->setName($formattedName); try { $gapicClient->getDatacenterConnector($request); // If the $gapicClient method call did not throw, fail the test @@ -2758,8 +2876,7 @@ public function getGroupTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $request = (new GetGroupRequest()) - ->setName($formattedName); + $request = (new GetGroupRequest())->setName($formattedName); $response = $gapicClient->getGroup($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2783,17 +2900,19 @@ public function getGroupExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $request = (new GetGroupRequest()) - ->setName($formattedName); + $request = (new GetGroupRequest())->setName($formattedName); try { $gapicClient->getGroup($request); // If the $gapicClient method call did not throw, fail the test @@ -2830,8 +2949,7 @@ public function getMigratingVmTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new GetMigratingVmRequest()) - ->setName($formattedName); + $request = (new GetMigratingVmRequest())->setName($formattedName); $response = $gapicClient->getMigratingVm($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2855,17 +2973,19 @@ public function getMigratingVmExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new GetMigratingVmRequest()) - ->setName($formattedName); + $request = (new GetMigratingVmRequest())->setName($formattedName); try { $gapicClient->getMigratingVm($request); // If the $gapicClient method call did not throw, fail the test @@ -2897,9 +3017,14 @@ public function getReplicationCycleTest() $expectedResponse->setProgressPercent($progressPercent); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->replicationCycleName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[REPLICATION_CYCLE]'); - $request = (new GetReplicationCycleRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->replicationCycleName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[REPLICATION_CYCLE]' + ); + $request = (new GetReplicationCycleRequest())->setName($formattedName); $response = $gapicClient->getReplicationCycle($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2923,17 +3048,25 @@ public function getReplicationCycleExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->replicationCycleName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[REPLICATION_CYCLE]'); - $request = (new GetReplicationCycleRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->replicationCycleName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[REPLICATION_CYCLE]' + ); + $request = (new GetReplicationCycleRequest())->setName($formattedName); try { $gapicClient->getReplicationCycle($request); // If the $gapicClient method call did not throw, fail the test @@ -2964,8 +3097,7 @@ public function getSourceTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $request = (new GetSourceRequest()) - ->setName($formattedName); + $request = (new GetSourceRequest())->setName($formattedName); $response = $gapicClient->getSource($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -2989,17 +3121,19 @@ public function getSourceExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $request = (new GetSourceRequest()) - ->setName($formattedName); + $request = (new GetSourceRequest())->setName($formattedName); try { $gapicClient->getSource($request); // If the $gapicClient method call did not throw, fail the test @@ -3032,8 +3166,7 @@ public function getTargetProjectTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); - $request = (new GetTargetProjectRequest()) - ->setName($formattedName); + $request = (new GetTargetProjectRequest())->setName($formattedName); $response = $gapicClient->getTargetProject($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3057,17 +3190,19 @@ public function getTargetProjectExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); - $request = (new GetTargetProjectRequest()) - ->setName($formattedName); + $request = (new GetTargetProjectRequest())->setName($formattedName); try { $gapicClient->getTargetProject($request); // If the $gapicClient method call did not throw, fail the test @@ -3099,9 +3234,13 @@ public function getUtilizationReportTest() $expectedResponse->setVmCount($vmCount); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); - $request = (new GetUtilizationReportRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->utilizationReportName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[UTILIZATION_REPORT]' + ); + $request = (new GetUtilizationReportRequest())->setName($formattedName); $response = $gapicClient->getUtilizationReport($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -3125,17 +3264,24 @@ public function getUtilizationReportExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); - $request = (new GetUtilizationReportRequest()) - ->setName($formattedName); + $formattedName = $gapicClient->utilizationReportName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[UTILIZATION_REPORT]' + ); + $request = (new GetUtilizationReportRequest())->setName($formattedName); try { $gapicClient->getUtilizationReport($request); // If the $gapicClient method call did not throw, fail the test @@ -3160,9 +3306,7 @@ public function listCloneJobsTest() // Mock response $nextPageToken = ''; $cloneJobsElement = new CloneJob(); - $cloneJobs = [ - $cloneJobsElement, - ]; + $cloneJobs = [$cloneJobsElement]; $expectedResponse = new ListCloneJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setCloneJobs($cloneJobs); @@ -3170,9 +3314,7 @@ public function listCloneJobsTest() // Mock request $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); $pageToken = 'pageToken1630607433'; - $request = (new ListCloneJobsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListCloneJobsRequest())->setParent($formattedParent)->setPageToken($pageToken); $response = $gapicClient->listCloneJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -3201,19 +3343,20 @@ public function listCloneJobsExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); $pageToken = 'pageToken1630607433'; - $request = (new ListCloneJobsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListCloneJobsRequest())->setParent($formattedParent)->setPageToken($pageToken); try { $gapicClient->listCloneJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -3238,9 +3381,7 @@ public function listCutoverJobsTest() // Mock response $nextPageToken = ''; $cutoverJobsElement = new CutoverJob(); - $cutoverJobs = [ - $cutoverJobsElement, - ]; + $cutoverJobs = [$cutoverJobsElement]; $expectedResponse = new ListCutoverJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setCutoverJobs($cutoverJobs); @@ -3248,9 +3389,7 @@ public function listCutoverJobsTest() // Mock request $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); $pageToken = 'pageToken1630607433'; - $request = (new ListCutoverJobsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListCutoverJobsRequest())->setParent($formattedParent)->setPageToken($pageToken); $response = $gapicClient->listCutoverJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -3279,19 +3418,20 @@ public function listCutoverJobsExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); $pageToken = 'pageToken1630607433'; - $request = (new ListCutoverJobsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListCutoverJobsRequest())->setParent($formattedParent)->setPageToken($pageToken); try { $gapicClient->listCutoverJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -3316,9 +3456,7 @@ public function listDatacenterConnectorsTest() // Mock response $nextPageToken = ''; $datacenterConnectorsElement = new DatacenterConnector(); - $datacenterConnectors = [ - $datacenterConnectorsElement, - ]; + $datacenterConnectors = [$datacenterConnectorsElement]; $expectedResponse = new ListDatacenterConnectorsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDatacenterConnectors($datacenterConnectors); @@ -3326,9 +3464,7 @@ public function listDatacenterConnectorsTest() // Mock request $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); $pageToken = 'pageToken1630607433'; - $request = (new ListDatacenterConnectorsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListDatacenterConnectorsRequest())->setParent($formattedParent)->setPageToken($pageToken); $response = $gapicClient->listDatacenterConnectors($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -3357,19 +3493,20 @@ public function listDatacenterConnectorsExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); $pageToken = 'pageToken1630607433'; - $request = (new ListDatacenterConnectorsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListDatacenterConnectorsRequest())->setParent($formattedParent)->setPageToken($pageToken); try { $gapicClient->listDatacenterConnectors($request); // If the $gapicClient method call did not throw, fail the test @@ -3394,9 +3531,7 @@ public function listGroupsTest() // Mock response $nextPageToken = ''; $groupsElement = new Group(); - $groups = [ - $groupsElement, - ]; + $groups = [$groupsElement]; $expectedResponse = new ListGroupsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setGroups($groups); @@ -3404,9 +3539,7 @@ public function listGroupsTest() // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $pageToken = 'pageToken1630607433'; - $request = (new ListGroupsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListGroupsRequest())->setParent($formattedParent)->setPageToken($pageToken); $response = $gapicClient->listGroups($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -3435,19 +3568,20 @@ public function listGroupsExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $pageToken = 'pageToken1630607433'; - $request = (new ListGroupsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListGroupsRequest())->setParent($formattedParent)->setPageToken($pageToken); try { $gapicClient->listGroups($request); // If the $gapicClient method call did not throw, fail the test @@ -3472,9 +3606,7 @@ public function listMigratingVmsTest() // Mock response $nextPageToken = ''; $migratingVmsElement = new MigratingVm(); - $migratingVms = [ - $migratingVmsElement, - ]; + $migratingVms = [$migratingVmsElement]; $expectedResponse = new ListMigratingVmsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setMigratingVms($migratingVms); @@ -3482,9 +3614,7 @@ public function listMigratingVmsTest() // Mock request $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); $pageToken = 'pageToken1630607433'; - $request = (new ListMigratingVmsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListMigratingVmsRequest())->setParent($formattedParent)->setPageToken($pageToken); $response = $gapicClient->listMigratingVms($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -3513,19 +3643,20 @@ public function listMigratingVmsExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); $pageToken = 'pageToken1630607433'; - $request = (new ListMigratingVmsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListMigratingVmsRequest())->setParent($formattedParent)->setPageToken($pageToken); try { $gapicClient->listMigratingVms($request); // If the $gapicClient method call did not throw, fail the test @@ -3550,9 +3681,7 @@ public function listReplicationCyclesTest() // Mock response $nextPageToken = ''; $replicationCyclesElement = new ReplicationCycle(); - $replicationCycles = [ - $replicationCyclesElement, - ]; + $replicationCycles = [$replicationCyclesElement]; $expectedResponse = new ListReplicationCyclesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setReplicationCycles($replicationCycles); @@ -3560,9 +3689,7 @@ public function listReplicationCyclesTest() // Mock request $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); $pageToken = 'pageToken1630607433'; - $request = (new ListReplicationCyclesRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListReplicationCyclesRequest())->setParent($formattedParent)->setPageToken($pageToken); $response = $gapicClient->listReplicationCycles($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -3591,19 +3718,20 @@ public function listReplicationCyclesExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); $pageToken = 'pageToken1630607433'; - $request = (new ListReplicationCyclesRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListReplicationCyclesRequest())->setParent($formattedParent)->setPageToken($pageToken); try { $gapicClient->listReplicationCycles($request); // If the $gapicClient method call did not throw, fail the test @@ -3628,9 +3756,7 @@ public function listSourcesTest() // Mock response $nextPageToken = ''; $sourcesElement = new Source(); - $sources = [ - $sourcesElement, - ]; + $sources = [$sourcesElement]; $expectedResponse = new ListSourcesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setSources($sources); @@ -3638,9 +3764,7 @@ public function listSourcesTest() // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $pageToken = 'pageToken1630607433'; - $request = (new ListSourcesRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListSourcesRequest())->setParent($formattedParent)->setPageToken($pageToken); $response = $gapicClient->listSources($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -3669,19 +3793,20 @@ public function listSourcesExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $pageToken = 'pageToken1630607433'; - $request = (new ListSourcesRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListSourcesRequest())->setParent($formattedParent)->setPageToken($pageToken); try { $gapicClient->listSources($request); // If the $gapicClient method call did not throw, fail the test @@ -3706,9 +3831,7 @@ public function listTargetProjectsTest() // Mock response $nextPageToken = ''; $targetProjectsElement = new TargetProject(); - $targetProjects = [ - $targetProjectsElement, - ]; + $targetProjects = [$targetProjectsElement]; $expectedResponse = new ListTargetProjectsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setTargetProjects($targetProjects); @@ -3716,9 +3839,7 @@ public function listTargetProjectsTest() // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $pageToken = 'pageToken1630607433'; - $request = (new ListTargetProjectsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListTargetProjectsRequest())->setParent($formattedParent)->setPageToken($pageToken); $response = $gapicClient->listTargetProjects($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -3747,19 +3868,20 @@ public function listTargetProjectsExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $pageToken = 'pageToken1630607433'; - $request = (new ListTargetProjectsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListTargetProjectsRequest())->setParent($formattedParent)->setPageToken($pageToken); try { $gapicClient->listTargetProjects($request); // If the $gapicClient method call did not throw, fail the test @@ -3784,9 +3906,7 @@ public function listUtilizationReportsTest() // Mock response $nextPageToken = ''; $utilizationReportsElement = new UtilizationReport(); - $utilizationReports = [ - $utilizationReportsElement, - ]; + $utilizationReports = [$utilizationReportsElement]; $expectedResponse = new ListUtilizationReportsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setUtilizationReports($utilizationReports); @@ -3794,9 +3914,7 @@ public function listUtilizationReportsTest() // Mock request $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); $pageToken = 'pageToken1630607433'; - $request = (new ListUtilizationReportsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListUtilizationReportsRequest())->setParent($formattedParent)->setPageToken($pageToken); $response = $gapicClient->listUtilizationReports($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -3825,19 +3943,20 @@ public function listUtilizationReportsExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); $pageToken = 'pageToken1630607433'; - $request = (new ListUtilizationReportsRequest()) - ->setParent($formattedParent) - ->setPageToken($pageToken); + $request = (new ListUtilizationReportsRequest())->setParent($formattedParent)->setPageToken($pageToken); try { $gapicClient->listUtilizationReports($request); // If the $gapicClient method call did not throw, fail the test @@ -3882,8 +4001,7 @@ public function pauseMigrationTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new PauseMigrationRequest()) - ->setMigratingVm($formattedMigratingVm); + $request = (new PauseMigrationRequest())->setMigratingVm($formattedMigratingVm); $response = $gapicClient->pauseMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -3939,17 +4057,19 @@ public function pauseMigrationExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new PauseMigrationRequest()) - ->setMigratingVm($formattedMigratingVm); + $request = (new PauseMigrationRequest())->setMigratingVm($formattedMigratingVm); $response = $gapicClient->pauseMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4003,8 +4123,7 @@ public function removeGroupMigrationTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $request = (new RemoveGroupMigrationRequest()) - ->setGroup($formattedGroup); + $request = (new RemoveGroupMigrationRequest())->setGroup($formattedGroup); $response = $gapicClient->removeGroupMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4060,17 +4179,19 @@ public function removeGroupMigrationExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $request = (new RemoveGroupMigrationRequest()) - ->setGroup($formattedGroup); + $request = (new RemoveGroupMigrationRequest())->setGroup($formattedGroup); $response = $gapicClient->removeGroupMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4124,8 +4245,7 @@ public function resumeMigrationTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new ResumeMigrationRequest()) - ->setMigratingVm($formattedMigratingVm); + $request = (new ResumeMigrationRequest())->setMigratingVm($formattedMigratingVm); $response = $gapicClient->resumeMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4181,17 +4301,19 @@ public function resumeMigrationExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new ResumeMigrationRequest()) - ->setMigratingVm($formattedMigratingVm); + $request = (new ResumeMigrationRequest())->setMigratingVm($formattedMigratingVm); $response = $gapicClient->resumeMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4245,8 +4367,7 @@ public function startMigrationTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new StartMigrationRequest()) - ->setMigratingVm($formattedMigratingVm); + $request = (new StartMigrationRequest())->setMigratingVm($formattedMigratingVm); $response = $gapicClient->startMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4302,17 +4423,19 @@ public function startMigrationExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $request = (new StartMigrationRequest()) - ->setMigratingVm($formattedMigratingVm); + $request = (new StartMigrationRequest())->setMigratingVm($formattedMigratingVm); $response = $gapicClient->startMigration($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4372,8 +4495,7 @@ public function updateGroupTest() $operationsTransport->addResponse($completeOperation); // Mock request $group = new Group(); - $request = (new UpdateGroupRequest()) - ->setGroup($group); + $request = (new UpdateGroupRequest())->setGroup($group); $response = $gapicClient->updateGroup($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4429,17 +4551,19 @@ public function updateGroupExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $group = new Group(); - $request = (new UpdateGroupRequest()) - ->setGroup($group); + $request = (new UpdateGroupRequest())->setGroup($group); $response = $gapicClient->updateGroup($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4503,8 +4627,7 @@ public function updateMigratingVmTest() $operationsTransport->addResponse($completeOperation); // Mock request $migratingVm = new MigratingVm(); - $request = (new UpdateMigratingVmRequest()) - ->setMigratingVm($migratingVm); + $request = (new UpdateMigratingVmRequest())->setMigratingVm($migratingVm); $response = $gapicClient->updateMigratingVm($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4560,17 +4683,19 @@ public function updateMigratingVmExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $migratingVm = new MigratingVm(); - $request = (new UpdateMigratingVmRequest()) - ->setMigratingVm($migratingVm); + $request = (new UpdateMigratingVmRequest())->setMigratingVm($migratingVm); $response = $gapicClient->updateMigratingVm($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4628,8 +4753,7 @@ public function updateSourceTest() $operationsTransport->addResponse($completeOperation); // Mock request $source = new Source(); - $request = (new UpdateSourceRequest()) - ->setSource($source); + $request = (new UpdateSourceRequest())->setSource($source); $response = $gapicClient->updateSource($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4685,17 +4809,19 @@ public function updateSourceExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $source = new Source(); - $request = (new UpdateSourceRequest()) - ->setSource($source); + $request = (new UpdateSourceRequest())->setSource($source); $response = $gapicClient->updateSource($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4755,8 +4881,7 @@ public function updateTargetProjectTest() $operationsTransport->addResponse($completeOperation); // Mock request $targetProject = new TargetProject(); - $request = (new UpdateTargetProjectRequest()) - ->setTargetProject($targetProject); + $request = (new UpdateTargetProjectRequest())->setTargetProject($targetProject); $response = $gapicClient->updateTargetProject($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4812,17 +4937,19 @@ public function updateTargetProjectExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $targetProject = new TargetProject(); - $request = (new UpdateTargetProjectRequest()) - ->setTargetProject($targetProject); + $request = (new UpdateTargetProjectRequest())->setTargetProject($targetProject); $response = $gapicClient->updateTargetProject($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4875,9 +5002,13 @@ public function upgradeApplianceTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedDatacenterConnector = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - $request = (new UpgradeApplianceRequest()) - ->setDatacenterConnector($formattedDatacenterConnector); + $formattedDatacenterConnector = $gapicClient->datacenterConnectorName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[DATACENTER_CONNECTOR]' + ); + $request = (new UpgradeApplianceRequest())->setDatacenterConnector($formattedDatacenterConnector); $response = $gapicClient->upgradeAppliance($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -4933,17 +5064,24 @@ public function upgradeApplianceExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedDatacenterConnector = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - $request = (new UpgradeApplianceRequest()) - ->setDatacenterConnector($formattedDatacenterConnector); + $formattedDatacenterConnector = $gapicClient->datacenterConnectorName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[DATACENTER_CONNECTOR]' + ); + $request = (new UpgradeApplianceRequest())->setDatacenterConnector($formattedDatacenterConnector); $response = $gapicClient->upgradeAppliance($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -5005,12 +5143,15 @@ public function getLocationExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -5037,9 +5178,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -5069,12 +5208,15 @@ public function listLocationsExceptionTest() $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); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try { @@ -5121,8 +5263,7 @@ public function addGroupMigrationAsyncTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $request = (new AddGroupMigrationRequest()) - ->setGroup($formattedGroup); + $request = (new AddGroupMigrationRequest())->setGroup($formattedGroup); $response = $gapicClient->addGroupMigrationAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/VmMigration/tests/Unit/V1/VmMigrationClientTest.php b/VmMigration/tests/Unit/V1/VmMigrationClientTest.php deleted file mode 100644 index f7641dc6ddc8..000000000000 --- a/VmMigration/tests/Unit/V1/VmMigrationClientTest.php +++ /dev/null @@ -1,4806 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return VmMigrationClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new VmMigrationClient($options); - } - - /** @test */ - public function addGroupMigrationTest() - { - $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/addGroupMigrationTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new AddGroupMigrationResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/addGroupMigrationTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $response = $gapicClient->addGroupMigration($formattedGroup); - $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.vmmigration.v1.VmMigration/AddGroupMigration', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGroup(); - $this->assertProtobufEquals($formattedGroup, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/addGroupMigrationTest'); - $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 addGroupMigrationExceptionTest() - { - $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/addGroupMigrationTest'); - $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 - $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $response = $gapicClient->addGroupMigration($formattedGroup); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/addGroupMigrationTest'); - 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 cancelCloneJobTest() - { - $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/cancelCloneJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new CancelCloneJobResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/cancelCloneJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); - $response = $gapicClient->cancelCloneJob($formattedName); - $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.vmmigration.v1.VmMigration/CancelCloneJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/cancelCloneJobTest'); - $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 cancelCloneJobExceptionTest() - { - $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/cancelCloneJobTest'); - $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->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); - $response = $gapicClient->cancelCloneJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/cancelCloneJobTest'); - 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 cancelCutoverJobTest() - { - $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/cancelCutoverJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new CancelCutoverJobResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/cancelCutoverJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); - $response = $gapicClient->cancelCutoverJob($formattedName); - $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.vmmigration.v1.VmMigration/CancelCutoverJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/cancelCutoverJobTest'); - $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 cancelCutoverJobExceptionTest() - { - $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/cancelCutoverJobTest'); - $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->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); - $response = $gapicClient->cancelCutoverJob($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/cancelCutoverJobTest'); - 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 createCloneJobTest() - { - $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/createCloneJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $expectedResponse = new CloneJob(); - $expectedResponse->setName($name); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createCloneJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $cloneJobId = 'cloneJobId-1008685569'; - $cloneJob = new CloneJob(); - $response = $gapicClient->createCloneJob($formattedParent, $cloneJobId, $cloneJob); - $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.vmmigration.v1.VmMigration/CreateCloneJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getCloneJobId(); - $this->assertProtobufEquals($cloneJobId, $actualValue); - $actualValue = $actualApiRequestObject->getCloneJob(); - $this->assertProtobufEquals($cloneJob, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createCloneJobTest'); - $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 createCloneJobExceptionTest() - { - $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/createCloneJobTest'); - $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 - $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $cloneJobId = 'cloneJobId-1008685569'; - $cloneJob = new CloneJob(); - $response = $gapicClient->createCloneJob($formattedParent, $cloneJobId, $cloneJob); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createCloneJobTest'); - 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 createCutoverJobTest() - { - $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/createCutoverJobTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $progressPercent = 2137894861; - $stateMessage = 'stateMessage29641305'; - $expectedResponse = new CutoverJob(); - $expectedResponse->setName($name); - $expectedResponse->setProgressPercent($progressPercent); - $expectedResponse->setStateMessage($stateMessage); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createCutoverJobTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $cutoverJobId = 'cutoverJobId504048422'; - $cutoverJob = new CutoverJob(); - $response = $gapicClient->createCutoverJob($formattedParent, $cutoverJobId, $cutoverJob); - $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.vmmigration.v1.VmMigration/CreateCutoverJob', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getCutoverJobId(); - $this->assertProtobufEquals($cutoverJobId, $actualValue); - $actualValue = $actualApiRequestObject->getCutoverJob(); - $this->assertProtobufEquals($cutoverJob, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createCutoverJobTest'); - $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 createCutoverJobExceptionTest() - { - $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/createCutoverJobTest'); - $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 - $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $cutoverJobId = 'cutoverJobId504048422'; - $cutoverJob = new CutoverJob(); - $response = $gapicClient->createCutoverJob($formattedParent, $cutoverJobId, $cutoverJob); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createCutoverJobTest'); - 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 createDatacenterConnectorTest() - { - $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/createDatacenterConnectorTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $registrationId = 'registrationId-412573087'; - $serviceAccount = 'serviceAccount-1948028253'; - $version = 'version351608024'; - $bucket = 'bucket-1378203158'; - $applianceInfrastructureVersion = 'applianceInfrastructureVersion662625550'; - $applianceSoftwareVersion = 'applianceSoftwareVersion-641402222'; - $expectedResponse = new DatacenterConnector(); - $expectedResponse->setName($name); - $expectedResponse->setRegistrationId($registrationId); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setVersion($version); - $expectedResponse->setBucket($bucket); - $expectedResponse->setApplianceInfrastructureVersion($applianceInfrastructureVersion); - $expectedResponse->setApplianceSoftwareVersion($applianceSoftwareVersion); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createDatacenterConnectorTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $datacenterConnectorId = 'datacenterConnectorId1629428237'; - $datacenterConnector = new DatacenterConnector(); - $response = $gapicClient->createDatacenterConnector($formattedParent, $datacenterConnectorId, $datacenterConnector); - $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.vmmigration.v1.VmMigration/CreateDatacenterConnector', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getDatacenterConnectorId(); - $this->assertProtobufEquals($datacenterConnectorId, $actualValue); - $actualValue = $actualApiRequestObject->getDatacenterConnector(); - $this->assertProtobufEquals($datacenterConnector, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDatacenterConnectorTest'); - $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 createDatacenterConnectorExceptionTest() - { - $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/createDatacenterConnectorTest'); - $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 - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $datacenterConnectorId = 'datacenterConnectorId1629428237'; - $datacenterConnector = new DatacenterConnector(); - $response = $gapicClient->createDatacenterConnector($formattedParent, $datacenterConnectorId, $datacenterConnector); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDatacenterConnectorTest'); - 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 createGroupTest() - { - $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/createGroupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Group(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setDisplayName($displayName); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createGroupTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $groupId = 'groupId506361563'; - $group = new Group(); - $response = $gapicClient->createGroup($formattedParent, $groupId, $group); - $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.vmmigration.v1.VmMigration/CreateGroup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getGroupId(); - $this->assertProtobufEquals($groupId, $actualValue); - $actualValue = $actualApiRequestObject->getGroup(); - $this->assertProtobufEquals($group, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createGroupTest'); - $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 createGroupExceptionTest() - { - $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/createGroupTest'); - $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 - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $groupId = 'groupId506361563'; - $group = new Group(); - $response = $gapicClient->createGroup($formattedParent, $groupId, $group); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createGroupTest'); - 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 createMigratingVmTest() - { - $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/createMigratingVmTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $sourceVmId = 'sourceVmId1673059967'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $group = 'group98629247'; - $expectedResponse = new MigratingVm(); - $expectedResponse->setName($name); - $expectedResponse->setSourceVmId($sourceVmId); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setGroup($group); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createMigratingVmTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $migratingVmId = 'migratingVmId-899085236'; - $migratingVm = new MigratingVm(); - $response = $gapicClient->createMigratingVm($formattedParent, $migratingVmId, $migratingVm); - $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.vmmigration.v1.VmMigration/CreateMigratingVm', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getMigratingVmId(); - $this->assertProtobufEquals($migratingVmId, $actualValue); - $actualValue = $actualApiRequestObject->getMigratingVm(); - $this->assertProtobufEquals($migratingVm, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createMigratingVmTest'); - $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 createMigratingVmExceptionTest() - { - $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/createMigratingVmTest'); - $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 - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $migratingVmId = 'migratingVmId-899085236'; - $migratingVm = new MigratingVm(); - $response = $gapicClient->createMigratingVm($formattedParent, $migratingVmId, $migratingVm); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createMigratingVmTest'); - 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 createSourceTest() - { - $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/createSourceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $expectedResponse = new Source(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createSourceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $sourceId = 'sourceId-1698410561'; - $source = new Source(); - $response = $gapicClient->createSource($formattedParent, $sourceId, $source); - $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.vmmigration.v1.VmMigration/CreateSource', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getSourceId(); - $this->assertProtobufEquals($sourceId, $actualValue); - $actualValue = $actualApiRequestObject->getSource(); - $this->assertProtobufEquals($source, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createSourceTest'); - $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 createSourceExceptionTest() - { - $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/createSourceTest'); - $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 - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $sourceId = 'sourceId-1698410561'; - $source = new Source(); - $response = $gapicClient->createSource($formattedParent, $sourceId, $source); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createSourceTest'); - 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 createTargetProjectTest() - { - $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/createTargetProjectTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $project = 'project-309310695'; - $description = 'description-1724546052'; - $expectedResponse = new TargetProject(); - $expectedResponse->setName($name); - $expectedResponse->setProject($project); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createTargetProjectTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $targetProjectId = 'targetProjectId1255314287'; - $targetProject = new TargetProject(); - $response = $gapicClient->createTargetProject($formattedParent, $targetProjectId, $targetProject); - $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.vmmigration.v1.VmMigration/CreateTargetProject', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getTargetProjectId(); - $this->assertProtobufEquals($targetProjectId, $actualValue); - $actualValue = $actualApiRequestObject->getTargetProject(); - $this->assertProtobufEquals($targetProject, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createTargetProjectTest'); - $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 createTargetProjectExceptionTest() - { - $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/createTargetProjectTest'); - $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 - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $targetProjectId = 'targetProjectId1255314287'; - $targetProject = new TargetProject(); - $response = $gapicClient->createTargetProject($formattedParent, $targetProjectId, $targetProject); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createTargetProjectTest'); - 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 createUtilizationReportTest() - { - $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/createUtilizationReportTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $vmCount = 261463431; - $expectedResponse = new UtilizationReport(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setVmCount($vmCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createUtilizationReportTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $utilizationReport = new UtilizationReport(); - $utilizationReportId = 'utilizationReportId-1346894295'; - $response = $gapicClient->createUtilizationReport($formattedParent, $utilizationReport, $utilizationReportId); - $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.vmmigration.v1.VmMigration/CreateUtilizationReport', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getUtilizationReport(); - $this->assertProtobufEquals($utilizationReport, $actualValue); - $actualValue = $actualApiRequestObject->getUtilizationReportId(); - $this->assertProtobufEquals($utilizationReportId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createUtilizationReportTest'); - $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 createUtilizationReportExceptionTest() - { - $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/createUtilizationReportTest'); - $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 - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $utilizationReport = new UtilizationReport(); - $utilizationReportId = 'utilizationReportId-1346894295'; - $response = $gapicClient->createUtilizationReport($formattedParent, $utilizationReport, $utilizationReportId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createUtilizationReportTest'); - 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 deleteDatacenterConnectorTest() - { - $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/deleteDatacenterConnectorTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteDatacenterConnectorTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - $response = $gapicClient->deleteDatacenterConnector($formattedName); - $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.vmmigration.v1.VmMigration/DeleteDatacenterConnector', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteDatacenterConnectorTest'); - $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 deleteDatacenterConnectorExceptionTest() - { - $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/deleteDatacenterConnectorTest'); - $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->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - $response = $gapicClient->deleteDatacenterConnector($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteDatacenterConnectorTest'); - 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 deleteGroupTest() - { - $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/deleteGroupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteGroupTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $response = $gapicClient->deleteGroup($formattedName); - $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.vmmigration.v1.VmMigration/DeleteGroup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteGroupTest'); - $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 deleteGroupExceptionTest() - { - $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/deleteGroupTest'); - $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->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $response = $gapicClient->deleteGroup($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteGroupTest'); - 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 deleteMigratingVmTest() - { - $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/deleteMigratingVmTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteMigratingVmTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $response = $gapicClient->deleteMigratingVm($formattedName); - $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.vmmigration.v1.VmMigration/DeleteMigratingVm', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteMigratingVmTest'); - $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 deleteMigratingVmExceptionTest() - { - $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/deleteMigratingVmTest'); - $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->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $response = $gapicClient->deleteMigratingVm($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteMigratingVmTest'); - 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 deleteSourceTest() - { - $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/deleteSourceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteSourceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $response = $gapicClient->deleteSource($formattedName); - $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.vmmigration.v1.VmMigration/DeleteSource', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteSourceTest'); - $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 deleteSourceExceptionTest() - { - $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/deleteSourceTest'); - $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->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $response = $gapicClient->deleteSource($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteSourceTest'); - 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 deleteTargetProjectTest() - { - $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/deleteTargetProjectTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteTargetProjectTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); - $response = $gapicClient->deleteTargetProject($formattedName); - $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.vmmigration.v1.VmMigration/DeleteTargetProject', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTargetProjectTest'); - $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 deleteTargetProjectExceptionTest() - { - $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/deleteTargetProjectTest'); - $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->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); - $response = $gapicClient->deleteTargetProject($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteTargetProjectTest'); - 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 deleteUtilizationReportTest() - { - $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/deleteUtilizationReportTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteUtilizationReportTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); - $response = $gapicClient->deleteUtilizationReport($formattedName); - $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.vmmigration.v1.VmMigration/DeleteUtilizationReport', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteUtilizationReportTest'); - $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 deleteUtilizationReportExceptionTest() - { - $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/deleteUtilizationReportTest'); - $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->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); - $response = $gapicClient->deleteUtilizationReport($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteUtilizationReportTest'); - 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 fetchInventoryTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new FetchInventoryResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSource = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $response = $gapicClient->fetchInventory($formattedSource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/FetchInventory', $actualFuncCall); - $actualValue = $actualRequestObject->getSource(); - $this->assertProtobufEquals($formattedSource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function fetchInventoryExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSource = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - try { - $gapicClient->fetchInventory($formattedSource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function finalizeMigrationTest() - { - $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/finalizeMigrationTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new FinalizeMigrationResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/finalizeMigrationTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $response = $gapicClient->finalizeMigration($formattedMigratingVm); - $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.vmmigration.v1.VmMigration/FinalizeMigration', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getMigratingVm(); - $this->assertProtobufEquals($formattedMigratingVm, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/finalizeMigrationTest'); - $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 finalizeMigrationExceptionTest() - { - $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/finalizeMigrationTest'); - $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 - $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $response = $gapicClient->finalizeMigration($formattedMigratingVm); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/finalizeMigrationTest'); - 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 getCloneJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new CloneJob(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); - $response = $gapicClient->getCloneJob($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetCloneJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getCloneJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); - try { - $gapicClient->getCloneJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getCutoverJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $progressPercent = 2137894861; - $stateMessage = 'stateMessage29641305'; - $expectedResponse = new CutoverJob(); - $expectedResponse->setName($name2); - $expectedResponse->setProgressPercent($progressPercent); - $expectedResponse->setStateMessage($stateMessage); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); - $response = $gapicClient->getCutoverJob($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetCutoverJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getCutoverJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); - try { - $gapicClient->getCutoverJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatacenterConnectorTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $registrationId = 'registrationId-412573087'; - $serviceAccount = 'serviceAccount-1948028253'; - $version = 'version351608024'; - $bucket = 'bucket-1378203158'; - $applianceInfrastructureVersion = 'applianceInfrastructureVersion662625550'; - $applianceSoftwareVersion = 'applianceSoftwareVersion-641402222'; - $expectedResponse = new DatacenterConnector(); - $expectedResponse->setName($name2); - $expectedResponse->setRegistrationId($registrationId); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setVersion($version); - $expectedResponse->setBucket($bucket); - $expectedResponse->setApplianceInfrastructureVersion($applianceInfrastructureVersion); - $expectedResponse->setApplianceSoftwareVersion($applianceSoftwareVersion); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - $response = $gapicClient->getDatacenterConnector($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetDatacenterConnector', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatacenterConnectorExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - try { - $gapicClient->getDatacenterConnector($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getGroupTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Group(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $response = $gapicClient->getGroup($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetGroup', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getGroupExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - try { - $gapicClient->getGroup($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getMigratingVmTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $sourceVmId = 'sourceVmId1673059967'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $group = 'group98629247'; - $expectedResponse = new MigratingVm(); - $expectedResponse->setName($name2); - $expectedResponse->setSourceVmId($sourceVmId); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setGroup($group); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $response = $gapicClient->getMigratingVm($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetMigratingVm', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getMigratingVmExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - try { - $gapicClient->getMigratingVm($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getReplicationCycleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $cycleNumber = 1095724862; - $progressPercent = 2137894861; - $expectedResponse = new ReplicationCycle(); - $expectedResponse->setName($name2); - $expectedResponse->setCycleNumber($cycleNumber); - $expectedResponse->setProgressPercent($progressPercent); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->replicationCycleName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[REPLICATION_CYCLE]'); - $response = $gapicClient->getReplicationCycle($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetReplicationCycle', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getReplicationCycleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->replicationCycleName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[REPLICATION_CYCLE]'); - try { - $gapicClient->getReplicationCycle($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSourceTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $expectedResponse = new Source(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $response = $gapicClient->getSource($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetSource', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSourceExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - try { - $gapicClient->getSource($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTargetProjectTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $project = 'project-309310695'; - $description = 'description-1724546052'; - $expectedResponse = new TargetProject(); - $expectedResponse->setName($name2); - $expectedResponse->setProject($project); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); - $response = $gapicClient->getTargetProject($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetTargetProject', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTargetProjectExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); - try { - $gapicClient->getTargetProject($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getUtilizationReportTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $vmCount = 261463431; - $expectedResponse = new UtilizationReport(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setVmCount($vmCount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); - $response = $gapicClient->getUtilizationReport($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetUtilizationReport', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getUtilizationReportExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); - try { - $gapicClient->getUtilizationReport($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listCloneJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $cloneJobsElement = new CloneJob(); - $cloneJobs = [ - $cloneJobsElement, - ]; - $expectedResponse = new ListCloneJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setCloneJobs($cloneJobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $pageToken = 'pageToken1630607433'; - $response = $gapicClient->listCloneJobs($formattedParent, $pageToken); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getCloneJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListCloneJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getPageToken(); - $this->assertProtobufEquals($pageToken, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listCloneJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $pageToken = 'pageToken1630607433'; - try { - $gapicClient->listCloneJobs($formattedParent, $pageToken); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listCutoverJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $cutoverJobsElement = new CutoverJob(); - $cutoverJobs = [ - $cutoverJobsElement, - ]; - $expectedResponse = new ListCutoverJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setCutoverJobs($cutoverJobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $pageToken = 'pageToken1630607433'; - $response = $gapicClient->listCutoverJobs($formattedParent, $pageToken); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getCutoverJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListCutoverJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getPageToken(); - $this->assertProtobufEquals($pageToken, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listCutoverJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $pageToken = 'pageToken1630607433'; - try { - $gapicClient->listCutoverJobs($formattedParent, $pageToken); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatacenterConnectorsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $datacenterConnectorsElement = new DatacenterConnector(); - $datacenterConnectors = [ - $datacenterConnectorsElement, - ]; - $expectedResponse = new ListDatacenterConnectorsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDatacenterConnectors($datacenterConnectors); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $pageToken = 'pageToken1630607433'; - $response = $gapicClient->listDatacenterConnectors($formattedParent, $pageToken); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDatacenterConnectors()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListDatacenterConnectors', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getPageToken(); - $this->assertProtobufEquals($pageToken, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatacenterConnectorsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $pageToken = 'pageToken1630607433'; - try { - $gapicClient->listDatacenterConnectors($formattedParent, $pageToken); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listGroupsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $groupsElement = new Group(); - $groups = [ - $groupsElement, - ]; - $expectedResponse = new ListGroupsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setGroups($groups); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $pageToken = 'pageToken1630607433'; - $response = $gapicClient->listGroups($formattedParent, $pageToken); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getGroups()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListGroups', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getPageToken(); - $this->assertProtobufEquals($pageToken, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listGroupsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $pageToken = 'pageToken1630607433'; - try { - $gapicClient->listGroups($formattedParent, $pageToken); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listMigratingVmsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $migratingVmsElement = new MigratingVm(); - $migratingVms = [ - $migratingVmsElement, - ]; - $expectedResponse = new ListMigratingVmsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setMigratingVms($migratingVms); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $pageToken = 'pageToken1630607433'; - $response = $gapicClient->listMigratingVms($formattedParent, $pageToken); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getMigratingVms()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListMigratingVms', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getPageToken(); - $this->assertProtobufEquals($pageToken, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listMigratingVmsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $pageToken = 'pageToken1630607433'; - try { - $gapicClient->listMigratingVms($formattedParent, $pageToken); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listReplicationCyclesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $replicationCyclesElement = new ReplicationCycle(); - $replicationCycles = [ - $replicationCyclesElement, - ]; - $expectedResponse = new ListReplicationCyclesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setReplicationCycles($replicationCycles); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $pageToken = 'pageToken1630607433'; - $response = $gapicClient->listReplicationCycles($formattedParent, $pageToken); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getReplicationCycles()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListReplicationCycles', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getPageToken(); - $this->assertProtobufEquals($pageToken, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listReplicationCyclesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $pageToken = 'pageToken1630607433'; - try { - $gapicClient->listReplicationCycles($formattedParent, $pageToken); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSourcesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $sourcesElement = new Source(); - $sources = [ - $sourcesElement, - ]; - $expectedResponse = new ListSourcesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSources($sources); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $pageToken = 'pageToken1630607433'; - $response = $gapicClient->listSources($formattedParent, $pageToken); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSources()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListSources', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getPageToken(); - $this->assertProtobufEquals($pageToken, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSourcesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $pageToken = 'pageToken1630607433'; - try { - $gapicClient->listSources($formattedParent, $pageToken); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTargetProjectsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $targetProjectsElement = new TargetProject(); - $targetProjects = [ - $targetProjectsElement, - ]; - $expectedResponse = new ListTargetProjectsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setTargetProjects($targetProjects); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $pageToken = 'pageToken1630607433'; - $response = $gapicClient->listTargetProjects($formattedParent, $pageToken); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getTargetProjects()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListTargetProjects', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getPageToken(); - $this->assertProtobufEquals($pageToken, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTargetProjectsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $pageToken = 'pageToken1630607433'; - try { - $gapicClient->listTargetProjects($formattedParent, $pageToken); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listUtilizationReportsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $utilizationReportsElement = new UtilizationReport(); - $utilizationReports = [ - $utilizationReportsElement, - ]; - $expectedResponse = new ListUtilizationReportsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setUtilizationReports($utilizationReports); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $pageToken = 'pageToken1630607433'; - $response = $gapicClient->listUtilizationReports($formattedParent, $pageToken); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getUtilizationReports()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListUtilizationReports', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getPageToken(); - $this->assertProtobufEquals($pageToken, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listUtilizationReportsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); - $pageToken = 'pageToken1630607433'; - try { - $gapicClient->listUtilizationReports($formattedParent, $pageToken); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function pauseMigrationTest() - { - $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/pauseMigrationTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new PauseMigrationResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/pauseMigrationTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $response = $gapicClient->pauseMigration($formattedMigratingVm); - $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.vmmigration.v1.VmMigration/PauseMigration', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getMigratingVm(); - $this->assertProtobufEquals($formattedMigratingVm, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/pauseMigrationTest'); - $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 pauseMigrationExceptionTest() - { - $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/pauseMigrationTest'); - $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 - $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $response = $gapicClient->pauseMigration($formattedMigratingVm); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/pauseMigrationTest'); - 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 removeGroupMigrationTest() - { - $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/removeGroupMigrationTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new RemoveGroupMigrationResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/removeGroupMigrationTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $response = $gapicClient->removeGroupMigration($formattedGroup); - $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.vmmigration.v1.VmMigration/RemoveGroupMigration', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGroup(); - $this->assertProtobufEquals($formattedGroup, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/removeGroupMigrationTest'); - $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 removeGroupMigrationExceptionTest() - { - $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/removeGroupMigrationTest'); - $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 - $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); - $response = $gapicClient->removeGroupMigration($formattedGroup); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/removeGroupMigrationTest'); - 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 resumeMigrationTest() - { - $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/resumeMigrationTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new ResumeMigrationResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/resumeMigrationTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $response = $gapicClient->resumeMigration($formattedMigratingVm); - $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.vmmigration.v1.VmMigration/ResumeMigration', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getMigratingVm(); - $this->assertProtobufEquals($formattedMigratingVm, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/resumeMigrationTest'); - $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 resumeMigrationExceptionTest() - { - $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/resumeMigrationTest'); - $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 - $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $response = $gapicClient->resumeMigration($formattedMigratingVm); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/resumeMigrationTest'); - 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 startMigrationTest() - { - $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/startMigrationTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new StartMigrationResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/startMigrationTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $response = $gapicClient->startMigration($formattedMigratingVm); - $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.vmmigration.v1.VmMigration/StartMigration', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getMigratingVm(); - $this->assertProtobufEquals($formattedMigratingVm, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/startMigrationTest'); - $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 startMigrationExceptionTest() - { - $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/startMigrationTest'); - $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 - $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); - $response = $gapicClient->startMigration($formattedMigratingVm); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/startMigrationTest'); - 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 updateGroupTest() - { - $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/updateGroupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Group(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setDisplayName($displayName); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateGroupTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $group = new Group(); - $response = $gapicClient->updateGroup($group); - $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.vmmigration.v1.VmMigration/UpdateGroup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGroup(); - $this->assertProtobufEquals($group, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateGroupTest'); - $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 updateGroupExceptionTest() - { - $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/updateGroupTest'); - $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 - $group = new Group(); - $response = $gapicClient->updateGroup($group); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateGroupTest'); - 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 updateMigratingVmTest() - { - $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/updateMigratingVmTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $sourceVmId = 'sourceVmId1673059967'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $group = 'group98629247'; - $expectedResponse = new MigratingVm(); - $expectedResponse->setName($name); - $expectedResponse->setSourceVmId($sourceVmId); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setGroup($group); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateMigratingVmTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $migratingVm = new MigratingVm(); - $response = $gapicClient->updateMigratingVm($migratingVm); - $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.vmmigration.v1.VmMigration/UpdateMigratingVm', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getMigratingVm(); - $this->assertProtobufEquals($migratingVm, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateMigratingVmTest'); - $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 updateMigratingVmExceptionTest() - { - $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/updateMigratingVmTest'); - $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 - $migratingVm = new MigratingVm(); - $response = $gapicClient->updateMigratingVm($migratingVm); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateMigratingVmTest'); - 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 updateSourceTest() - { - $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/updateSourceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $expectedResponse = new Source(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateSourceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $source = new Source(); - $response = $gapicClient->updateSource($source); - $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.vmmigration.v1.VmMigration/UpdateSource', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getSource(); - $this->assertProtobufEquals($source, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateSourceTest'); - $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 updateSourceExceptionTest() - { - $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/updateSourceTest'); - $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 - $source = new Source(); - $response = $gapicClient->updateSource($source); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateSourceTest'); - 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 updateTargetProjectTest() - { - $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/updateTargetProjectTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $project = 'project-309310695'; - $description = 'description-1724546052'; - $expectedResponse = new TargetProject(); - $expectedResponse->setName($name); - $expectedResponse->setProject($project); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateTargetProjectTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $targetProject = new TargetProject(); - $response = $gapicClient->updateTargetProject($targetProject); - $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.vmmigration.v1.VmMigration/UpdateTargetProject', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getTargetProject(); - $this->assertProtobufEquals($targetProject, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateTargetProjectTest'); - $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 updateTargetProjectExceptionTest() - { - $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/updateTargetProjectTest'); - $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 - $targetProject = new TargetProject(); - $response = $gapicClient->updateTargetProject($targetProject); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateTargetProjectTest'); - 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 upgradeApplianceTest() - { - $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/upgradeApplianceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new UpgradeApplianceResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/upgradeApplianceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedDatacenterConnector = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - $response = $gapicClient->upgradeAppliance($formattedDatacenterConnector); - $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.vmmigration.v1.VmMigration/UpgradeAppliance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDatacenterConnector(); - $this->assertProtobufEquals($formattedDatacenterConnector, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/upgradeApplianceTest'); - $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 upgradeApplianceExceptionTest() - { - $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/upgradeApplianceTest'); - $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 - $formattedDatacenterConnector = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); - $response = $gapicClient->upgradeAppliance($formattedDatacenterConnector); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/upgradeApplianceTest'); - 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 getLocationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $locationId = 'locationId552319461'; - $displayName = 'displayName1615086568'; - $expectedResponse = new Location(); - $expectedResponse->setName($name2); - $expectedResponse->setLocationId($locationId); - $expectedResponse->setDisplayName($displayName); - $transport->addResponse($expectedResponse); - $response = $gapicClient->getLocation(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getLocationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->getLocation(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; - $expectedResponse = new ListLocationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setLocations($locations); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listLocations(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listLocationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - try { - $gapicClient->listLocations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -}