Skip to content

Commit

Permalink
feat: Update Compute Engine API to revision 20241201 (#966) (#7906)
Browse files Browse the repository at this point in the history
Source-Link: googleapis/googleapis@5d5b1bf
Source-Link: googleapis/googleapis-gen@c735b61
Copy-Tag: eyJwIjoiQ29tcHV0ZS8uT3dsQm90LnlhbWwiLCJoIjoiYzczNWI2MTkzZGFlYmFhOWM0NWMyZTIzMTUzYWYxNmFlZTczMmZlNiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Dec 10, 2024
1 parent d67f842 commit 0f75adc
Show file tree
Hide file tree
Showing 169 changed files with 14,964 additions and 112 deletions.
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,90 @@
<?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_InstanceGroupManagers_ResumeInstances_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\InstanceGroupManagersClient;
use Google\Cloud\Compute\V1\InstanceGroupManagersResumeInstancesRequest;
use Google\Rpc\Status;

/**
* Flags the specified instances in the managed instance group to be resumed. This method increases the targetSize and decreases the targetSuspendedSize of the managed instance group by the number of instances that you resume. The resumeInstances operation is marked DONE if the resumeInstances request is successful. The underlying actions take additional time. You must separately verify the status of the RESUMING action with the listmanagedinstances method. In this request, you can only specify instances that are suspended. For example, if an instance was previously suspended using the suspendInstances method, it can be resumed using the resumeInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are resumed. You can specify a maximum of 1000 instances with this method per request.
*
* @param string $instanceGroupManager The name of the managed instance group.
* @param string $project Project ID for this request.
* @param string $zone The name of the zone where the managed instance group is located.
*/
function resume_instances_sample(
string $instanceGroupManager,
string $project,
string $zone
): void {
// Create a client.
$instanceGroupManagersClient = new InstanceGroupManagersClient();

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

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $instanceGroupManagersClient->resumeInstances(
$instanceGroupManager,
$instanceGroupManagersResumeInstancesRequestResource,
$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]';

resume_instances_sample($instanceGroupManager, $project, $zone);
}
// [END compute_v1_generated_InstanceGroupManagers_ResumeInstances_sync]
87 changes: 87 additions & 0 deletions Compute/samples/V1/InstanceGroupManagersClient/start_instances.php
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_InstanceGroupManagers_StartInstances_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\InstanceGroupManagersClient;
use Google\Cloud\Compute\V1\InstanceGroupManagersStartInstancesRequest;
use Google\Rpc\Status;

/**
* Flags the specified instances in the managed instance group to be started. This method increases the targetSize and decreases the targetStoppedSize of the managed instance group by the number of instances that you start. The startInstances operation is marked DONE if the startInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STARTING action with the listmanagedinstances method. In this request, you can only specify instances that are stopped. For example, if an instance was previously stopped using the stopInstances method, it can be started using the startInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are started. You can specify a maximum of 1000 instances with this method per request.
*
* @param string $instanceGroupManager The name of the managed instance group.
* @param string $project Project ID for this request.
* @param string $zone The name of the zone where the managed instance group is located.
*/
function start_instances_sample(string $instanceGroupManager, string $project, string $zone): void
{
// Create a client.
$instanceGroupManagersClient = new InstanceGroupManagersClient();

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

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $instanceGroupManagersClient->startInstances(
$instanceGroupManager,
$instanceGroupManagersStartInstancesRequestResource,
$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]';

start_instances_sample($instanceGroupManager, $project, $zone);
}
// [END compute_v1_generated_InstanceGroupManagers_StartInstances_sync]
87 changes: 87 additions & 0 deletions Compute/samples/V1/InstanceGroupManagersClient/stop_instances.php
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_InstanceGroupManagers_StopInstances_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\InstanceGroupManagersClient;
use Google\Cloud\Compute\V1\InstanceGroupManagersStopInstancesRequest;
use Google\Rpc\Status;

/**
* Flags the specified instances in the managed instance group to be immediately stopped. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetStoppedSize of the managed instance group by the number of instances that you stop. The stopInstances operation is marked DONE if the stopInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STOPPING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays stopping the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is stopped. Stopped instances can be started using the startInstances method. You can specify a maximum of 1000 instances with this method per request.
*
* @param string $instanceGroupManager The name of the managed instance group.
* @param string $project Project ID for this request.
* @param string $zone The name of the zone where the managed instance group is located.
*/
function stop_instances_sample(string $instanceGroupManager, string $project, string $zone): void
{
// Create a client.
$instanceGroupManagersClient = new InstanceGroupManagersClient();

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

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $instanceGroupManagersClient->stopInstances(
$instanceGroupManager,
$instanceGroupManagersStopInstancesRequestResource,
$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]';

stop_instances_sample($instanceGroupManager, $project, $zone);
}
// [END compute_v1_generated_InstanceGroupManagers_StopInstances_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?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_InstanceGroupManagers_SuspendInstances_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\InstanceGroupManagersClient;
use Google\Cloud\Compute\V1\InstanceGroupManagersSuspendInstancesRequest;
use Google\Rpc\Status;

/**
* Flags the specified instances in the managed instance group to be immediately suspended. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetSuspendedSize of the managed instance group by the number of instances that you suspend. The suspendInstances operation is marked DONE if the suspendInstances request is successful. The underlying actions take additional time. You must separately verify the status of the SUSPENDING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays suspension of the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is suspended. Suspended instances can be resumed using the resumeInstances method. You can specify a maximum of 1000 instances with this method per request.
*
* @param string $instanceGroupManager The name of the managed instance group.
* @param string $project Project ID for this request.
* @param string $zone The name of the zone where the managed instance group is located.
*/
function suspend_instances_sample(
string $instanceGroupManager,
string $project,
string $zone
): void {
// Create a client.
$instanceGroupManagersClient = new InstanceGroupManagersClient();

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

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $instanceGroupManagersClient->suspendInstances(
$instanceGroupManager,
$instanceGroupManagersSuspendInstancesRequestResource,
$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]';

suspend_instances_sample($instanceGroupManager, $project, $zone);
}
// [END compute_v1_generated_InstanceGroupManagers_SuspendInstances_sync]
Loading

0 comments on commit 0f75adc

Please sign in to comment.