Skip to content

Commit

Permalink
feat: add Oracle to PostgreSQL migration APIs (#6237)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 533037268
Source-Link: googleapis/googleapis@d45c9a2
Source-Link: googleapis/googleapis-gen@40c3304
Copy-Tag: eyJwIjoiRG1zLy5Pd2xCb3QueWFtbCIsImgiOiI0MGMzMzA0M2UzZDc5YTBkZDM4ZWMyOWRhYmRlNjY0OTBkY2NlODA5In0=
  • Loading branch information
gcf-owl-bot[bot] authored May 18, 2023
1 parent cb902e9 commit 1a931d2
Show file tree
Hide file tree
Showing 132 changed files with 19,015 additions and 714 deletions.
Binary file modified Dms/metadata/V1/Clouddms.php
Binary file not shown.
Binary file modified Dms/metadata/V1/ClouddmsResources.php
Binary file not shown.
Binary file added Dms/metadata/V1/ConversionworkspaceResources.php
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php
/*
* 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START datamigration_v1_generated_DataMigrationService_ApplyConversionWorkspace_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Rpc\Status;

/**
* Applies draft tree onto a specific destination database.
*
* @param string $formattedName The name of the conversion workspace resource for which to apply
* the draft tree. Must be in the form of:
* projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}. Please see
* {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
*/
function apply_conversion_workspace_sample(string $formattedName): void
{
// Create a client.
$dataMigrationServiceClient = new DataMigrationServiceClient();

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $dataMigrationServiceClient->applyConversionWorkspace($formattedName);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var ConversionWorkspace $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = DataMigrationServiceClient::conversionWorkspaceName(
'[PROJECT]',
'[LOCATION]',
'[CONVERSION_WORKSPACE]'
);

apply_conversion_workspace_sample($formattedName);
}
// [END datamigration_v1_generated_DataMigrationService_ApplyConversionWorkspace_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php
/*
* 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START datamigration_v1_generated_DataMigrationService_CommitConversionWorkspace_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Rpc\Status;

/**
* Marks all the data in the conversion workspace as committed.
*
* @param string $formattedName Name of the conversion workspace resource to commit. Please see
* {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
*/
function commit_conversion_workspace_sample(string $formattedName): void
{
// Create a client.
$dataMigrationServiceClient = new DataMigrationServiceClient();

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $dataMigrationServiceClient->commitConversionWorkspace($formattedName);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var ConversionWorkspace $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = DataMigrationServiceClient::conversionWorkspaceName(
'[PROJECT]',
'[LOCATION]',
'[CONVERSION_WORKSPACE]'
);

commit_conversion_workspace_sample($formattedName);
}
// [END datamigration_v1_generated_DataMigrationService_CommitConversionWorkspace_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
/*
* 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START datamigration_v1_generated_DataMigrationService_ConvertConversionWorkspace_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Rpc\Status;

/**
* Creates a draft tree schema for the destination database.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function convert_conversion_workspace_sample(): void
{
// Create a client.
$dataMigrationServiceClient = new DataMigrationServiceClient();

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $dataMigrationServiceClient->convertConversionWorkspace();
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var ConversionWorkspace $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
// [END datamigration_v1_generated_DataMigrationService_ConvertConversionWorkspace_sync]
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/**
* Creates a new connection profile in a given project and location.
*
* @param string $formattedParent The parent, which owns this collection of connection profiles. Please see
* @param string $formattedParent The parent which owns this collection of connection profiles. Please see
* {@see DataMigrationServiceClient::connectionProfileName()} for help formatting this field.
* @param string $connectionProfileId The connection profile identifier.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php
/*
* 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START datamigration_v1_generated_DataMigrationService_CreateConversionWorkspace_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\CloudDms\V1\ConversionWorkspace;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\DatabaseEngine;
use Google\Cloud\CloudDms\V1\DatabaseEngineInfo;
use Google\Rpc\Status;

/**
* Creates a new conversion workspace in a given project and location.
*
* @param string $formattedParent The parent which owns this collection of conversion workspaces. Please see
* {@see DataMigrationServiceClient::locationName()} for help formatting this field.
* @param string $conversionWorkspaceId The ID of the conversion workspace to create.
* @param int $conversionWorkspaceSourceEngine Engine type.
* @param string $conversionWorkspaceSourceVersion Engine named version, for example 12.c.1.
* @param int $conversionWorkspaceDestinationEngine Engine type.
* @param string $conversionWorkspaceDestinationVersion Engine named version, for example 12.c.1.
*/
function create_conversion_workspace_sample(
string $formattedParent,
string $conversionWorkspaceId,
int $conversionWorkspaceSourceEngine,
string $conversionWorkspaceSourceVersion,
int $conversionWorkspaceDestinationEngine,
string $conversionWorkspaceDestinationVersion
): void {
// Create a client.
$dataMigrationServiceClient = new DataMigrationServiceClient();

// Prepare any non-scalar elements to be passed along with the request.
$conversionWorkspaceSource = (new DatabaseEngineInfo())
->setEngine($conversionWorkspaceSourceEngine)
->setVersion($conversionWorkspaceSourceVersion);
$conversionWorkspaceDestination = (new DatabaseEngineInfo())
->setEngine($conversionWorkspaceDestinationEngine)
->setVersion($conversionWorkspaceDestinationVersion);
$conversionWorkspace = (new ConversionWorkspace())
->setSource($conversionWorkspaceSource)
->setDestination($conversionWorkspaceDestination);

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $dataMigrationServiceClient->createConversionWorkspace(
$formattedParent,
$conversionWorkspaceId,
$conversionWorkspace
);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var ConversionWorkspace $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = DataMigrationServiceClient::locationName('[PROJECT]', '[LOCATION]');
$conversionWorkspaceId = '[CONVERSION_WORKSPACE_ID]';
$conversionWorkspaceSourceEngine = DatabaseEngine::DATABASE_ENGINE_UNSPECIFIED;
$conversionWorkspaceSourceVersion = '[VERSION]';
$conversionWorkspaceDestinationEngine = DatabaseEngine::DATABASE_ENGINE_UNSPECIFIED;
$conversionWorkspaceDestinationVersion = '[VERSION]';

create_conversion_workspace_sample(
$formattedParent,
$conversionWorkspaceId,
$conversionWorkspaceSourceEngine,
$conversionWorkspaceSourceVersion,
$conversionWorkspaceDestinationEngine,
$conversionWorkspaceDestinationVersion
);
}
// [END datamigration_v1_generated_DataMigrationService_CreateConversionWorkspace_sync]
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/**
* Creates a new migration job in a given project and location.
*
* @param string $formattedParent The parent, which owns this collection of migration jobs. Please see
* @param string $formattedParent The parent which owns this collection of migration jobs. Please see
* {@see DataMigrationServiceClient::locationName()} for help formatting this field.
* @param string $migrationJobId The ID of the instance to create.
* @param int $migrationJobType The migration job type.
Expand Down
Loading

0 comments on commit 1a931d2

Please sign in to comment.