Class InstanceAdminClient
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource,AutoCloseable
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().
| Method | Description | Method Variants |
|---|---|---|
ListInstanceConfigs |
Lists the supported instance configurations for a given project. Returns both Google-managed configurations and user-managed configurations. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateInstanceConfig |
Creates an instance configuration and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance configuration. The instance configuration name is assigned by the caller. If the named instance configuration already exists, `CreateInstanceConfig` returns `ALREADY_EXISTS`. Immediately after the request returns: * The instance configuration is readable via the API, with all requested attributes. The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] field is set to true. Its state is `CREATING`. While the operation is pending: * Cancelling the operation renders the instance configuration immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance configuration are rejected. Upon completion of the returned operation: * Instances can be created using the instance configuration. * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.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 configuration. The metadata field type is [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. The response field type is [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if successful. Authorization requires `spanner.instanceConfigs.create` permission on the resource [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateInstanceConfig |
Updates an instance configuration. The returned long-running operation can be used to track the progress of updating the instance. If the named instance configuration does not exist, returns `NOT_FOUND`. Only user-managed configurations can be updated. Immediately after the request returns: * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] field is set to true. While the operation is pending: * Cancelling the operation sets its metadata's [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.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 configuration are rejected. * Reading the instance configuration 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 new values of the instance configuration are readable via the API. * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.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 configuration modification. The metadata field type is [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. The response field type is [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if successful. Authorization requires `spanner.instanceConfigs.update` permission on the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteInstanceConfig |
Deletes the instance configuration. Deletion is only allowed when no instances are using the configuration. If any instances are using the configuration, returns `FAILED_PRECONDITION`. Only user-managed configurations can be deleted. Authorization requires `spanner.instanceConfigs.delete` permission on the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListInstanceConfigOperations |
Lists the user-managed instance configuration long-running operations in the given project. An instance configuration 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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][google.spanner.admin.instance.v1.CreateInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.Instance], if successful. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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][google.spanner.admin.instance.v1.UpdateInstanceMetadata.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][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.Instance], if successful. Authorization requires `spanner.instances.update` permission on the resource [name][google.spanner.admin.instance.v1.Instance.name]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetIamPolicy |
Sets the access control policy on an instance resource. Replaces any existing policy. Authorization requires `spanner.instances.setIamPolicy` on [resource][google.iam.v1.SetIamPolicyRequest.resource]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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][google.iam.v1.GetIamPolicyRequest.resource]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. The response field type is [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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][google.spanner.admin.instance.v1.InstancePartition.name]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.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][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. The response field type is [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. Authorization requires `spanner.instancePartitions.update` permission on the resource [name][google.spanner.admin.instance.v1.InstancePartition.name]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
MoveInstance |
Moves an instance to the target instance configuration. You can use the returned long-running operation to track the progress of moving the instance. `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of the following criteria: * Is undergoing a move to a different instance configuration * Has backups * Has an ongoing update * Contains any CMEK-enabled databases * Is a free trial instance While the operation is pending: * All other attempts to modify the instance, including changes to its compute capacity, are rejected. * The following database and backup admin operations are rejected: * `DatabaseAdmin.CreateDatabase` * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is specified in the request.) * `DatabaseAdmin.RestoreDatabase` * `DatabaseAdmin.CreateBackup` * `DatabaseAdmin.CopyBackup` * Both the source and target instance configurations are subject to hourly compute and storage charges. * The instance might experience higher read-write latencies and a higher transaction abort rate. However, moving an instance doesn't cause any downtime. The returned long-running operation has a name of the format `<instance_name>/operations/<operation_id>` and can be used to track the move instance operation. The metadata field type is [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.Instance], if successful. Cancelling the operation sets its metadata's [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]. Cancellation is not immediate because it involves moving any data previously moved to the target instance configuration back to the original instance configuration. You can use this operation to track the progress of the cancellation. Upon successful completion of the cancellation, the operation terminates with `CANCELLED` status. If not cancelled, upon completion of the returned operation: * The instance successfully moves to the target instance configuration. * You are billed for compute and storage in target instance configuration. Authorization requires the `spanner.instances.update` permission on the resource [instance][google.spanner.admin.instance.v1.Instance]. For more details, see [Move an instance](https://cloud.google.com/spanner/docs/move-instance). |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstanceAdminClient(InstanceAdminSettings settings) Constructs an instance of InstanceAdminClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final InstanceAdminClientcreate()Constructs an instance of InstanceAdminClient with default settings.static final InstanceAdminClientcreate(InstanceAdminSettings settings) Constructs an instance of InstanceAdminClient, using the given settings.static final InstanceAdminClientcreate(InstanceAdminStub stub) Constructs an instance of InstanceAdminClient, using the given stub for making calls.final com.google.api.gax.longrunning.OperationFuture<Instance,CreateInstanceMetadata> createInstanceAsync(CreateInstanceRequest request) Creates an instance and begins preparing it to begin serving.final com.google.api.gax.longrunning.OperationFuture<Instance,CreateInstanceMetadata> createInstanceAsync(ProjectName parent, String instanceId, Instance instance) Creates an instance and begins preparing it to begin serving.final com.google.api.gax.longrunning.OperationFuture<Instance,CreateInstanceMetadata> createInstanceAsync(String parent, String instanceId, Instance instance) Creates an instance and begins preparing it to begin serving.final com.google.api.gax.rpc.UnaryCallable<CreateInstanceRequest,com.google.longrunning.Operation> Creates an instance and begins preparing it to begin serving.final com.google.api.gax.longrunning.OperationFuture<InstanceConfig,CreateInstanceConfigMetadata> Creates an instance configuration and begins preparing it to be used.final com.google.api.gax.longrunning.OperationFuture<InstanceConfig,CreateInstanceConfigMetadata> createInstanceConfigAsync(ProjectName parent, InstanceConfig instanceConfig, String instanceConfigId) Creates an instance configuration and begins preparing it to be used.final com.google.api.gax.longrunning.OperationFuture<InstanceConfig,CreateInstanceConfigMetadata> createInstanceConfigAsync(String parent, InstanceConfig instanceConfig, String instanceConfigId) Creates an instance configuration and begins preparing it to be used.final com.google.api.gax.rpc.UnaryCallable<CreateInstanceConfigRequest,com.google.longrunning.Operation> Creates an instance configuration and begins preparing it to be used.final com.google.api.gax.rpc.OperationCallable<CreateInstanceConfigRequest,InstanceConfig, CreateInstanceConfigMetadata> Creates an instance configuration and begins preparing it to be used.final com.google.api.gax.rpc.OperationCallable<CreateInstanceRequest,Instance, CreateInstanceMetadata> Creates an instance and begins preparing it to begin serving.final com.google.api.gax.longrunning.OperationFuture<InstancePartition,CreateInstancePartitionMetadata> Creates an instance partition and begins preparing it to be used.final com.google.api.gax.longrunning.OperationFuture<InstancePartition,CreateInstancePartitionMetadata> createInstancePartitionAsync(InstanceName parent, InstancePartition instancePartition, String instancePartitionId) Creates an instance partition and begins preparing it to be used.final com.google.api.gax.longrunning.OperationFuture<InstancePartition,CreateInstancePartitionMetadata> createInstancePartitionAsync(String parent, InstancePartition instancePartition, String instancePartitionId) Creates an instance partition and begins preparing it to be used.final com.google.api.gax.rpc.UnaryCallable<CreateInstancePartitionRequest,com.google.longrunning.Operation> Creates an instance partition and begins preparing it to be used.final com.google.api.gax.rpc.OperationCallable<CreateInstancePartitionRequest,InstancePartition, CreateInstancePartitionMetadata> Creates an instance partition and begins preparing it to be used.final voiddeleteInstance(DeleteInstanceRequest request) Deletes an instance.final voiddeleteInstance(InstanceName name) Deletes an instance.final voiddeleteInstance(String name) Deletes an instance.final com.google.api.gax.rpc.UnaryCallable<DeleteInstanceRequest,com.google.protobuf.Empty> Deletes an instance.final voidDeletes the instance configuration.final voidDeletes the instance configuration.final voiddeleteInstanceConfig(String name) Deletes the instance configuration.final com.google.api.gax.rpc.UnaryCallable<DeleteInstanceConfigRequest,com.google.protobuf.Empty> Deletes the instance configuration.final voidDeletes an existing instance partition.final voidDeletes an existing instance partition.final voidDeletes an existing instance partition.final com.google.api.gax.rpc.UnaryCallable<DeleteInstancePartitionRequest,com.google.protobuf.Empty> Deletes an existing instance partition.final com.google.api.gax.httpjson.longrunning.OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final com.google.iam.v1.PolicygetIamPolicy(com.google.api.resourcenames.ResourceName resource) Gets the access control policy for an instance resource.final com.google.iam.v1.PolicygetIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) Gets the access control policy for an instance resource.final com.google.iam.v1.PolicygetIamPolicy(String resource) Gets the access control policy for an instance resource.final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> Gets the access control policy for an instance resource.final InstancegetInstance(GetInstanceRequest request) Gets information about a particular instance.final InstancegetInstance(InstanceName name) Gets information about a particular instance.final InstancegetInstance(String name) Gets information about a particular instance.final com.google.api.gax.rpc.UnaryCallable<GetInstanceRequest,Instance> Gets information about a particular instance.final InstanceConfigGets information about a particular instance configuration.final InstanceConfigGets information about a particular instance configuration.final InstanceConfiggetInstanceConfig(String name) Gets information about a particular instance configuration.final com.google.api.gax.rpc.UnaryCallable<GetInstanceConfigRequest,InstanceConfig> Gets information about a particular instance configuration.final InstancePartitionGets information about a particular instance partition.final InstancePartitionGets information about a particular instance partition.final InstancePartitiongetInstancePartition(String name) Gets information about a particular instance partition.final com.google.api.gax.rpc.UnaryCallable<GetInstancePartitionRequest,InstancePartition> Gets information about a particular instance partition.final com.google.longrunning.OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final InstanceAdminSettingsgetStub()booleanbooleanLists the user-managed instance configuration long-running operations in the given project.Lists the user-managed instance configuration long-running operations in the given project.listInstanceConfigOperations(String parent) Lists the user-managed instance configuration long-running operations in the given project.final com.google.api.gax.rpc.UnaryCallable<ListInstanceConfigOperationsRequest,ListInstanceConfigOperationsResponse> Lists the user-managed instance configuration long-running operations in the given project.final com.google.api.gax.rpc.UnaryCallable<ListInstanceConfigOperationsRequest,InstanceAdminClient.ListInstanceConfigOperationsPagedResponse> Lists the user-managed instance configuration long-running operations in the given project.Lists the supported instance configurations for a given project.listInstanceConfigs(ProjectName parent) Lists the supported instance configurations for a given project.listInstanceConfigs(String parent) Lists the supported instance configurations for a given project.final com.google.api.gax.rpc.UnaryCallable<ListInstanceConfigsRequest,ListInstanceConfigsResponse> Lists the supported instance configurations for a given project.final com.google.api.gax.rpc.UnaryCallable<ListInstanceConfigsRequest,InstanceAdminClient.ListInstanceConfigsPagedResponse> Lists the supported instance configurations for a given project.Lists instance partition long-running operations in the given instance.Lists instance partition long-running operations in the given instance.Lists instance partition long-running operations in the given instance.final com.google.api.gax.rpc.UnaryCallable<ListInstancePartitionOperationsRequest,ListInstancePartitionOperationsResponse> Lists instance partition long-running operations in the given instance.final com.google.api.gax.rpc.UnaryCallable<ListInstancePartitionOperationsRequest,InstanceAdminClient.ListInstancePartitionOperationsPagedResponse> Lists instance partition long-running operations in the given instance.listInstancePartitions(InstanceName parent) Lists all instance partitions for the given instance.Lists all instance partitions for the given instance.listInstancePartitions(String parent) Lists all instance partitions for the given instance.final com.google.api.gax.rpc.UnaryCallable<ListInstancePartitionsRequest,ListInstancePartitionsResponse> Lists all instance partitions for the given instance.final com.google.api.gax.rpc.UnaryCallable<ListInstancePartitionsRequest,InstanceAdminClient.ListInstancePartitionsPagedResponse> Lists all instance partitions for the given instance.listInstances(ListInstancesRequest request) Lists all instances in the given project.listInstances(ProjectName parent) Lists all instances in the given project.listInstances(String parent) Lists all instances in the given project.final com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,ListInstancesResponse> Lists all instances in the given project.final com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,InstanceAdminClient.ListInstancesPagedResponse> Lists all instances in the given project.final com.google.api.gax.longrunning.OperationFuture<MoveInstanceResponse,MoveInstanceMetadata> moveInstanceAsync(MoveInstanceRequest request) Moves an instance to the target instance configuration.final com.google.api.gax.rpc.UnaryCallable<MoveInstanceRequest,com.google.longrunning.Operation> Moves an instance to the target instance configuration.final com.google.api.gax.rpc.OperationCallable<MoveInstanceRequest,MoveInstanceResponse, MoveInstanceMetadata> Moves an instance to the target instance configuration.final com.google.iam.v1.PolicysetIamPolicy(com.google.api.resourcenames.ResourceName resource, com.google.iam.v1.Policy policy) Sets the access control policy on an instance resource.final com.google.iam.v1.PolicysetIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) Sets the access control policy on an instance resource.final com.google.iam.v1.PolicysetIamPolicy(String resource, com.google.iam.v1.Policy policy) Sets the access control policy on an instance resource.final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> Sets the access control policy on an instance resource.voidshutdown()voidfinal com.google.iam.v1.TestIamPermissionsResponsetestIamPermissions(com.google.api.resourcenames.ResourceName resource, List<String> permissions) Returns permissions that the caller has on the specified instance resource.final com.google.iam.v1.TestIamPermissionsResponsetestIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request) Returns permissions that the caller has on the specified instance resource.final com.google.iam.v1.TestIamPermissionsResponsetestIamPermissions(String resource, List<String> permissions) Returns permissions that the caller has on the specified instance resource.final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> Returns permissions that the caller has on the specified instance resource.final com.google.api.gax.longrunning.OperationFuture<Instance,UpdateInstanceMetadata> updateInstanceAsync(Instance instance, com.google.protobuf.FieldMask fieldMask) Updates an instance, and begins allocating or releasing resources as requested.final com.google.api.gax.longrunning.OperationFuture<Instance,UpdateInstanceMetadata> updateInstanceAsync(UpdateInstanceRequest request) Updates an instance, and begins allocating or releasing resources as requested.final com.google.api.gax.rpc.UnaryCallable<UpdateInstanceRequest,com.google.longrunning.Operation> Updates an instance, and begins allocating or releasing resources as requested.final com.google.api.gax.longrunning.OperationFuture<InstanceConfig,UpdateInstanceConfigMetadata> updateInstanceConfigAsync(InstanceConfig instanceConfig, com.google.protobuf.FieldMask updateMask) Updates an instance configuration.final com.google.api.gax.longrunning.OperationFuture<InstanceConfig,UpdateInstanceConfigMetadata> Updates an instance configuration.final com.google.api.gax.rpc.UnaryCallable<UpdateInstanceConfigRequest,com.google.longrunning.Operation> Updates an instance configuration.final com.google.api.gax.rpc.OperationCallable<UpdateInstanceConfigRequest,InstanceConfig, UpdateInstanceConfigMetadata> Updates an instance configuration.final com.google.api.gax.rpc.OperationCallable<UpdateInstanceRequest,Instance, UpdateInstanceMetadata> Updates an instance, and begins allocating or releasing resources as requested.final com.google.api.gax.longrunning.OperationFuture<InstancePartition,UpdateInstancePartitionMetadata> updateInstancePartitionAsync(InstancePartition instancePartition, com.google.protobuf.FieldMask fieldMask) Updates an instance partition, and begins allocating or releasing resources as requested.final com.google.api.gax.longrunning.OperationFuture<InstancePartition,UpdateInstancePartitionMetadata> Updates an instance partition, and begins allocating or releasing resources as requested.final com.google.api.gax.rpc.UnaryCallable<UpdateInstancePartitionRequest,com.google.longrunning.Operation> Updates an instance partition, and begins allocating or releasing resources as requested.final com.google.api.gax.rpc.OperationCallable<UpdateInstancePartitionRequest,InstancePartition, UpdateInstancePartitionMetadata> Updates an instance partition, and begins allocating or releasing resources as requested.
-
Constructor Details
-
InstanceAdminClient
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.- Throws:
IOException
-
InstanceAdminClient
-
-
Method Details
-
create
Constructs an instance of InstanceAdminClient with default settings.- Throws:
IOException
-
create
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.- Throws:
IOException
-
create
Constructs an instance of InstanceAdminClient, using the given stub for making calls. This is for advanced usage - prefer using create(InstanceAdminSettings). -
getSettings
-
getStub
-
getOperationsClient
public final com.google.longrunning.OperationsClient getOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
getHttpJsonOperationsClient
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
listInstanceConfigs
public final InstanceAdminClient.ListInstanceConfigsPagedResponse listInstanceConfigs(ProjectName parent) Lists the supported instance configurations for a given project.Returns both Google-managed configurations and user-managed configurations.
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); } }- Parameters:
parent- Required. The name of the project for which a list of supported instance configurations is requested. Values are of the form `projects/<project>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstanceConfigs
public final InstanceAdminClient.ListInstanceConfigsPagedResponse listInstanceConfigs(String parent) Lists the supported instance configurations for a given project.Returns both Google-managed configurations and user-managed configurations.
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); } }- Parameters:
parent- Required. The name of the project for which a list of supported instance configurations is requested. Values are of the form `projects/<project>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstanceConfigs
public final InstanceAdminClient.ListInstanceConfigsPagedResponse listInstanceConfigs(ListInstanceConfigsRequest request) Lists the supported instance configurations for a given project.Returns both Google-managed configurations and user-managed configurations.
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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstanceConfigsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListInstanceConfigsRequest,InstanceAdminClient.ListInstanceConfigsPagedResponse> listInstanceConfigsPagedCallable()Lists the supported instance configurations for a given project.Returns both Google-managed configurations and user-managed configurations.
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); } } -
listInstanceConfigsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListInstanceConfigsRequest,ListInstanceConfigsResponse> listInstanceConfigsCallable()Lists the supported instance configurations for a given project.Returns both Google-managed configurations and user-managed configurations.
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; } } } -
getInstanceConfig
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); }- Parameters:
name- Required. The name of the requested instance configuration. Values are of the form `projects/<project>/instanceConfigs/<config>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getInstanceConfig
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); }- Parameters:
name- Required. The name of the requested instance configuration. Values are of the form `projects/<project>/instanceConfigs/<config>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getInstanceConfig
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getInstanceConfigCallable
public final com.google.api.gax.rpc.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(); } -
createInstanceConfigAsync
public final com.google.api.gax.longrunning.OperationFuture<InstanceConfig,CreateInstanceConfigMetadata> createInstanceConfigAsync(ProjectName parent, InstanceConfig instanceConfig, String instanceConfigId) Creates an instance configuration and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance configuration. The instance configuration name is assigned by the caller. If the named instance configuration already exists, `CreateInstanceConfig` returns `ALREADY_EXISTS`.Immediately after the request returns:
* The instance configuration is readable via the API, with all requested attributes. The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] field is set to true. Its state is `CREATING`.
While the operation is pending:
* Cancelling the operation renders the instance configuration immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance configuration are rejected.
Upon completion of the returned operation:
* Instances can be created using the instance configuration. * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.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 configuration. The metadata field type is [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. The response field type is [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if successful.
Authorization requires `spanner.instanceConfigs.create` permission on the resource [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.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:
parent- Required. The name of the project in which to create the instance configuration. Values are of the form `projects/<project>`.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- Required. The ID of the instance configuration 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.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createInstanceConfigAsync
public final com.google.api.gax.longrunning.OperationFuture<InstanceConfig,CreateInstanceConfigMetadata> createInstanceConfigAsync(String parent, InstanceConfig instanceConfig, String instanceConfigId) Creates an instance configuration and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance configuration. The instance configuration name is assigned by the caller. If the named instance configuration already exists, `CreateInstanceConfig` returns `ALREADY_EXISTS`.Immediately after the request returns:
* The instance configuration is readable via the API, with all requested attributes. The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] field is set to true. Its state is `CREATING`.
While the operation is pending:
* Cancelling the operation renders the instance configuration immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance configuration are rejected.
Upon completion of the returned operation:
* Instances can be created using the instance configuration. * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.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 configuration. The metadata field type is [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. The response field type is [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if successful.
Authorization requires `spanner.instanceConfigs.create` permission on the resource [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.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:
parent- Required. The name of the project in which to create the instance configuration. Values are of the form `projects/<project>`.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- Required. The ID of the instance configuration 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.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createInstanceConfigAsync
public final com.google.api.gax.longrunning.OperationFuture<InstanceConfig,CreateInstanceConfigMetadata> createInstanceConfigAsync(CreateInstanceConfigRequest request) Creates an instance configuration and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance configuration. The instance configuration name is assigned by the caller. If the named instance configuration already exists, `CreateInstanceConfig` returns `ALREADY_EXISTS`.Immediately after the request returns:
* The instance configuration is readable via the API, with all requested attributes. The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] field is set to true. Its state is `CREATING`.
While the operation is pending:
* Cancelling the operation renders the instance configuration immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance configuration are rejected.
Upon completion of the returned operation:
* Instances can be created using the instance configuration. * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.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 configuration. The metadata field type is [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. The response field type is [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if successful.
Authorization requires `spanner.instanceConfigs.create` permission on the resource [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.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(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createInstanceConfigOperationCallable
public final com.google.api.gax.rpc.OperationCallable<CreateInstanceConfigRequest,InstanceConfig, createInstanceConfigOperationCallable()CreateInstanceConfigMetadata> Creates an instance configuration and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance configuration. The instance configuration name is assigned by the caller. If the named instance configuration already exists, `CreateInstanceConfig` returns `ALREADY_EXISTS`.Immediately after the request returns:
* The instance configuration is readable via the API, with all requested attributes. The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] field is set to true. Its state is `CREATING`.
While the operation is pending:
* Cancelling the operation renders the instance configuration immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance configuration are rejected.
Upon completion of the returned operation:
* Instances can be created using the instance configuration. * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.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 configuration. The metadata field type is [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. The response field type is [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if successful.
Authorization requires `spanner.instanceConfigs.create` permission on the resource [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.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(); } -
createInstanceConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateInstanceConfigRequest,com.google.longrunning.Operation> createInstanceConfigCallable()Creates an instance configuration and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance configuration. The instance configuration name is assigned by the caller. If the named instance configuration already exists, `CreateInstanceConfig` returns `ALREADY_EXISTS`.Immediately after the request returns:
* The instance configuration is readable via the API, with all requested attributes. The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] field is set to true. Its state is `CREATING`.
While the operation is pending:
* Cancelling the operation renders the instance configuration immediately unreadable via the API. * Except for deleting the creating resource, all other attempts to modify the instance configuration are rejected.
Upon completion of the returned operation:
* Instances can be created using the instance configuration. * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.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 configuration. The metadata field type is [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. The response field type is [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if successful.
Authorization requires `spanner.instanceConfigs.create` permission on the resource [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.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(); } -
updateInstanceConfigAsync
public final com.google.api.gax.longrunning.OperationFuture<InstanceConfig,UpdateInstanceConfigMetadata> updateInstanceConfigAsync(InstanceConfig instanceConfig, com.google.protobuf.FieldMask updateMask) Updates an instance configuration. The returned long-running operation can be used to track the progress of updating the instance. If the named instance configuration does not exist, returns `NOT_FOUND`.Only user-managed configurations can be updated.
Immediately after the request returns:
* The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] field is set to true.
While the operation is pending:
* Cancelling the operation sets its metadata's [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.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 configuration are rejected. * Reading the instance configuration 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 new values of the instance configuration are readable via the API. * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.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 configuration modification. The metadata field type is [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. The response field type is [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if successful.
Authorization requires `spanner.instanceConfigs.update` permission on the resource [name][google.spanner.admin.instance.v1.InstanceConfig.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:
instanceConfig- Required. The user instance configuration to update, which must always include the instance configuration name. Otherwise, only fields mentioned in [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] need be included. To prevent conflicts of concurrent updates, [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can be used.updateMask- Required. A mask specifying which fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be updated. The field mask must always be specified; this prevents any future fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] from being erased accidentally by clients that do not know about them. Only display_name and labels can be updated.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateInstanceConfigAsync
public final com.google.api.gax.longrunning.OperationFuture<InstanceConfig,UpdateInstanceConfigMetadata> updateInstanceConfigAsync(UpdateInstanceConfigRequest request) Updates an instance configuration. The returned long-running operation can be used to track the progress of updating the instance. If the named instance configuration does not exist, returns `NOT_FOUND`.Only user-managed configurations can be updated.
Immediately after the request returns:
* The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] field is set to true.
While the operation is pending:
* Cancelling the operation sets its metadata's [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.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 configuration are rejected. * Reading the instance configuration 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 new values of the instance configuration are readable via the API. * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.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 configuration modification. The metadata field type is [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. The response field type is [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if successful.
Authorization requires `spanner.instanceConfigs.update` permission on the resource [name][google.spanner.admin.instance.v1.InstanceConfig.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(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateInstanceConfigOperationCallable
public final com.google.api.gax.rpc.OperationCallable<UpdateInstanceConfigRequest,InstanceConfig, updateInstanceConfigOperationCallable()UpdateInstanceConfigMetadata> Updates an instance configuration. The returned long-running operation can be used to track the progress of updating the instance. If the named instance configuration does not exist, returns `NOT_FOUND`.Only user-managed configurations can be updated.
Immediately after the request returns:
* The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] field is set to true.
While the operation is pending:
* Cancelling the operation sets its metadata's [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.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 configuration are rejected. * Reading the instance configuration 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 new values of the instance configuration are readable via the API. * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.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 configuration modification. The metadata field type is [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. The response field type is [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if successful.
Authorization requires `spanner.instanceConfigs.update` permission on the resource [name][google.spanner.admin.instance.v1.InstanceConfig.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(); } -
updateInstanceConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateInstanceConfigRequest,com.google.longrunning.Operation> updateInstanceConfigCallable()Updates an instance configuration. The returned long-running operation can be used to track the progress of updating the instance. If the named instance configuration does not exist, returns `NOT_FOUND`.Only user-managed configurations can be updated.
Immediately after the request returns:
* The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] field is set to true.
While the operation is pending:
* Cancelling the operation sets its metadata's [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.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 configuration are rejected. * Reading the instance configuration 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 new values of the instance configuration are readable via the API. * The instance configuration's [reconciling][google.spanner.admin.instance.v1.InstanceConfig.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 configuration modification. The metadata field type is [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. The response field type is [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if successful.
Authorization requires `spanner.instanceConfigs.update` permission on the resource [name][google.spanner.admin.instance.v1.InstanceConfig.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(); } -
deleteInstanceConfig
Deletes the instance configuration. Deletion is only allowed when no instances are using the configuration. If any instances are using the configuration, returns `FAILED_PRECONDITION`.Only user-managed configurations can be deleted.
Authorization requires `spanner.instanceConfigs.delete` permission on the resource [name][google.spanner.admin.instance.v1.InstanceConfig.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); }- Parameters:
name- Required. The name of the instance configuration to be deleted. Values are of the form `projects/<project>/instanceConfigs/<instance_config>`- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteInstanceConfig
Deletes the instance configuration. Deletion is only allowed when no instances are using the configuration. If any instances are using the configuration, returns `FAILED_PRECONDITION`.Only user-managed configurations can be deleted.
Authorization requires `spanner.instanceConfigs.delete` permission on the resource [name][google.spanner.admin.instance.v1.InstanceConfig.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); }- Parameters:
name- Required. The name of the instance configuration to be deleted. Values are of the form `projects/<project>/instanceConfigs/<instance_config>`- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteInstanceConfig
Deletes the instance configuration. Deletion is only allowed when no instances are using the configuration. If any instances are using the configuration, returns `FAILED_PRECONDITION`.Only user-managed configurations can be deleted.
Authorization requires `spanner.instanceConfigs.delete` permission on the resource [name][google.spanner.admin.instance.v1.InstanceConfig.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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteInstanceConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteInstanceConfigRequest,com.google.protobuf.Empty> deleteInstanceConfigCallable()Deletes the instance configuration. Deletion is only allowed when no instances are using the configuration. If any instances are using the configuration, returns `FAILED_PRECONDITION`.Only user-managed configurations can be deleted.
Authorization requires `spanner.instanceConfigs.delete` permission on the resource [name][google.spanner.admin.instance.v1.InstanceConfig.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(); } -
listInstanceConfigOperations
public final InstanceAdminClient.ListInstanceConfigOperationsPagedResponse listInstanceConfigOperations(ProjectName parent) Lists the user-managed instance configuration long-running operations in the given project. An instance configuration 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); } }- Parameters:
parent- Required. The project of the instance configuration operations. Values are of the form `projects/<project>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstanceConfigOperations
public final InstanceAdminClient.ListInstanceConfigOperationsPagedResponse listInstanceConfigOperations(String parent) Lists the user-managed instance configuration long-running operations in the given project. An instance configuration 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); } }- Parameters:
parent- Required. The project of the instance configuration operations. Values are of the form `projects/<project>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstanceConfigOperations
public final InstanceAdminClient.ListInstanceConfigOperationsPagedResponse listInstanceConfigOperations(ListInstanceConfigOperationsRequest request) Lists the user-managed instance configuration long-running operations in the given project. An instance configuration 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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstanceConfigOperationsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListInstanceConfigOperationsRequest,InstanceAdminClient.ListInstanceConfigOperationsPagedResponse> listInstanceConfigOperationsPagedCallable()Lists the user-managed instance configuration long-running operations in the given project. An instance configuration 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); } } -
listInstanceConfigOperationsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListInstanceConfigOperationsRequest,ListInstanceConfigOperationsResponse> listInstanceConfigOperationsCallable()Lists the user-managed instance configuration long-running operations in the given project. An instance configuration 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; } } } -
listInstances
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); } }- Parameters:
parent- Required. The name of the project for which a list of instances is requested. Values are of the form `projects/<project>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstances
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); } }- Parameters:
parent- Required. The name of the project for which a list of instances is requested. Values are of the form `projects/<project>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstances
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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstancesPagedCallable
public final com.google.api.gax.rpc.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); } } -
listInstancesCallable
public final com.google.api.gax.rpc.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; } } } -
listInstancePartitions
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); } }- Parameters:
parent- Required. The instance whose instance partitions should be listed. Values are of the form `projects/<project>/instances/<instance>`. Use `{instance} = '-'` to list instance partitions for all Instances in a project, e.g., `projects/myproject/instances/-`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstancePartitions
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); } }- Parameters:
parent- Required. The instance whose instance partitions should be listed. Values are of the form `projects/<project>/instances/<instance>`. Use `{instance} = '-'` to list instance partitions for all Instances in a project, e.g., `projects/myproject/instances/-`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstancePartitions
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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstancePartitionsPagedCallable
public final com.google.api.gax.rpc.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); } } -
listInstancePartitionsCallable
public final com.google.api.gax.rpc.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; } } } -
getInstance
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); }- Parameters:
name- Required. The name of the requested instance. Values are of the form `projects/<project>/instances/<instance>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getInstance
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); }- Parameters:
name- Required. The name of the requested instance. Values are of the form `projects/<project>/instances/<instance>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getInstance
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getInstanceCallable
public final com.google.api.gax.rpc.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(); } -
createInstanceAsync
public final com.google.api.gax.longrunning.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][google.spanner.admin.instance.v1.CreateInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.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:
parent- Required. The name of the project in which to create the instance. Values are of the form `projects/<project>`.instanceId- Required. The ID of the instance to create. Valid identifiers are of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in length.instance- Required. The instance to create. The name may be omitted, but if specified must be `<parent>/instances/<instance_id>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createInstanceAsync
public final com.google.api.gax.longrunning.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][google.spanner.admin.instance.v1.CreateInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.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:
parent- Required. The name of the project in which to create the instance. Values are of the form `projects/<project>`.instanceId- Required. The ID of the instance to create. Valid identifiers are of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in length.instance- Required. The instance to create. The name may be omitted, but if specified must be `<parent>/instances/<instance_id>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createInstanceAsync
public final com.google.api.gax.longrunning.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][google.spanner.admin.instance.v1.CreateInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.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(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createInstanceOperationCallable
public final com.google.api.gax.rpc.OperationCallable<CreateInstanceRequest,Instance, createInstanceOperationCallable()CreateInstanceMetadata> 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][google.spanner.admin.instance.v1.CreateInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.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(); } -
createInstanceCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateInstanceRequest,com.google.longrunning.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][google.spanner.admin.instance.v1.CreateInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.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(); } -
updateInstanceAsync
public final com.google.api.gax.longrunning.OperationFuture<Instance,UpdateInstanceMetadata> updateInstanceAsync(Instance instance, com.google.protobuf.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][google.spanner.admin.instance.v1.UpdateInstanceMetadata.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][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.Instance], if successful.
Authorization requires `spanner.instances.update` permission on the resource [name][google.spanner.admin.instance.v1.Instance.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:
instance- Required. The instance to update, which must always include the instance name. Otherwise, only fields mentioned in [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] need be included.fieldMask- Required. A mask specifying which fields in [Instance][google.spanner.admin.instance.v1.Instance] should be updated. The field mask must always be specified; this prevents any future fields in [Instance][google.spanner.admin.instance.v1.Instance] from being erased accidentally by clients that do not know about them.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateInstanceAsync
public final com.google.api.gax.longrunning.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][google.spanner.admin.instance.v1.UpdateInstanceMetadata.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][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.Instance], if successful.
Authorization requires `spanner.instances.update` permission on the resource [name][google.spanner.admin.instance.v1.Instance.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(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateInstanceOperationCallable
public final com.google.api.gax.rpc.OperationCallable<UpdateInstanceRequest,Instance, updateInstanceOperationCallable()UpdateInstanceMetadata> 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][google.spanner.admin.instance.v1.UpdateInstanceMetadata.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][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.Instance], if successful.
Authorization requires `spanner.instances.update` permission on the resource [name][google.spanner.admin.instance.v1.Instance.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(); } -
updateInstanceCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateInstanceRequest,com.google.longrunning.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][google.spanner.admin.instance.v1.UpdateInstanceMetadata.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][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.Instance], if successful.
Authorization requires `spanner.instances.update` permission on the resource [name][google.spanner.admin.instance.v1.Instance.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(); } -
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.
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); }- Parameters:
name- Required. The name of the instance to be deleted. Values are of the form `projects/<project>/instances/<instance>`- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
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.
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); }- Parameters:
name- Required. The name of the instance to be deleted. Values are of the form `projects/<project>/instances/<instance>`- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
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.
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteInstanceCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteInstanceRequest,com.google.protobuf.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(); } -
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(com.google.api.resourcenames.ResourceName resource, com.google.iam.v1.Policy policy) Sets the access control policy on an instance resource. Replaces any existing policy.Authorization requires `spanner.instances.setIamPolicy` on [resource][google.iam.v1.SetIamPolicyRequest.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:
resource- REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.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.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(String resource, com.google.iam.v1.Policy policy) Sets the access control policy on an instance resource. Replaces any existing policy.Authorization requires `spanner.instances.setIamPolicy` on [resource][google.iam.v1.SetIamPolicyRequest.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:
resource- REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.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.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) Sets the access control policy on an instance resource. Replaces any existing policy.Authorization requires `spanner.instances.setIamPolicy` on [resource][google.iam.v1.SetIamPolicyRequest.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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
setIamPolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()Sets the access control policy on an instance resource. Replaces any existing policy.Authorization requires `spanner.instances.setIamPolicy` on [resource][google.iam.v1.SetIamPolicyRequest.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(); } -
getIamPolicy
public final com.google.iam.v1.Policy getIamPolicy(com.google.api.resourcenames.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][google.iam.v1.GetIamPolicyRequest.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); }- Parameters:
resource- REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
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][google.iam.v1.GetIamPolicyRequest.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); }- Parameters:
resource- REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getIamPolicy
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.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][google.iam.v1.GetIamPolicyRequest.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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getIamPolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.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][google.iam.v1.GetIamPolicyRequest.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(); } -
testIamPermissions
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.api.resourcenames.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:
resource- REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.permissions- 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](https://cloud.google.com/iam/docs/overview#permissions).- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
testIamPermissions
public final com.google.iam.v1.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:
resource- REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.permissions- 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](https://cloud.google.com/iam/docs/overview#permissions).- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
testIamPermissions
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
testIamPermissionsCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.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(); } -
getInstancePartition
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); }- Parameters:
name- Required. The name of the requested instance partition. Values are of the form `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getInstancePartition
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); }- Parameters:
name- Required. The name of the requested instance partition. Values are of the form `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getInstancePartition
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getInstancePartitionCallable
public final com.google.api.gax.rpc.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(); } -
createInstancePartitionAsync
public final com.google.api.gax.longrunning.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][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. The response field type is [InstancePartition][google.spanner.admin.instance.v1.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:
parent- Required. The name of the instance in which to create the instance partition. Values are of the form `projects/<project>/instances/<instance>`.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- Required. The ID of the instance partition to create. Valid identifiers are of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in length.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createInstancePartitionAsync
public final com.google.api.gax.longrunning.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][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. The response field type is [InstancePartition][google.spanner.admin.instance.v1.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:
parent- Required. The name of the instance in which to create the instance partition. Values are of the form `projects/<project>/instances/<instance>`.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- Required. The ID of the instance partition to create. Valid identifiers are of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in length.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createInstancePartitionAsync
public final com.google.api.gax.longrunning.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][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. The response field type is [InstancePartition][google.spanner.admin.instance.v1.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(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createInstancePartitionOperationCallable
public final com.google.api.gax.rpc.OperationCallable<CreateInstancePartitionRequest,InstancePartition, createInstancePartitionOperationCallable()CreateInstancePartitionMetadata> 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][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. The response field type is [InstancePartition][google.spanner.admin.instance.v1.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(); } -
createInstancePartitionCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateInstancePartitionRequest,com.google.longrunning.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][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. The response field type is [InstancePartition][google.spanner.admin.instance.v1.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(); } -
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][google.spanner.admin.instance.v1.InstancePartition.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); }- Parameters:
name- Required. The name of the instance partition to be deleted. Values are of the form `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
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][google.spanner.admin.instance.v1.InstancePartition.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); }- Parameters:
name- Required. The name of the instance partition to be deleted. Values are of the form `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
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][google.spanner.admin.instance.v1.InstancePartition.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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteInstancePartitionCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteInstancePartitionRequest,com.google.protobuf.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][google.spanner.admin.instance.v1.InstancePartition.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(); } -
updateInstancePartitionAsync
public final com.google.api.gax.longrunning.OperationFuture<InstancePartition,UpdateInstancePartitionMetadata> updateInstancePartitionAsync(InstancePartition instancePartition, com.google.protobuf.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][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.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][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. The response field type is [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful.
Authorization requires `spanner.instancePartitions.update` permission on the resource [name][google.spanner.admin.instance.v1.InstancePartition.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:
instancePartition- Required. The instance partition to update, which must always include the instance partition name. Otherwise, only fields mentioned in [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] need be included.fieldMask- Required. A mask specifying which fields in [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] should be updated. The field mask must always be specified; this prevents any future fields in [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] from being erased accidentally by clients that do not know about them.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateInstancePartitionAsync
public final com.google.api.gax.longrunning.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][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.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][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. The response field type is [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful.
Authorization requires `spanner.instancePartitions.update` permission on the resource [name][google.spanner.admin.instance.v1.InstancePartition.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(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateInstancePartitionOperationCallable
public final com.google.api.gax.rpc.OperationCallable<UpdateInstancePartitionRequest,InstancePartition, updateInstancePartitionOperationCallable()UpdateInstancePartitionMetadata> 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][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.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][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. The response field type is [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful.
Authorization requires `spanner.instancePartitions.update` permission on the resource [name][google.spanner.admin.instance.v1.InstancePartition.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(); } -
updateInstancePartitionCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateInstancePartitionRequest,com.google.longrunning.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][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.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][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. The response field type is [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful.
Authorization requires `spanner.instancePartitions.update` permission on the resource [name][google.spanner.admin.instance.v1.InstancePartition.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(); } -
listInstancePartitionOperations
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][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.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); } }- Parameters:
parent- Required. The parent instance of the instance partition operations. Values are of the form `projects/<project>/instances/<instance>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstancePartitionOperations
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][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.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); } }- Parameters:
parent- Required. The parent instance of the instance partition operations. Values are of the form `projects/<project>/instances/<instance>`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstancePartitionOperations
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][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listInstancePartitionOperationsPagedCallable
public final com.google.api.gax.rpc.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][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.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); } } -
listInstancePartitionOperationsCallable
public final com.google.api.gax.rpc.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][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.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; } } } -
moveInstanceAsync
public final com.google.api.gax.longrunning.OperationFuture<MoveInstanceResponse,MoveInstanceMetadata> moveInstanceAsync(MoveInstanceRequest request) Moves an instance to the target instance configuration. You can use the returned long-running operation to track the progress of moving the instance.`MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of the following criteria:
* Is undergoing a move to a different instance configuration * Has backups * Has an ongoing update * Contains any CMEK-enabled databases * Is a free trial instance
While the operation is pending:
* All other attempts to modify the instance, including changes to its compute capacity, are rejected. * The following database and backup admin operations are rejected:
* `DatabaseAdmin.CreateDatabase` * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is specified in the request.) * `DatabaseAdmin.RestoreDatabase` * `DatabaseAdmin.CreateBackup` * `DatabaseAdmin.CopyBackup`
* Both the source and target instance configurations are subject to hourly compute and storage charges. * The instance might experience higher read-write latencies and a higher transaction abort rate. However, moving an instance doesn't cause any downtime.
The returned long-running operation has a name of the format `<instance_name>/operations/<operation_id>` and can be used to track the move instance operation. The metadata field type is [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.Instance], if successful. Cancelling the operation sets its metadata's [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]. Cancellation is not immediate because it involves moving any data previously moved to the target instance configuration back to the original instance configuration. You can use this operation to track the progress of the cancellation. Upon successful completion of the cancellation, the operation terminates with `CANCELLED` status.
If not cancelled, upon completion of the returned operation:
* The instance successfully moves to the target instance configuration. * You are billed for compute and storage in target instance configuration.
Authorization requires the `spanner.instances.update` permission on the resource [instance][google.spanner.admin.instance.v1.Instance].
For more details, see [Move an instance](https://cloud.google.com/spanner/docs/move-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()) { MoveInstanceRequest request = MoveInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) .setTargetConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) .build(); MoveInstanceResponse response = instanceAdminClient.moveInstanceAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
moveInstanceOperationCallable
public final com.google.api.gax.rpc.OperationCallable<MoveInstanceRequest,MoveInstanceResponse, moveInstanceOperationCallable()MoveInstanceMetadata> Moves an instance to the target instance configuration. You can use the returned long-running operation to track the progress of moving the instance.`MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of the following criteria:
* Is undergoing a move to a different instance configuration * Has backups * Has an ongoing update * Contains any CMEK-enabled databases * Is a free trial instance
While the operation is pending:
* All other attempts to modify the instance, including changes to its compute capacity, are rejected. * The following database and backup admin operations are rejected:
* `DatabaseAdmin.CreateDatabase` * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is specified in the request.) * `DatabaseAdmin.RestoreDatabase` * `DatabaseAdmin.CreateBackup` * `DatabaseAdmin.CopyBackup`
* Both the source and target instance configurations are subject to hourly compute and storage charges. * The instance might experience higher read-write latencies and a higher transaction abort rate. However, moving an instance doesn't cause any downtime.
The returned long-running operation has a name of the format `<instance_name>/operations/<operation_id>` and can be used to track the move instance operation. The metadata field type is [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.Instance], if successful. Cancelling the operation sets its metadata's [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]. Cancellation is not immediate because it involves moving any data previously moved to the target instance configuration back to the original instance configuration. You can use this operation to track the progress of the cancellation. Upon successful completion of the cancellation, the operation terminates with `CANCELLED` status.
If not cancelled, upon completion of the returned operation:
* The instance successfully moves to the target instance configuration. * You are billed for compute and storage in target instance configuration.
Authorization requires the `spanner.instances.update` permission on the resource [instance][google.spanner.admin.instance.v1.Instance].
For more details, see [Move an instance](https://cloud.google.com/spanner/docs/move-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()) { MoveInstanceRequest request = MoveInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) .setTargetConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) .build(); OperationFuture<MoveInstanceResponse, MoveInstanceMetadata> future = instanceAdminClient.moveInstanceOperationCallable().futureCall(request); // Do something. MoveInstanceResponse response = future.get(); } -
moveInstanceCallable
public final com.google.api.gax.rpc.UnaryCallable<MoveInstanceRequest,com.google.longrunning.Operation> moveInstanceCallable()Moves an instance to the target instance configuration. You can use the returned long-running operation to track the progress of moving the instance.`MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of the following criteria:
* Is undergoing a move to a different instance configuration * Has backups * Has an ongoing update * Contains any CMEK-enabled databases * Is a free trial instance
While the operation is pending:
* All other attempts to modify the instance, including changes to its compute capacity, are rejected. * The following database and backup admin operations are rejected:
* `DatabaseAdmin.CreateDatabase` * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is specified in the request.) * `DatabaseAdmin.RestoreDatabase` * `DatabaseAdmin.CreateBackup` * `DatabaseAdmin.CopyBackup`
* Both the source and target instance configurations are subject to hourly compute and storage charges. * The instance might experience higher read-write latencies and a higher transaction abort rate. However, moving an instance doesn't cause any downtime.
The returned long-running operation has a name of the format `<instance_name>/operations/<operation_id>` and can be used to track the move instance operation. The metadata field type is [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. The response field type is [Instance][google.spanner.admin.instance.v1.Instance], if successful. Cancelling the operation sets its metadata's [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]. Cancellation is not immediate because it involves moving any data previously moved to the target instance configuration back to the original instance configuration. You can use this operation to track the progress of the cancellation. Upon successful completion of the cancellation, the operation terminates with `CANCELLED` status.
If not cancelled, upon completion of the returned operation:
* The instance successfully moves to the target instance configuration. * You are billed for compute and storage in target instance configuration.
Authorization requires the `spanner.instances.update` permission on the resource [instance][google.spanner.admin.instance.v1.Instance].
For more details, see [Move an instance](https://cloud.google.com/spanner/docs/move-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()) { MoveInstanceRequest request = MoveInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) .setTargetConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) .build(); ApiFuture<Operation> future = instanceAdminClient.moveInstanceCallable().futureCall(request); // Do something. Operation response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
InterruptedException
-