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

feat: [Compute] Update Compute Engine API to revision 20250211 #8097

Merged
merged 4 commits into from
Feb 20, 2025
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 Compute/metadata/V1/Compute.php
Binary file not shown.
85 changes: 85 additions & 0 deletions Compute/samples/V1/RoutersClient/delete_route_policy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php
/*
* Copyright 2025 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 compute_v1_generated_Routers_DeleteRoutePolicy_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\Client\RoutersClient;
use Google\Cloud\Compute\V1\DeleteRoutePolicyRouterRequest;
use Google\Rpc\Status;

/**
* Deletes Route Policy
*
* @param string $project Project ID for this request.
* @param string $region Name of the region for this request.
* @param string $router Name of the Router resource where Route Policy is defined.
*/
function delete_route_policy_sample(string $project, string $region, string $router): void
{
// Create a client.
$routersClient = new RoutersClient();

// Prepare the request message.
$request = (new DeleteRoutePolicyRouterRequest())
->setProject($project)
->setRegion($region)
->setRouter($router);

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

if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} 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
{
$project = '[PROJECT]';
$region = '[REGION]';
$router = '[ROUTER]';

delete_route_policy_sample($project, $region, $router);
}
// [END compute_v1_generated_Routers_DeleteRoutePolicy_sync]
76 changes: 76 additions & 0 deletions Compute/samples/V1/RoutersClient/get_route_policy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/*
* Copyright 2025 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 compute_v1_generated_Routers_GetRoutePolicy_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\Client\RoutersClient;
use Google\Cloud\Compute\V1\GetRoutePolicyRouterRequest;
use Google\Cloud\Compute\V1\RoutersGetRoutePolicyResponse;

/**
* Returns specified Route Policy
*
* @param string $project Project ID for this request.
* @param string $region Name of the region for this request.
* @param string $router Name of the Router resource to query for the route policy. The name should conform to RFC1035.
*/
function get_route_policy_sample(string $project, string $region, string $router): void
{
// Create a client.
$routersClient = new RoutersClient();

// Prepare the request message.
$request = (new GetRoutePolicyRouterRequest())
->setProject($project)
->setRegion($region)
->setRouter($router);

// Call the API and handle any network failures.
try {
/** @var RoutersGetRoutePolicyResponse $response */
$response = $routersClient->getRoutePolicy($request);
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
{
$project = '[PROJECT]';
$region = '[REGION]';
$router = '[ROUTER]';

get_route_policy_sample($project, $region, $router);
}
// [END compute_v1_generated_Routers_GetRoutePolicy_sync]
76 changes: 76 additions & 0 deletions Compute/samples/V1/RoutersClient/list_bgp_routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/*
* Copyright 2025 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 compute_v1_generated_Routers_ListBgpRoutes_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\Client\RoutersClient;
use Google\Cloud\Compute\V1\ListBgpRoutesRoutersRequest;
use Google\Cloud\Compute\V1\RoutersListBgpRoutes;

/**
* Retrieves a list of router bgp routes available to the specified project.
*
* @param string $project Project ID for this request.
* @param string $region Name of the region for this request.
* @param string $router Name or id of the resource for this request. Name should conform to RFC1035.
*/
function list_bgp_routes_sample(string $project, string $region, string $router): void
{
// Create a client.
$routersClient = new RoutersClient();

// Prepare the request message.
$request = (new ListBgpRoutesRoutersRequest())
->setProject($project)
->setRegion($region)
->setRouter($router);

// Call the API and handle any network failures.
try {
/** @var RoutersListBgpRoutes $response */
$response = $routersClient->listBgpRoutes($request);
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
{
$project = '[PROJECT]';
$region = '[REGION]';
$router = '[ROUTER]';

list_bgp_routes_sample($project, $region, $router);
}
// [END compute_v1_generated_Routers_ListBgpRoutes_sync]
76 changes: 76 additions & 0 deletions Compute/samples/V1/RoutersClient/list_route_policies.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/*
* Copyright 2025 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 compute_v1_generated_Routers_ListRoutePolicies_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\Client\RoutersClient;
use Google\Cloud\Compute\V1\ListRoutePoliciesRoutersRequest;
use Google\Cloud\Compute\V1\RoutersListRoutePolicies;

/**
* Retrieves a list of router route policy subresources available to the specified project.
*
* @param string $project Project ID for this request.
* @param string $region Name of the region for this request.
* @param string $router Name or id of the resource for this request. Name should conform to RFC1035.
*/
function list_route_policies_sample(string $project, string $region, string $router): void
{
// Create a client.
$routersClient = new RoutersClient();

// Prepare the request message.
$request = (new ListRoutePoliciesRoutersRequest())
->setProject($project)
->setRegion($region)
->setRouter($router);

// Call the API and handle any network failures.
try {
/** @var RoutersListRoutePolicies $response */
$response = $routersClient->listRoutePolicies($request);
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
{
$project = '[PROJECT]';
$region = '[REGION]';
$router = '[ROUTER]';

list_route_policies_sample($project, $region, $router);
}
// [END compute_v1_generated_Routers_ListRoutePolicies_sync]
Loading
Loading