- 1.50.0 (latest)
- 1.49.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.35.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.0
- 1.27.0
- 1.26.0
- 1.25.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.2
- 1.0.1
- 0.2.2
public class MetadataServiceClient implements BackgroundResource
Service Description: Metadata service manages metadata resources such as tables, filesets and partitions.
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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns 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 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.newHttpJsonBuilder().build();
MetadataServiceClient metadataServiceClient =
MetadataServiceClient.create(metadataServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final MetadataServiceClient create()
Constructs an instance of MetadataServiceClient with default settings.
Returns | |
---|---|
Type | Description |
MetadataServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(MetadataServiceSettings settings)
public static final MetadataServiceClient create(MetadataServiceSettings settings)
Constructs an instance of MetadataServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Parameter | |
---|---|
Name | Description |
settings | MetadataServiceSettings |
Returns | |
---|---|
Type | Description |
MetadataServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(MetadataServiceStub stub)
public static final MetadataServiceClient create(MetadataServiceStub stub)
Constructs an instance of MetadataServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(MetadataServiceSettings).
Parameter | |
---|---|
Name | Description |
stub | MetadataServiceStub |
Returns | |
---|---|
Type | Description |
MetadataServiceClient |
Constructors
MetadataServiceClient(MetadataServiceSettings settings)
protected MetadataServiceClient(MetadataServiceSettings settings)
Constructs an instance of MetadataServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Parameter | |
---|---|
Name | Description |
settings | MetadataServiceSettings |
MetadataServiceClient(MetadataServiceStub stub)
protected MetadataServiceClient(MetadataServiceStub stub)
Parameter | |
---|---|
Name | Description |
stub | MetadataServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration | long |
unit | TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
createEntity(CreateEntityRequest request)
public final Entity createEntity(CreateEntityRequest request)
Create a metadata 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()) {
CreateEntityRequest request =
CreateEntityRequest.newBuilder()
.setParent(ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString())
.setEntity(Entity.newBuilder().build())
.setValidateOnly(true)
.build();
Entity response = metadataServiceClient.createEntity(request);
}
Parameter | |
---|---|
Name | Description |
request | CreateEntityRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Entity |
createEntity(ZoneName parent, Entity entity)
public final Entity createEntity(ZoneName parent, Entity entity)
Create a metadata 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);
}
Parameters | |
---|---|
Name | Description |
parent | ZoneName Required. The resource name of the parent zone:
|
entity | Entity Required. Entity resource. |
Returns | |
---|---|
Type | Description |
Entity |
createEntity(String parent, Entity entity)
public final Entity createEntity(String parent, Entity entity)
Create a metadata 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);
}
Parameters | |
---|---|
Name | Description |
parent | String Required. The resource name of the parent zone:
|
entity | Entity Required. Entity resource. |
Returns | |
---|---|
Type | Description |
Entity |
createEntityCallable()
public final UnaryCallable<CreateEntityRequest,Entity> createEntityCallable()
Create a metadata 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()) {
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateEntityRequest,Entity> |
createPartition(CreatePartitionRequest request)
public final Partition createPartition(CreatePartitionRequest request)
Create a metadata 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()) {
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);
}
Parameter | |
---|---|
Name | Description |
request | CreatePartitionRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Partition |
createPartition(EntityName parent, Partition partition)
public final Partition createPartition(EntityName parent, Partition partition)
Create a metadata 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);
}
Parameters | |
---|---|
Name | Description |
parent | EntityName Required. The resource name of the parent zone:
|
partition | Partition Required. Partition resource. |
Returns | |
---|---|
Type | Description |
Partition |
createPartition(String parent, Partition partition)
public final Partition createPartition(String parent, Partition partition)
Create a metadata 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);
}
Parameters | |
---|---|
Name | Description |
parent | String Required. The resource name of the parent zone:
|
partition | Partition Required. Partition resource. |
Returns | |
---|---|
Type | Description |
Partition |
createPartitionCallable()
public final UnaryCallable<CreatePartitionRequest,Partition> createPartitionCallable()
Create a metadata 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()) {
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreatePartitionRequest,Partition> |
deleteEntity(DeleteEntityRequest request)
public final void deleteEntity(DeleteEntityRequest request)
Delete a metadata 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()) {
DeleteEntityRequest request =
DeleteEntityRequest.newBuilder()
.setName(
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
.toString())
.setEtag("etag3123477")
.build();
metadataServiceClient.deleteEntity(request);
}
Parameter | |
---|---|
Name | Description |
request | DeleteEntityRequest The request object containing all of the parameters for the API call. |
deleteEntity(EntityName name)
public final void deleteEntity(EntityName name)
Delete a metadata 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()) {
EntityName name = EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]");
metadataServiceClient.deleteEntity(name);
}
Parameter | |
---|---|
Name | Description |
name | EntityName Required. The resource name of the entity:
|
deleteEntity(String name)
public final void deleteEntity(String name)
Delete a metadata 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 name =
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]").toString();
metadataServiceClient.deleteEntity(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The resource name of the entity:
|
deleteEntityCallable()
public final UnaryCallable<DeleteEntityRequest,Empty> deleteEntityCallable()
Delete a metadata 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()) {
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteEntityRequest,Empty> |
deletePartition(DeletePartitionRequest request)
public final void deletePartition(DeletePartitionRequest request)
Delete a metadata 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()) {
DeletePartitionRequest request =
DeletePartitionRequest.newBuilder()
.setName(
PartitionName.of(
"[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
.toString())
.setEtag("etag3123477")
.build();
metadataServiceClient.deletePartition(request);
}
Parameter | |
---|---|
Name | Description |
request | DeletePartitionRequest The request object containing all of the parameters for the API call. |
deletePartition(PartitionName name)
public final void deletePartition(PartitionName name)
Delete a metadata 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()) {
PartitionName name =
PartitionName.of(
"[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]");
metadataServiceClient.deletePartition(name);
}
Parameter | |
---|---|
Name | Description |
name | PartitionName Required. The resource name of the partition. format:
|
deletePartition(String name)
public final void deletePartition(String name)
Delete a metadata 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 name =
PartitionName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
.toString();
metadataServiceClient.deletePartition(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The resource name of the partition. format:
|
deletePartitionCallable()
public final UnaryCallable<DeletePartitionRequest,Empty> deletePartitionCallable()
Delete a metadata 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()) {
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeletePartitionRequest,Empty> |
getEntity(EntityName name)
public final Entity getEntity(EntityName name)
Get a metadata 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()) {
EntityName name = EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]");
Entity response = metadataServiceClient.getEntity(name);
}
Parameter | |
---|---|
Name | Description |
name | EntityName Required. The resource name of the entity:
|
Returns | |
---|---|
Type | Description |
Entity |
getEntity(GetEntityRequest request)
public final Entity getEntity(GetEntityRequest request)
Get a metadata 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()) {
GetEntityRequest request =
GetEntityRequest.newBuilder()
.setName(
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
.toString())
.build();
Entity response = metadataServiceClient.getEntity(request);
}
Parameter | |
---|---|
Name | Description |
request | GetEntityRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Entity |
getEntity(String name)
public final Entity getEntity(String name)
Get a metadata 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 name =
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]").toString();
Entity response = metadataServiceClient.getEntity(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The resource name of the entity:
|
Returns | |
---|---|
Type | Description |
Entity |
getEntityCallable()
public final UnaryCallable<GetEntityRequest,Entity> getEntityCallable()
Get a metadata 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()) {
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetEntityRequest,Entity> |
getLocation(GetLocationRequest request)
public final Location getLocation(GetLocationRequest request)
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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = metadataServiceClient.getLocation(request);
}
Parameter | |
---|---|
Name | Description |
request | com.google.cloud.location.GetLocationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.cloud.location.Location |
getLocationCallable()
public final UnaryCallable<GetLocationRequest,Location> 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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = metadataServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getPartition(GetPartitionRequest request)
public final Partition getPartition(GetPartitionRequest request)
Get a metadata partition of an 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()) {
GetPartitionRequest request =
GetPartitionRequest.newBuilder()
.setName(
PartitionName.of(
"[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
.toString())
.build();
Partition response = metadataServiceClient.getPartition(request);
}
Parameter | |
---|---|
Name | Description |
request | GetPartitionRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Partition |
getPartition(PartitionName name)
public final Partition getPartition(PartitionName name)
Get a metadata partition of an 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()) {
PartitionName name =
PartitionName.of(
"[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]");
Partition response = metadataServiceClient.getPartition(name);
}
Parameter | |
---|---|
Name | Description |
name | PartitionName Required. The resource name of the partition:
|
Returns | |
---|---|
Type | Description |
Partition |
getPartition(String name)
public final Partition getPartition(String name)
Get a metadata partition of an 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 name =
PartitionName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
.toString();
Partition response = metadataServiceClient.getPartition(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The resource name of the partition:
|
Returns | |
---|---|
Type | Description |
Partition |
getPartitionCallable()
public final UnaryCallable<GetPartitionRequest,Partition> getPartitionCallable()
Get a metadata partition of an 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()) {
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetPartitionRequest,Partition> |
getSettings()
public final MetadataServiceSettings getSettings()
Returns | |
---|---|
Type | Description |
MetadataServiceSettings |
getStub()
public MetadataServiceStub getStub()
Returns | |
---|---|
Type | Description |
MetadataServiceStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listEntities(ListEntitiesRequest request)
public final MetadataServiceClient.ListEntitiesPagedResponse listEntities(ListEntitiesRequest request)
List metadata entities in a zone.
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);
}
}
Parameter | |
---|---|
Name | Description |
request | ListEntitiesRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
MetadataServiceClient.ListEntitiesPagedResponse |
listEntities(ZoneName parent)
public final MetadataServiceClient.ListEntitiesPagedResponse listEntities(ZoneName parent)
List metadata entities in a zone.
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);
}
}
Parameter | |
---|---|
Name | Description |
parent | ZoneName Required. The resource name of the parent zone:
|
Returns | |
---|---|
Type | Description |
MetadataServiceClient.ListEntitiesPagedResponse |
listEntities(String parent)
public final MetadataServiceClient.ListEntitiesPagedResponse listEntities(String parent)
List metadata entities in a zone.
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);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The resource name of the parent zone:
|
Returns | |
---|---|
Type | Description |
MetadataServiceClient.ListEntitiesPagedResponse |
listEntitiesCallable()
public final UnaryCallable<ListEntitiesRequest,ListEntitiesResponse> listEntitiesCallable()
List metadata entities in a zone.
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;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListEntitiesRequest,ListEntitiesResponse> |
listEntitiesPagedCallable()
public final UnaryCallable<ListEntitiesRequest,MetadataServiceClient.ListEntitiesPagedResponse> listEntitiesPagedCallable()
List metadata entities in a zone.
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);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListEntitiesRequest,ListEntitiesPagedResponse> |
listLocations(ListLocationsRequest request)
public final MetadataServiceClient.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 (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);
}
}
Parameter | |
---|---|
Name | Description |
request | com.google.cloud.location.ListLocationsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
MetadataServiceClient.ListLocationsPagedResponse |
listLocationsCallable()
public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> 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 (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;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsPagedCallable()
public final UnaryCallable<ListLocationsRequest,MetadataServiceClient.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 (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);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse> |
listPartitions(EntityName parent)
public final MetadataServiceClient.ListPartitionsPagedResponse listPartitions(EntityName parent)
List metadata partitions of an 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()) {
EntityName parent = EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]");
for (Partition element : metadataServiceClient.listPartitions(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | EntityName Required. The resource name of the parent entity:
|
Returns | |
---|---|
Type | Description |
MetadataServiceClient.ListPartitionsPagedResponse |
listPartitions(ListPartitionsRequest request)
public final MetadataServiceClient.ListPartitionsPagedResponse listPartitions(ListPartitionsRequest request)
List metadata partitions of an 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()) {
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);
}
}
Parameter | |
---|---|
Name | Description |
request | ListPartitionsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
MetadataServiceClient.ListPartitionsPagedResponse |
listPartitions(String parent)
public final MetadataServiceClient.ListPartitionsPagedResponse listPartitions(String parent)
List metadata partitions of an 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 =
EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]").toString();
for (Partition element : metadataServiceClient.listPartitions(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The resource name of the parent entity:
|
Returns | |
---|---|
Type | Description |
MetadataServiceClient.ListPartitionsPagedResponse |
listPartitionsCallable()
public final UnaryCallable<ListPartitionsRequest,ListPartitionsResponse> listPartitionsCallable()
List metadata partitions of an 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()) {
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;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListPartitionsRequest,ListPartitionsResponse> |
listPartitionsPagedCallable()
public final UnaryCallable<ListPartitionsRequest,MetadataServiceClient.ListPartitionsPagedResponse> listPartitionsPagedCallable()
List metadata partitions of an 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()) {
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);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListPartitionsRequest,ListPartitionsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateEntity(UpdateEntityRequest request)
public final Entity updateEntity(UpdateEntityRequest request)
Update a metadata entity. Only supports full resource update.
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);
}
Parameter | |
---|---|
Name | Description |
request | UpdateEntityRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Entity |
updateEntityCallable()
public final UnaryCallable<UpdateEntityRequest,Entity> updateEntityCallable()
Update a metadata entity. Only supports full resource update.
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateEntityRequest,Entity> |