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 20231110 (#868) #6849

Merged
merged 5 commits into from
Dec 8, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file modified Compute/metadata/V1/Compute.php
Binary file not shown.
67 changes: 67 additions & 0 deletions Compute/samples/V1/BackendBucketsClient/get_iam_policy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?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 compute_v1_generated_BackendBuckets_GetIamPolicy_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\BackendBucketsClient;
use Google\Cloud\Compute\V1\Policy;

/**
* Gets the access control policy for a resource. May be empty if no such policy or resource exists.
*
* @param string $project Project ID for this request.
* @param string $resource Name or id of the resource for this request.
*/
function get_iam_policy_sample(string $project, string $resource): void
{
// Create a client.
$backendBucketsClient = new BackendBucketsClient();

// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $backendBucketsClient->getIamPolicy($project, $resource);
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]';
$resource = '[RESOURCE]';

get_iam_policy_sample($project, $resource);
}
// [END compute_v1_generated_BackendBuckets_GetIamPolicy_sync]
75 changes: 75 additions & 0 deletions Compute/samples/V1/BackendBucketsClient/set_iam_policy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?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 compute_v1_generated_BackendBuckets_SetIamPolicy_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\BackendBucketsClient;
use Google\Cloud\Compute\V1\GlobalSetPolicyRequest;
use Google\Cloud\Compute\V1\Policy;

/**
* Sets the access control policy on the specified resource. Replaces any existing policy.
*
* @param string $project Project ID for this request.
* @param string $resource Name or id of the resource for this request.
*/
function set_iam_policy_sample(string $project, string $resource): void
{
// Create a client.
$backendBucketsClient = new BackendBucketsClient();

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

// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $backendBucketsClient->setIamPolicy(
$globalSetPolicyRequestResource,
$project,
$resource
);
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]';
$resource = '[RESOURCE]';

set_iam_policy_sample($project, $resource);
}
// [END compute_v1_generated_BackendBuckets_SetIamPolicy_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?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 compute_v1_generated_BackendBuckets_TestIamPermissions_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\BackendBucketsClient;
use Google\Cloud\Compute\V1\TestPermissionsRequest;
use Google\Cloud\Compute\V1\TestPermissionsResponse;

/**
* Returns permissions that a caller has on the specified resource.
*
* @param string $project Project ID for this request.
* @param string $resource Name or id of the resource for this request.
*/
function test_iam_permissions_sample(string $project, string $resource): void
{
// Create a client.
$backendBucketsClient = new BackendBucketsClient();

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

// Call the API and handle any network failures.
try {
/** @var TestPermissionsResponse $response */
$response = $backendBucketsClient->testIamPermissions(
$project,
$resource,
$testPermissionsRequestResource
);
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]';
$resource = '[RESOURCE]';

test_iam_permissions_sample($project, $resource);
}
// [END compute_v1_generated_BackendBuckets_TestIamPermissions_sync]
68 changes: 68 additions & 0 deletions Compute/samples/V1/BackendServicesClient/list_usable.php
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 compute_v1_generated_BackendServices_ListUsable_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Compute\V1\BackendServicesClient;

/**
* Retrieves an aggregated list of all usable backend services in the specified project.
*
* @param string $project Project ID for this request.
*/
function list_usable_sample(string $project): void
{
// Create a client.
$backendServicesClient = new BackendServicesClient();

// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $backendServicesClient->listUsable($project);

foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->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]';

list_usable_sample($project);
}
// [END compute_v1_generated_BackendServices_ListUsable_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?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 compute_v1_generated_BackendServices_TestIamPermissions_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\BackendServicesClient;
use Google\Cloud\Compute\V1\TestPermissionsRequest;
use Google\Cloud\Compute\V1\TestPermissionsResponse;

/**
* Returns permissions that a caller has on the specified resource.
*
* @param string $project Project ID for this request.
* @param string $resource Name or id of the resource for this request.
*/
function test_iam_permissions_sample(string $project, string $resource): void
{
// Create a client.
$backendServicesClient = new BackendServicesClient();

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

// Call the API and handle any network failures.
try {
/** @var TestPermissionsResponse $response */
$response = $backendServicesClient->testIamPermissions(
$project,
$resource,
$testPermissionsRequestResource
);
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]';
$resource = '[RESOURCE]';

test_iam_permissions_sample($project, $resource);
}
// [END compute_v1_generated_BackendServices_TestIamPermissions_sync]
Loading