Class GkeHubClient (1.42.0)

GitHub RepositoryProduct Reference

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:

  • Membership
  • Feature

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. Sample code to get started:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   MembershipName name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]");
   Membership response = gkeHubClient.getMembership(name);
 }
 

Note: close() needs to be called on the GkeHubClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

ListMemberships

Lists Memberships in a given project and location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listMemberships(ListMembershipsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listMemberships(LocationName parent)

  • listMemberships(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listMembershipsPagedCallable()

  • listMembershipsCallable()

ListFeatures

Lists Features in a given project and location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listFeatures(ListFeaturesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listFeatures(LocationName parent)

  • listFeatures(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listFeaturesPagedCallable()

  • listFeaturesCallable()

GetMembership

Gets the details of a Membership.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getMembership(GetMembershipRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getMembership(MembershipName name)

  • getMembership(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getMembershipCallable()

GetFeature

Gets details of a single Feature.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getFeature(GetFeatureRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getFeature(FeatureName name)

  • getFeature(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getFeatureCallable()

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.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createMembershipAsync(CreateMembershipRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createMembershipAsync(LocationName parent, Membership resource, String membershipId)

  • createMembershipAsync(String parent, Membership resource, String membershipId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createMembershipOperationCallable()

  • createMembershipCallable()

CreateFeature

Adds a new Feature.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createFeatureAsync(CreateFeatureRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createFeatureAsync(LocationName parent, Feature resource, String featureId)

  • createFeatureAsync(String parent, Feature resource, String featureId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createFeatureOperationCallable()

  • createFeatureCallable()

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.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteMembershipAsync(DeleteMembershipRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteMembershipAsync(MembershipName name)

  • deleteMembershipAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteMembershipOperationCallable()

  • deleteMembershipCallable()

DeleteFeature

Removes a Feature.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteFeatureAsync(DeleteFeatureRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteFeatureAsync(FeatureName name)

  • deleteFeatureAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteFeatureOperationCallable()

  • deleteFeatureCallable()

UpdateMembership

Updates an existing Membership.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateMembershipAsync(UpdateMembershipRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • updateMembershipAsync(MembershipName name, Membership resource, FieldMask updateMask)

  • updateMembershipAsync(String name, Membership resource, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateMembershipOperationCallable()

  • updateMembershipCallable()

UpdateFeature

Updates an existing Feature.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateFeatureAsync(UpdateFeatureRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • updateFeatureAsync(FeatureName name, Feature resource, FieldMask updateMask)

  • updateFeatureAsync(String name, Feature resource, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateFeatureOperationCallable()

  • updateFeatureCallable()

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.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • generateConnectManifest(GenerateConnectManifestRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • generateConnectManifestCallable()

See the individual methods for example code.

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 parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of GkeHubSettings to create(). For example:

To customize credentials:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 GkeHubSettings gkeHubSettings =
     GkeHubSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 GkeHubClient gkeHubClient = GkeHubClient.create(gkeHubSettings);
 

To customize the endpoint:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 GkeHubSettings gkeHubSettings = GkeHubSettings.newBuilder().setEndpoint(myEndpoint).build();
 GkeHubClient gkeHubClient = GkeHubClient.create(gkeHubSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 GkeHubSettings gkeHubSettings = GkeHubSettings.newHttpJsonBuilder().build();
 GkeHubClient gkeHubClient = GkeHubClient.create(gkeHubSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > GkeHubClient

Static Methods

create()

public static final GkeHubClient create()

Constructs an instance of GkeHubClient with default settings.

Returns
Type Description
GkeHubClient
Exceptions
Type Description
IOException

create(GkeHubSettings settings)

public static final GkeHubClient create(GkeHubSettings settings)

Constructs an instance of GkeHubClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings GkeHubSettings
Returns
Type Description
GkeHubClient
Exceptions
Type Description
IOException

create(GkeHubStub stub)

public static final GkeHubClient create(GkeHubStub stub)

Constructs an instance of GkeHubClient, using the given stub for making calls. This is for advanced usage - prefer using create(GkeHubSettings).

Parameter
Name Description
stub GkeHubStub
Returns
Type Description
GkeHubClient

Constructors

GkeHubClient(GkeHubSettings settings)

protected GkeHubClient(GkeHubSettings settings)

Constructs an instance of GkeHubClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings GkeHubSettings

GkeHubClient(GkeHubStub stub)

protected GkeHubClient(GkeHubStub stub)
Parameter
Name Description
stub GkeHubStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

createFeatureAsync(CreateFeatureRequest request)

public final OperationFuture<Feature,OperationMetadata> createFeatureAsync(CreateFeatureRequest request)

Adds a new Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   CreateFeatureRequest request =
       CreateFeatureRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFeatureId("featureId-420503887")
           .setResource(Feature.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Feature response = gkeHubClient.createFeatureAsync(request).get();
 }
 
Parameter
Name Description
request CreateFeatureRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Feature,OperationMetadata>

createFeatureAsync(LocationName parent, Feature resource, String featureId)

public final OperationFuture<Feature,OperationMetadata> createFeatureAsync(LocationName parent, Feature resource, String featureId)

Adds a new Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Feature resource = Feature.newBuilder().build();
   String featureId = "featureId-420503887";
   Feature response = gkeHubClient.createFeatureAsync(parent, resource, featureId).get();
 }
 
Parameters
Name Description
parent LocationName

Required. The parent (project and location) where the Feature will be created. Specified in the format projects/*/locations/*.

resource Feature

The Feature resource to create.

featureId String

The ID of the feature to create.

Returns
Type Description
OperationFuture<Feature,OperationMetadata>

createFeatureAsync(String parent, Feature resource, String featureId)

public final OperationFuture<Feature,OperationMetadata> createFeatureAsync(String parent, Feature resource, String featureId)

Adds a new Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Feature resource = Feature.newBuilder().build();
   String featureId = "featureId-420503887";
   Feature response = gkeHubClient.createFeatureAsync(parent, resource, featureId).get();
 }
 
Parameters
Name Description
parent String

Required. The parent (project and location) where the Feature will be created. Specified in the format projects/*/locations/*.

resource Feature

The Feature resource to create.

featureId String

The ID of the feature to create.

Returns
Type Description
OperationFuture<Feature,OperationMetadata>

createFeatureCallable()

public final UnaryCallable<CreateFeatureRequest,Operation> createFeatureCallable()

Adds a new Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   CreateFeatureRequest request =
       CreateFeatureRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFeatureId("featureId-420503887")
           .setResource(Feature.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = gkeHubClient.createFeatureCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateFeatureRequest,Operation>

createFeatureOperationCallable()

public final OperationCallable<CreateFeatureRequest,Feature,OperationMetadata> createFeatureOperationCallable()

Adds a new Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   CreateFeatureRequest request =
       CreateFeatureRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFeatureId("featureId-420503887")
           .setResource(Feature.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Feature, OperationMetadata> future =
       gkeHubClient.createFeatureOperationCallable().futureCall(request);
   // Do something.
   Feature response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateFeatureRequest,Feature,OperationMetadata>

createMembershipAsync(CreateMembershipRequest request)

public final OperationFuture<Membership,OperationMetadata> createMembershipAsync(CreateMembershipRequest request)

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   CreateMembershipRequest request =
       CreateMembershipRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setMembershipId("membershipId517665681")
           .setResource(Membership.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Membership response = gkeHubClient.createMembershipAsync(request).get();
 }
 
Parameter
Name Description
request CreateMembershipRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Membership,OperationMetadata>

createMembershipAsync(LocationName parent, Membership resource, String membershipId)

public final OperationFuture<Membership,OperationMetadata> createMembershipAsync(LocationName parent, Membership resource, String membershipId)

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Membership resource = Membership.newBuilder().build();
   String membershipId = "membershipId517665681";
   Membership response =
       gkeHubClient.createMembershipAsync(parent, resource, membershipId).get();
 }
 
Parameters
Name Description
parent LocationName

Required. The parent (project and location) where the Memberships will be created. Specified in the format projects/*/locations/*.

resource Membership

Required. The membership to create.

membershipId String

Required. 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?, with a maximum length of 63 characters.

Returns
Type Description
OperationFuture<Membership,OperationMetadata>

createMembershipAsync(String parent, Membership resource, String membershipId)

public final OperationFuture<Membership,OperationMetadata> createMembershipAsync(String parent, Membership resource, String membershipId)

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Membership resource = Membership.newBuilder().build();
   String membershipId = "membershipId517665681";
   Membership response =
       gkeHubClient.createMembershipAsync(parent, resource, membershipId).get();
 }
 
Parameters
Name Description
parent String

Required. The parent (project and location) where the Memberships will be created. Specified in the format projects/*/locations/*.

resource Membership

Required. The membership to create.

membershipId String

Required. 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?, with a maximum length of 63 characters.

Returns
Type Description
OperationFuture<Membership,OperationMetadata>

createMembershipCallable()

public final UnaryCallable<CreateMembershipRequest,Operation> createMembershipCallable()

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   CreateMembershipRequest request =
       CreateMembershipRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setMembershipId("membershipId517665681")
           .setResource(Membership.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = gkeHubClient.createMembershipCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateMembershipRequest,Operation>

createMembershipOperationCallable()

public final OperationCallable<CreateMembershipRequest,Membership,OperationMetadata> createMembershipOperationCallable()

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   CreateMembershipRequest request =
       CreateMembershipRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setMembershipId("membershipId517665681")
           .setResource(Membership.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Membership, OperationMetadata> future =
       gkeHubClient.createMembershipOperationCallable().futureCall(request);
   // Do something.
   Membership response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateMembershipRequest,Membership,OperationMetadata>

deleteFeatureAsync(DeleteFeatureRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteFeatureAsync(DeleteFeatureRequest request)

Removes a Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   DeleteFeatureRequest request =
       DeleteFeatureRequest.newBuilder()
           .setName(FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURE]").toString())
           .setForce(true)
           .setRequestId("requestId693933066")
           .build();
   gkeHubClient.deleteFeatureAsync(request).get();
 }
 
Parameter
Name Description
request DeleteFeatureRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteFeatureAsync(FeatureName name)

public final OperationFuture<Empty,OperationMetadata> deleteFeatureAsync(FeatureName name)

Removes a Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   FeatureName name = FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURE]");
   gkeHubClient.deleteFeatureAsync(name).get();
 }
 
Parameter
Name Description
name FeatureName

Required. The Feature resource name in the format projects/*/locations/*/features/*.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteFeatureAsync(String name)

public final OperationFuture<Empty,OperationMetadata> deleteFeatureAsync(String name)

Removes a Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   String name = FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURE]").toString();
   gkeHubClient.deleteFeatureAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. The Feature resource name in the format projects/*/locations/*/features/*.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteFeatureCallable()

public final UnaryCallable<DeleteFeatureRequest,Operation> deleteFeatureCallable()

Removes a Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   DeleteFeatureRequest request =
       DeleteFeatureRequest.newBuilder()
           .setName(FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURE]").toString())
           .setForce(true)
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = gkeHubClient.deleteFeatureCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteFeatureRequest,Operation>

deleteFeatureOperationCallable()

public final OperationCallable<DeleteFeatureRequest,Empty,OperationMetadata> deleteFeatureOperationCallable()

Removes a Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   DeleteFeatureRequest request =
       DeleteFeatureRequest.newBuilder()
           .setName(FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURE]").toString())
           .setForce(true)
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       gkeHubClient.deleteFeatureOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
OperationCallable<DeleteFeatureRequest,Empty,OperationMetadata>

deleteMembershipAsync(DeleteMembershipRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteMembershipAsync(DeleteMembershipRequest request)

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   DeleteMembershipRequest request =
       DeleteMembershipRequest.newBuilder()
           .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString())
           .setRequestId("requestId693933066")
           .setForce(true)
           .build();
   gkeHubClient.deleteMembershipAsync(request).get();
 }
 
Parameter
Name Description
request DeleteMembershipRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteMembershipAsync(MembershipName name)

public final OperationFuture<Empty,OperationMetadata> deleteMembershipAsync(MembershipName name)

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   MembershipName name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]");
   gkeHubClient.deleteMembershipAsync(name).get();
 }
 
Parameter
Name Description
name MembershipName

Required. The Membership resource name in the format projects/*/locations/*/memberships/*.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteMembershipAsync(String name)

public final OperationFuture<Empty,OperationMetadata> deleteMembershipAsync(String name)

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   String name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString();
   gkeHubClient.deleteMembershipAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. The Membership resource name in the format projects/*/locations/*/memberships/*.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteMembershipCallable()

public final UnaryCallable<DeleteMembershipRequest,Operation> deleteMembershipCallable()

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   DeleteMembershipRequest request =
       DeleteMembershipRequest.newBuilder()
           .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString())
           .setRequestId("requestId693933066")
           .setForce(true)
           .build();
   ApiFuture<Operation> future = gkeHubClient.deleteMembershipCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteMembershipRequest,Operation>

deleteMembershipOperationCallable()

public final OperationCallable<DeleteMembershipRequest,Empty,OperationMetadata> deleteMembershipOperationCallable()

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   DeleteMembershipRequest request =
       DeleteMembershipRequest.newBuilder()
           .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString())
           .setRequestId("requestId693933066")
           .setForce(true)
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       gkeHubClient.deleteMembershipOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
OperationCallable<DeleteMembershipRequest,Empty,OperationMetadata>

generateConnectManifest(GenerateConnectManifestRequest request)

public final GenerateConnectManifestResponse generateConnectManifest(GenerateConnectManifestRequest request)

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   GenerateConnectManifestRequest request =
       GenerateConnectManifestRequest.newBuilder()
           .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString())
           .setNamespace("namespace1252218203")
           .setProxy(ByteString.EMPTY)
           .setVersion("version351608024")
           .setIsUpgrade(true)
           .setRegistry("registry-690212803")
           .setImagePullSecretContent(ByteString.EMPTY)
           .build();
   GenerateConnectManifestResponse response = gkeHubClient.generateConnectManifest(request);
 }
 
Parameter
Name Description
request GenerateConnectManifestRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
GenerateConnectManifestResponse

generateConnectManifestCallable()

public final UnaryCallable<GenerateConnectManifestRequest,GenerateConnectManifestResponse> generateConnectManifestCallable()

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.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   GenerateConnectManifestRequest request =
       GenerateConnectManifestRequest.newBuilder()
           .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString())
           .setNamespace("namespace1252218203")
           .setProxy(ByteString.EMPTY)
           .setVersion("version351608024")
           .setIsUpgrade(true)
           .setRegistry("registry-690212803")
           .setImagePullSecretContent(ByteString.EMPTY)
           .build();
   ApiFuture<GenerateConnectManifestResponse> future =
       gkeHubClient.generateConnectManifestCallable().futureCall(request);
   // Do something.
   GenerateConnectManifestResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GenerateConnectManifestRequest,GenerateConnectManifestResponse>

getFeature(FeatureName name)

public final Feature getFeature(FeatureName name)

Gets details of a single Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   FeatureName name = FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURE]");
   Feature response = gkeHubClient.getFeature(name);
 }
 
Parameter
Name Description
name FeatureName

Required. The Feature resource name in the format projects/*/locations/*/features/*

Returns
Type Description
Feature

getFeature(GetFeatureRequest request)

public final Feature getFeature(GetFeatureRequest request)

Gets details of a single Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   GetFeatureRequest request =
       GetFeatureRequest.newBuilder()
           .setName(FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURE]").toString())
           .build();
   Feature response = gkeHubClient.getFeature(request);
 }
 
Parameter
Name Description
request GetFeatureRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Feature

getFeature(String name)

public final Feature getFeature(String name)

Gets details of a single Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   String name = FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURE]").toString();
   Feature response = gkeHubClient.getFeature(name);
 }
 
Parameter
Name Description
name String

Required. The Feature resource name in the format projects/*/locations/*/features/*

Returns
Type Description
Feature

getFeatureCallable()

public final UnaryCallable<GetFeatureRequest,Feature> getFeatureCallable()

Gets details of a single Feature.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   GetFeatureRequest request =
       GetFeatureRequest.newBuilder()
           .setName(FeatureName.of("[PROJECT]", "[LOCATION]", "[FEATURE]").toString())
           .build();
   ApiFuture<Feature> future = gkeHubClient.getFeatureCallable().futureCall(request);
   // Do something.
   Feature response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetFeatureRequest,Feature>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getMembership(GetMembershipRequest request)

public final Membership getMembership(GetMembershipRequest request)

Gets the details of a Membership.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   GetMembershipRequest request =
       GetMembershipRequest.newBuilder()
           .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString())
           .build();
   Membership response = gkeHubClient.getMembership(request);
 }
 
Parameter
Name Description
request GetMembershipRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Membership

getMembership(MembershipName name)

public final Membership getMembership(MembershipName name)

Gets the details of a Membership.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   MembershipName name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]");
   Membership response = gkeHubClient.getMembership(name);
 }
 
Parameter
Name Description
name MembershipName

Required. The Membership resource name in the format projects/*/locations/*/memberships/*.

Returns
Type Description
Membership

getMembership(String name)

public final Membership getMembership(String name)

Gets the details of a Membership.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   String name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString();
   Membership response = gkeHubClient.getMembership(name);
 }
 
Parameter
Name Description
name String

Required. The Membership resource name in the format projects/*/locations/*/memberships/*.

Returns
Type Description
Membership

getMembershipCallable()

public final UnaryCallable<GetMembershipRequest,Membership> getMembershipCallable()

Gets the details of a Membership.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   GetMembershipRequest request =
       GetMembershipRequest.newBuilder()
           .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString())
           .build();
   ApiFuture<Membership> future = gkeHubClient.getMembershipCallable().futureCall(request);
   // Do something.
   Membership response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetMembershipRequest,Membership>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getSettings()

public final GkeHubSettings getSettings()
Returns
Type Description
GkeHubSettings

getStub()

public GkeHubStub getStub()
Returns
Type Description
GkeHubStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listFeatures(ListFeaturesRequest request)

public final GkeHubClient.ListFeaturesPagedResponse listFeatures(ListFeaturesRequest request)

Lists Features in a given project and location.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   ListFeaturesRequest request =
       ListFeaturesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   for (Feature element : gkeHubClient.listFeatures(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListFeaturesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
GkeHubClient.ListFeaturesPagedResponse

listFeatures(LocationName parent)

public final GkeHubClient.ListFeaturesPagedResponse listFeatures(LocationName parent)

Lists Features in a given project and location.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Feature element : gkeHubClient.listFeatures(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. The parent (project and location) where the Features will be listed. Specified in the format projects/*/locations/*.

Returns
Type Description
GkeHubClient.ListFeaturesPagedResponse

listFeatures(String parent)

public final GkeHubClient.ListFeaturesPagedResponse listFeatures(String parent)

Lists Features in a given project and location.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Feature element : gkeHubClient.listFeatures(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent (project and location) where the Features will be listed. Specified in the format projects/*/locations/*.

Returns
Type Description
GkeHubClient.ListFeaturesPagedResponse

listFeaturesCallable()

public final UnaryCallable<ListFeaturesRequest,ListFeaturesResponse> listFeaturesCallable()

Lists Features in a given project and location.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   ListFeaturesRequest request =
       ListFeaturesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   while (true) {
     ListFeaturesResponse response = gkeHubClient.listFeaturesCallable().call(request);
     for (Feature element : response.getResourcesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListFeaturesRequest,ListFeaturesResponse>

listFeaturesPagedCallable()

public final UnaryCallable<ListFeaturesRequest,GkeHubClient.ListFeaturesPagedResponse> listFeaturesPagedCallable()

Lists Features in a given project and location.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   ListFeaturesRequest request =
       ListFeaturesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   ApiFuture<Feature> future = gkeHubClient.listFeaturesPagedCallable().futureCall(request);
   // Do something.
   for (Feature element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListFeaturesRequest,ListFeaturesPagedResponse>

listMemberships(ListMembershipsRequest request)

public final GkeHubClient.ListMembershipsPagedResponse listMemberships(ListMembershipsRequest request)

Lists Memberships in a given project and location.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   ListMembershipsRequest request =
       ListMembershipsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   for (Membership element : gkeHubClient.listMemberships(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListMembershipsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
GkeHubClient.ListMembershipsPagedResponse

listMemberships(LocationName parent)

public final GkeHubClient.ListMembershipsPagedResponse listMemberships(LocationName parent)

Lists Memberships in a given project and location.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Membership element : gkeHubClient.listMemberships(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. 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.

Returns
Type Description
GkeHubClient.ListMembershipsPagedResponse

listMemberships(String parent)

public final GkeHubClient.ListMembershipsPagedResponse listMemberships(String parent)

Lists Memberships in a given project and location.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Membership element : gkeHubClient.listMemberships(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. 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.

Returns
Type Description
GkeHubClient.ListMembershipsPagedResponse

listMembershipsCallable()

public final UnaryCallable<ListMembershipsRequest,ListMembershipsResponse> listMembershipsCallable()

Lists Memberships in a given project and location.

Sample code:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
   ListMembershipsRequest request =
       ListMembershipsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   while (true) {
     ListMembershipsResponse response = gkeHubClient.listMembershipsCallable().call(request);
     for (Membership element : response.getResourcesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();