Google Cloud Gke Hub V1 Client - Class GkeHubClient (1.3.1)

Reference documentation and code samples for the Google Cloud Gke Hub V1 Client class GkeHubClient.

Service Description: The GKE Hub service handles the registration of many Kubernetes clusters to Google Cloud, and the management of multi-cluster features over those clusters.

The GKE Hub service operates on the following resources:

GKE Hub is currently available in the global region and all regions in https://cloud.google.com/compute/docs/regions-zones . Feature is only available in global region while membership is global region and all the regions.

Membership management may be non-trivial:it is recommended to use one of the Google-provided client libraries or tools where possible when working with Membership resources.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Namespace

Google \ Cloud \ GkeHub \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name
Description
options
array| Google\ApiCore\Options\ClientOptions

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint
string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials
FetchAuthTokenInterface|CredentialsWrapper

This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Cloud\GkeHub\V1\GkeHubClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new GkeHubClient(['credentials' => $creds]); https://cloud.google.com/docs/authentication/external/externally-sourced-credentials

↳ credentialsConfig
array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries
bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false .

↳ clientConfig
string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport
string|TransportInterface

The transport used for executing network requests. May be either the string rest or grpc . Defaults to grpc if gRPC support is detected on the system. Advanced usage : Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig
array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource
callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

↳ logger
false|LoggerInterface

A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag

↳ universeDomain
string

The service domain for the client. Defaults to 'googleapis.com'.

createFeature

Adds a new Feature.

The async variant is GkeHubClient::createFeatureAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\CreateFeatureRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 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;

/**
 * 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());
    }
} 

createFleet

Creates a fleet.

The async variant is GkeHubClient::createFleetAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\CreateFleetRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 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;

/**
 * @param string $formattedParent The parent (project and location) where the Fleet will be
 *                                created. Specified in the format `projects/*/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);
} 

createMembership

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 .

The async variant is GkeHubClient::createMembershipAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\CreateMembershipRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 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;

/**
 * @param string $formattedParent The parent (project and location) where the Memberships will be
 *                                created. Specified in the format `projects/*/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);
} 

createMembershipBinding

Creates a MembershipBinding.

The async variant is GkeHubClient::createMembershipBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\CreateMembershipBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 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;

/**
 * @param string $formattedParent     The parent (project and location) where the MembershipBinding
 *                                    will be created. Specified in the format
 *                                    `projects/*/locations/*/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);
} 

createMembershipRBACRoleBinding

Creates a Membership RBACRoleBinding.

The async variant is GkeHubClient::createMembershipRBACRoleBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\CreateMembershipRBACRoleBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 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;

/**
 * @param string $formattedParent   The parent (project and location) where the RBACRoleBinding will
 *                                  be created. Specified in the format `projects/*/locations/*/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);
} 

createScope

Creates a Scope.

The async variant is GkeHubClient::createScopeAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\CreateScopeRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\CreateScopeRequest;
use Google\Cloud\GkeHub\V1\Scope;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The parent (project and location) where the Scope will be
 *                                created. Specified in the format `projects/*/locations/*`. Please see
 *                                {@see GkeHubClient::locationName()} for help formatting this field.
 * @param string $scopeId         Client chosen ID for the Scope. `scope_id` must be a
 *                                ????
 */
function create_scope_sample(string $formattedParent, string $scopeId): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $scope = new Scope();
    $request = (new CreateScopeRequest())
        ->setParent($formattedParent)
        ->setScopeId($scopeId)
        ->setScope($scope);

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

        if ($response->operationSucceeded()) {
            /** @var Scope $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]');
    $scopeId = '[SCOPE_ID]';

    create_scope_sample($formattedParent, $scopeId);
} 

createScopeNamespace

Creates a fleet namespace.

The async variant is GkeHubClient::createScopeNamespaceAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\CreateScopeNamespaceRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\CreateScopeNamespaceRequest;
use Google\Cloud\GkeHub\V1\PBNamespace;
use Google\Rpc\Status;

/**
 * @param string $formattedParent              The parent (project and location) where the Namespace will be
 *                                             created. Specified in the format `projects/*/locations/*/scopes/*`. Please see
 *                                             {@see GkeHubClient::scopeName()} for help formatting this field.
 * @param string $scopeNamespaceId             Client chosen ID for the Namespace. `namespace_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.
 * @param string $formattedScopeNamespaceScope Scope associated with the namespace
 *                                             Please see {@see GkeHubClient::scopeName()} for help formatting this field.
 */
function create_scope_namespace_sample(
    string $formattedParent,
    string $scopeNamespaceId,
    string $formattedScopeNamespaceScope
): void {
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $scopeNamespace = (new PBNamespace())
        ->setScope($formattedScopeNamespaceScope);
    $request = (new CreateScopeNamespaceRequest())
        ->setParent($formattedParent)
        ->setScopeNamespaceId($scopeNamespaceId)
        ->setScopeNamespace($scopeNamespace);

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

        if ($response->operationSucceeded()) {
            /** @var PBNamespace $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]');
    $scopeNamespaceId = '[SCOPE_NAMESPACE_ID]';
    $formattedScopeNamespaceScope = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]');

    create_scope_namespace_sample($formattedParent, $scopeNamespaceId, $formattedScopeNamespaceScope);
} 

createScopeRBACRoleBinding

Creates a Scope RBACRoleBinding.

The async variant is GkeHubClient::createScopeRBACRoleBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\CreateScopeRBACRoleBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\CreateScopeRBACRoleBindingRequest;
use Google\Cloud\GkeHub\V1\RBACRoleBinding;
use Google\Cloud\GkeHub\V1\RBACRoleBinding\Role;
use Google\Rpc\Status;

/**
 * @param string $formattedParent   The parent (project and location) where the RBACRoleBinding will
 *                                  be created. Specified in the format `projects/*/locations/*/scopes/*`. 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_scope_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 CreateScopeRBACRoleBindingRequest())
        ->setParent($formattedParent)
        ->setRbacrolebindingId($rbacrolebindingId)
        ->setRbacrolebinding($rbacrolebinding);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->createScopeRBACRoleBinding($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_scope_rbac_role_binding_sample($formattedParent, $rbacrolebindingId);
} 

deleteFeature

Removes a Feature.

The async variant is GkeHubClient::deleteFeatureAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\DeleteFeatureRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\DeleteFeatureRequest;
use Google\Rpc\Status;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->deleteFeature($request);
        $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());
    }
} 

deleteFleet

Removes a Fleet. There must be no memberships remaining in the Fleet.

The async variant is GkeHubClient::deleteFleetAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\DeleteFleetRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\DeleteFleetRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The Fleet resource name in the format
 *                              `projects/*/locations/*/fleets/*`. Please see
 *                              {@see GkeHubClient::fleetName()} for help formatting this field.
 */
function delete_fleet_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new DeleteFleetRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->deleteFleet($request);
        $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
{
    $formattedName = GkeHubClient::fleetName('[PROJECT]', '[LOCATION]', '[FLEET]');

    delete_fleet_sample($formattedName);
} 

deleteMembership

Removes a Membership.

This is currently only supported for GKE clusters on Google Cloud. To unregister other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster .

The async variant is GkeHubClient::deleteMembershipAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\DeleteMembershipRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\DeleteMembershipRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The Membership resource name in the format
 *                              `projects/*/locations/*/memberships/*`. Please see
 *                              {@see GkeHubClient::membershipName()} for help formatting this field.
 */
function delete_membership_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new DeleteMembershipRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->deleteMembership($request);
        $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
{
    $formattedName = GkeHubClient::membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]');

    delete_membership_sample($formattedName);
} 

deleteMembershipBinding

Deletes a MembershipBinding.

The async variant is GkeHubClient::deleteMembershipBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\DeleteMembershipBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\DeleteMembershipBindingRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The MembershipBinding resource name in the format
 *                              `projects/*/locations/*/memberships/*/bindings/*`. Please see
 *                              {@see GkeHubClient::membershipBindingName()} for help formatting this field.
 */
function delete_membership_binding_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new DeleteMembershipBindingRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->deleteMembershipBinding($request);
        $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
{
    $formattedName = GkeHubClient::membershipBindingName(
        '[PROJECT]',
        '[LOCATION]',
        '[MEMBERSHIP]',
        '[MEMBERSHIPBINDING]'
    );

    delete_membership_binding_sample($formattedName);
} 

deleteMembershipRBACRoleBinding

Deletes a Membership RBACRoleBinding.

The async variant is GkeHubClient::deleteMembershipRBACRoleBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\DeleteMembershipRBACRoleBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\DeleteMembershipRBACRoleBindingRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The RBACRoleBinding resource name in the format
 *                              `projects/*/locations/*/memberships/*/rbacrolebindings/*`. Please see
 *                              {@see GkeHubClient::rBACRoleBindingName()} for help formatting this field.
 */
function delete_membership_rbac_role_binding_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new DeleteMembershipRBACRoleBindingRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->deleteMembershipRBACRoleBinding($request);
        $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
{
    $formattedName = GkeHubClient::rBACRoleBindingName(
        '[PROJECT]',
        '[LOCATION]',
        '[SCOPE]',
        '[RBACROLEBINDING]'
    );

    delete_membership_rbac_role_binding_sample($formattedName);
} 

deleteScope

Deletes a Scope.

The async variant is GkeHubClient::deleteScopeAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\DeleteScopeRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\DeleteScopeRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The Scope resource name in the format
 *                              `projects/*/locations/*/scopes/*`. Please see
 *                              {@see GkeHubClient::scopeName()} for help formatting this field.
 */
function delete_scope_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new DeleteScopeRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->deleteScope($request);
        $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
{
    $formattedName = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]');

    delete_scope_sample($formattedName);
} 

deleteScopeNamespace

Deletes a fleet namespace.

The async variant is GkeHubClient::deleteScopeNamespaceAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\DeleteScopeNamespaceRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\DeleteScopeNamespaceRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The Namespace resource name in the format
 *                              `projects/*/locations/*/scopes/*/namespaces/*`. Please see
 *                              {@see GkeHubClient::namespaceName()} for help formatting this field.
 */
function delete_scope_namespace_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new DeleteScopeNamespaceRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->deleteScopeNamespace($request);
        $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
{
    $formattedName = GkeHubClient::namespaceName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[NAMESPACE]');

    delete_scope_namespace_sample($formattedName);
} 

deleteScopeRBACRoleBinding

Deletes a Scope RBACRoleBinding.

The async variant is GkeHubClient::deleteScopeRBACRoleBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\DeleteScopeRBACRoleBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\DeleteScopeRBACRoleBindingRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The RBACRoleBinding resource name in the format
 *                              `projects/*/locations/*/scopes/*/rbacrolebindings/*`. Please see
 *                              {@see GkeHubClient::rBACRoleBindingName()} for help formatting this field.
 */
function delete_scope_rbac_role_binding_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new DeleteScopeRBACRoleBindingRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->deleteScopeRBACRoleBinding($request);
        $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
{
    $formattedName = GkeHubClient::rBACRoleBindingName(
        '[PROJECT]',
        '[LOCATION]',
        '[SCOPE]',
        '[RBACROLEBINDING]'
    );

    delete_scope_rbac_role_binding_sample($formattedName);
} 

generateConnectManifest

Generates the manifest for deployment of the GKE connect agent.

This method is used internally by Google-provided libraries.Most clients should not need to call this method directly.

The async variant is GkeHubClient::generateConnectManifestAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\GenerateConnectManifestRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\GenerateConnectManifestRequest;
use Google\Cloud\GkeHub\V1\GenerateConnectManifestResponse;

/**
 * @param string $formattedName The Membership resource name the Agent will associate with, in
 *                              the format `projects/*/locations/*/memberships/*`. Please see
 *                              {@see GkeHubClient::membershipName()} for help formatting this field.
 */
function generate_connect_manifest_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new GenerateConnectManifestRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var GenerateConnectManifestResponse $response */
        $response = $gkeHubClient->generateConnectManifest($request);
        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
{
    $formattedName = GkeHubClient::membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]');

    generate_connect_manifest_sample($formattedName);
} 

generateMembershipRBACRoleBindingYAML

Generates a YAML of the RBAC policies for the specified RoleBinding and its associated impersonation resources.

The async variant is GkeHubClient::generateMembershipRBACRoleBindingYAMLAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\GenerateMembershipRBACRoleBindingYAMLRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\GenerateMembershipRBACRoleBindingYAMLRequest;
use Google\Cloud\GkeHub\V1\GenerateMembershipRBACRoleBindingYAMLResponse;
use Google\Cloud\GkeHub\V1\RBACRoleBinding;
use Google\Cloud\GkeHub\V1\RBACRoleBinding\Role;

/**
 * @param string $formattedParent   The parent (project and location) where the RBACRoleBinding will
 *                                  be created. Specified in the format `projects/*/locations/*/memberships/*`. Please see
 *                                  {@see GkeHubClient::membershipName()} 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 generate_membership_rbac_role_binding_yaml_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 GenerateMembershipRBACRoleBindingYAMLRequest())
        ->setParent($formattedParent)
        ->setRbacrolebindingId($rbacrolebindingId)
        ->setRbacrolebinding($rbacrolebinding);

    // Call the API and handle any network failures.
    try {
        /** @var GenerateMembershipRBACRoleBindingYAMLResponse $response */
        $response = $gkeHubClient->generateMembershipRBACRoleBindingYAML($request);
        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
{
    $formattedParent = GkeHubClient::membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]');
    $rbacrolebindingId = '[RBACROLEBINDING_ID]';

    generate_membership_rbac_role_binding_yaml_sample($formattedParent, $rbacrolebindingId);
} 

getFeature

Gets details of a single Feature.

The async variant is GkeHubClient::getFeatureAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\GetFeatureRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\Feature;
use Google\Cloud\GkeHub\V1\GetFeatureRequest;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var Feature $response */
        $response = $gkeHubClient->getFeature($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
} 

getFleet

Returns the details of a fleet.

The async variant is GkeHubClient::getFleetAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\GetFleetRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\Fleet;
use Google\Cloud\GkeHub\V1\GetFleetRequest;

/**
 * @param string $formattedName The Fleet resource name in the format
 *                              `projects/*/locations/*/fleets/*`. Please see
 *                              {@see GkeHubClient::fleetName()} for help formatting this field.
 */
function get_fleet_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new GetFleetRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Fleet $response */
        $response = $gkeHubClient->getFleet($request);
        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
{
    $formattedName = GkeHubClient::fleetName('[PROJECT]', '[LOCATION]', '[FLEET]');

    get_fleet_sample($formattedName);
} 

getMembership

Gets the details of a Membership.

The async variant is GkeHubClient::getMembershipAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\GetMembershipRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\GetMembershipRequest;
use Google\Cloud\GkeHub\V1\Membership;

/**
 * @param string $formattedName The Membership resource name in the format
 *                              `projects/*/locations/*/memberships/*`. Please see
 *                              {@see GkeHubClient::membershipName()} for help formatting this field.
 */
function get_membership_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new GetMembershipRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Membership $response */
        $response = $gkeHubClient->getMembership($request);
        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
{
    $formattedName = GkeHubClient::membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]');

    get_membership_sample($formattedName);
} 

getMembershipBinding

Returns the details of a MembershipBinding.

The async variant is GkeHubClient::getMembershipBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\GetMembershipBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\GetMembershipBindingRequest;
use Google\Cloud\GkeHub\V1\MembershipBinding;

/**
 * @param string $formattedName The MembershipBinding resource name in the format
 *                              `projects/*/locations/*/memberships/*/bindings/*`. Please see
 *                              {@see GkeHubClient::membershipBindingName()} for help formatting this field.
 */
function get_membership_binding_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new GetMembershipBindingRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var MembershipBinding $response */
        $response = $gkeHubClient->getMembershipBinding($request);
        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
{
    $formattedName = GkeHubClient::membershipBindingName(
        '[PROJECT]',
        '[LOCATION]',
        '[MEMBERSHIP]',
        '[MEMBERSHIPBINDING]'
    );

    get_membership_binding_sample($formattedName);
} 

getMembershipRBACRoleBinding

Returns the details of a Membership RBACRoleBinding.

The async variant is GkeHubClient::getMembershipRBACRoleBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\GetMembershipRBACRoleBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\GetMembershipRBACRoleBindingRequest;
use Google\Cloud\GkeHub\V1\RBACRoleBinding;

/**
 * @param string $formattedName The RBACRoleBinding resource name in the format
 *                              `projects/*/locations/*/memberships/*/rbacrolebindings/*`. Please see
 *                              {@see GkeHubClient::rBACRoleBindingName()} for help formatting this field.
 */
function get_membership_rbac_role_binding_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new GetMembershipRBACRoleBindingRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var RBACRoleBinding $response */
        $response = $gkeHubClient->getMembershipRBACRoleBinding($request);
        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
{
    $formattedName = GkeHubClient::rBACRoleBindingName(
        '[PROJECT]',
        '[LOCATION]',
        '[SCOPE]',
        '[RBACROLEBINDING]'
    );

    get_membership_rbac_role_binding_sample($formattedName);
} 

getScope

Returns the details of a Scope.

The async variant is GkeHubClient::getScopeAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\GetScopeRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\GetScopeRequest;
use Google\Cloud\GkeHub\V1\Scope;

/**
 * @param string $formattedName The Scope resource name in the format
 *                              `projects/*/locations/*/scopes/*`. Please see
 *                              {@see GkeHubClient::scopeName()} for help formatting this field.
 */
function get_scope_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new GetScopeRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Scope $response */
        $response = $gkeHubClient->getScope($request);
        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
{
    $formattedName = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]');

    get_scope_sample($formattedName);
} 

getScopeNamespace

Returns the details of a fleet namespace.

The async variant is GkeHubClient::getScopeNamespaceAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\GetScopeNamespaceRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\GetScopeNamespaceRequest;
use Google\Cloud\GkeHub\V1\PBNamespace;

/**
 * @param string $formattedName The Namespace resource name in the format
 *                              `projects/*/locations/*/scopes/*/namespaces/*`. Please see
 *                              {@see GkeHubClient::namespaceName()} for help formatting this field.
 */
function get_scope_namespace_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new GetScopeNamespaceRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var PBNamespace $response */
        $response = $gkeHubClient->getScopeNamespace($request);
        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
{
    $formattedName = GkeHubClient::namespaceName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[NAMESPACE]');

    get_scope_namespace_sample($formattedName);
} 

getScopeRBACRoleBinding

Returns the details of a Scope RBACRoleBinding.

The async variant is GkeHubClient::getScopeRBACRoleBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\GetScopeRBACRoleBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\GetScopeRBACRoleBindingRequest;
use Google\Cloud\GkeHub\V1\RBACRoleBinding;

/**
 * @param string $formattedName The RBACRoleBinding resource name in the format
 *                              `projects/*/locations/*/scopes/*/rbacrolebindings/*`. Please see
 *                              {@see GkeHubClient::rBACRoleBindingName()} for help formatting this field.
 */
function get_scope_rbac_role_binding_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new GetScopeRBACRoleBindingRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var RBACRoleBinding $response */
        $response = $gkeHubClient->getScopeRBACRoleBinding($request);
        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
{
    $formattedName = GkeHubClient::rBACRoleBindingName(
        '[PROJECT]',
        '[LOCATION]',
        '[SCOPE]',
        '[RBACROLEBINDING]'
    );

    get_scope_rbac_role_binding_sample($formattedName);
} 

listBoundMemberships

Lists Memberships bound to a Scope. The response includes relevant Memberships from all regions.

The async variant is GkeHubClient::listBoundMembershipsAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListBoundMembershipsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\ListBoundMembershipsRequest;
use Google\Cloud\GkeHub\V1\Membership;

/**
 * @param string $formattedScopeName Name of the Scope, in the format
 *                                   `projects/*/locations/global/scopes/*`, to which the Memberships are bound. Please see
 *                                   {@see GkeHubClient::scopeName()} for help formatting this field.
 */
function list_bound_memberships_sample(string $formattedScopeName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new ListBoundMembershipsRequest())
        ->setScopeName($formattedScopeName);

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

        /** @var Membership $element */
        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
{
    $formattedScopeName = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]');

    list_bound_memberships_sample($formattedScopeName);
} 

listFeatures

Lists Features in a given project and location.

The async variant is GkeHubClient::listFeaturesAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListFeaturesRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\Feature;
use Google\Cloud\GkeHub\V1\ListFeaturesRequest;

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

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

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

        /** @var Feature $element */
        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());
    }
} 

listFleets

Returns all fleets within an organization or a project that the caller has access to.

The async variant is GkeHubClient::listFleetsAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListFleetsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\Fleet;
use Google\Cloud\GkeHub\V1\ListFleetsRequest;

/**
 * @param string $formattedParent The organization or project to list for Fleets under, in the
 *                                format `organizations/*/locations/*` or `projects/*/locations/*`. Please see
 *                                {@see GkeHubClient::locationName()} for help formatting this field.
 */
function list_fleets_sample(string $formattedParent): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new ListFleetsRequest())
        ->setParent($formattedParent);

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

        /** @var Fleet $element */
        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
{
    $formattedParent = GkeHubClient::locationName('[PROJECT]', '[LOCATION]');

    list_fleets_sample($formattedParent);
} 

listMembershipBindings

Lists MembershipBindings.

The async variant is GkeHubClient::listMembershipBindingsAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListMembershipBindingsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\ListMembershipBindingsRequest;
use Google\Cloud\GkeHub\V1\MembershipBinding;

/**
 * @param string $formattedParent The parent Membership for which the MembershipBindings will be
 *                                listed. Specified in the format `projects/*/locations/*/memberships/*`. Please see
 *                                {@see GkeHubClient::membershipName()} for help formatting this field.
 */
function list_membership_bindings_sample(string $formattedParent): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new ListMembershipBindingsRequest())
        ->setParent($formattedParent);

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

        /** @var MembershipBinding $element */
        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
{
    $formattedParent = GkeHubClient::membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]');

    list_membership_bindings_sample($formattedParent);
} 

listMembershipRBACRoleBindings

Lists all Membership RBACRoleBindings.

The async variant is GkeHubClient::listMembershipRBACRoleBindingsAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListMembershipRBACRoleBindingsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\ListMembershipRBACRoleBindingsRequest;
use Google\Cloud\GkeHub\V1\RBACRoleBinding;

/**
 * @param string $formattedParent The parent (project and location) where the Features will be
 *                                listed. Specified in the format `projects/*/locations/*/memberships/*`. Please see
 *                                {@see GkeHubClient::scopeName()} for help formatting this field.
 */
function list_membership_rbac_role_bindings_sample(string $formattedParent): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new ListMembershipRBACRoleBindingsRequest())
        ->setParent($formattedParent);

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

        /** @var RBACRoleBinding $element */
        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
{
    $formattedParent = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]');

    list_membership_rbac_role_bindings_sample($formattedParent);
} 

listMemberships

Lists Memberships in a given project and location.

The async variant is GkeHubClient::listMembershipsAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListMembershipsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\ListMembershipsRequest;
use Google\Cloud\GkeHub\V1\Membership;

/**
 * @param string $formattedParent The parent (project and location) where the Memberships will be
 *                                listed. Specified in the format `projects/*/locations/*`.
 *                                `projects/*/locations/-` list memberships in all the regions. Please see
 *                                {@see GkeHubClient::locationName()} for help formatting this field.
 */
function list_memberships_sample(string $formattedParent): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new ListMembershipsRequest())
        ->setParent($formattedParent);

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

        /** @var Membership $element */
        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
{
    $formattedParent = GkeHubClient::locationName('[PROJECT]', '[LOCATION]');

    list_memberships_sample($formattedParent);
} 

listPermittedScopes

Lists permitted Scopes.

The async variant is GkeHubClient::listPermittedScopesAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListPermittedScopesRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\ListPermittedScopesRequest;
use Google\Cloud\GkeHub\V1\Scope;

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

    // Prepare the request message.
    $request = (new ListPermittedScopesRequest())
        ->setParent($formattedParent);

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

        /** @var Scope $element */
        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
{
    $formattedParent = GkeHubClient::locationName('[PROJECT]', '[LOCATION]');

    list_permitted_scopes_sample($formattedParent);
} 

listScopeNamespaces

Lists fleet namespaces.

The async variant is GkeHubClient::listScopeNamespacesAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListScopeNamespacesRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\ListScopeNamespacesRequest;
use Google\Cloud\GkeHub\V1\PBNamespace;

/**
 * @param string $formattedParent The parent (project and location) where the Features will be
 *                                listed. Specified in the format `projects/*/locations/*/scopes/*`. Please see
 *                                {@see GkeHubClient::scopeName()} for help formatting this field.
 */
function list_scope_namespaces_sample(string $formattedParent): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new ListScopeNamespacesRequest())
        ->setParent($formattedParent);

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

        /** @var PBNamespace $element */
        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
{
    $formattedParent = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]');

    list_scope_namespaces_sample($formattedParent);
} 

listScopeRBACRoleBindings

Lists all Scope RBACRoleBindings.

The async variant is GkeHubClient::listScopeRBACRoleBindingsAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListScopeRBACRoleBindingsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\ListScopeRBACRoleBindingsRequest;
use Google\Cloud\GkeHub\V1\RBACRoleBinding;

/**
 * @param string $formattedParent The parent (project and location) where the Features will be
 *                                listed. Specified in the format `projects/*/locations/*/scopes/*`. Please see
 *                                {@see GkeHubClient::scopeName()} for help formatting this field.
 */
function list_scope_rbac_role_bindings_sample(string $formattedParent): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $request = (new ListScopeRBACRoleBindingsRequest())
        ->setParent($formattedParent);

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

        /** @var RBACRoleBinding $element */
        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
{
    $formattedParent = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]');

    list_scope_rbac_role_bindings_sample($formattedParent);
} 

listScopes

Lists Scopes.

The async variant is GkeHubClient::listScopesAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListScopesRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\ListScopesRequest;
use Google\Cloud\GkeHub\V1\Scope;

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

    // Prepare the request message.
    $request = (new ListScopesRequest())
        ->setParent($formattedParent);

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

        /** @var Scope $element */
        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
{
    $formattedParent = GkeHubClient::locationName('[PROJECT]', '[LOCATION]');

    list_scopes_sample($formattedParent);
} 

updateFeature

Updates an existing Feature.

The async variant is GkeHubClient::updateFeatureAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\UpdateFeatureRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\Feature;
use Google\Cloud\GkeHub\V1\UpdateFeatureRequest;
use Google\Rpc\Status;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->updateFeature($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());
    }
} 

updateFleet

Updates a fleet.

The async variant is GkeHubClient::updateFleetAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\UpdateFleetRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\Fleet;
use Google\Cloud\GkeHub\V1\UpdateFleetRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

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

    // Prepare the request message.
    $fleet = new Fleet();
    $updateMask = new FieldMask();
    $request = (new UpdateFleetRequest())
        ->setFleet($fleet)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->updateFleet($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());
    }
} 

updateMembership

Updates an existing Membership.

The async variant is GkeHubClient::updateMembershipAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\UpdateMembershipRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\Membership;
use Google\Cloud\GkeHub\V1\UpdateMembershipRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $formattedName The Membership resource name in the format
 *                              `projects/*/locations/*/memberships/*`. Please see
 *                              {@see GkeHubClient::membershipName()} for help formatting this field.
 */
function update_membership_sample(string $formattedName): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $resource = new Membership();
    $request = (new UpdateMembershipRequest())
        ->setName($formattedName)
        ->setUpdateMask($updateMask)
        ->setResource($resource);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->updateMembership($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
{
    $formattedName = GkeHubClient::membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]');

    update_membership_sample($formattedName);
} 

updateMembershipBinding

Updates a MembershipBinding.

The async variant is GkeHubClient::updateMembershipBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\UpdateMembershipBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\MembershipBinding;
use Google\Cloud\GkeHub\V1\UpdateMembershipBindingRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

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

    // Prepare the request message.
    $membershipBinding = new MembershipBinding();
    $updateMask = new FieldMask();
    $request = (new UpdateMembershipBindingRequest())
        ->setMembershipBinding($membershipBinding)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->updateMembershipBinding($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());
    }
} 

updateMembershipRBACRoleBinding

Updates a Membership RBACRoleBinding.

The async variant is GkeHubClient::updateMembershipRBACRoleBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\UpdateMembershipRBACRoleBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\RBACRoleBinding;
use Google\Cloud\GkeHub\V1\RBACRoleBinding\Role;
use Google\Cloud\GkeHub\V1\UpdateMembershipRBACRoleBindingRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

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

    // Prepare the request message.
    $rbacrolebindingRole = new Role();
    $rbacrolebinding = (new RBACRoleBinding())
        ->setRole($rbacrolebindingRole);
    $updateMask = new FieldMask();
    $request = (new UpdateMembershipRBACRoleBindingRequest())
        ->setRbacrolebinding($rbacrolebinding)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->updateMembershipRBACRoleBinding($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());
    }
} 

updateScope

Updates a scopes.

The async variant is GkeHubClient::updateScopeAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\UpdateScopeRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\Scope;
use Google\Cloud\GkeHub\V1\UpdateScopeRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

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

    // Prepare the request message.
    $scope = new Scope();
    $updateMask = new FieldMask();
    $request = (new UpdateScopeRequest())
        ->setScope($scope)
        ->setUpdateMask($updateMask);

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

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

updateScopeNamespace

Updates a fleet namespace.

The async variant is GkeHubClient::updateScopeNamespaceAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\UpdateScopeNamespaceRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\PBNamespace;
use Google\Cloud\GkeHub\V1\UpdateScopeNamespaceRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $formattedScopeNamespaceScope Scope associated with the namespace
 *                                             Please see {@see GkeHubClient::scopeName()} for help formatting this field.
 */
function update_scope_namespace_sample(string $formattedScopeNamespaceScope): void
{
    // Create a client.
    $gkeHubClient = new GkeHubClient();

    // Prepare the request message.
    $scopeNamespace = (new PBNamespace())
        ->setScope($formattedScopeNamespaceScope);
    $updateMask = new FieldMask();
    $request = (new UpdateScopeNamespaceRequest())
        ->setScopeNamespace($scopeNamespace)
        ->setUpdateMask($updateMask);

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

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

    update_scope_namespace_sample($formattedScopeNamespaceScope);
} 

updateScopeRBACRoleBinding

Updates a Scope RBACRoleBinding.

The async variant is GkeHubClient::updateScopeRBACRoleBindingAsync() .

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\UpdateScopeRBACRoleBindingRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeHub\V1\Client\GkeHubClient;
use Google\Cloud\GkeHub\V1\RBACRoleBinding;
use Google\Cloud\GkeHub\V1\RBACRoleBinding\Role;
use Google\Cloud\GkeHub\V1\UpdateScopeRBACRoleBindingRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

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

    // Prepare the request message.
    $rbacrolebindingRole = new Role();
    $rbacrolebinding = (new RBACRoleBinding())
        ->setRole($rbacrolebindingRole);
    $updateMask = new FieldMask();
    $request = (new UpdateScopeRBACRoleBindingRequest())
        ->setRbacrolebinding($rbacrolebinding)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $gkeHubClient->updateScopeRBACRoleBinding($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());
    }
} 

createFeatureAsync

Parameters
Name
Description
optionalArgs
array

createFleetAsync

Parameters
Name
Description
optionalArgs
array

createMembershipAsync

Parameters
Name
Description
optionalArgs
array

createMembershipBindingAsync

Parameters
Name
Description
optionalArgs
array

createMembershipRBACRoleBindingAsync

Parameters
Name
Description
optionalArgs
array

createScopeAsync

Parameters
Name
Description
optionalArgs
array

createScopeNamespaceAsync

Parameters
Name
Description
optionalArgs
array

createScopeRBACRoleBindingAsync

Parameters
Name
Description
optionalArgs
array

deleteFeatureAsync

Parameters
Name
Description
optionalArgs
array

deleteFleetAsync

Parameters
Name
Description
optionalArgs
array

deleteMembershipAsync

Parameters
Name
Description
optionalArgs
array

deleteMembershipBindingAsync

Parameters
Name
Description
optionalArgs
array

deleteMembershipRBACRoleBindingAsync

Parameters
Name
Description
optionalArgs
array

deleteScopeAsync

Parameters
Name
Description
optionalArgs
array

deleteScopeNamespaceAsync

Parameters
Name
Description
optionalArgs
array

deleteScopeRBACRoleBindingAsync

Parameters
Name
Description
optionalArgs
array

generateConnectManifestAsync

Parameters
Name
Description
optionalArgs
array

generateMembershipRBACRoleBindingYAMLAsync

Parameters
Name
Description
optionalArgs
array

getFeatureAsync

Parameters
Name
Description
optionalArgs
array

getFleetAsync

Parameters
Name
Description
optionalArgs
array

getMembershipAsync

Parameters
Name
Description
optionalArgs
array

getMembershipBindingAsync

Parameters
Name
Description
optionalArgs
array

getMembershipRBACRoleBindingAsync

Parameters
Name
Description
optionalArgs
array

getScopeAsync

Parameters
Name
Description
optionalArgs
array

getScopeNamespaceAsync

Parameters
Name
Description
optionalArgs
array

getScopeRBACRoleBindingAsync

Parameters
Name
Description
optionalArgs
array

listBoundMembershipsAsync

Parameters
Name
Description
optionalArgs
array

listFeaturesAsync

Parameters
Name
Description
optionalArgs
array

listFleetsAsync

Parameters
Name
Description
optionalArgs
array

listMembershipBindingsAsync

Parameters
Name
Description
optionalArgs
array

listMembershipRBACRoleBindingsAsync

Parameters
Name
Description
optionalArgs
array

listMembershipsAsync

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListMembershipsRequest
optionalArgs
array

listPermittedScopesAsync

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListPermittedScopesRequest
optionalArgs
array

listScopeNamespacesAsync

Parameters
Name
Description
optionalArgs
array

listScopeRBACRoleBindingsAsync

Parameters
Name
Description
optionalArgs
array

listScopesAsync

Parameters
Name
Description
request
Google\Cloud\GkeHub\V1\ListScopesRequest
optionalArgs
array

updateFeatureAsync

Parameters
Name
Description
optionalArgs
array

updateFleetAsync

Parameters
Name
Description
optionalArgs
array

updateMembershipAsync

Parameters
Name
Description
optionalArgs
array

updateMembershipBindingAsync

Parameters
Name
Description
optionalArgs
array

updateMembershipRBACRoleBindingAsync

Parameters
Name
Description
optionalArgs
array

updateScopeAsync

Parameters
Name
Description
optionalArgs
array

updateScopeNamespaceAsync

Parameters
Name
Description
optionalArgs
array

updateScopeRBACRoleBindingAsync

Parameters
Name
Description
optionalArgs
array

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
Type
Description
Google\LongRunning\Client\OperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
Name
Description
operationName
string

The name of the long running operation

methodName
string

The name of the method used to start the operation

Returns
Type
Description

static::featureName

Formats a string containing the fully-qualified path to represent a feature resource.

Parameters
Name
Description
project
string
location
string
feature
string
Returns
Type
Description
string
The formatted feature resource.

static::fleetName

Formats a string containing the fully-qualified path to represent a fleet resource.

Parameters
Name
Description
project
string
location
string
fleet
string
Returns
Type
Description
string
The formatted fleet resource.

static::locationName

Formats a string containing the fully-qualified path to represent a location resource.

Parameters
Name
Description
project
string
location
string
Returns
Type
Description
string
The formatted location resource.

static::membershipName

Formats a string containing the fully-qualified path to represent a membership resource.

Parameters
Name
Description
project
string
location
string
membership
string
Returns
Type
Description
string
The formatted membership resource.

static::membershipBindingName

Formats a string containing the fully-qualified path to represent a membership_binding resource.

Parameters
Name
Description
project
string
location
string
membership
string
membershipbinding
string
Returns
Type
Description
string
The formatted membership_binding resource.

static::namespaceName

Formats a string containing the fully-qualified path to represent a namespace resource.

Parameters
Name
Description
project
string
location
string
scope
string
namespace
string
Returns
Type
Description
string
The formatted namespace resource.

static::organizationLocationFleetName

Formats a string containing the fully-qualified path to represent a organization_location_fleet resource.

Parameters
Name
Description
organization
string
location
string
fleet
string
Returns
Type
Description
string
The formatted organization_location_fleet resource.

static::projectLocationFleetName

Formats a string containing the fully-qualified path to represent a project_location_fleet resource.

Parameters
Name
Description
project
string
location
string
fleet
string
Returns
Type
Description
string
The formatted project_location_fleet resource.

static::projectLocationMembershipRbacrolebindingName

Formats a string containing the fully-qualified path to represent a project_location_membership_rbacrolebinding resource.

Parameters
Name
Description
project
string
location
string
membership
string
rbacrolebinding
string
Returns
Type
Description
string
The formatted project_location_membership_rbacrolebinding resource.

static::projectLocationScopeRbacrolebindingName

Formats a string containing the fully-qualified path to represent a project_location_scope_rbacrolebinding resource.

Parameters
Name
Description
project
string
location
string
scope
string
rbacrolebinding
string
Returns
Type
Description
string
The formatted project_location_scope_rbacrolebinding resource.

static::rBACRoleBindingName

Formats a string containing the fully-qualified path to represent a rbac_role_binding resource.

Parameters
Name
Description
project
string
location
string
scope
string
rbacrolebinding
string
Returns
Type
Description
string
The formatted rbac_role_binding resource.

static::scopeName

Formats a string containing the fully-qualified path to represent a scope resource.

Parameters
Name
Description
project
string
location
string
scope
string
Returns
Type
Description
string
The formatted scope resource.

static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • feature: projects/{project}/locations/{location}/features/{feature}
  • fleet: projects/{project}/locations/{location}/fleets/{fleet}
  • location: projects/{project}/locations/{location}
  • membership: projects/{project}/locations/{location}/memberships/{membership}
  • membershipBinding: projects/{project}/locations/{location}/memberships/{membership}/bindings/{membershipbinding}
  • namespace: projects/{project}/locations/{location}/scopes/{scope}/namespaces/{namespace}
  • organizationLocationFleet: organizations/{organization}/locations/{location}/fleets/{fleet}
  • projectLocationFleet: projects/{project}/locations/{location}/fleets/{fleet}
  • projectLocationMembershipRbacrolebinding: projects/{project}/locations/{location}/memberships/{membership}/rbacrolebindings/{rbacrolebinding}
  • projectLocationScopeRbacrolebinding: projects/{project}/locations/{location}/scopes/{scope}/rbacrolebindings/{rbacrolebinding}
  • rBACRoleBinding: projects/{project}/locations/{location}/scopes/{scope}/rbacrolebindings/{rbacrolebinding}
  • scope: projects/{project}/locations/{location}/scopes/{scope}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
Name
Description
formattedName
string

The formatted name string

template
?string

Optional name of template to match

Returns
Type
Description
array
An associative array from name component IDs to component values.
Create a Mobile Website
View Site in Mobile | Classic
Share by: