Class GkeHubMembershipServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
GKE Hub is currently available in the global region and all regions in https://cloud.google.com/compute/docs/regions-zones.
**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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient =
GkeHubMembershipServiceClient.create()) {
MembershipName name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]");
Membership response = gkeHubMembershipServiceClient.getMembership(name);
}
Note: close() needs to be called on the GkeHubMembershipServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateMembership |
Updates an existing Membership. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ValidateExclusivity |
ValidateExclusivity validates the state of exclusivity in the cluster. The validation does not depend on an existing Hub membership resource. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GenerateExclusivityManifest |
GenerateExclusivityManifest generates the manifests to update the exclusivity artifacts in the cluster if needed. Exclusivity artifacts include the Membership custom resource definition (CRD) and the singleton Membership custom resource (CR). Combined with ValidateExclusivity, exclusivity artifacts guarantee that a Kubernetes cluster is only registered to a single GKE Hub. The Membership CRD is versioned, and may require conversion when the GKE Hub API server begins serving a newer version of the CRD and corresponding CR. The response will be the converted CRD and CR if there are any differences between the versions. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetIamPolicy |
Sets the access control policy on the specified resource. Replacesany existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIamPolicy |
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 GkeHubMembershipServiceSettings 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
GkeHubMembershipServiceSettings gkeHubMembershipServiceSettings =
GkeHubMembershipServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
GkeHubMembershipServiceClient gkeHubMembershipServiceClient =
GkeHubMembershipServiceClient.create(gkeHubMembershipServiceSettings);
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
GkeHubMembershipServiceSettings gkeHubMembershipServiceSettings =
GkeHubMembershipServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
GkeHubMembershipServiceClient gkeHubMembershipServiceClient =
GkeHubMembershipServiceClient.create(gkeHubMembershipServiceSettings);
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
GkeHubMembershipServiceSettings gkeHubMembershipServiceSettings =
GkeHubMembershipServiceSettings.newHttpJsonBuilder().build();
GkeHubMembershipServiceClient gkeHubMembershipServiceClient =
GkeHubMembershipServiceClient.create(gkeHubMembershipServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of GkeHubMembershipServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final GkeHubMembershipServiceClientcreate()Constructs an instance of GkeHubMembershipServiceClient with default settings.static final GkeHubMembershipServiceClientcreate(GkeHubMembershipServiceSettings settings) Constructs an instance of GkeHubMembershipServiceClient, using the given settings.static final GkeHubMembershipServiceClientConstructs an instance of GkeHubMembershipServiceClient, using the given stub for making calls.Creates a new Membership.createMembershipAsync(LocationName parent, Membership resource, String membershipId) Creates a new Membership.createMembershipAsync(String parent, Membership resource, String membershipId) Creates a new Membership.Creates a new Membership.Creates a new Membership.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> Removes a Membership.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> Removes a Membership.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteMembershipAsync(String name) Removes a Membership.Removes a Membership.final OperationCallable<DeleteMembershipRequest,com.google.protobuf.Empty, OperationMetadata> Removes a Membership.Generates the manifest for deployment of the GKE connect agent.Generates the manifest for deployment of the GKE connect agent.GenerateExclusivityManifest generates the manifests to update the exclusivity artifacts in the cluster if needed.GenerateExclusivityManifest generates the manifests to update the exclusivity artifacts in the cluster if needed.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final PolicygetIamPolicy(GetIamPolicyRequest request) Gets the access control policy for a resource.Gets the access control policy for a resource.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.final MembershipgetMembership(GetMembershipRequest request) Gets the details of a Membership.final MembershipgetMembership(MembershipName name) Gets the details of a Membership.final MembershipgetMembership(String name) Gets the details of a Membership.Gets the details of a Membership.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.getStub()booleanbooleanlistLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.listMemberships(ListMembershipsRequest request) Lists Memberships in a given project and location.listMemberships(LocationName parent) Lists Memberships in a given project and location.listMemberships(String parent) Lists Memberships in a given project and location.Lists Memberships in a given project and location.final UnaryCallable<ListMembershipsRequest,GkeHubMembershipServiceClient.ListMembershipsPagedResponse> Lists Memberships in a given project and location.final PolicysetIamPolicy(SetIamPolicyRequest request) Sets the access control policy on the specified resource.Sets the access control policy on the specified resource.voidshutdown()voidReturns permissions that a caller has on the specified resource.Returns permissions that a caller has on the specified resource.updateMembershipAsync(MembershipName name, Membership resource, com.google.protobuf.FieldMask updateMask) Updates an existing Membership.Updates an existing Membership.updateMembershipAsync(String name, Membership resource, com.google.protobuf.FieldMask updateMask) Updates an existing Membership.Updates an existing Membership.Updates an existing Membership.ValidateExclusivity validates the state of exclusivity in the cluster.ValidateExclusivity validates the state of exclusivity in the cluster.
-
Constructor Details
-
GkeHubMembershipServiceClient
protected GkeHubMembershipServiceClient(GkeHubMembershipServiceSettings settings) throws IOException Constructs an instance of GkeHubMembershipServiceClient, 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.- Throws:
IOException
-
GkeHubMembershipServiceClient
-
-
Method Details
-
create
Constructs an instance of GkeHubMembershipServiceClient with default settings.- Throws:
IOException
-
create
public static final GkeHubMembershipServiceClient create(GkeHubMembershipServiceSettings settings) throws IOException Constructs an instance of GkeHubMembershipServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of GkeHubMembershipServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(GkeHubMembershipServiceSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
getHttpJsonOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
listMemberships
public final GkeHubMembershipServiceClient.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Membership element : gkeHubMembershipServiceClient.listMemberships(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- 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.- Throws:
ApiException- if the remote call fails
-
listMemberships
public final GkeHubMembershipServiceClient.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Membership element : gkeHubMembershipServiceClient.listMemberships(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- 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.- Throws:
ApiException- if the remote call fails
-
listMemberships
public final GkeHubMembershipServiceClient.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.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 : gkeHubMembershipServiceClient.listMemberships(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listMembershipsPagedCallable
public final UnaryCallable<ListMembershipsRequest,GkeHubMembershipServiceClient.ListMembershipsPagedResponse> listMembershipsPagedCallable()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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { ListMembershipsRequest request = ListMembershipsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); ApiFuture<Membership> future = gkeHubMembershipServiceClient.listMembershipsPagedCallable().futureCall(request); // Do something. for (Membership element : future.get().iterateAll()) { // doThingsWith(element); } } -
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.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 = gkeHubMembershipServiceClient.listMembershipsCallable().call(request); for (Membership element : response.getResourcesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getMembership
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { MembershipName name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]"); Membership response = gkeHubMembershipServiceClient.getMembership(name); }- Parameters:
name- Required. The Membership resource name in the format `projects/*/locations/*/memberships/*`.- Throws:
ApiException- if the remote call fails
-
getMembership
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { String name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString(); Membership response = gkeHubMembershipServiceClient.getMembership(name); }- Parameters:
name- Required. The Membership resource name in the format `projects/*/locations/*/memberships/*`.- Throws:
ApiException- if the remote call fails
-
getMembership
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { GetMembershipRequest request = GetMembershipRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .build(); Membership response = gkeHubMembershipServiceClient.getMembership(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { GetMembershipRequest request = GetMembershipRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .build(); ApiFuture<Membership> future = gkeHubMembershipServiceClient.getMembershipCallable().futureCall(request); // Do something. Membership response = future.get(); } -
createMembershipAsync
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Membership resource = Membership.newBuilder().build(); String membershipId = "membershipId517665681"; Membership response = gkeHubMembershipServiceClient.createMembershipAsync(parent, resource, membershipId).get(); }- Parameters:
parent- Required. The parent (project and location) where the Memberships will be created. Specified in the format `projects/*/locations/*`.resource- Required. The membership to create.membershipId- 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]([-a-z0-9]*[a-z0-9])?`, with a maximum length of 63 characters.
- Throws:
ApiException- if the remote call fails
-
createMembershipAsync
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Membership resource = Membership.newBuilder().build(); String membershipId = "membershipId517665681"; Membership response = gkeHubMembershipServiceClient.createMembershipAsync(parent, resource, membershipId).get(); }- Parameters:
parent- Required. The parent (project and location) where the Memberships will be created. Specified in the format `projects/*/locations/*`.resource- Required. The membership to create.membershipId- 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]([-a-z0-9]*[a-z0-9])?`, with a maximum length of 63 characters.
- Throws:
ApiException- if the remote call fails
-
createMembershipAsync
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { CreateMembershipRequest request = CreateMembershipRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setMembershipId("membershipId517665681") .setResource(Membership.newBuilder().build()) .setRequestId("requestId693933066") .build(); Membership response = gkeHubMembershipServiceClient.createMembershipAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createMembershipOperationCallable
public final OperationCallable<CreateMembershipRequest,Membership, createMembershipOperationCallable()OperationMetadata> 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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { CreateMembershipRequest request = CreateMembershipRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setMembershipId("membershipId517665681") .setResource(Membership.newBuilder().build()) .setRequestId("requestId693933066") .build(); OperationFuture<Membership, OperationMetadata> future = gkeHubMembershipServiceClient.createMembershipOperationCallable().futureCall(request); // Do something. Membership response = future.get(); } -
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { CreateMembershipRequest request = CreateMembershipRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setMembershipId("membershipId517665681") .setResource(Membership.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = gkeHubMembershipServiceClient.createMembershipCallable().futureCall(request); // Do something. Operation response = future.get(); } -
deleteMembershipAsync
public final OperationFuture<com.google.protobuf.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { MembershipName name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]"); gkeHubMembershipServiceClient.deleteMembershipAsync(name).get(); }- Parameters:
name- Required. The Membership resource name in the format `projects/*/locations/*/memberships/*`.- Throws:
ApiException- if the remote call fails
-
deleteMembershipAsync
public final OperationFuture<com.google.protobuf.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { String name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString(); gkeHubMembershipServiceClient.deleteMembershipAsync(name).get(); }- Parameters:
name- Required. The Membership resource name in the format `projects/*/locations/*/memberships/*`.- Throws:
ApiException- if the remote call fails
-
deleteMembershipAsync
public final OperationFuture<com.google.protobuf.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { DeleteMembershipRequest request = DeleteMembershipRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setRequestId("requestId693933066") .setForce(true) .build(); gkeHubMembershipServiceClient.deleteMembershipAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteMembershipOperationCallable
public final OperationCallable<DeleteMembershipRequest,com.google.protobuf.Empty, deleteMembershipOperationCallable()OperationMetadata> 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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { DeleteMembershipRequest request = DeleteMembershipRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setRequestId("requestId693933066") .setForce(true) .build(); OperationFuture<Empty, OperationMetadata> future = gkeHubMembershipServiceClient.deleteMembershipOperationCallable().futureCall(request); // Do something. future.get(); } -
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { DeleteMembershipRequest request = DeleteMembershipRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setRequestId("requestId693933066") .setForce(true) .build(); ApiFuture<Operation> future = gkeHubMembershipServiceClient.deleteMembershipCallable().futureCall(request); // Do something. future.get(); } -
updateMembershipAsync
public final OperationFuture<Membership,OperationMetadata> updateMembershipAsync(MembershipName name, Membership resource, com.google.protobuf.FieldMask updateMask) Updates an existing 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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { MembershipName name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]"); Membership resource = Membership.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Membership response = gkeHubMembershipServiceClient.updateMembershipAsync(name, resource, updateMask).get(); }- Parameters:
name- Required. The membership resource name in the format: `projects/[project_id]/locations/global/memberships/[membership_id]`resource- Required. Only fields specified in update_mask are updated. If you specify a field in the update_mask but don't specify its value here that field will be deleted. If you are updating a map field, set the value of a key to null or empty string to delete the key from the map. It's not possible to update a key's value to the empty string. If you specify the update_mask to be a special path "*", fully replaces all user-modifiable fields to match `resource`.updateMask- Required. Mask of fields to update. At least one field path must be specified in this mask.- Throws:
ApiException- if the remote call fails
-
updateMembershipAsync
public final OperationFuture<Membership,OperationMetadata> updateMembershipAsync(String name, Membership resource, com.google.protobuf.FieldMask updateMask) Updates an existing 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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { String name = MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString(); Membership resource = Membership.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Membership response = gkeHubMembershipServiceClient.updateMembershipAsync(name, resource, updateMask).get(); }- Parameters:
name- Required. The membership resource name in the format: `projects/[project_id]/locations/global/memberships/[membership_id]`resource- Required. Only fields specified in update_mask are updated. If you specify a field in the update_mask but don't specify its value here that field will be deleted. If you are updating a map field, set the value of a key to null or empty string to delete the key from the map. It's not possible to update a key's value to the empty string. If you specify the update_mask to be a special path "*", fully replaces all user-modifiable fields to match `resource`.updateMask- Required. Mask of fields to update. At least one field path must be specified in this mask.- Throws:
ApiException- if the remote call fails
-
updateMembershipAsync
public final OperationFuture<Membership,OperationMetadata> updateMembershipAsync(UpdateMembershipRequest request) Updates an existing 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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { UpdateMembershipRequest request = UpdateMembershipRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setUpdateMask(FieldMask.newBuilder().build()) .setResource(Membership.newBuilder().build()) .setRequestId("requestId693933066") .build(); Membership response = gkeHubMembershipServiceClient.updateMembershipAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateMembershipOperationCallable
public final OperationCallable<UpdateMembershipRequest,Membership, updateMembershipOperationCallable()OperationMetadata> Updates an existing 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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { UpdateMembershipRequest request = UpdateMembershipRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setUpdateMask(FieldMask.newBuilder().build()) .setResource(Membership.newBuilder().build()) .setRequestId("requestId693933066") .build(); OperationFuture<Membership, OperationMetadata> future = gkeHubMembershipServiceClient.updateMembershipOperationCallable().futureCall(request); // Do something. Membership response = future.get(); } -
updateMembershipCallable
Updates an existing 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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { UpdateMembershipRequest request = UpdateMembershipRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setUpdateMask(FieldMask.newBuilder().build()) .setResource(Membership.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = gkeHubMembershipServiceClient.updateMembershipCallable().futureCall(request); // Do something. Operation response = future.get(); } -
generateConnectManifest
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { GenerateConnectManifestRequest request = GenerateConnectManifestRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setConnectAgent(ConnectAgent.newBuilder().build()) .setVersion("version351608024") .setIsUpgrade(true) .setRegistry("registry-690212803") .setImagePullSecretContent(ByteString.EMPTY) .build(); GenerateConnectManifestResponse response = gkeHubMembershipServiceClient.generateConnectManifest(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { GenerateConnectManifestRequest request = GenerateConnectManifestRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setConnectAgent(ConnectAgent.newBuilder().build()) .setVersion("version351608024") .setIsUpgrade(true) .setRegistry("registry-690212803") .setImagePullSecretContent(ByteString.EMPTY) .build(); ApiFuture<GenerateConnectManifestResponse> future = gkeHubMembershipServiceClient.generateConnectManifestCallable().futureCall(request); // Do something. GenerateConnectManifestResponse response = future.get(); } -
validateExclusivity
ValidateExclusivity validates the state of exclusivity in the cluster. The validation does not depend on an existing Hub membership resource.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { ValidateExclusivityRequest request = ValidateExclusivityRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setCrManifest("crManifest-1971077186") .setIntendedMembership("intendedMembership-2074920351") .build(); ValidateExclusivityResponse response = gkeHubMembershipServiceClient.validateExclusivity(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
validateExclusivityCallable
public final UnaryCallable<ValidateExclusivityRequest,ValidateExclusivityResponse> validateExclusivityCallable()ValidateExclusivity validates the state of exclusivity in the cluster. The validation does not depend on an existing Hub membership resource.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { ValidateExclusivityRequest request = ValidateExclusivityRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setCrManifest("crManifest-1971077186") .setIntendedMembership("intendedMembership-2074920351") .build(); ApiFuture<ValidateExclusivityResponse> future = gkeHubMembershipServiceClient.validateExclusivityCallable().futureCall(request); // Do something. ValidateExclusivityResponse response = future.get(); } -
generateExclusivityManifest
public final GenerateExclusivityManifestResponse generateExclusivityManifest(GenerateExclusivityManifestRequest request) GenerateExclusivityManifest generates the manifests to update the exclusivity artifacts in the cluster if needed.Exclusivity artifacts include the Membership custom resource definition (CRD) and the singleton Membership custom resource (CR). Combined with ValidateExclusivity, exclusivity artifacts guarantee that a Kubernetes cluster is only registered to a single GKE Hub.
The Membership CRD is versioned, and may require conversion when the GKE Hub API server begins serving a newer version of the CRD and corresponding CR. The response will be the converted CRD and CR if there are any differences between the versions.
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { GenerateExclusivityManifestRequest request = GenerateExclusivityManifestRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setCrdManifest("crdManifest1401188132") .setCrManifest("crManifest-1971077186") .build(); GenerateExclusivityManifestResponse response = gkeHubMembershipServiceClient.generateExclusivityManifest(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
generateExclusivityManifestCallable
public final UnaryCallable<GenerateExclusivityManifestRequest,GenerateExclusivityManifestResponse> generateExclusivityManifestCallable()GenerateExclusivityManifest generates the manifests to update the exclusivity artifacts in the cluster if needed.Exclusivity artifacts include the Membership custom resource definition (CRD) and the singleton Membership custom resource (CR). Combined with ValidateExclusivity, exclusivity artifacts guarantee that a Kubernetes cluster is only registered to a single GKE Hub.
The Membership CRD is versioned, and may require conversion when the GKE Hub API server begins serving a newer version of the CRD and corresponding CR. The response will be the converted CRD and CR if there are any differences between the versions.
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { GenerateExclusivityManifestRequest request = GenerateExclusivityManifestRequest.newBuilder() .setName(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setCrdManifest("crdManifest1401188132") .setCrManifest("crManifest-1971077186") .build(); ApiFuture<GenerateExclusivityManifestResponse> future = gkeHubMembershipServiceClient.generateExclusivityManifestCallable().futureCall(request); // Do something. GenerateExclusivityManifestResponse response = future.get(); } -
listLocations
public final GkeHubMembershipServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Location element : gkeHubMembershipServiceClient.listLocations(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listLocationsPagedCallable
public final UnaryCallable<ListLocationsRequest,GkeHubMembershipServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()Lists information about the supported locations for this service.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Location> future = gkeHubMembershipServiceClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } } -
listLocationsCallable
Lists information about the supported locations for this service.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListLocationsResponse response = gkeHubMembershipServiceClient.listLocationsCallable().call(request); for (Location element : response.getLocationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getLocation
Gets information about a 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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = gkeHubMembershipServiceClient.getLocation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getLocationCallable
Gets information about a 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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = gkeHubMembershipServiceClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); } -
setIamPolicy
Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Policy response = gkeHubMembershipServiceClient.setIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
setIamPolicyCallable
Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Policy> future = gkeHubMembershipServiceClient.setIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
getIamPolicy
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); Policy response = gkeHubMembershipServiceClient.getIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getIamPolicyCallable
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); ApiFuture<Policy> future = gkeHubMembershipServiceClient.getIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
testIamPermissions
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .addAllPermissions(new ArrayList<String>()) .build(); TestIamPermissionsResponse response = gkeHubMembershipServiceClient.testIamPermissions(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
testIamPermissionsCallable
public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource(MembershipName.of("[PROJECT]", "[LOCATION]", "[MEMBERSHIP]").toString()) .addAllPermissions(new ArrayList<String>()) .build(); ApiFuture<TestIamPermissionsResponse> future = gkeHubMembershipServiceClient.testIamPermissionsCallable().futureCall(request); // Do something. TestIamPermissionsResponse response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-