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 20240421 (#899) #7268

Merged
merged 8 commits into from
Apr 30, 2024
Binary file modified Compute/metadata/V1/Compute.php
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
/*
* Copyright 2024 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_InstanceGroupManagerResizeRequests_Cancel_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\InstanceGroupManagerResizeRequestsClient;
use Google\Rpc\Status;

/**
* Cancels the specified resize request and removes it from the queue. Cancelled resize request does no longer wait for the resources to be provisioned. Cancel is only possible for requests that are accepted in the queue.
*
* @param string $instanceGroupManager The name of the managed instance group. The name should conform to RFC1035 or be a resource ID.
* @param string $project Project ID for this request.
* @param string $resizeRequest The name of the resize request to cancel. The name should conform to RFC1035 or be a resource ID.
* @param string $zone The name of the zone where the managed instance group is located. The name should conform to RFC1035.
*/
function cancel_sample(
string $instanceGroupManager,
string $project,
string $resizeRequest,
string $zone
): void {
// Create a client.
$instanceGroupManagerResizeRequestsClient = new InstanceGroupManagerResizeRequestsClient();

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $instanceGroupManagerResizeRequestsClient->cancel(
$instanceGroupManager,
$project,
$resizeRequest,
$zone
);
$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
{
$instanceGroupManager = '[INSTANCE_GROUP_MANAGER]';
$project = '[PROJECT]';
$resizeRequest = '[RESIZE_REQUEST]';
$zone = '[ZONE]';

cancel_sample($instanceGroupManager, $project, $resizeRequest, $zone);
}
// [END compute_v1_generated_InstanceGroupManagerResizeRequests_Cancel_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
/*
* Copyright 2024 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_InstanceGroupManagerResizeRequests_Delete_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\InstanceGroupManagerResizeRequestsClient;
use Google\Rpc\Status;

/**
* Deletes the specified, inactive resize request. Requests that are still active cannot be deleted. Deleting request does not delete instances that were provisioned previously.
*
* @param string $instanceGroupManager The name of the managed instance group. The name should conform to RFC1035 or be a resource ID.
* @param string $project Project ID for this request.
* @param string $resizeRequest The name of the resize request to delete. The name should conform to RFC1035 or be a resource ID.
* @param string $zone The name of the zone where the managed instance group is located. The name should conform to RFC1035.
*/
function delete_sample(
string $instanceGroupManager,
string $project,
string $resizeRequest,
string $zone
): void {
// Create a client.
$instanceGroupManagerResizeRequestsClient = new InstanceGroupManagerResizeRequestsClient();

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $instanceGroupManagerResizeRequestsClient->delete(
$instanceGroupManager,
$project,
$resizeRequest,
$zone
);
$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
{
$instanceGroupManager = '[INSTANCE_GROUP_MANAGER]';
$project = '[PROJECT]';
$resizeRequest = '[RESIZE_REQUEST]';
$zone = '[ZONE]';

delete_sample($instanceGroupManager, $project, $resizeRequest, $zone);
}
// [END compute_v1_generated_InstanceGroupManagerResizeRequests_Delete_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php
/*
* Copyright 2024 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_InstanceGroupManagerResizeRequests_Get_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\InstanceGroupManagerResizeRequest;
use Google\Cloud\Compute\V1\InstanceGroupManagerResizeRequestsClient;

/**
* Returns all of the details about the specified resize request.
*
* @param string $instanceGroupManager The name of the managed instance group. Name should conform to RFC1035 or be a resource ID.
* @param string $project Project ID for this request.
* @param string $resizeRequest The name of the resize request. Name should conform to RFC1035 or be a resource ID.
* @param string $zone Name of the href="/compute/docs/regions-zones/#available">zone scoping this request. Name should conform to RFC1035.
*/
function get_sample(
string $instanceGroupManager,
string $project,
string $resizeRequest,
string $zone
): void {
// Create a client.
$instanceGroupManagerResizeRequestsClient = new InstanceGroupManagerResizeRequestsClient();

// Call the API and handle any network failures.
try {
/** @var InstanceGroupManagerResizeRequest $response */
$response = $instanceGroupManagerResizeRequestsClient->get(
$instanceGroupManager,
$project,
$resizeRequest,
$zone
);
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
{
$instanceGroupManager = '[INSTANCE_GROUP_MANAGER]';
$project = '[PROJECT]';
$resizeRequest = '[RESIZE_REQUEST]';
$zone = '[ZONE]';

get_sample($instanceGroupManager, $project, $resizeRequest, $zone);
}
// [END compute_v1_generated_InstanceGroupManagerResizeRequests_Get_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php
/*
* Copyright 2024 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_InstanceGroupManagerResizeRequests_Insert_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\InstanceGroupManagerResizeRequest;
use Google\Cloud\Compute\V1\InstanceGroupManagerResizeRequestsClient;
use Google\Rpc\Status;

/**
* Creates a new resize request that starts provisioning VMs immediately or queues VM creation.
*
* @param string $instanceGroupManager The name of the managed instance group to which the resize request will be added. Name should conform to RFC1035 or be a resource ID.
* @param string $project Project ID for this request.
* @param string $zone The name of the zone where the managed instance group is located and where the resize request will be created. Name should conform to RFC1035.
*/
function insert_sample(string $instanceGroupManager, string $project, string $zone): void
{
// Create a client.
$instanceGroupManagerResizeRequestsClient = new InstanceGroupManagerResizeRequestsClient();

// Prepare any non-scalar elements to be passed along with the request.
$instanceGroupManagerResizeRequestResource = new InstanceGroupManagerResizeRequest();

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $instanceGroupManagerResizeRequestsClient->insert(
$instanceGroupManager,
$instanceGroupManagerResizeRequestResource,
$project,
$zone
);
$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
{
$instanceGroupManager = '[INSTANCE_GROUP_MANAGER]';
$project = '[PROJECT]';
$zone = '[ZONE]';

insert_sample($instanceGroupManager, $project, $zone);
}
// [END compute_v1_generated_InstanceGroupManagerResizeRequests_Insert_sync]
Loading
Loading