@Generated(value="by gapic-generator-java") public class MetadataServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ZoneName parent = ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]");
Entity entity = Entity.newBuilder().build();
Entity response = metadataServiceClient.createEntity(parent, entity);
}
Note: close() needs to be called on the MetadataServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
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 MetadataServiceSettings 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
MetadataServiceSettings metadataServiceSettings =
MetadataServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
MetadataServiceClient metadataServiceClient =
MetadataServiceClient.create(metadataServiceSettings);
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
MetadataServiceSettings metadataServiceSettings =
MetadataServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
MetadataServiceClient metadataServiceClient =
MetadataServiceClient.create(metadataServiceSettings);
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
MetadataServiceSettings metadataServiceSettings =
MetadataServiceSettings.newBuilder()
.setTransportChannelProvider(
MetadataServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
MetadataServiceClient metadataServiceClient =
MetadataServiceClient.create(metadataServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
MetadataServiceClient.ListEntitiesFixedSizeCollection |
static class |
MetadataServiceClient.ListEntitiesPage |
static class |
MetadataServiceClient.ListEntitiesPagedResponse |
static class |
MetadataServiceClient.ListLocationsFixedSizeCollection |
static class |
MetadataServiceClient.ListLocationsPage |
static class |
MetadataServiceClient.ListLocationsPagedResponse |
static class |
MetadataServiceClient.ListPartitionsFixedSizeCollection |
static class |
MetadataServiceClient.ListPartitionsPage |
static class |
MetadataServiceClient.ListPartitionsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
MetadataServiceClient(MetadataServiceSettings settings)
Constructs an instance of MetadataServiceClient, using the given settings.
|
protected |
MetadataServiceClient(MetadataServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static MetadataServiceClient |
create()
Constructs an instance of MetadataServiceClient with default settings.
|
static MetadataServiceClient |
create(MetadataServiceSettings settings)
Constructs an instance of MetadataServiceClient, using the given settings.
|
static MetadataServiceClient |
create(MetadataServiceStub stub)
Constructs an instance of MetadataServiceClient, using the given stub for making calls.
|
Entity |
createEntity(CreateEntityRequest request)
Create a metadata entity.
|
Entity |
createEntity(String parent,
Entity entity)
Create a metadata entity.
|
Entity |
createEntity(ZoneName parent,
Entity entity)
Create a metadata entity.
|
com.google.api.gax.rpc.UnaryCallable<CreateEntityRequest,Entity> |
createEntityCallable()
Create a metadata entity.
|
Partition |
createPartition(CreatePartitionRequest request)
Create a metadata partition.
|
Partition |
createPartition(EntityName parent,
Partition partition)
Create a metadata partition.
|
Partition |
createPartition(String parent,
Partition partition)
Create a metadata partition.
|
com.google.api.gax.rpc.UnaryCallable<CreatePartitionRequest,Partition> |
createPartitionCallable()
Create a metadata partition.
|
void |
deleteEntity(DeleteEntityRequest request)
Delete a metadata entity.
|
void |
deleteEntity(EntityName name)
Delete a metadata entity.
|
void |
deleteEntity(String name)
Delete a metadata entity.
|
com.google.api.gax.rpc.UnaryCallable<DeleteEntityRequest,com.google.protobuf.Empty> |
deleteEntityCallable()
Delete a metadata entity.
|
void |
deletePartition(DeletePartitionRequest request)
Delete a metadata partition.
|
void |
deletePartition(PartitionName name)
Delete a metadata partition.
|
void |
deletePartition(String name)
Delete a metadata partition.
|
com.google.api.gax.rpc.UnaryCallable<DeletePartitionRequest,com.google.protobuf.Empty> |
deletePartitionCallable()
Delete a metadata partition.
|
Entity |
getEntity(EntityName name)
Get a metadata entity.
|
Entity |
getEntity(GetEntityRequest request)
Get a metadata entity.
|
Entity |
getEntity(String name)
Get a metadata entity.
|
com.google.api.gax.rpc.UnaryCallable<GetEntityRequest,Entity> |
getEntityCallable()
Get a metadata entity.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
Partition |
getPartition(GetPartitionRequest request)
Get a metadata partition of an entity.
|
Partition |
getPartition(PartitionName name)
Get a metadata partition of an entity.
|
Partition |
getPartition(String name)
Get a metadata partition of an entity.
|
com.google.api.gax.rpc.UnaryCallable<GetPartitionRequest,Partition> |
getPartitionCallable()
Get a metadata partition of an entity.
|
MetadataServiceSettings |
getSettings() |
MetadataServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
MetadataServiceClient.ListEntitiesPagedResponse |
listEntities(ListEntitiesRequest request)
List metadata entities in a zone.
|
MetadataServiceClient.ListEntitiesPagedResponse |
listEntities(String parent)
List metadata entities in a zone.
|
MetadataServiceClient.ListEntitiesPagedResponse |
listEntities(ZoneName parent)
List metadata entities in a zone.
|
com.google.api.gax.rpc.UnaryCallable<ListEntitiesRequest,ListEntitiesResponse> |
listEntitiesCallable()
List metadata entities in a zone.
|
com.google.api.gax.rpc.UnaryCallable<ListEntitiesRequest,MetadataServiceClient.ListEntitiesPagedResponse> |
listEntitiesPagedCallable()
List metadata entities in a zone.
|
MetadataServiceClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,MetadataServiceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
MetadataServiceClient.ListPartitionsPagedResponse |
listPartitions(EntityName parent)
List metadata partitions of an entity.
|
MetadataServiceClient.ListPartitionsPagedResponse |
listPartitions(ListPartitionsRequest request)
List metadata partitions of an entity.
|
MetadataServiceClient.ListPartitionsPagedResponse |
listPartitions(String parent)
List metadata partitions of an entity.
|
com.google.api.gax.rpc.UnaryCallable<ListPartitionsRequest,ListPartitionsResponse> |
listPartitionsCallable()
List metadata partitions of an entity.
|
com.google.api.gax.rpc.UnaryCallable<ListPartitionsRequest,MetadataServiceClient.ListPartitionsPagedResponse> |
listPartitionsPagedCallable()
List metadata partitions of an entity.
|
void |
shutdown() |
void |
shutdownNow() |
Entity |
updateEntity(UpdateEntityRequest request)
Update a metadata entity.
|
com.google.api.gax.rpc.UnaryCallable<UpdateEntityRequest,Entity> |
updateEntityCallable()
Update a metadata entity.
|
protected MetadataServiceClient(MetadataServiceSettings settings) throws IOException
IOExceptionprotected MetadataServiceClient(MetadataServiceStub stub)
public static final MetadataServiceClient create() throws IOException
IOExceptionpublic static final MetadataServiceClient create(MetadataServiceSettings settings) throws IOException
IOExceptionpublic static final MetadataServiceClient create(MetadataServiceStub stub)
public final MetadataServiceSettings getSettings()
public MetadataServiceStub getStub()
public final Entity createEntity(ZoneName parent, Entity entity)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ZoneName parent = ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]");
Entity entity = Entity.newBuilder().build();
Entity response = metadataServiceClient.createEntity(parent, entity);
}
parent - Required. The resource name of the parent zone:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}`.entity - Required. Entity resource.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Entity createEntity(String parent, Entity entity)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
String parent = ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString();
Entity entity = Entity.newBuilder().build();
Entity response = metadataServiceClient.createEntity(parent, entity);
}
parent - Required. The resource name of the parent zone:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}`.entity - Required. Entity resource.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Entity createEntity(CreateEntityRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
CreateEntityRequest request =
CreateEntityRequest.newBuilder()
.setParent(ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString())
.setEntity(Entity.newBuilder().build())
.setValidateOnly(true)
.build();
Entity response = metadataServiceClient.createEntity(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateEntityRequest,Entity> createEntityCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
CreateEntityRequest request =
CreateEntityRequest.newBuilder()
.setParent(ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString())
.setEntity(Entity.newBuilder().build())
.setValidateOnly(true)
.build();
ApiFuture<Entity> future = metadataServiceClient.createEntityCallable().futureCall(request);
// Do something.
Entity response = future.get();
}
public final Entity updateEntity(UpdateEntityRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
UpdateEntityRequest request =
UpdateEntityRequest.newBuilder()
.setEntity(Entity.newBuilder().build())
.setValidateOnly(true)
.build();
Entity response = metadataServiceClient.updateEntity(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateEntityRequest,Entity> updateEntityCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
UpdateEntityRequest request =
UpdateEntityRequest.newBuilder()
.setEntity(Entity.newBuilder().build())
.setValidateOnly(true)
.build();
ApiFuture<Entity> future = metadataServiceClient.updateEntityCallable().futureCall(request);
// Do something.
Entity response = future.get();
}
public final void deleteEntity(EntityName name)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
EntityName name = EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]");
metadataServiceClient.deleteEntity(name);
}
name - Required. The resource name of the entity:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteEntity(String name)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
String name =
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]").toString();
metadataServiceClient.deleteEntity(name);
}
name - Required. The resource name of the entity:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteEntity(DeleteEntityRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
DeleteEntityRequest request =
DeleteEntityRequest.newBuilder()
.setName(
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
.toString())
.setEtag("etag3123477")
.build();
metadataServiceClient.deleteEntity(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteEntityRequest,com.google.protobuf.Empty> deleteEntityCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
DeleteEntityRequest request =
DeleteEntityRequest.newBuilder()
.setName(
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
.toString())
.setEtag("etag3123477")
.build();
ApiFuture<Empty> future = metadataServiceClient.deleteEntityCallable().futureCall(request);
// Do something.
future.get();
}
public final Entity getEntity(EntityName name)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
EntityName name = EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]");
Entity response = metadataServiceClient.getEntity(name);
}
name - Required. The resource name of the entity:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Entity getEntity(String name)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
String name =
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]").toString();
Entity response = metadataServiceClient.getEntity(name);
}
name - Required. The resource name of the entity:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Entity getEntity(GetEntityRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
GetEntityRequest request =
GetEntityRequest.newBuilder()
.setName(
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
.toString())
.build();
Entity response = metadataServiceClient.getEntity(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetEntityRequest,Entity> getEntityCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
GetEntityRequest request =
GetEntityRequest.newBuilder()
.setName(
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
.toString())
.build();
ApiFuture<Entity> future = metadataServiceClient.getEntityCallable().futureCall(request);
// Do something.
Entity response = future.get();
}
public final MetadataServiceClient.ListEntitiesPagedResponse listEntities(ZoneName parent)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ZoneName parent = ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]");
for (Entity element : metadataServiceClient.listEntities(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the parent zone:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetadataServiceClient.ListEntitiesPagedResponse listEntities(String parent)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
String parent = ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString();
for (Entity element : metadataServiceClient.listEntities(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the parent zone:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetadataServiceClient.ListEntitiesPagedResponse listEntities(ListEntitiesRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ListEntitiesRequest request =
ListEntitiesRequest.newBuilder()
.setParent(ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (Entity element : metadataServiceClient.listEntities(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListEntitiesRequest,MetadataServiceClient.ListEntitiesPagedResponse> listEntitiesPagedCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ListEntitiesRequest request =
ListEntitiesRequest.newBuilder()
.setParent(ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<Entity> future =
metadataServiceClient.listEntitiesPagedCallable().futureCall(request);
// Do something.
for (Entity element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListEntitiesRequest,ListEntitiesResponse> listEntitiesCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ListEntitiesRequest request =
ListEntitiesRequest.newBuilder()
.setParent(ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListEntitiesResponse response = metadataServiceClient.listEntitiesCallable().call(request);
for (Entity element : response.getEntitiesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Partition createPartition(EntityName parent, Partition partition)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
EntityName parent = EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]");
Partition partition = Partition.newBuilder().build();
Partition response = metadataServiceClient.createPartition(parent, partition);
}
parent - Required. The resource name of the parent zone:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.partition - Required. Partition resource.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Partition createPartition(String parent, Partition partition)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
String parent =
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]").toString();
Partition partition = Partition.newBuilder().build();
Partition response = metadataServiceClient.createPartition(parent, partition);
}
parent - Required. The resource name of the parent zone:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.partition - Required. Partition resource.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Partition createPartition(CreatePartitionRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
CreatePartitionRequest request =
CreatePartitionRequest.newBuilder()
.setParent(
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
.toString())
.setPartition(Partition.newBuilder().build())
.setValidateOnly(true)
.build();
Partition response = metadataServiceClient.createPartition(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreatePartitionRequest,Partition> createPartitionCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
CreatePartitionRequest request =
CreatePartitionRequest.newBuilder()
.setParent(
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
.toString())
.setPartition(Partition.newBuilder().build())
.setValidateOnly(true)
.build();
ApiFuture<Partition> future =
metadataServiceClient.createPartitionCallable().futureCall(request);
// Do something.
Partition response = future.get();
}
public final void deletePartition(PartitionName name)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
PartitionName name =
PartitionName.of(
"[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]");
metadataServiceClient.deletePartition(name);
}
name - Required. The resource name of the partition. format:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}/partitions/{partition_value_path}`.
The {partition_value_path} segment consists of an ordered sequence of partition values
separated by "/". All values must be provided.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deletePartition(String name)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
String name =
PartitionName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
.toString();
metadataServiceClient.deletePartition(name);
}
name - Required. The resource name of the partition. format:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}/partitions/{partition_value_path}`.
The {partition_value_path} segment consists of an ordered sequence of partition values
separated by "/". All values must be provided.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deletePartition(DeletePartitionRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
DeletePartitionRequest request =
DeletePartitionRequest.newBuilder()
.setName(
PartitionName.of(
"[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
.toString())
.setEtag("etag3123477")
.build();
metadataServiceClient.deletePartition(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeletePartitionRequest,com.google.protobuf.Empty> deletePartitionCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
DeletePartitionRequest request =
DeletePartitionRequest.newBuilder()
.setName(
PartitionName.of(
"[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
.toString())
.setEtag("etag3123477")
.build();
ApiFuture<Empty> future = metadataServiceClient.deletePartitionCallable().futureCall(request);
// Do something.
future.get();
}
public final Partition getPartition(PartitionName name)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
PartitionName name =
PartitionName.of(
"[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]");
Partition response = metadataServiceClient.getPartition(name);
}
name - Required. The resource name of the partition:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}/partitions/{partition_value_path}`.
The {partition_value_path} segment consists of an ordered sequence of partition values
separated by "/". All values must be provided.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Partition getPartition(String name)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
String name =
PartitionName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
.toString();
Partition response = metadataServiceClient.getPartition(name);
}
name - Required. The resource name of the partition:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}/partitions/{partition_value_path}`.
The {partition_value_path} segment consists of an ordered sequence of partition values
separated by "/". All values must be provided.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Partition getPartition(GetPartitionRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
GetPartitionRequest request =
GetPartitionRequest.newBuilder()
.setName(
PartitionName.of(
"[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
.toString())
.build();
Partition response = metadataServiceClient.getPartition(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetPartitionRequest,Partition> getPartitionCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
GetPartitionRequest request =
GetPartitionRequest.newBuilder()
.setName(
PartitionName.of(
"[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
.toString())
.build();
ApiFuture<Partition> future =
metadataServiceClient.getPartitionCallable().futureCall(request);
// Do something.
Partition response = future.get();
}
public final MetadataServiceClient.ListPartitionsPagedResponse listPartitions(EntityName parent)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
EntityName parent = EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]");
for (Partition element : metadataServiceClient.listPartitions(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the parent entity:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetadataServiceClient.ListPartitionsPagedResponse listPartitions(String parent)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
String parent =
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]").toString();
for (Partition element : metadataServiceClient.listPartitions(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the parent entity:
`projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetadataServiceClient.ListPartitionsPagedResponse listPartitions(ListPartitionsRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ListPartitionsRequest request =
ListPartitionsRequest.newBuilder()
.setParent(
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (Partition element : metadataServiceClient.listPartitions(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListPartitionsRequest,MetadataServiceClient.ListPartitionsPagedResponse> listPartitionsPagedCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ListPartitionsRequest request =
ListPartitionsRequest.newBuilder()
.setParent(
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<Partition> future =
metadataServiceClient.listPartitionsPagedCallable().futureCall(request);
// Do something.
for (Partition element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListPartitionsRequest,ListPartitionsResponse> listPartitionsCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ListPartitionsRequest request =
ListPartitionsRequest.newBuilder()
.setParent(
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListPartitionsResponse response =
metadataServiceClient.listPartitionsCallable().call(request);
for (Partition element : response.getPartitionsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final MetadataServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : metadataServiceClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,MetadataServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
metadataServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
metadataServiceClient.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;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = metadataServiceClient.getLocation(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = metadataServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2022 Google LLC. All rights reserved.