Skip to content

Commit

Permalink
fix: add missing protos to PHP assembly (googleapis#6240)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 533145281
Source-Link: googleapis/googleapis@00165a9
Source-Link: https://github.com/googleapis/googleapis-gen/commit/fd245b5c29cad9db7e2bd65b15e875493d4d7c03
Copy-Tag: eyJwIjoiR2tlSHViLy5Pd2xCb3QueWFtbCIsImgiOiJmZDI0NWI1YzI5Y2FkOWRiN2UyYmQ2NWIxNWU4NzU0OTNkNGQ3YzAzIn0=
  • Loading branch information
gcf-owl-bot[bot] authored May 18, 2023
1 parent a5e03eb commit e51616e
Show file tree
Hide file tree
Showing 89 changed files with 14,622 additions and 0 deletions.
Binary file not shown.
Binary file added GkeHub/metadata/V1/Feature.php
Binary file not shown.
Binary file added GkeHub/metadata/V1/Membership.php
Binary file not shown.
29 changes: 29 additions & 0 deletions GkeHub/metadata/V1/Multiclusteringress/Multiclusteringress.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

150 changes: 150 additions & 0 deletions GkeHub/metadata/V1/Service.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions GkeHub/samples/V1/GkeHubClient/create_feature.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?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 gkehub_v1_generated_GkeHub_CreateFeature_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\CreateFeatureRequest;
use Google\Cloud\GkeHub\V1\Feature;
use Google\Rpc\Status;

/**
* Adds a new Feature.
*
* 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 create_feature_sample(): void
{
// Create a client.
$gkeHubClient = new GkeHubClient();

// Prepare the request message.
$request = new CreateFeatureRequest();

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

if ($response->operationSucceeded()) {
/** @var Feature $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} 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());
}
}
// [END gkehub_v1_generated_GkeHub_CreateFeature_sync]
101 changes: 101 additions & 0 deletions GkeHub/samples/V1/GkeHubClient/create_membership.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?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 gkehub_v1_generated_GkeHub_CreateMembership_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\CreateMembershipRequest;
use Google\Cloud\GkeHub\V1\Membership;
use Google\Rpc\Status;

/**
* Creates a new Membership.
*
* **This is currently only supported for GKE clusters on Google Cloud**.
* To register other clusters, follow the instructions at
* https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster.
*
* @param string $formattedParent The parent (project and location) where the Memberships will be
* created. Specified in the format `projects/&#42;/locations/*`. Please see
* {@see GkeHubClient::locationName()} for help formatting this field.
* @param string $membershipId Client chosen ID for the membership. `membership_id` must be a
* valid RFC 1123 compliant DNS label:
*
* 1. At most 63 characters in length
* 2. It must consist of lower case alphanumeric characters or `-`
* 3. It must start and end with an alphanumeric character
*
* Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`,
* with a maximum length of 63 characters.
*/
function create_membership_sample(string $formattedParent, string $membershipId): void
{
// Create a client.
$gkeHubClient = new GkeHubClient();

// Prepare the request message.
$resource = new Membership();
$request = (new CreateMembershipRequest())
->setParent($formattedParent)
->setMembershipId($membershipId)
->setResource($resource);

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

if ($response->operationSucceeded()) {
/** @var Membership $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} 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
{
$formattedParent = GkeHubClient::locationName('[PROJECT]', '[LOCATION]');
$membershipId = '[MEMBERSHIP_ID]';

create_membership_sample($formattedParent, $membershipId);
}
// [END gkehub_v1_generated_GkeHub_CreateMembership_sync]
Loading

0 comments on commit e51616e

Please sign in to comment.