Google Cloud Spanner C++ Client
1.32.0
A C++ Client Library for Google Cloud Spanner
|
Performs instance administration operations on Cloud Spanner. More...
#include <google/cloud/spanner/instance_admin_client.h>
Public Member Functions | |
InstanceAdminClient (std::shared_ptr< InstanceAdminConnection > conn) | |
InstanceAdminClient ()=delete | |
No default construction. More... | |
InstanceAdminClient (InstanceAdminClient const &)=default | |
InstanceAdminClient & | operator= (InstanceAdminClient const &)=default |
InstanceAdminClient (InstanceAdminClient &&)=default | |
InstanceAdminClient & | operator= (InstanceAdminClient &&)=default |
StatusOr< google::spanner::admin::instance::v1::Instance > | GetInstance (Instance const &in) |
Retrieve metadata information about a Cloud Spanner Instance. More... | |
future< StatusOr< google::spanner::admin::instance::v1::Instance > > | CreateInstance (google::spanner::admin::instance::v1::CreateInstanceRequest const &) |
Creates a new Cloud Spanner instance in the given project. More... | |
future< StatusOr< google::spanner::admin::instance::v1::Instance > > | UpdateInstance (google::spanner::admin::instance::v1::UpdateInstanceRequest const &) |
Updates a Cloud Spanner instance. More... | |
Status | DeleteInstance (Instance const &in) |
Deletes an existing Cloud Spanner instance. More... | |
StatusOr< google::spanner::admin::instance::v1::InstanceConfig > | GetInstanceConfig (std::string const &name) |
Retrieve information about a Cloud Spanner Instance Config. More... | |
ListInstanceConfigsRange | ListInstanceConfigs (std::string project_id) |
Retrieve a list of instance configs for a given project. More... | |
ListInstancesRange | ListInstances (std::string project_id, std::string filter) |
Retrieve a list of instances for a given project. More... | |
StatusOr< google::iam::v1::Policy > | GetIamPolicy (Instance const &in) |
Get the IAM policy in effect for the given instance. More... | |
StatusOr< google::iam::v1::Policy > | SetIamPolicy (Instance const &in, google::iam::v1::Policy policy) |
Set the IAM policy for the given instance. More... | |
StatusOr< google::iam::v1::Policy > | SetIamPolicy (Instance const &in, IamUpdater const &updater) |
Updates the IAM policy for an instance using an optimistic concurrency control loop. More... | |
StatusOr< google::iam::v1::Policy > | SetIamPolicy (Instance const &in, IamUpdater const &updater, std::unique_ptr< TransactionRerunPolicy > rerun_policy, std::unique_ptr< BackoffPolicy > backoff_policy) |
Updates the IAM policy for an instance using an optimistic concurrency control loop. More... | |
StatusOr< google::iam::v1::TestIamPermissionsResponse > | TestIamPermissions (Instance const &in, std::vector< std::string > permissions) |
Get the subset of the permissions the caller has on the given instance. More... | |
Friends | |
bool | operator== (InstanceAdminClient const &a, InstanceAdminClient const &b) |
bool | operator!= (InstanceAdminClient const &a, InstanceAdminClient const &b) |
Performs instance administration operations on Cloud Spanner.
Applications use this class to perform operations on Spanner Databases.
InstanceAdminClient
objects are cheap to create, copy, and move. However, each InstanceAdminClient
object must be created with a std::shared_ptr<InstanceAdminConnection>
, which itself is relatively expensive to create. Therefore, connection instances should be shared when possible. See the MakeInstanceAdminConnection()
method and the InstanceAdminConnection
interface for more details.
Instances of this class created via copy-construction or copy-assignment share the underlying pool of connections. Access to these copies via multiple threads is guaranteed to work. Two threads operating on the same instance of this class is not guaranteed to work.
This class uses StatusOr<T>
to report errors. When an operation fails to perform its work the returned StatusOr<T>
contains the error details. If the ok()
member function in the StatusOr<T>
returns true
then it contains the expected result. Please consult the StatusOr<T>
documentation for more details.
Definition at line 64 of file instance_admin_client.h.
|
inlineexplicit |
Definition at line 67 of file instance_admin_client.h.
|
delete |
No default construction.
Use InstanceAdminClient(std::shared_ptr<InstanceAdminConnection>)
|
default |
|
default |
future< StatusOr< google::spanner::admin::instance::v1::Instance > > google::cloud::spanner::v1::InstanceAdminClient::CreateInstance | ( | google::spanner::admin::instance::v1::CreateInstanceRequest const & | request | ) |
Creates a new Cloud Spanner instance in the given project.
Use CreateInstanceRequestBuilder to build the google::spanner::admin::instance::v1::CreateInstanceRequest
object.
Note that the instance id must be between 2 and 64 characters long, it must start with a lowercase letter ([a-z]
), it must end with a lowercase letter or a number ([a-z0-9]
) and any characters between the beginning and ending characters must be lower case letters, numbers, or dashes (-
), that is, they must belong to the [-a-z0-9]
character set.
Definition at line 30 of file instance_admin_client.cc.
Status google::cloud::spanner::v1::InstanceAdminClient::DeleteInstance | ( | Instance const & | in | ) |
Deletes an existing Cloud Spanner instance.
Definition at line 43 of file instance_admin_client.cc.
StatusOr< google::iam::v1::Policy > google::cloud::spanner::v1::InstanceAdminClient::GetIamPolicy | ( | Instance const & | in | ) |
Get the IAM policy in effect for the given instance.
This function retrieves the IAM policy configured in the given instance, that is, which roles are enabled in the instance, and what entities are members of each role.
Definition at line 62 of file instance_admin_client.cc.
StatusOr< google::spanner::admin::instance::v1::Instance > google::cloud::spanner::v1::InstanceAdminClient::GetInstance | ( | Instance const & | in | ) |
Retrieve metadata information about a Cloud Spanner Instance.
Definition at line 25 of file instance_admin_client.cc.
StatusOr< google::spanner::admin::instance::v1::InstanceConfig > google::cloud::spanner::v1::InstanceAdminClient::GetInstanceConfig | ( | std::string const & | name | ) |
Retrieve information about a Cloud Spanner Instance Config.
Definition at line 48 of file instance_admin_client.cc.
ListInstanceConfigsRange google::cloud::spanner::v1::InstanceAdminClient::ListInstanceConfigs | ( | std::string | project_id | ) |
Retrieve a list of instance configs for a given project.
Definition at line 52 of file instance_admin_client.cc.
ListInstancesRange google::cloud::spanner::v1::InstanceAdminClient::ListInstances | ( | std::string | project_id, |
std::string | filter | ||
) |
Retrieve a list of instances for a given project.
Definition at line 57 of file instance_admin_client.cc.
|
default |
|
default |
StatusOr< google::iam::v1::Policy > google::cloud::spanner::v1::InstanceAdminClient::SetIamPolicy | ( | Instance const & | in, |
google::iam::v1::Policy | policy | ||
) |
Set the IAM policy for the given instance.
This function changes the IAM policy configured in the given instance to the value of policy
.
etag
field in policy
is set. Therefore, the underlying RPCs are only retried if the field is set, and the function returns the first RPC error in any other case.Definition at line 67 of file instance_admin_client.cc.
StatusOr< google::iam::v1::Policy > google::cloud::spanner::v1::InstanceAdminClient::SetIamPolicy | ( | Instance const & | in, |
IamUpdater const & | updater | ||
) |
Updates the IAM policy for an instance using an optimistic concurrency control loop.
This function repeatedly reads the current IAM policy in in
, and then calls the updater
with the this policy. The updater
returns an empty optional if no changes are required, or it returns the new desired value for the IAM policy. This function then updates the policy.
Updating an IAM policy can fail with retryable errors or can be aborted because there were simultaneous changes the to IAM policy. In these cases this function reruns the loop until it succeeds.
The function returns the final IAM policy, or an error if the rerun policy for the underlying connection has expired.
etag
field on the policy, so the underlying RPCs are retried automatically.in | the identifier for the instance where you want to change the IAM policy. |
updater | a callback to modify the policy. Return an unset optional to indicate that no changes to the policy are needed. |
Definition at line 72 of file instance_admin_client.cc.
StatusOr< google::iam::v1::Policy > google::cloud::spanner::v1::InstanceAdminClient::SetIamPolicy | ( | Instance const & | in, |
IamUpdater const & | updater, | ||
std::unique_ptr< TransactionRerunPolicy > | rerun_policy, | ||
std::unique_ptr< BackoffPolicy > | backoff_policy | ||
) |
Updates the IAM policy for an instance using an optimistic concurrency control loop.
This function repeatedly reads the current IAM policy in in
, and then calls the updater
with the this policy. The updater
returns an empty optional if no changes are required, or it returns the new desired value for the IAM policy. This function then updates the policy.
Updating an IAM policy can fail with retryable errors or can be aborted because there were simultaneous changes the to IAM policy. In these cases this function reruns the loop until it succeeds.
The function returns the final IAM policy, or an error if the rerun policy for the underlying connection has expired.
etag
field on the policy, so the underlying RPCs are retried automatically.in | the identifier for the instance where you want to change the IAM policy. |
updater | a callback to modify the policy. Return an unset optional to indicate that no changes to the policy are needed. |
rerun_policy | controls for how long (or how many times) the updater will be rerun after the IAM policy update aborts. |
backoff_policy | controls how long SetIamPolicy waits between reruns. |
Definition at line 90 of file instance_admin_client.cc.
StatusOr< google::iam::v1::TestIamPermissionsResponse > google::cloud::spanner::v1::InstanceAdminClient::TestIamPermissions | ( | Instance const & | in, |
std::vector< std::string > | permissions | ||
) |
Get the subset of the permissions the caller has on the given instance.
This function compares the given list of permissions against those permissions granted to the caller, and returns the subset of the list that the caller actually holds.
spanner.*
are not allowed.Definition at line 121 of file instance_admin_client.cc.
future< StatusOr< google::spanner::admin::instance::v1::Instance > > google::cloud::spanner::v1::InstanceAdminClient::UpdateInstance | ( | google::spanner::admin::instance::v1::UpdateInstanceRequest const & | request | ) |
Updates a Cloud Spanner instance.
Use google::cloud::spanner::UpdateInstanceRequestBuilder
to build the google::spanner::admin::instance::v1::UpdateInstanceRequest
object.
Definition at line 37 of file instance_admin_client.cc.
|
friend |
Definition at line 88 of file instance_admin_client.h.
|
friend |
Definition at line 84 of file instance_admin_client.h.