Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [Dms] update PHP generator to 1.8.2 #6607

Merged
merged 7 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 modified Dms/metadata/V1/ConversionworkspaceResources.php
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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
* {@see DataMigrationServiceClient::connectionProfileName()} for help formatting this field.
* {@see DataMigrationServiceClient::locationName()} for help formatting this field.
* @param string $connectionProfileId The connection profile identifier.
*/
function create_connection_profile_sample(
Expand Down Expand Up @@ -81,11 +81,7 @@ function create_connection_profile_sample(
*/
function callSample(): void
{
$formattedParent = DataMigrationServiceClient::connectionProfileName(
'[PROJECT]',
'[LOCATION]',
'[CONNECTION_PROFILE]'
);
$formattedParent = DataMigrationServiceClient::locationName('[PROJECT]', '[LOCATION]');
$connectionProfileId = '[CONNECTION_PROFILE_ID]';

create_connection_profile_sample($formattedParent, $connectionProfileId);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?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_CreateMappingRule_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\DatabaseEntityType;
use Google\Cloud\CloudDms\V1\MappingRule;
use Google\Cloud\CloudDms\V1\MappingRuleFilter;

/**
* Creates a new mapping rule for a given conversion workspace.
*
* @param string $formattedParent The parent which owns this collection of mapping rules. Please see
* {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
* @param string $mappingRuleId The ID of the rule to create.
* @param int $mappingRuleRuleScope The rule scope
* @param int $mappingRuleRuleOrder The order in which the rule is applied. Lower order rules are
* applied before higher value rules so they may end up being overridden.
*/
function create_mapping_rule_sample(
string $formattedParent,
string $mappingRuleId,
int $mappingRuleRuleScope,
int $mappingRuleRuleOrder
): void {
// Create a client.
$dataMigrationServiceClient = new DataMigrationServiceClient();

// Prepare any non-scalar elements to be passed along with the request.
$mappingRuleFilter = new MappingRuleFilter();
$mappingRule = (new MappingRule())
->setRuleScope($mappingRuleRuleScope)
->setFilter($mappingRuleFilter)
->setRuleOrder($mappingRuleRuleOrder);

// Call the API and handle any network failures.
try {
/** @var MappingRule $response */
$response = $dataMigrationServiceClient->createMappingRule(
$formattedParent,
$mappingRuleId,
$mappingRule
);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

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

create_mapping_rule_sample(
$formattedParent,
$mappingRuleId,
$mappingRuleRuleScope,
$mappingRuleRuleOrder
);
}
// [END datamigration_v1_generated_DataMigrationService_CreateMappingRule_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?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_DeleteMappingRule_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;

/**
* Deletes a single mapping rule.
*
* @param string $formattedName Name of the mapping rule resource to delete. Please see
* {@see DataMigrationServiceClient::conversionWorkspaceName()} for help formatting this field.
*/
function delete_mapping_rule_sample(string $formattedName): void
{
// Create a client.
$dataMigrationServiceClient = new DataMigrationServiceClient();

// Call the API and handle any network failures.
try {
$dataMigrationServiceClient->deleteMappingRule($formattedName);
printf('Call completed successfully.' . PHP_EOL);
} 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]'
);

delete_mapping_rule_sample($formattedName);
}
// [END datamigration_v1_generated_DataMigrationService_DeleteMappingRule_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?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_GenerateTcpProxyScript_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\TcpProxyScript;

/**
* Generate a TCP Proxy configuration script to configure a cloud-hosted VM
* running a TCP Proxy.
*
* @param string $vmName The name of the Compute instance that will host the proxy.
* @param string $vmMachineType The type of the Compute instance that will host the proxy.
* @param string $vmSubnet The name of the subnet the Compute instance will use for private
* connectivity. Must be supplied in the form of
* projects/{project}/regions/{region}/subnetworks/{subnetwork}.
* Note: the region for the subnet must match the Compute instance region.
*/
function generate_tcp_proxy_script_sample(
string $vmName,
string $vmMachineType,
string $vmSubnet
): void {
// Create a client.
$dataMigrationServiceClient = new DataMigrationServiceClient();

// Call the API and handle any network failures.
try {
/** @var TcpProxyScript $response */
$response = $dataMigrationServiceClient->generateTcpProxyScript($vmName, $vmMachineType, $vmSubnet);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

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

generate_tcp_proxy_script_sample($vmName, $vmMachineType, $vmSubnet);
}
// [END datamigration_v1_generated_DataMigrationService_GenerateTcpProxyScript_sync]
77 changes: 77 additions & 0 deletions Dms/samples/V1/DataMigrationServiceClient/get_mapping_rule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?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_GetMappingRule_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\CloudDms\V1\DataMigrationServiceClient;
use Google\Cloud\CloudDms\V1\MappingRule;

/**
* Gets the details of a mapping rule.
*
* @param string $formattedName Name of the mapping rule resource to get.
* Example: conversionWorkspaces/123/mappingRules/rule123
*
* In order to retrieve a previous revision of the mapping rule, also provide
* the revision ID.
* Example:
* conversionWorkspace/123/mappingRules/rule123&#64;c7cfa2a8c7cfa2a8c7cfa2a8c7cfa2a8
* Please see {@see DataMigrationServiceClient::mappingRuleName()} for help formatting this field.
*/
function get_mapping_rule_sample(string $formattedName): void
{
// Create a client.
$dataMigrationServiceClient = new DataMigrationServiceClient();

// Call the API and handle any network failures.
try {
/** @var MappingRule $response */
$response = $dataMigrationServiceClient->getMappingRule($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

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

get_mapping_rule_sample($formattedName);
}
// [END datamigration_v1_generated_DataMigrationService_GetMappingRule_sync]
Loading