Skip to content

Commit 206c37d

Browse files
feat: [Config] add support for enabling automigration from deprecated Terraform versions (#8855)
* feat: add support for enabling automigration from deprecated Terraform versions feat: added error code when failing import values from an external source PiperOrigin-RevId: 854277617 Source-Link: googleapis/googleapis@6145b5f Source-Link: googleapis/googleapis-gen@25bb3c0 Copy-Tag: eyJwIjoiQ29uZmlnLy5Pd2xCb3QueWFtbCIsImgiOiIyNWJiM2MwMzQ3Y2U1NGI1NzBkN2RhNjM5OGM2NjZmZjE2ZWM4ZWQwIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 345514e commit 206c37d

15 files changed

Lines changed: 902 additions & 0 deletions

Config/metadata/V1/Config.php

1.16 KB
Binary file not shown.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
/*
3+
* Copyright 2026 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START config_v1_generated_Config_GetAutoMigrationConfig_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\Config\V1\AutoMigrationConfig;
28+
use Google\Cloud\Config\V1\Client\ConfigClient;
29+
use Google\Cloud\Config\V1\GetAutoMigrationConfigRequest;
30+
31+
/**
32+
* Get the AutoMigrationConfig for a given project and location.
33+
*
34+
* @param string $formattedName The name of the AutoMigrationConfig.
35+
* Format:
36+
* 'projects/{project_id}/locations/{location}/AutoMigrationConfig'. Please see
37+
* {@see ConfigClient::autoMigrationConfigName()} for help formatting this field.
38+
*/
39+
function get_auto_migration_config_sample(string $formattedName): void
40+
{
41+
// Create a client.
42+
$configClient = new ConfigClient();
43+
44+
// Prepare the request message.
45+
$request = (new GetAutoMigrationConfigRequest())
46+
->setName($formattedName);
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
/** @var AutoMigrationConfig $response */
51+
$response = $configClient->getAutoMigrationConfig($request);
52+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
53+
} catch (ApiException $ex) {
54+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
55+
}
56+
}
57+
58+
/**
59+
* Helper to execute the sample.
60+
*
61+
* This sample has been automatically generated and should be regarded as a code
62+
* template only. It will require modifications to work:
63+
* - It may require correct/in-range values for request initialization.
64+
* - It may require specifying regional endpoints when creating the service client,
65+
* please see the apiEndpoint client configuration option for more details.
66+
*/
67+
function callSample(): void
68+
{
69+
$formattedName = ConfigClient::autoMigrationConfigName('[PROJECT]', '[LOCATION]');
70+
71+
get_auto_migration_config_sample($formattedName);
72+
}
73+
// [END config_v1_generated_Config_GetAutoMigrationConfig_sync]
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/*
3+
* Copyright 2026 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START config_v1_generated_Config_UpdateAutoMigrationConfig_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\Config\V1\AutoMigrationConfig;
29+
use Google\Cloud\Config\V1\Client\ConfigClient;
30+
use Google\Cloud\Config\V1\UpdateAutoMigrationConfigRequest;
31+
use Google\Rpc\Status;
32+
33+
/**
34+
* Updates the AutoMigrationConfig for a given project and location.
35+
*
36+
* This sample has been automatically generated and should be regarded as a code
37+
* template only. It will require modifications to work:
38+
* - It may require correct/in-range values for request initialization.
39+
* - It may require specifying regional endpoints when creating the service client,
40+
* please see the apiEndpoint client configuration option for more details.
41+
*/
42+
function update_auto_migration_config_sample(): void
43+
{
44+
// Create a client.
45+
$configClient = new ConfigClient();
46+
47+
// Prepare the request message.
48+
$autoMigrationConfig = new AutoMigrationConfig();
49+
$request = (new UpdateAutoMigrationConfigRequest())
50+
->setAutoMigrationConfig($autoMigrationConfig);
51+
52+
// Call the API and handle any network failures.
53+
try {
54+
/** @var OperationResponse $response */
55+
$response = $configClient->updateAutoMigrationConfig($request);
56+
$response->pollUntilComplete();
57+
58+
if ($response->operationSucceeded()) {
59+
/** @var AutoMigrationConfig $result */
60+
$result = $response->getResult();
61+
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
62+
} else {
63+
/** @var Status $error */
64+
$error = $response->getError();
65+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
66+
}
67+
} catch (ApiException $ex) {
68+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
69+
}
70+
}
71+
// [END config_v1_generated_Config_UpdateAutoMigrationConfig_sync]

Config/src/V1/AutoMigrationConfig.php

Lines changed: 153 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)