Class InstanceAdminClient (6.65.1)

GitHub RepositoryProduct Reference

Service Description: Cloud Spanner Instance Admin API

The Cloud Spanner Instance Admin API can be used to create, delete, modify and list instances. Instances are dedicated Cloud Spanner serving and storage resources to be used by Cloud Spanner databases.

Each instance has a "configuration", which dictates where the serving resources for the Cloud Spanner instance are located (e.g., US-central, Europe). Configurations are created by Google based on resource availability.

Cloud Spanner billing is based on the instances that exist and their sizes. After an instance exists, there are no additional per-database or per-operation charges for use of the instance (though there may be additional network bandwidth charges). Instances offer isolation: problems with databases in one instance will not affect other instances. However, within an instance databases can affect each other. For example, if one database in an instance receives a lot of requests and consumes most of the instance resources, fewer resources are available for other databases in that instance, and their performance may suffer.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstanceConfigName name = InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]");
   InstanceConfig response = instanceAdminClient.getInstanceConfig(name);
 }
 

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

Methods
Method Description Method Variants

ListInstanceConfigs

Lists the supported instance configurations for a given project.

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

  • listInstanceConfigs(ListInstanceConfigsRequest request)

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

  • listInstanceConfigs(ProjectName parent)

  • listInstanceConfigs(String parent)

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

  • listInstanceConfigsPagedCallable()

  • listInstanceConfigsCallable()

GetInstanceConfig

Gets information about a particular instance configuration.

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

  • getInstanceConfig(GetInstanceConfigRequest request)

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

  • getInstanceConfig(InstanceConfigName name)

  • getInstanceConfig(String name)

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

  • getInstanceConfigCallable()

CreateInstanceConfig

Creates an instance config and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance config. The instance config name is assigned by the caller. If the named instance config already exists, CreateInstanceConfig returns ALREADY_EXISTS.

Immediately after the request returns:

* The instance config is readable via the API, with all requested attributes. The instance config's reconciling field is set to true. Its state is CREATING.

While the operation is pending:

* Cancelling the operation renders the instance config immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance config are rejected.

Upon completion of the returned operation:

* Instances can be created using the instance configuration. * The instance config's reconciling field becomes false. Its state becomes READY.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track creation of the instance config. The metadata field type is CreateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.create permission on the resource parent.

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

  • createInstanceConfigAsync(CreateInstanceConfigRequest request)

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

  • createInstanceConfigAsync(ProjectName parent, InstanceConfig instanceConfig, String instanceConfigId)

  • createInstanceConfigAsync(String parent, InstanceConfig instanceConfig, String instanceConfigId)

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

  • createInstanceConfigOperationCallable()

  • createInstanceConfigCallable()

UpdateInstanceConfig

Updates an instance config. The returned long-running operation can be used to track the progress of updating the instance. If the named instance config does not exist, returns NOT_FOUND.

Only user managed configurations can be updated.

Immediately after the request returns:

* The instance config's reconciling field is set to true.

While the operation is pending:

* Cancelling the operation sets its metadata's cancel_time. The operation is guaranteed to succeed at undoing all changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance config are rejected. * Reading the instance config via the API continues to give the pre-request values.

Upon completion of the returned operation:

* Creating instances using the instance configuration uses the new values. * The instance config's new values are readable via the API. * The instance config's reconciling field becomes false.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track the instance config modification. The metadata field type is UpdateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.update permission on the resource name.

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

  • updateInstanceConfigAsync(UpdateInstanceConfigRequest request)

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

  • updateInstanceConfigAsync(InstanceConfig instanceConfig, FieldMask updateMask)

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

  • updateInstanceConfigOperationCallable()

  • updateInstanceConfigCallable()

DeleteInstanceConfig

Deletes the instance config. Deletion is only allowed when no instances are using the configuration. If any instances are using the config, returns FAILED_PRECONDITION.

Only user managed configurations can be deleted.

Authorization requires spanner.instanceConfigs.delete permission on the resource name.

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

  • deleteInstanceConfig(DeleteInstanceConfigRequest request)

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

  • deleteInstanceConfig(InstanceConfigName name)

  • deleteInstanceConfig(String name)

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

  • deleteInstanceConfigCallable()

ListInstanceConfigOperations

Lists the user-managed instance config long-running operations in the given project. An instance config operation has a name of the form projects/<project>/instanceConfigs/<instance_config>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

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

  • listInstanceConfigOperations(ListInstanceConfigOperationsRequest request)

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

  • listInstanceConfigOperations(ProjectName parent)

  • listInstanceConfigOperations(String parent)

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

  • listInstanceConfigOperationsPagedCallable()

  • listInstanceConfigOperationsCallable()

ListInstances

Lists all instances in the given project.

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

  • listInstances(ListInstancesRequest request)

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

  • listInstances(ProjectName parent)

  • listInstances(String parent)

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

  • listInstancesPagedCallable()

  • listInstancesCallable()

ListInstancePartitions

Lists all instance partitions for the given instance.

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

  • listInstancePartitions(ListInstancePartitionsRequest request)

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

  • listInstancePartitions(InstanceName parent)

  • listInstancePartitions(String parent)

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

  • listInstancePartitionsPagedCallable()

  • listInstancePartitionsCallable()

GetInstance

Gets information about a particular instance.

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

  • getInstance(GetInstanceRequest request)

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

  • getInstance(InstanceName name)

  • getInstance(String name)

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

  • getInstanceCallable()

CreateInstance

Creates an instance and begins preparing it to begin serving. The returned long-running operation can be used to track the progress of preparing the new instance. The instance name is assigned by the caller. If the named instance already exists, CreateInstance returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance immediately unreadable via the API. * The instance can be deleted. * All other attempts to modify the instance are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can be created in the instance. * The instance's allocated resource levels are readable via the API. * The instance's state becomes READY.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track creation of the instance. The metadata field type is CreateInstanceMetadata. The response field type is Instance, if successful.

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

  • createInstanceAsync(CreateInstanceRequest request)

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

  • createInstanceAsync(ProjectName parent, String instanceId, Instance instance)

  • createInstanceAsync(String parent, String instanceId, Instance instance)

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

  • createInstanceOperationCallable()

  • createInstanceCallable()

UpdateInstance

Updates an instance, and begins allocating or releasing resources as requested. The returned long-running operation can be used to track the progress of updating the instance. If the named instance does not exist, returns NOT_FOUND.

Immediately upon completion of this request:

* For resource types for which a decrease in the instance's allocation has been requested, billing is based on the newly-requested level.

Until completion of the returned operation:

* Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance are rejected. * Reading the instance via the API continues to give the pre-request resource levels.

Upon completion of the returned operation:

* Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance's tables. * The instance's new resource levels are readable via the API.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track the instance modification. The metadata field type is UpdateInstanceMetadata. The response field type is Instance, if successful.

Authorization requires spanner.instances.update permission on the resource name.

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

  • updateInstanceAsync(UpdateInstanceRequest request)

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

  • updateInstanceAsync(Instance instance, FieldMask fieldMask)

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

  • updateInstanceOperationCallable()

  • updateInstanceCallable()

DeleteInstance

Deletes an instance.

Immediately upon completion of the request:

* Billing ceases for all of the instance's reserved resources.

Soon afterward:

* The instance and *all of its databases* immediately and irrevocably disappear from the API. All data in the databases is permanently deleted.

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

  • deleteInstance(DeleteInstanceRequest request)

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

  • deleteInstance(InstanceName name)

  • deleteInstance(String name)

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

  • deleteInstanceCallable()

SetIamPolicy

Sets the access control policy on an instance resource. Replaces any existing policy.

Authorization requires spanner.instances.setIamPolicy on resource.

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

  • setIamPolicy(SetIamPolicyRequest request)

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

  • setIamPolicy(ResourceName resource, Policy policy)

  • setIamPolicy(String resource, Policy policy)

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

  • setIamPolicyCallable()

GetIamPolicy

Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.

Authorization requires spanner.instances.getIamPolicy on resource.

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

  • getIamPolicy(GetIamPolicyRequest request)

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

  • getIamPolicy(ResourceName resource)

  • getIamPolicy(String resource)

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

  • getIamPolicyCallable()

TestIamPermissions

Returns permissions that the caller has on the specified instance resource.

Attempting this RPC on a non-existent Cloud Spanner instance resource will result in a NOT_FOUND error if the user has spanner.instances.list permission on the containing Google Cloud Project. Otherwise returns an empty set of permissions.

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

  • testIamPermissions(TestIamPermissionsRequest request)

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

  • testIamPermissions(ResourceName resource, List<String> permissions)

  • testIamPermissions(String resource, List<String> permissions)

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

  • testIamPermissionsCallable()

GetInstancePartition

Gets information about a particular instance partition.

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

  • getInstancePartition(GetInstancePartitionRequest request)

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

  • getInstancePartition(InstancePartitionName name)

  • getInstancePartition(String name)

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

  • getInstancePartitionCallable()

CreateInstancePartition

Creates an instance partition and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance partition. The instance partition name is assigned by the caller. If the named instance partition already exists, CreateInstancePartition returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance partition is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance partition immediately unreadable via the API. * The instance partition can be deleted. * All other attempts to modify the instance partition are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can start using this instance partition. * The instance partition's allocated resource levels are readable via the API. * The instance partition's state becomes READY.

The returned long-running operation will have a name of the format <instance_partition_name>/operations/<operation_id> and can be used to track creation of the instance partition. The metadata field type is CreateInstancePartitionMetadata. The response field type is InstancePartition, if successful.

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

  • createInstancePartitionAsync(CreateInstancePartitionRequest request)

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

  • createInstancePartitionAsync(InstanceName parent, InstancePartition instancePartition, String instancePartitionId)

  • createInstancePartitionAsync(String parent, InstancePartition instancePartition, String instancePartitionId)

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

  • createInstancePartitionOperationCallable()

  • createInstancePartitionCallable()

DeleteInstancePartition

Deletes an existing instance partition. Requires that the instance partition is not used by any database or backup and is not the default instance partition of an instance.

Authorization requires spanner.instancePartitions.delete permission on the resource name.

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

  • deleteInstancePartition(DeleteInstancePartitionRequest request)

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

  • deleteInstancePartition(InstancePartitionName name)

  • deleteInstancePartition(String name)

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

  • deleteInstancePartitionCallable()

UpdateInstancePartition

Updates an instance partition, and begins allocating or releasing resources as requested. The returned long-running operation can be used to track the progress of updating the instance partition. If the named instance partition does not exist, returns NOT_FOUND.

Immediately upon completion of this request:

* For resource types for which a decrease in the instance partition's allocation has been requested, billing is based on the newly-requested level.

Until completion of the returned operation:

* Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance partition are rejected. * Reading the instance partition via the API continues to give the pre-request resource levels.

Upon completion of the returned operation:

* Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance partition's tables. * The instance partition's new resource levels are readable via the API.

The returned long-running operation will have a name of the format <instance_partition_name>/operations/<operation_id> and can be used to track the instance partition modification. The metadata field type is UpdateInstancePartitionMetadata. The response field type is InstancePartition, if successful.

Authorization requires spanner.instancePartitions.update permission on the resource name.

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

  • updateInstancePartitionAsync(UpdateInstancePartitionRequest request)

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

  • updateInstancePartitionAsync(InstancePartition instancePartition, FieldMask fieldMask)

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

  • updateInstancePartitionOperationCallable()

  • updateInstancePartitionCallable()

ListInstancePartitionOperations

Lists instance partition long-running operations in the given instance. An instance partition operation has a name of the form projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

Authorization requires spanner.instancePartitionOperations.list permission on the resource parent.

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

  • listInstancePartitionOperations(ListInstancePartitionOperationsRequest request)

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

  • listInstancePartitionOperations(InstanceName parent)

  • listInstancePartitionOperations(String parent)

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

  • listInstancePartitionOperationsPagedCallable()

  • listInstancePartitionOperationsCallable()

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 InstanceAdminSettings 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
 InstanceAdminSettings instanceAdminSettings =
     InstanceAdminSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 InstanceAdminClient instanceAdminClient = InstanceAdminClient.create(instanceAdminSettings);
 

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
 InstanceAdminSettings instanceAdminSettings =
     InstanceAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
 InstanceAdminClient instanceAdminClient = InstanceAdminClient.create(instanceAdminSettings);
 

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
 InstanceAdminSettings instanceAdminSettings =
     InstanceAdminSettings.newHttpJsonBuilder().build();
 InstanceAdminClient instanceAdminClient = InstanceAdminClient.create(instanceAdminSettings);
 

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

Inheritance

java.lang.Object > InstanceAdminClient

Static Methods

create()

public static final InstanceAdminClient create()

Constructs an instance of InstanceAdminClient with default settings.

Returns
Type Description
InstanceAdminClient
Exceptions
Type Description
IOException

create(InstanceAdminSettings settings)

public static final InstanceAdminClient create(InstanceAdminSettings settings)

Constructs an instance of InstanceAdminClient, 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 InstanceAdminSettings
Returns
Type Description
InstanceAdminClient
Exceptions
Type Description
IOException

create(InstanceAdminStub stub)

public static final InstanceAdminClient create(InstanceAdminStub stub)

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

Parameter
Name Description
stub InstanceAdminStub
Returns
Type Description
InstanceAdminClient

Constructors

InstanceAdminClient(InstanceAdminSettings settings)

protected InstanceAdminClient(InstanceAdminSettings settings)

Constructs an instance of InstanceAdminClient, 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 InstanceAdminSettings

InstanceAdminClient(InstanceAdminStub stub)

protected InstanceAdminClient(InstanceAdminStub stub)
Parameter
Name Description
stub InstanceAdminStub

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()

createInstanceAsync(CreateInstanceRequest request)

public final OperationFuture<Instance,CreateInstanceMetadata> createInstanceAsync(CreateInstanceRequest request)

Creates an instance and begins preparing it to begin serving. The returned long-running operation can be used to track the progress of preparing the new instance. The instance name is assigned by the caller. If the named instance already exists, CreateInstance returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance immediately unreadable via the API. * The instance can be deleted. * All other attempts to modify the instance are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can be created in the instance. * The instance's allocated resource levels are readable via the API. * The instance's state becomes READY.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track creation of the instance. The metadata field type is CreateInstanceMetadata. The response field type is Instance, if successful.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setInstanceId("instanceId902024336")
           .setInstance(Instance.newBuilder().build())
           .build();
   Instance response = instanceAdminClient.createInstanceAsync(request).get();
 }
 
Parameter
Name Description
request CreateInstanceRequest

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

Returns
Type Description
OperationFuture<Instance,CreateInstanceMetadata>

createInstanceAsync(ProjectName parent, String instanceId, Instance instance)

public final OperationFuture<Instance,CreateInstanceMetadata> createInstanceAsync(ProjectName parent, String instanceId, Instance instance)

Creates an instance and begins preparing it to begin serving. The returned long-running operation can be used to track the progress of preparing the new instance. The instance name is assigned by the caller. If the named instance already exists, CreateInstance returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance immediately unreadable via the API. * The instance can be deleted. * All other attempts to modify the instance are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can be created in the instance. * The instance's allocated resource levels are readable via the API. * The instance's state becomes READY.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track creation of the instance. The metadata field type is CreateInstanceMetadata. The response field type is Instance, if successful.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   String instanceId = "instanceId902024336";
   Instance instance = Instance.newBuilder().build();
   Instance response =
       instanceAdminClient.createInstanceAsync(parent, instanceId, instance).get();
 }
 
Parameters
Name Description
parent ProjectName

Required. The name of the project in which to create the instance. Values are of the form projects/<project>.

instanceId String

Required. The ID of the instance to create. Valid identifiers are of the form a-z*[a-z0-9] and must be between 2 and 64 characters in length.

instance Instance

Required. The instance to create. The name may be omitted, but if specified must be <parent>/instances/<instance_id>.

Returns
Type Description
OperationFuture<Instance,CreateInstanceMetadata>

createInstanceAsync(String parent, String instanceId, Instance instance)

public final OperationFuture<Instance,CreateInstanceMetadata> createInstanceAsync(String parent, String instanceId, Instance instance)

Creates an instance and begins preparing it to begin serving. The returned long-running operation can be used to track the progress of preparing the new instance. The instance name is assigned by the caller. If the named instance already exists, CreateInstance returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance immediately unreadable via the API. * The instance can be deleted. * All other attempts to modify the instance are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can be created in the instance. * The instance's allocated resource levels are readable via the API. * The instance's state becomes READY.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track creation of the instance. The metadata field type is CreateInstanceMetadata. The response field type is Instance, if successful.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   String instanceId = "instanceId902024336";
   Instance instance = Instance.newBuilder().build();
   Instance response =
       instanceAdminClient.createInstanceAsync(parent, instanceId, instance).get();
 }
 
Parameters
Name Description
parent String

Required. The name of the project in which to create the instance. Values are of the form projects/<project>.

instanceId String

Required. The ID of the instance to create. Valid identifiers are of the form a-z*[a-z0-9] and must be between 2 and 64 characters in length.

instance Instance

Required. The instance to create. The name may be omitted, but if specified must be <parent>/instances/<instance_id>.

Returns
Type Description
OperationFuture<Instance,CreateInstanceMetadata>

createInstanceCallable()

public final UnaryCallable<CreateInstanceRequest,Operation> createInstanceCallable()

Creates an instance and begins preparing it to begin serving. The returned long-running operation can be used to track the progress of preparing the new instance. The instance name is assigned by the caller. If the named instance already exists, CreateInstance returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance immediately unreadable via the API. * The instance can be deleted. * All other attempts to modify the instance are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can be created in the instance. * The instance's allocated resource levels are readable via the API. * The instance's state becomes READY.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track creation of the instance. The metadata field type is CreateInstanceMetadata. The response field type is Instance, if successful.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setInstanceId("instanceId902024336")
           .setInstance(Instance.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       instanceAdminClient.createInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateInstanceRequest,Operation>

createInstanceConfigAsync(CreateInstanceConfigRequest request)

public final OperationFuture<InstanceConfig,CreateInstanceConfigMetadata> createInstanceConfigAsync(CreateInstanceConfigRequest request)

Creates an instance config and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance config. The instance config name is assigned by the caller. If the named instance config already exists, CreateInstanceConfig returns ALREADY_EXISTS.

Immediately after the request returns:

* The instance config is readable via the API, with all requested attributes. The instance config's reconciling field is set to true. Its state is CREATING.

While the operation is pending:

* Cancelling the operation renders the instance config immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance config are rejected.

Upon completion of the returned operation:

* Instances can be created using the instance configuration. * The instance config's reconciling field becomes false. Its state becomes READY.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track creation of the instance config. The metadata field type is CreateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.create permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   CreateInstanceConfigRequest request =
       CreateInstanceConfigRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setInstanceConfigId("instanceConfigId1750947762")
           .setInstanceConfig(InstanceConfig.newBuilder().build())
           .setValidateOnly(true)
           .build();
   InstanceConfig response = instanceAdminClient.createInstanceConfigAsync(request).get();
 }
 
Parameter
Name Description
request CreateInstanceConfigRequest

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

Returns
Type Description
OperationFuture<InstanceConfig,CreateInstanceConfigMetadata>

createInstanceConfigAsync(ProjectName parent, InstanceConfig instanceConfig, String instanceConfigId)

public final OperationFuture<InstanceConfig,CreateInstanceConfigMetadata> createInstanceConfigAsync(ProjectName parent, InstanceConfig instanceConfig, String instanceConfigId)

Creates an instance config and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance config. The instance config name is assigned by the caller. If the named instance config already exists, CreateInstanceConfig returns ALREADY_EXISTS.

Immediately after the request returns:

* The instance config is readable via the API, with all requested attributes. The instance config's reconciling field is set to true. Its state is CREATING.

While the operation is pending:

* Cancelling the operation renders the instance config immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance config are rejected.

Upon completion of the returned operation:

* Instances can be created using the instance configuration. * The instance config's reconciling field becomes false. Its state becomes READY.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track creation of the instance config. The metadata field type is CreateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.create permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   InstanceConfig instanceConfig = InstanceConfig.newBuilder().build();
   String instanceConfigId = "instanceConfigId1750947762";
   InstanceConfig response =
       instanceAdminClient
           .createInstanceConfigAsync(parent, instanceConfig, instanceConfigId)
           .get();
 }
 
Parameters
Name Description
parent ProjectName

Required. The name of the project in which to create the instance config. Values are of the form projects/<project>.

instanceConfig InstanceConfig

Required. The InstanceConfig proto of the configuration to create. instance_config.name must be <parent>/instanceConfigs/<instance_config_id>. instance_config.base_config must be a Google managed configuration name, e.g. <parent>/instanceConfigs/us-east1, <parent>/instanceConfigs/nam3.

instanceConfigId String

Required. The ID of the instance config to create. Valid identifiers are of the form custom-[-a-z0-9]*[a-z0-9] and must be between 2 and 64 characters in length. The custom- prefix is required to avoid name conflicts with Google managed configurations.

Returns
Type Description
OperationFuture<InstanceConfig,CreateInstanceConfigMetadata>

createInstanceConfigAsync(String parent, InstanceConfig instanceConfig, String instanceConfigId)

public final OperationFuture<InstanceConfig,CreateInstanceConfigMetadata> createInstanceConfigAsync(String parent, InstanceConfig instanceConfig, String instanceConfigId)

Creates an instance config and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance config. The instance config name is assigned by the caller. If the named instance config already exists, CreateInstanceConfig returns ALREADY_EXISTS.

Immediately after the request returns:

* The instance config is readable via the API, with all requested attributes. The instance config's reconciling field is set to true. Its state is CREATING.

While the operation is pending:

* Cancelling the operation renders the instance config immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance config are rejected.

Upon completion of the returned operation:

* Instances can be created using the instance configuration. * The instance config's reconciling field becomes false. Its state becomes READY.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track creation of the instance config. The metadata field type is CreateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.create permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   InstanceConfig instanceConfig = InstanceConfig.newBuilder().build();
   String instanceConfigId = "instanceConfigId1750947762";
   InstanceConfig response =
       instanceAdminClient
           .createInstanceConfigAsync(parent, instanceConfig, instanceConfigId)
           .get();
 }
 
Parameters
Name Description
parent String

Required. The name of the project in which to create the instance config. Values are of the form projects/<project>.

instanceConfig InstanceConfig

Required. The InstanceConfig proto of the configuration to create. instance_config.name must be <parent>/instanceConfigs/<instance_config_id>. instance_config.base_config must be a Google managed configuration name, e.g. <parent>/instanceConfigs/us-east1, <parent>/instanceConfigs/nam3.

instanceConfigId String

Required. The ID of the instance config to create. Valid identifiers are of the form custom-[-a-z0-9]*[a-z0-9] and must be between 2 and 64 characters in length. The custom- prefix is required to avoid name conflicts with Google managed configurations.

Returns
Type Description
OperationFuture<InstanceConfig,CreateInstanceConfigMetadata>

createInstanceConfigCallable()

public final UnaryCallable<CreateInstanceConfigRequest,Operation> createInstanceConfigCallable()

Creates an instance config and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance config. The instance config name is assigned by the caller. If the named instance config already exists, CreateInstanceConfig returns ALREADY_EXISTS.

Immediately after the request returns:

* The instance config is readable via the API, with all requested attributes. The instance config's reconciling field is set to true. Its state is CREATING.

While the operation is pending:

* Cancelling the operation renders the instance config immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance config are rejected.

Upon completion of the returned operation:

* Instances can be created using the instance configuration. * The instance config's reconciling field becomes false. Its state becomes READY.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track creation of the instance config. The metadata field type is CreateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.create permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   CreateInstanceConfigRequest request =
       CreateInstanceConfigRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setInstanceConfigId("instanceConfigId1750947762")
           .setInstanceConfig(InstanceConfig.newBuilder().build())
           .setValidateOnly(true)
           .build();
   ApiFuture<Operation> future =
       instanceAdminClient.createInstanceConfigCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateInstanceConfigRequest,Operation>

createInstanceConfigOperationCallable()

public final OperationCallable<CreateInstanceConfigRequest,InstanceConfig,CreateInstanceConfigMetadata> createInstanceConfigOperationCallable()

Creates an instance config and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance config. The instance config name is assigned by the caller. If the named instance config already exists, CreateInstanceConfig returns ALREADY_EXISTS.

Immediately after the request returns:

* The instance config is readable via the API, with all requested attributes. The instance config's reconciling field is set to true. Its state is CREATING.

While the operation is pending:

* Cancelling the operation renders the instance config immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance config are rejected.

Upon completion of the returned operation:

* Instances can be created using the instance configuration. * The instance config's reconciling field becomes false. Its state becomes READY.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track creation of the instance config. The metadata field type is CreateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.create permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   CreateInstanceConfigRequest request =
       CreateInstanceConfigRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setInstanceConfigId("instanceConfigId1750947762")
           .setInstanceConfig(InstanceConfig.newBuilder().build())
           .setValidateOnly(true)
           .build();
   OperationFuture<InstanceConfig, CreateInstanceConfigMetadata> future =
       instanceAdminClient.createInstanceConfigOperationCallable().futureCall(request);
   // Do something.
   InstanceConfig response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateInstanceConfigRequest,InstanceConfig,CreateInstanceConfigMetadata>

createInstanceOperationCallable()

public final OperationCallable<CreateInstanceRequest,Instance,CreateInstanceMetadata> createInstanceOperationCallable()

Creates an instance and begins preparing it to begin serving. The returned long-running operation can be used to track the progress of preparing the new instance. The instance name is assigned by the caller. If the named instance already exists, CreateInstance returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance immediately unreadable via the API. * The instance can be deleted. * All other attempts to modify the instance are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can be created in the instance. * The instance's allocated resource levels are readable via the API. * The instance's state becomes READY.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track creation of the instance. The metadata field type is CreateInstanceMetadata. The response field type is Instance, if successful.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setInstanceId("instanceId902024336")
           .setInstance(Instance.newBuilder().build())
           .build();
   OperationFuture<Instance, CreateInstanceMetadata> future =
       instanceAdminClient.createInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateInstanceRequest,Instance,CreateInstanceMetadata>

createInstancePartitionAsync(CreateInstancePartitionRequest request)

public final OperationFuture<InstancePartition,CreateInstancePartitionMetadata> createInstancePartitionAsync(CreateInstancePartitionRequest request)

Creates an instance partition and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance partition. The instance partition name is assigned by the caller. If the named instance partition already exists, CreateInstancePartition returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance partition is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance partition immediately unreadable via the API. * The instance partition can be deleted. * All other attempts to modify the instance partition are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can start using this instance partition. * The instance partition's allocated resource levels are readable via the API. * The instance partition's state becomes READY.

The returned long-running operation will have a name of the format <instance_partition_name>/operations/<operation_id> and can be used to track creation of the instance partition. The metadata field type is CreateInstancePartitionMetadata. The response field type is InstancePartition, if successful.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   CreateInstancePartitionRequest request =
       CreateInstancePartitionRequest.newBuilder()
           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setInstancePartitionId("instancePartitionId1364450768")
           .setInstancePartition(InstancePartition.newBuilder().build())
           .build();
   InstancePartition response = instanceAdminClient.createInstancePartitionAsync(request).get();
 }
 
Parameter
Name Description
request CreateInstancePartitionRequest

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

Returns
Type Description
OperationFuture<InstancePartition,CreateInstancePartitionMetadata>

createInstancePartitionAsync(InstanceName parent, InstancePartition instancePartition, String instancePartitionId)

public final OperationFuture<InstancePartition,CreateInstancePartitionMetadata> createInstancePartitionAsync(InstanceName parent, InstancePartition instancePartition, String instancePartitionId)

Creates an instance partition and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance partition. The instance partition name is assigned by the caller. If the named instance partition already exists, CreateInstancePartition returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance partition is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance partition immediately unreadable via the API. * The instance partition can be deleted. * All other attempts to modify the instance partition are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can start using this instance partition. * The instance partition's allocated resource levels are readable via the API. * The instance partition's state becomes READY.

The returned long-running operation will have a name of the format <instance_partition_name>/operations/<operation_id> and can be used to track creation of the instance partition. The metadata field type is CreateInstancePartitionMetadata. The response field type is InstancePartition, if successful.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   InstancePartition instancePartition = InstancePartition.newBuilder().build();
   String instancePartitionId = "instancePartitionId1364450768";
   InstancePartition response =
       instanceAdminClient
           .createInstancePartitionAsync(parent, instancePartition, instancePartitionId)
           .get();
 }
 
Parameters
Name Description
parent InstanceName

Required. The name of the instance in which to create the instance partition. Values are of the form projects/<project>/instances/<instance>.

instancePartition InstancePartition

Required. The instance partition to create. The instance_partition.name may be omitted, but if specified must be <parent>/instancePartitions/<instance_partition_id>.

instancePartitionId String

Required. The ID of the instance partition to create. Valid identifiers are of the form a-z*[a-z0-9] and must be between 2 and 64 characters in length.

Returns
Type Description
OperationFuture<InstancePartition,CreateInstancePartitionMetadata>

createInstancePartitionAsync(String parent, InstancePartition instancePartition, String instancePartitionId)

public final OperationFuture<InstancePartition,CreateInstancePartitionMetadata> createInstancePartitionAsync(String parent, InstancePartition instancePartition, String instancePartitionId)

Creates an instance partition and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance partition. The instance partition name is assigned by the caller. If the named instance partition already exists, CreateInstancePartition returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance partition is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance partition immediately unreadable via the API. * The instance partition can be deleted. * All other attempts to modify the instance partition are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can start using this instance partition. * The instance partition's allocated resource levels are readable via the API. * The instance partition's state becomes READY.

The returned long-running operation will have a name of the format <instance_partition_name>/operations/<operation_id> and can be used to track creation of the instance partition. The metadata field type is CreateInstancePartitionMetadata. The response field type is InstancePartition, if successful.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   InstancePartition instancePartition = InstancePartition.newBuilder().build();
   String instancePartitionId = "instancePartitionId1364450768";
   InstancePartition response =
       instanceAdminClient
           .createInstancePartitionAsync(parent, instancePartition, instancePartitionId)
           .get();
 }
 
Parameters
Name Description
parent String

Required. The name of the instance in which to create the instance partition. Values are of the form projects/<project>/instances/<instance>.

instancePartition InstancePartition

Required. The instance partition to create. The instance_partition.name may be omitted, but if specified must be <parent>/instancePartitions/<instance_partition_id>.

instancePartitionId String

Required. The ID of the instance partition to create. Valid identifiers are of the form a-z*[a-z0-9] and must be between 2 and 64 characters in length.

Returns
Type Description
OperationFuture<InstancePartition,CreateInstancePartitionMetadata>

createInstancePartitionCallable()

public final UnaryCallable<CreateInstancePartitionRequest,Operation> createInstancePartitionCallable()

Creates an instance partition and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance partition. The instance partition name is assigned by the caller. If the named instance partition already exists, CreateInstancePartition returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance partition is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance partition immediately unreadable via the API. * The instance partition can be deleted. * All other attempts to modify the instance partition are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can start using this instance partition. * The instance partition's allocated resource levels are readable via the API. * The instance partition's state becomes READY.

The returned long-running operation will have a name of the format <instance_partition_name>/operations/<operation_id> and can be used to track creation of the instance partition. The metadata field type is CreateInstancePartitionMetadata. The response field type is InstancePartition, if successful.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   CreateInstancePartitionRequest request =
       CreateInstancePartitionRequest.newBuilder()
           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setInstancePartitionId("instancePartitionId1364450768")
           .setInstancePartition(InstancePartition.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       instanceAdminClient.createInstancePartitionCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateInstancePartitionRequest,Operation>

createInstancePartitionOperationCallable()

public final OperationCallable<CreateInstancePartitionRequest,InstancePartition,CreateInstancePartitionMetadata> createInstancePartitionOperationCallable()

Creates an instance partition and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance partition. The instance partition name is assigned by the caller. If the named instance partition already exists, CreateInstancePartition returns ALREADY_EXISTS.

Immediately upon completion of this request:

* The instance partition is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

* Cancelling the operation renders the instance partition immediately unreadable via the API. * The instance partition can be deleted. * All other attempts to modify the instance partition are rejected.

Upon completion of the returned operation:

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can start using this instance partition. * The instance partition's allocated resource levels are readable via the API. * The instance partition's state becomes READY.

The returned long-running operation will have a name of the format <instance_partition_name>/operations/<operation_id> and can be used to track creation of the instance partition. The metadata field type is CreateInstancePartitionMetadata. The response field type is InstancePartition, if successful.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   CreateInstancePartitionRequest request =
       CreateInstancePartitionRequest.newBuilder()
           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setInstancePartitionId("instancePartitionId1364450768")
           .setInstancePartition(InstancePartition.newBuilder().build())
           .build();
   OperationFuture<InstancePartition, CreateInstancePartitionMetadata> future =
       instanceAdminClient.createInstancePartitionOperationCallable().futureCall(request);
   // Do something.
   InstancePartition response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateInstancePartitionRequest,InstancePartition,CreateInstancePartitionMetadata>

deleteInstance(DeleteInstanceRequest request)

public final void deleteInstance(DeleteInstanceRequest request)

Deletes an instance.

Immediately upon completion of the request:

* Billing ceases for all of the instance's reserved resources.

Soon afterward:

* The instance and *all of its databases* immediately and irrevocably disappear from the API. All data in the databases is permanently deleted.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .build();
   instanceAdminClient.deleteInstance(request);
 }
 
Parameter
Name Description
request DeleteInstanceRequest

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

deleteInstance(InstanceName name)

public final void deleteInstance(InstanceName name)

Deletes an instance.

Immediately upon completion of the request:

* Billing ceases for all of the instance's reserved resources.

Soon afterward:

* The instance and *all of its databases* immediately and irrevocably disappear from the API. All data in the databases is permanently deleted.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
   instanceAdminClient.deleteInstance(name);
 }
 
Parameter
Name Description
name InstanceName

Required. The name of the instance to be deleted. Values are of the form projects/<project>/instances/<instance>

deleteInstance(String name)

public final void deleteInstance(String name)

Deletes an instance.

Immediately upon completion of the request:

* Billing ceases for all of the instance's reserved resources.

Soon afterward:

* The instance and *all of its databases* immediately and irrevocably disappear from the API. All data in the databases is permanently deleted.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String name = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   instanceAdminClient.deleteInstance(name);
 }
 
Parameter
Name Description
name String

Required. The name of the instance to be deleted. Values are of the form projects/<project>/instances/<instance>

deleteInstanceCallable()

public final UnaryCallable<DeleteInstanceRequest,Empty> deleteInstanceCallable()

Deletes an instance.

Immediately upon completion of the request:

* Billing ceases for all of the instance's reserved resources.

Soon afterward:

* The instance and *all of its databases* immediately and irrevocably disappear from the API. All data in the databases is permanently deleted.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .build();
   ApiFuture<Empty> future = instanceAdminClient.deleteInstanceCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteInstanceRequest,Empty>

deleteInstanceConfig(DeleteInstanceConfigRequest request)

public final void deleteInstanceConfig(DeleteInstanceConfigRequest request)

Deletes the instance config. Deletion is only allowed when no instances are using the configuration. If any instances are using the config, returns FAILED_PRECONDITION.

Only user managed configurations can be deleted.

Authorization requires spanner.instanceConfigs.delete permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   DeleteInstanceConfigRequest request =
       DeleteInstanceConfigRequest.newBuilder()
           .setName(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
           .setEtag("etag3123477")
           .setValidateOnly(true)
           .build();
   instanceAdminClient.deleteInstanceConfig(request);
 }
 
Parameter
Name Description
request DeleteInstanceConfigRequest

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

deleteInstanceConfig(InstanceConfigName name)

public final void deleteInstanceConfig(InstanceConfigName name)

Deletes the instance config. Deletion is only allowed when no instances are using the configuration. If any instances are using the config, returns FAILED_PRECONDITION.

Only user managed configurations can be deleted.

Authorization requires spanner.instanceConfigs.delete permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstanceConfigName name = InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]");
   instanceAdminClient.deleteInstanceConfig(name);
 }
 
Parameter
Name Description
name InstanceConfigName

Required. The name of the instance configuration to be deleted. Values are of the form projects/<project>/instanceConfigs/<instance_config>

deleteInstanceConfig(String name)

public final void deleteInstanceConfig(String name)

Deletes the instance config. Deletion is only allowed when no instances are using the configuration. If any instances are using the config, returns FAILED_PRECONDITION.

Only user managed configurations can be deleted.

Authorization requires spanner.instanceConfigs.delete permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String name = InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString();
   instanceAdminClient.deleteInstanceConfig(name);
 }
 
Parameter
Name Description
name String

Required. The name of the instance configuration to be deleted. Values are of the form projects/<project>/instanceConfigs/<instance_config>

deleteInstanceConfigCallable()

public final UnaryCallable<DeleteInstanceConfigRequest,Empty> deleteInstanceConfigCallable()

Deletes the instance config. Deletion is only allowed when no instances are using the configuration. If any instances are using the config, returns FAILED_PRECONDITION.

Only user managed configurations can be deleted.

Authorization requires spanner.instanceConfigs.delete permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   DeleteInstanceConfigRequest request =
       DeleteInstanceConfigRequest.newBuilder()
           .setName(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
           .setEtag("etag3123477")
           .setValidateOnly(true)
           .build();
   ApiFuture<Empty> future =
       instanceAdminClient.deleteInstanceConfigCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteInstanceConfigRequest,Empty>

deleteInstancePartition(DeleteInstancePartitionRequest request)

public final void deleteInstancePartition(DeleteInstancePartitionRequest request)

Deletes an existing instance partition. Requires that the instance partition is not used by any database or backup and is not the default instance partition of an instance.

Authorization requires spanner.instancePartitions.delete permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   DeleteInstancePartitionRequest request =
       DeleteInstancePartitionRequest.newBuilder()
           .setName(
               InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]")
                   .toString())
           .setEtag("etag3123477")
           .build();
   instanceAdminClient.deleteInstancePartition(request);
 }
 
Parameter
Name Description
request DeleteInstancePartitionRequest

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

deleteInstancePartition(InstancePartitionName name)

public final void deleteInstancePartition(InstancePartitionName name)

Deletes an existing instance partition. Requires that the instance partition is not used by any database or backup and is not the default instance partition of an instance.

Authorization requires spanner.instancePartitions.delete permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstancePartitionName name =
       InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]");
   instanceAdminClient.deleteInstancePartition(name);
 }
 
Parameter
Name Description
name InstancePartitionName

Required. The name of the instance partition to be deleted. Values are of the form projects/{project}/instances/{instance}/instancePartitions/{instance_partition}

deleteInstancePartition(String name)

public final void deleteInstancePartition(String name)

Deletes an existing instance partition. Requires that the instance partition is not used by any database or backup and is not the default instance partition of an instance.

Authorization requires spanner.instancePartitions.delete permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String name =
       InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]").toString();
   instanceAdminClient.deleteInstancePartition(name);
 }
 
Parameter
Name Description
name String

Required. The name of the instance partition to be deleted. Values are of the form projects/{project}/instances/{instance}/instancePartitions/{instance_partition}

deleteInstancePartitionCallable()

public final UnaryCallable<DeleteInstancePartitionRequest,Empty> deleteInstancePartitionCallable()

Deletes an existing instance partition. Requires that the instance partition is not used by any database or backup and is not the default instance partition of an instance.

Authorization requires spanner.instancePartitions.delete permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   DeleteInstancePartitionRequest request =
       DeleteInstancePartitionRequest.newBuilder()
           .setName(
               InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]")
                   .toString())
           .setEtag("etag3123477")
           .build();
   ApiFuture<Empty> future =
       instanceAdminClient.deleteInstancePartitionCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteInstancePartitionRequest,Empty>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

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

Returns
Type Description
OperationsClient

getIamPolicy(ResourceName resource)

public final Policy getIamPolicy(ResourceName resource)

Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.

Authorization requires spanner.instances.getIamPolicy on resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ResourceName resource = InstanceName.of("[PROJECT]", "[INSTANCE]");
   Policy response = instanceAdminClient.getIamPolicy(resource);
 }
 
Parameter
Name Description
resource com.google.api.resourcenames.ResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

Returns
Type Description
com.google.iam.v1.Policy

getIamPolicy(GetIamPolicyRequest request)

public final Policy getIamPolicy(GetIamPolicyRequest request)

Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.

Authorization requires spanner.instances.getIamPolicy on resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   GetIamPolicyRequest request =
       GetIamPolicyRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setOptions(GetPolicyOptions.newBuilder().build())
           .build();
   Policy response = instanceAdminClient.getIamPolicy(request);
 }
 
Parameter
Name Description
request com.google.iam.v1.GetIamPolicyRequest

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

Returns
Type Description
com.google.iam.v1.Policy

getIamPolicy(String resource)

public final Policy getIamPolicy(String resource)

Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.

Authorization requires spanner.instances.getIamPolicy on resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String resource = ProjectName.of("[PROJECT]").toString();
   Policy response = instanceAdminClient.getIamPolicy(resource);
 }
 
Parameter
Name Description
resource String

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

Returns
Type Description
com.google.iam.v1.Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()

Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.

Authorization requires spanner.instances.getIamPolicy on resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   GetIamPolicyRequest request =
       GetIamPolicyRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setOptions(GetPolicyOptions.newBuilder().build())
           .build();
   ApiFuture<Policy> future = instanceAdminClient.getIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>

getInstance(GetInstanceRequest request)

public final Instance getInstance(GetInstanceRequest request)

Gets information about a particular instance.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   GetInstanceRequest request =
       GetInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setFieldMask(FieldMask.newBuilder().build())
           .build();
   Instance response = instanceAdminClient.getInstance(request);
 }
 
Parameter
Name Description
request GetInstanceRequest

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

Returns
Type Description
Instance

getInstance(InstanceName name)

public final Instance getInstance(InstanceName name)

Gets information about a particular instance.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
   Instance response = instanceAdminClient.getInstance(name);
 }
 
Parameter
Name Description
name InstanceName

Required. The name of the requested instance. Values are of the form projects/<project>/instances/<instance>.

Returns
Type Description
Instance

getInstance(String name)

public final Instance getInstance(String name)

Gets information about a particular instance.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String name = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   Instance response = instanceAdminClient.getInstance(name);
 }
 
Parameter
Name Description
name String

Required. The name of the requested instance. Values are of the form projects/<project>/instances/<instance>.

Returns
Type Description
Instance

getInstanceCallable()

public final UnaryCallable<GetInstanceRequest,Instance> getInstanceCallable()

Gets information about a particular instance.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   GetInstanceRequest request =
       GetInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setFieldMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Instance> future = instanceAdminClient.getInstanceCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetInstanceRequest,Instance>

getInstanceConfig(GetInstanceConfigRequest request)

public final InstanceConfig getInstanceConfig(GetInstanceConfigRequest request)

Gets information about a particular instance configuration.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   GetInstanceConfigRequest request =
       GetInstanceConfigRequest.newBuilder()
           .setName(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
           .build();
   InstanceConfig response = instanceAdminClient.getInstanceConfig(request);
 }
 
Parameter
Name Description
request GetInstanceConfigRequest

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

Returns
Type Description
InstanceConfig

getInstanceConfig(InstanceConfigName name)

public final InstanceConfig getInstanceConfig(InstanceConfigName name)

Gets information about a particular instance configuration.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstanceConfigName name = InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]");
   InstanceConfig response = instanceAdminClient.getInstanceConfig(name);
 }
 
Parameter
Name Description
name InstanceConfigName

Required. The name of the requested instance configuration. Values are of the form projects/<project>/instanceConfigs/<config>.

Returns
Type Description
InstanceConfig

getInstanceConfig(String name)

public final InstanceConfig getInstanceConfig(String name)

Gets information about a particular instance configuration.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String name = InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString();
   InstanceConfig response = instanceAdminClient.getInstanceConfig(name);
 }
 
Parameter
Name Description
name String

Required. The name of the requested instance configuration. Values are of the form projects/<project>/instanceConfigs/<config>.

Returns
Type Description
InstanceConfig

getInstanceConfigCallable()

public final UnaryCallable<GetInstanceConfigRequest,InstanceConfig> getInstanceConfigCallable()

Gets information about a particular instance configuration.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   GetInstanceConfigRequest request =
       GetInstanceConfigRequest.newBuilder()
           .setName(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString())
           .build();
   ApiFuture<InstanceConfig> future =
       instanceAdminClient.getInstanceConfigCallable().futureCall(request);
   // Do something.
   InstanceConfig response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetInstanceConfigRequest,InstanceConfig>

getInstancePartition(GetInstancePartitionRequest request)

public final InstancePartition getInstancePartition(GetInstancePartitionRequest request)

Gets information about a particular instance 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   GetInstancePartitionRequest request =
       GetInstancePartitionRequest.newBuilder()
           .setName(
               InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]")
                   .toString())
           .build();
   InstancePartition response = instanceAdminClient.getInstancePartition(request);
 }
 
Parameter
Name Description
request GetInstancePartitionRequest

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

Returns
Type Description
InstancePartition

getInstancePartition(InstancePartitionName name)

public final InstancePartition getInstancePartition(InstancePartitionName name)

Gets information about a particular instance 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstancePartitionName name =
       InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]");
   InstancePartition response = instanceAdminClient.getInstancePartition(name);
 }
 
Parameter
Name Description
name InstancePartitionName

Required. The name of the requested instance partition. Values are of the form projects/{project}/instances/{instance}/instancePartitions/{instance_partition}.

Returns
Type Description
InstancePartition

getInstancePartition(String name)

public final InstancePartition getInstancePartition(String name)

Gets information about a particular instance 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String name =
       InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]").toString();
   InstancePartition response = instanceAdminClient.getInstancePartition(name);
 }
 
Parameter
Name Description
name String

Required. The name of the requested instance partition. Values are of the form projects/{project}/instances/{instance}/instancePartitions/{instance_partition}.

Returns
Type Description
InstancePartition

getInstancePartitionCallable()

public final UnaryCallable<GetInstancePartitionRequest,InstancePartition> getInstancePartitionCallable()

Gets information about a particular instance 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   GetInstancePartitionRequest request =
       GetInstancePartitionRequest.newBuilder()
           .setName(
               InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]")
                   .toString())
           .build();
   ApiFuture<InstancePartition> future =
       instanceAdminClient.getInstancePartitionCallable().futureCall(request);
   // Do something.
   InstancePartition response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetInstancePartitionRequest,InstancePartition>

getOperationsClient()

public final OperationsClient getOperationsClient()

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

Returns
Type Description
OperationsClient

getSettings()

public final InstanceAdminSettings getSettings()
Returns
Type Description
InstanceAdminSettings

getStub()

public InstanceAdminStub getStub()
Returns
Type Description
InstanceAdminStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listInstanceConfigOperations(ListInstanceConfigOperationsRequest request)

public final InstanceAdminClient.ListInstanceConfigOperationsPagedResponse listInstanceConfigOperations(ListInstanceConfigOperationsRequest request)

Lists the user-managed instance config long-running operations in the given project. An instance config operation has a name of the form projects/<project>/instanceConfigs/<instance_config>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstanceConfigOperationsRequest request =
       ListInstanceConfigOperationsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Operation element :
       instanceAdminClient.listInstanceConfigOperations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListInstanceConfigOperationsRequest

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

Returns
Type Description
InstanceAdminClient.ListInstanceConfigOperationsPagedResponse

listInstanceConfigOperations(ProjectName parent)

public final InstanceAdminClient.ListInstanceConfigOperationsPagedResponse listInstanceConfigOperations(ProjectName parent)

Lists the user-managed instance config long-running operations in the given project. An instance config operation has a name of the form projects/<project>/instanceConfigs/<instance_config>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   for (Operation element :
       instanceAdminClient.listInstanceConfigOperations(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent ProjectName

Required. The project of the instance config operations. Values are of the form projects/<project>.

Returns
Type Description
InstanceAdminClient.ListInstanceConfigOperationsPagedResponse

listInstanceConfigOperations(String parent)

public final InstanceAdminClient.ListInstanceConfigOperationsPagedResponse listInstanceConfigOperations(String parent)

Lists the user-managed instance config long-running operations in the given project. An instance config operation has a name of the form projects/<project>/instanceConfigs/<instance_config>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   for (Operation element :
       instanceAdminClient.listInstanceConfigOperations(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The project of the instance config operations. Values are of the form projects/<project>.

Returns
Type Description
InstanceAdminClient.ListInstanceConfigOperationsPagedResponse

listInstanceConfigOperationsCallable()

public final UnaryCallable<ListInstanceConfigOperationsRequest,ListInstanceConfigOperationsResponse> listInstanceConfigOperationsCallable()

Lists the user-managed instance config long-running operations in the given project. An instance config operation has a name of the form projects/<project>/instanceConfigs/<instance_config>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstanceConfigOperationsRequest request =
       ListInstanceConfigOperationsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListInstanceConfigOperationsResponse response =
         instanceAdminClient.listInstanceConfigOperationsCallable().call(request);
     for (Operation element : response.getOperationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstanceConfigOperationsRequest,ListInstanceConfigOperationsResponse>

listInstanceConfigOperationsPagedCallable()

public final UnaryCallable<ListInstanceConfigOperationsRequest,InstanceAdminClient.ListInstanceConfigOperationsPagedResponse> listInstanceConfigOperationsPagedCallable()

Lists the user-managed instance config long-running operations in the given project. An instance config operation has a name of the form projects/<project>/instanceConfigs/<instance_config>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstanceConfigOperationsRequest request =
       ListInstanceConfigOperationsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Operation> future =
       instanceAdminClient.listInstanceConfigOperationsPagedCallable().futureCall(request);
   // Do something.
   for (Operation element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstanceConfigOperationsRequest,ListInstanceConfigOperationsPagedResponse>

listInstanceConfigs(ListInstanceConfigsRequest request)

public final InstanceAdminClient.ListInstanceConfigsPagedResponse listInstanceConfigs(ListInstanceConfigsRequest request)

Lists the supported instance configurations for a given project.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstanceConfigsRequest request =
       ListInstanceConfigsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (InstanceConfig element : instanceAdminClient.listInstanceConfigs(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListInstanceConfigsRequest

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

Returns
Type Description
InstanceAdminClient.ListInstanceConfigsPagedResponse

listInstanceConfigs(ProjectName parent)

public final InstanceAdminClient.ListInstanceConfigsPagedResponse listInstanceConfigs(ProjectName parent)

Lists the supported instance configurations for a given project.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   for (InstanceConfig element : instanceAdminClient.listInstanceConfigs(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent ProjectName

Required. The name of the project for which a list of supported instance configurations is requested. Values are of the form projects/<project>.

Returns
Type Description
InstanceAdminClient.ListInstanceConfigsPagedResponse

listInstanceConfigs(String parent)

public final InstanceAdminClient.ListInstanceConfigsPagedResponse listInstanceConfigs(String parent)

Lists the supported instance configurations for a given project.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   for (InstanceConfig element : instanceAdminClient.listInstanceConfigs(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The name of the project for which a list of supported instance configurations is requested. Values are of the form projects/<project>.

Returns
Type Description
InstanceAdminClient.ListInstanceConfigsPagedResponse

listInstanceConfigsCallable()

public final UnaryCallable<ListInstanceConfigsRequest,ListInstanceConfigsResponse> listInstanceConfigsCallable()

Lists the supported instance configurations for a given project.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstanceConfigsRequest request =
       ListInstanceConfigsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListInstanceConfigsResponse response =
         instanceAdminClient.listInstanceConfigsCallable().call(request);
     for (InstanceConfig element : response.getInstanceConfigsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstanceConfigsRequest,ListInstanceConfigsResponse>

listInstanceConfigsPagedCallable()

public final UnaryCallable<ListInstanceConfigsRequest,InstanceAdminClient.ListInstanceConfigsPagedResponse> listInstanceConfigsPagedCallable()

Lists the supported instance configurations for a given project.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstanceConfigsRequest request =
       ListInstanceConfigsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<InstanceConfig> future =
       instanceAdminClient.listInstanceConfigsPagedCallable().futureCall(request);
   // Do something.
   for (InstanceConfig element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstanceConfigsRequest,ListInstanceConfigsPagedResponse>

listInstancePartitionOperations(InstanceName parent)

public final InstanceAdminClient.ListInstancePartitionOperationsPagedResponse listInstancePartitionOperations(InstanceName parent)

Lists instance partition long-running operations in the given instance. An instance partition operation has a name of the form projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

Authorization requires spanner.instancePartitionOperations.list permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   for (Operation element :
       instanceAdminClient.listInstancePartitionOperations(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent InstanceName

Required. The parent instance of the instance partition operations. Values are of the form projects/<project>/instances/<instance>.

Returns
Type Description
InstanceAdminClient.ListInstancePartitionOperationsPagedResponse

listInstancePartitionOperations(ListInstancePartitionOperationsRequest request)

public final InstanceAdminClient.ListInstancePartitionOperationsPagedResponse listInstancePartitionOperations(ListInstancePartitionOperationsRequest request)

Lists instance partition long-running operations in the given instance. An instance partition operation has a name of the form projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

Authorization requires spanner.instancePartitionOperations.list permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstancePartitionOperationsRequest request =
       ListInstancePartitionOperationsRequest.newBuilder()
           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
           .build();
   for (Operation element :
       instanceAdminClient.listInstancePartitionOperations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListInstancePartitionOperationsRequest

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

Returns
Type Description
InstanceAdminClient.ListInstancePartitionOperationsPagedResponse

listInstancePartitionOperations(String parent)

public final InstanceAdminClient.ListInstancePartitionOperationsPagedResponse listInstancePartitionOperations(String parent)

Lists instance partition long-running operations in the given instance. An instance partition operation has a name of the form projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

Authorization requires spanner.instancePartitionOperations.list permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   for (Operation element :
       instanceAdminClient.listInstancePartitionOperations(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent instance of the instance partition operations. Values are of the form projects/<project>/instances/<instance>.

Returns
Type Description
InstanceAdminClient.ListInstancePartitionOperationsPagedResponse

listInstancePartitionOperationsCallable()

public final UnaryCallable<ListInstancePartitionOperationsRequest,ListInstancePartitionOperationsResponse> listInstancePartitionOperationsCallable()

Lists instance partition long-running operations in the given instance. An instance partition operation has a name of the form projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

Authorization requires spanner.instancePartitionOperations.list permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstancePartitionOperationsRequest request =
       ListInstancePartitionOperationsRequest.newBuilder()
           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
           .build();
   while (true) {
     ListInstancePartitionOperationsResponse response =
         instanceAdminClient.listInstancePartitionOperationsCallable().call(request);
     for (Operation element : response.getOperationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstancePartitionOperationsRequest,ListInstancePartitionOperationsResponse>

listInstancePartitionOperationsPagedCallable()

public final UnaryCallable<ListInstancePartitionOperationsRequest,InstanceAdminClient.ListInstancePartitionOperationsPagedResponse> listInstancePartitionOperationsPagedCallable()

Lists instance partition long-running operations in the given instance. An instance partition operation has a name of the form projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

Authorization requires spanner.instancePartitionOperations.list permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstancePartitionOperationsRequest request =
       ListInstancePartitionOperationsRequest.newBuilder()
           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       instanceAdminClient.listInstancePartitionOperationsPagedCallable().futureCall(request);
   // Do something.
   for (Operation element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstancePartitionOperationsRequest,ListInstancePartitionOperationsPagedResponse>

listInstancePartitions(InstanceName parent)

public final InstanceAdminClient.ListInstancePartitionsPagedResponse listInstancePartitions(InstanceName parent)

Lists all instance partitions for the given instance.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   for (InstancePartition element :
       instanceAdminClient.listInstancePartitions(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent InstanceName

Required. The instance whose instance partitions should be listed. Values are of the form projects/<project>/instances/<instance>.

Returns
Type Description
InstanceAdminClient.ListInstancePartitionsPagedResponse

listInstancePartitions(ListInstancePartitionsRequest request)

public final InstanceAdminClient.ListInstancePartitionsPagedResponse listInstancePartitions(ListInstancePartitionsRequest request)

Lists all instance partitions for the given instance.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstancePartitionsRequest request =
       ListInstancePartitionsRequest.newBuilder()
           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
           .build();
   for (InstancePartition element :
       instanceAdminClient.listInstancePartitions(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListInstancePartitionsRequest

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

Returns
Type Description
InstanceAdminClient.ListInstancePartitionsPagedResponse

listInstancePartitions(String parent)

public final InstanceAdminClient.ListInstancePartitionsPagedResponse listInstancePartitions(String parent)

Lists all instance partitions for the given instance.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   for (InstancePartition element :
       instanceAdminClient.listInstancePartitions(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The instance whose instance partitions should be listed. Values are of the form projects/<project>/instances/<instance>.

Returns
Type Description
InstanceAdminClient.ListInstancePartitionsPagedResponse

listInstancePartitionsCallable()

public final UnaryCallable<ListInstancePartitionsRequest,ListInstancePartitionsResponse> listInstancePartitionsCallable()

Lists all instance partitions for the given instance.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstancePartitionsRequest request =
       ListInstancePartitionsRequest.newBuilder()
           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
           .build();
   while (true) {
     ListInstancePartitionsResponse response =
         instanceAdminClient.listInstancePartitionsCallable().call(request);
     for (InstancePartition element : response.getInstancePartitionsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstancePartitionsRequest,ListInstancePartitionsResponse>

listInstancePartitionsPagedCallable()

public final UnaryCallable<ListInstancePartitionsRequest,InstanceAdminClient.ListInstancePartitionsPagedResponse> listInstancePartitionsPagedCallable()

Lists all instance partitions for the given instance.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstancePartitionsRequest request =
       ListInstancePartitionsRequest.newBuilder()
           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
           .build();
   ApiFuture<InstancePartition> future =
       instanceAdminClient.listInstancePartitionsPagedCallable().futureCall(request);
   // Do something.
   for (InstancePartition element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstancePartitionsRequest,ListInstancePartitionsPagedResponse>

listInstances(ListInstancesRequest request)

public final InstanceAdminClient.ListInstancesPagedResponse listInstances(ListInstancesRequest request)

Lists all instances in the given project.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setInstanceDeadline(Timestamp.newBuilder().build())
           .build();
   for (Instance element : instanceAdminClient.listInstances(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListInstancesRequest

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

Returns
Type Description
InstanceAdminClient.ListInstancesPagedResponse

listInstances(ProjectName parent)

public final InstanceAdminClient.ListInstancesPagedResponse listInstances(ProjectName parent)

Lists all instances in the given project.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   for (Instance element : instanceAdminClient.listInstances(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent ProjectName

Required. The name of the project for which a list of instances is requested. Values are of the form projects/<project>.

Returns
Type Description
InstanceAdminClient.ListInstancesPagedResponse

listInstances(String parent)

public final InstanceAdminClient.ListInstancesPagedResponse listInstances(String parent)

Lists all instances in the given project.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   for (Instance element : instanceAdminClient.listInstances(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The name of the project for which a list of instances is requested. Values are of the form projects/<project>.

Returns
Type Description
InstanceAdminClient.ListInstancesPagedResponse

listInstancesCallable()

public final UnaryCallable<ListInstancesRequest,ListInstancesResponse> listInstancesCallable()

Lists all instances in the given project.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setInstanceDeadline(Timestamp.newBuilder().build())
           .build();
   while (true) {
     ListInstancesResponse response = instanceAdminClient.listInstancesCallable().call(request);
     for (Instance element : response.getInstancesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstancesRequest,ListInstancesResponse>

listInstancesPagedCallable()

public final UnaryCallable<ListInstancesRequest,InstanceAdminClient.ListInstancesPagedResponse> listInstancesPagedCallable()

Lists all instances in the given project.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setInstanceDeadline(Timestamp.newBuilder().build())
           .build();
   ApiFuture<Instance> future =
       instanceAdminClient.listInstancesPagedCallable().futureCall(request);
   // Do something.
   for (Instance element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstancesRequest,ListInstancesPagedResponse>

setIamPolicy(ResourceName resource, Policy policy)

public final Policy setIamPolicy(ResourceName resource, Policy policy)

Sets the access control policy on an instance resource. Replaces any existing policy.

Authorization requires spanner.instances.setIamPolicy on resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ResourceName resource = InstanceName.of("[PROJECT]", "[INSTANCE]");
   Policy policy = Policy.newBuilder().build();
   Policy response = instanceAdminClient.setIamPolicy(resource, policy);
 }
 
Parameters
Name Description
resource com.google.api.resourcenames.ResourceName

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policy com.google.iam.v1.Policy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

Returns
Type Description
com.google.iam.v1.Policy

setIamPolicy(SetIamPolicyRequest request)

public final Policy setIamPolicy(SetIamPolicyRequest request)

Sets the access control policy on an instance resource. Replaces any existing policy.

Authorization requires spanner.instances.setIamPolicy on resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   SetIamPolicyRequest request =
       SetIamPolicyRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setPolicy(Policy.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Policy response = instanceAdminClient.setIamPolicy(request);
 }
 
Parameter
Name Description
request com.google.iam.v1.SetIamPolicyRequest

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

Returns
Type Description
com.google.iam.v1.Policy

setIamPolicy(String resource, Policy policy)

public final Policy setIamPolicy(String resource, Policy policy)

Sets the access control policy on an instance resource. Replaces any existing policy.

Authorization requires spanner.instances.setIamPolicy on resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String resource = ProjectName.of("[PROJECT]").toString();
   Policy policy = Policy.newBuilder().build();
   Policy response = instanceAdminClient.setIamPolicy(resource, policy);
 }
 
Parameters
Name Description
resource String

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policy com.google.iam.v1.Policy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

Returns
Type Description
com.google.iam.v1.Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()

Sets the access control policy on an instance resource. Replaces any existing policy.

Authorization requires spanner.instances.setIamPolicy on resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   SetIamPolicyRequest request =
       SetIamPolicyRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .setPolicy(Policy.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Policy> future = instanceAdminClient.setIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

testIamPermissions(ResourceName resource, List<String> permissions)

public final TestIamPermissionsResponse testIamPermissions(ResourceName resource, List<String> permissions)

Returns permissions that the caller has on the specified instance resource.

Attempting this RPC on a non-existent Cloud Spanner instance resource will result in a NOT_FOUND error if the user has spanner.instances.list permission on the containing Google Cloud Project. Otherwise returns an empty set of permissions.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   ResourceName resource = InstanceName.of("[PROJECT]", "[INSTANCE]");
   List<String> permissions = new ArrayList<>();
   TestIamPermissionsResponse response =
       instanceAdminClient.testIamPermissions(resource, permissions);
 }
 
Parameters
Name Description
resource com.google.api.resourcenames.ResourceName

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissions List<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.

Returns
Type Description
com.google.iam.v1.TestIamPermissionsResponse

testIamPermissions(TestIamPermissionsRequest request)

public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)

Returns permissions that the caller has on the specified instance resource.

Attempting this RPC on a non-existent Cloud Spanner instance resource will result in a NOT_FOUND error if the user has spanner.instances.list permission on the containing Google Cloud Project. Otherwise returns an empty set of permissions.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   TestIamPermissionsRequest request =
       TestIamPermissionsRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .addAllPermissions(new ArrayList<String>())
           .build();
   TestIamPermissionsResponse response = instanceAdminClient.testIamPermissions(request);
 }
 
Parameter
Name Description
request com.google.iam.v1.TestIamPermissionsRequest

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

Returns
Type Description
com.google.iam.v1.TestIamPermissionsResponse

testIamPermissions(String resource, List<String> permissions)

public final TestIamPermissionsResponse testIamPermissions(String resource, List<String> permissions)

Returns permissions that the caller has on the specified instance resource.

Attempting this RPC on a non-existent Cloud Spanner instance resource will result in a NOT_FOUND error if the user has spanner.instances.list permission on the containing Google Cloud Project. Otherwise returns an empty set of permissions.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   String resource = ProjectName.of("[PROJECT]").toString();
   List<String> permissions = new ArrayList<>();
   TestIamPermissionsResponse response =
       instanceAdminClient.testIamPermissions(resource, permissions);
 }
 
Parameters
Name Description
resource String

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissions List<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.

Returns
Type Description
com.google.iam.v1.TestIamPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()

Returns permissions that the caller has on the specified instance resource.

Attempting this RPC on a non-existent Cloud Spanner instance resource will result in a NOT_FOUND error if the user has spanner.instances.list permission on the containing Google Cloud Project. Otherwise returns an empty set of permissions.

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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   TestIamPermissionsRequest request =
       TestIamPermissionsRequest.newBuilder()
           .setResource(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
           .addAllPermissions(new ArrayList<String>())
           .build();
   ApiFuture<TestIamPermissionsResponse> future =
       instanceAdminClient.testIamPermissionsCallable().futureCall(request);
   // Do something.
   TestIamPermissionsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse>

updateInstanceAsync(Instance instance, FieldMask fieldMask)

public final OperationFuture<Instance,UpdateInstanceMetadata> updateInstanceAsync(Instance instance, FieldMask fieldMask)

Updates an instance, and begins allocating or releasing resources as requested. The returned long-running operation can be used to track the progress of updating the instance. If the named instance does not exist, returns NOT_FOUND.

Immediately upon completion of this request:

* For resource types for which a decrease in the instance's allocation has been requested, billing is based on the newly-requested level.

Until completion of the returned operation:

* Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance are rejected. * Reading the instance via the API continues to give the pre-request resource levels.

Upon completion of the returned operation:

* Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance's tables. * The instance's new resource levels are readable via the API.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track the instance modification. The metadata field type is UpdateInstanceMetadata. The response field type is Instance, if successful.

Authorization requires spanner.instances.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   Instance instance = Instance.newBuilder().build();
   FieldMask fieldMask = FieldMask.newBuilder().build();
   Instance response = instanceAdminClient.updateInstanceAsync(instance, fieldMask).get();
 }
 
Parameters
Name Description
instance Instance

Required. The instance to update, which must always include the instance name. Otherwise, only fields mentioned in field_mask need be included.

fieldMask FieldMask

Required. A mask specifying which fields in Instance should be updated. The field mask must always be specified; this prevents any future fields in Instance from being erased accidentally by clients that do not know about them.

Returns
Type Description
OperationFuture<Instance,UpdateInstanceMetadata>

updateInstanceAsync(UpdateInstanceRequest request)

public final OperationFuture<Instance,UpdateInstanceMetadata> updateInstanceAsync(UpdateInstanceRequest request)

Updates an instance, and begins allocating or releasing resources as requested. The returned long-running operation can be used to track the progress of updating the instance. If the named instance does not exist, returns NOT_FOUND.

Immediately upon completion of this request:

* For resource types for which a decrease in the instance's allocation has been requested, billing is based on the newly-requested level.

Until completion of the returned operation:

* Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance are rejected. * Reading the instance via the API continues to give the pre-request resource levels.

Upon completion of the returned operation:

* Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance's tables. * The instance's new resource levels are readable via the API.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track the instance modification. The metadata field type is UpdateInstanceMetadata. The response field type is Instance, if successful.

Authorization requires spanner.instances.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setInstance(Instance.newBuilder().build())
           .setFieldMask(FieldMask.newBuilder().build())
           .build();
   Instance response = instanceAdminClient.updateInstanceAsync(request).get();
 }
 
Parameter
Name Description
request UpdateInstanceRequest

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

Returns
Type Description
OperationFuture<Instance,UpdateInstanceMetadata>

updateInstanceCallable()

public final UnaryCallable<UpdateInstanceRequest,Operation> updateInstanceCallable()

Updates an instance, and begins allocating or releasing resources as requested. The returned long-running operation can be used to track the progress of updating the instance. If the named instance does not exist, returns NOT_FOUND.

Immediately upon completion of this request:

* For resource types for which a decrease in the instance's allocation has been requested, billing is based on the newly-requested level.

Until completion of the returned operation:

* Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance are rejected. * Reading the instance via the API continues to give the pre-request resource levels.

Upon completion of the returned operation:

* Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance's tables. * The instance's new resource levels are readable via the API.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track the instance modification. The metadata field type is UpdateInstanceMetadata. The response field type is Instance, if successful.

Authorization requires spanner.instances.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setInstance(Instance.newBuilder().build())
           .setFieldMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       instanceAdminClient.updateInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateInstanceRequest,Operation>

updateInstanceConfigAsync(InstanceConfig instanceConfig, FieldMask updateMask)

public final OperationFuture<InstanceConfig,UpdateInstanceConfigMetadata> updateInstanceConfigAsync(InstanceConfig instanceConfig, FieldMask updateMask)

Updates an instance config. The returned long-running operation can be used to track the progress of updating the instance. If the named instance config does not exist, returns NOT_FOUND.

Only user managed configurations can be updated.

Immediately after the request returns:

* The instance config's reconciling field is set to true.

While the operation is pending:

* Cancelling the operation sets its metadata's cancel_time. The operation is guaranteed to succeed at undoing all changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance config are rejected. * Reading the instance config via the API continues to give the pre-request values.

Upon completion of the returned operation:

* Creating instances using the instance configuration uses the new values. * The instance config's new values are readable via the API. * The instance config's reconciling field becomes false.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track the instance config modification. The metadata field type is UpdateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstanceConfig instanceConfig = InstanceConfig.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   InstanceConfig response =
       instanceAdminClient.updateInstanceConfigAsync(instanceConfig, updateMask).get();
 }
 
Parameters
Name Description
instanceConfig InstanceConfig

Required. The user instance config to update, which must always include the instance config name. Otherwise, only fields mentioned in update_mask need be included. To prevent conflicts of concurrent updates, etag can be used.

updateMask FieldMask

Required. A mask specifying which fields in InstanceConfig should be updated. The field mask must always be specified; this prevents any future fields in InstanceConfig from being erased accidentally by clients that do not know about them. Only display_name and labels can be updated.

Returns
Type Description
OperationFuture<InstanceConfig,UpdateInstanceConfigMetadata>

updateInstanceConfigAsync(UpdateInstanceConfigRequest request)

public final OperationFuture<InstanceConfig,UpdateInstanceConfigMetadata> updateInstanceConfigAsync(UpdateInstanceConfigRequest request)

Updates an instance config. The returned long-running operation can be used to track the progress of updating the instance. If the named instance config does not exist, returns NOT_FOUND.

Only user managed configurations can be updated.

Immediately after the request returns:

* The instance config's reconciling field is set to true.

While the operation is pending:

* Cancelling the operation sets its metadata's cancel_time. The operation is guaranteed to succeed at undoing all changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance config are rejected. * Reading the instance config via the API continues to give the pre-request values.

Upon completion of the returned operation:

* Creating instances using the instance configuration uses the new values. * The instance config's new values are readable via the API. * The instance config's reconciling field becomes false.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track the instance config modification. The metadata field type is UpdateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   UpdateInstanceConfigRequest request =
       UpdateInstanceConfigRequest.newBuilder()
           .setInstanceConfig(InstanceConfig.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   InstanceConfig response = instanceAdminClient.updateInstanceConfigAsync(request).get();
 }
 
Parameter
Name Description
request UpdateInstanceConfigRequest

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

Returns
Type Description
OperationFuture<InstanceConfig,UpdateInstanceConfigMetadata>

updateInstanceConfigCallable()

public final UnaryCallable<UpdateInstanceConfigRequest,Operation> updateInstanceConfigCallable()

Updates an instance config. The returned long-running operation can be used to track the progress of updating the instance. If the named instance config does not exist, returns NOT_FOUND.

Only user managed configurations can be updated.

Immediately after the request returns:

* The instance config's reconciling field is set to true.

While the operation is pending:

* Cancelling the operation sets its metadata's cancel_time. The operation is guaranteed to succeed at undoing all changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance config are rejected. * Reading the instance config via the API continues to give the pre-request values.

Upon completion of the returned operation:

* Creating instances using the instance configuration uses the new values. * The instance config's new values are readable via the API. * The instance config's reconciling field becomes false.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track the instance config modification. The metadata field type is UpdateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   UpdateInstanceConfigRequest request =
       UpdateInstanceConfigRequest.newBuilder()
           .setInstanceConfig(InstanceConfig.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   ApiFuture<Operation> future =
       instanceAdminClient.updateInstanceConfigCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateInstanceConfigRequest,Operation>

updateInstanceConfigOperationCallable()

public final OperationCallable<UpdateInstanceConfigRequest,InstanceConfig,UpdateInstanceConfigMetadata> updateInstanceConfigOperationCallable()

Updates an instance config. The returned long-running operation can be used to track the progress of updating the instance. If the named instance config does not exist, returns NOT_FOUND.

Only user managed configurations can be updated.

Immediately after the request returns:

* The instance config's reconciling field is set to true.

While the operation is pending:

* Cancelling the operation sets its metadata's cancel_time. The operation is guaranteed to succeed at undoing all changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance config are rejected. * Reading the instance config via the API continues to give the pre-request values.

Upon completion of the returned operation:

* Creating instances using the instance configuration uses the new values. * The instance config's new values are readable via the API. * The instance config's reconciling field becomes false.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track the instance config modification. The metadata field type is UpdateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   UpdateInstanceConfigRequest request =
       UpdateInstanceConfigRequest.newBuilder()
           .setInstanceConfig(InstanceConfig.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   OperationFuture<InstanceConfig, UpdateInstanceConfigMetadata> future =
       instanceAdminClient.updateInstanceConfigOperationCallable().futureCall(request);
   // Do something.
   InstanceConfig response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdateInstanceConfigRequest,InstanceConfig,UpdateInstanceConfigMetadata>

updateInstanceOperationCallable()

public final OperationCallable<UpdateInstanceRequest,Instance,UpdateInstanceMetadata> updateInstanceOperationCallable()

Updates an instance, and begins allocating or releasing resources as requested. The returned long-running operation can be used to track the progress of updating the instance. If the named instance does not exist, returns NOT_FOUND.

Immediately upon completion of this request:

* For resource types for which a decrease in the instance's allocation has been requested, billing is based on the newly-requested level.

Until completion of the returned operation:

* Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance are rejected. * Reading the instance via the API continues to give the pre-request resource levels.

Upon completion of the returned operation:

* Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance's tables. * The instance's new resource levels are readable via the API.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track the instance modification. The metadata field type is UpdateInstanceMetadata. The response field type is Instance, if successful.

Authorization requires spanner.instances.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setInstance(Instance.newBuilder().build())
           .setFieldMask(FieldMask.newBuilder().build())
           .build();
   OperationFuture<Instance, UpdateInstanceMetadata> future =
       instanceAdminClient.updateInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdateInstanceRequest,Instance,UpdateInstanceMetadata>

updateInstancePartitionAsync(InstancePartition instancePartition, FieldMask fieldMask)

public final OperationFuture<InstancePartition,UpdateInstancePartitionMetadata> updateInstancePartitionAsync(InstancePartition instancePartition, FieldMask fieldMask)

Updates an instance partition, and begins allocating or releasing resources as requested. The returned long-running operation can be used to track the progress of updating the instance partition. If the named instance partition does not exist, returns NOT_FOUND.

Immediately upon completion of this request:

* For resource types for which a decrease in the instance partition's allocation has been requested, billing is based on the newly-requested level.

Until completion of the returned operation:

* Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance partition are rejected. * Reading the instance partition via the API continues to give the pre-request resource levels.

Upon completion of the returned operation:

* Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance partition's tables. * The instance partition's new resource levels are readable via the API.

The returned long-running operation will have a name of the format <instance_partition_name>/operations/<operation_id> and can be used to track the instance partition modification. The metadata field type is UpdateInstancePartitionMetadata. The response field type is InstancePartition, if successful.

Authorization requires spanner.instancePartitions.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   InstancePartition instancePartition = InstancePartition.newBuilder().build();
   FieldMask fieldMask = FieldMask.newBuilder().build();
   InstancePartition response =
       instanceAdminClient.updateInstancePartitionAsync(instancePartition, fieldMask).get();
 }
 
Parameters
Name Description
instancePartition InstancePartition

Required. The instance partition to update, which must always include the instance partition name. Otherwise, only fields mentioned in field_mask need be included.

fieldMask FieldMask

Required. A mask specifying which fields in InstancePartition should be updated. The field mask must always be specified; this prevents any future fields in InstancePartition from being erased accidentally by clients that do not know about them.

Returns
Type Description
OperationFuture<InstancePartition,UpdateInstancePartitionMetadata>

updateInstancePartitionAsync(UpdateInstancePartitionRequest request)

public final OperationFuture<InstancePartition,UpdateInstancePartitionMetadata> updateInstancePartitionAsync(UpdateInstancePartitionRequest request)

Updates an instance partition, and begins allocating or releasing resources as requested. The returned long-running operation can be used to track the progress of updating the instance partition. If the named instance partition does not exist, returns NOT_FOUND.

Immediately upon completion of this request:

* For resource types for which a decrease in the instance partition's allocation has been requested, billing is based on the newly-requested level.

Until completion of the returned operation:

* Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance partition are rejected. * Reading the instance partition via the API continues to give the pre-request resource levels.

Upon completion of the returned operation:

* Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance partition's tables. * The instance partition's new resource levels are readable via the API.

The returned long-running operation will have a name of the format <instance_partition_name>/operations/<operation_id> and can be used to track the instance partition modification. The metadata field type is UpdateInstancePartitionMetadata. The response field type is InstancePartition, if successful.

Authorization requires spanner.instancePartitions.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   UpdateInstancePartitionRequest request =
       UpdateInstancePartitionRequest.newBuilder()
           .setInstancePartition(InstancePartition.newBuilder().build())
           .setFieldMask(FieldMask.newBuilder().build())
           .build();
   InstancePartition response = instanceAdminClient.updateInstancePartitionAsync(request).get();
 }
 
Parameter
Name Description
request UpdateInstancePartitionRequest

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

Returns
Type Description
OperationFuture<InstancePartition,UpdateInstancePartitionMetadata>

updateInstancePartitionCallable()

public final UnaryCallable<UpdateInstancePartitionRequest,Operation> updateInstancePartitionCallable()

Updates an instance partition, and begins allocating or releasing resources as requested. The returned long-running operation can be used to track the progress of updating the instance partition. If the named instance partition does not exist, returns NOT_FOUND.

Immediately upon completion of this request:

* For resource types for which a decrease in the instance partition's allocation has been requested, billing is based on the newly-requested level.

Until completion of the returned operation:

* Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance partition are rejected. * Reading the instance partition via the API continues to give the pre-request resource levels.

Upon completion of the returned operation:

* Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance partition's tables. * The instance partition's new resource levels are readable via the API.

The returned long-running operation will have a name of the format <instance_partition_name>/operations/<operation_id> and can be used to track the instance partition modification. The metadata field type is UpdateInstancePartitionMetadata. The response field type is InstancePartition, if successful.

Authorization requires spanner.instancePartitions.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   UpdateInstancePartitionRequest request =
       UpdateInstancePartitionRequest.newBuilder()
           .setInstancePartition(InstancePartition.newBuilder().build())
           .setFieldMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       instanceAdminClient.updateInstancePartitionCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateInstancePartitionRequest,Operation>

updateInstancePartitionOperationCallable()

public final OperationCallable<UpdateInstancePartitionRequest,InstancePartition,UpdateInstancePartitionMetadata> updateInstancePartitionOperationCallable()

Updates an instance partition, and begins allocating or releasing resources as requested. The returned long-running operation can be used to track the progress of updating the instance partition. If the named instance partition does not exist, returns NOT_FOUND.

Immediately upon completion of this request:

* For resource types for which a decrease in the instance partition's allocation has been requested, billing is based on the newly-requested level.

Until completion of the returned operation:

* Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a CANCELLED status. * All other attempts to modify the instance partition are rejected. * Reading the instance partition via the API continues to give the pre-request resource levels.

Upon completion of the returned operation:

* Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance partition's tables. * The instance partition's new resource levels are readable via the API.

The returned long-running operation will have a name of the format <instance_partition_name>/operations/<operation_id> and can be used to track the instance partition modification. The metadata field type is UpdateInstancePartitionMetadata. The response field type is InstancePartition, if successful.

Authorization requires spanner.instancePartitions.update permission on the resource 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 (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
   UpdateInstancePartitionRequest request =
       UpdateInstancePartitionRequest.newBuilder()
           .setInstancePartition(InstancePartition.newBuilder().build())
           .setFieldMask(FieldMask.newBuilder().build())
           .build();
   OperationFuture<InstancePartition, UpdateInstancePartitionMetadata> future =
       instanceAdminClient.updateInstancePartitionOperationCallable().futureCall(request);
   // Do something.
   InstancePartition response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdateInstancePartitionRequest,InstancePartition,UpdateInstancePartitionMetadata>