Skip to content
Open
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 GkeHub/metadata/V1/Feature.php
Binary file not shown.
Binary file added GkeHub/metadata/V1/Fleet.php
Binary file not shown.

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

238 changes: 226 additions & 12 deletions GkeHub/metadata/V1/Service.php

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions GkeHub/samples/V1/GkeHubClient/create_fleet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php
/*
* Copyright 2026 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_CreateFleet_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\CreateFleetRequest;
use Google\Cloud\GkeHub\V1\Fleet;
use Google\Rpc\Status;

/**
* Creates a fleet.
*
* @param string $formattedParent The parent (project and location) where the Fleet will be
* created. Specified in the format `projects/&#42;/locations/*`. Please see
* {@see GkeHubClient::locationName()} for help formatting this field.
*/
function create_fleet_sample(string $formattedParent): void
{
// Create a client.
$gkeHubClient = new GkeHubClient();

// Prepare the request message.
$fleet = new Fleet();
$request = (new CreateFleetRequest())
->setParent($formattedParent)
->setFleet($fleet);

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

if ($response->operationSucceeded()) {
/** @var Fleet $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]');

create_fleet_sample($formattedParent);
}
// [END gkehub_v1_generated_GkeHub_CreateFleet_sync]
92 changes: 92 additions & 0 deletions GkeHub/samples/V1/GkeHubClient/create_membership_binding.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/*
* Copyright 2026 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_CreateMembershipBinding_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\CreateMembershipBindingRequest;
use Google\Cloud\GkeHub\V1\MembershipBinding;
use Google\Rpc\Status;

/**
* Creates a MembershipBinding.
*
* @param string $formattedParent The parent (project and location) where the MembershipBinding
* will be created. Specified in the format
* `projects/&#42;/locations/&#42;/memberships/*`. Please see
* {@see GkeHubClient::membershipName()} for help formatting this field.
* @param string $membershipBindingId The ID to use for the MembershipBinding.
*/
function create_membership_binding_sample(
string $formattedParent,
string $membershipBindingId
): void {
// Create a client.
$gkeHubClient = new GkeHubClient();

// Prepare the request message.
$membershipBinding = new MembershipBinding();
$request = (new CreateMembershipBindingRequest())
->setParent($formattedParent)
->setMembershipBinding($membershipBinding)
->setMembershipBindingId($membershipBindingId);

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

if ($response->operationSucceeded()) {
/** @var MembershipBinding $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::membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]');
$membershipBindingId = '[MEMBERSHIP_BINDING_ID]';

create_membership_binding_sample($formattedParent, $membershipBindingId);
}
// [END gkehub_v1_generated_GkeHub_CreateMembershipBinding_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php
/*
* Copyright 2026 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_CreateMembershipRBACRoleBinding_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\CreateMembershipRBACRoleBindingRequest;
use Google\Cloud\GkeHub\V1\RBACRoleBinding;
use Google\Cloud\GkeHub\V1\RBACRoleBinding\Role;
use Google\Rpc\Status;

/**
* Creates a Membership RBACRoleBinding.
*
* @param string $formattedParent The parent (project and location) where the RBACRoleBinding will
* be created. Specified in the format `projects/&#42;/locations/&#42;/memberships/*`. Please see
* {@see GkeHubClient::scopeName()} for help formatting this field.
* @param string $rbacrolebindingId Client chosen ID for the RBACRoleBinding. `rbacrolebinding_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_rbac_role_binding_sample(
string $formattedParent,
string $rbacrolebindingId
): void {
// Create a client.
$gkeHubClient = new GkeHubClient();

// Prepare the request message.
$rbacrolebindingRole = new Role();
$rbacrolebinding = (new RBACRoleBinding())
->setRole($rbacrolebindingRole);
$request = (new CreateMembershipRBACRoleBindingRequest())
->setParent($formattedParent)
->setRbacrolebindingId($rbacrolebindingId)
->setRbacrolebinding($rbacrolebinding);

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

if ($response->operationSucceeded()) {
/** @var RBACRoleBinding $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::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]');
$rbacrolebindingId = '[RBACROLEBINDING_ID]';

create_membership_rbac_role_binding_sample($formattedParent, $rbacrolebindingId);
}
// [END gkehub_v1_generated_GkeHub_CreateMembershipRBACRoleBinding_sync]
Loading
Loading