Google Cloud Spanner C++ Client 2.13.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... | |
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... | |
Copy and move support | |
InstanceAdminClient (InstanceAdminClient const &)=default | |
InstanceAdminClient & | operator= (InstanceAdminClient const &)=default |
InstanceAdminClient (InstanceAdminClient &&)=default | |
InstanceAdminClient & | operator= (InstanceAdminClient &&)=default |
Friends | |
Equality | |
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. For more information, see the Error Handling Guide.
|
inlineexplicit |
|
delete |
No default construction.
Use InstanceAdminClient(std::shared_ptr<InstanceAdminConnection>)
|
default |
|
default |
future< StatusOr< google::spanner::admin::instance::v1::Instance > > google::cloud::spanner::InstanceAdminClient::CreateInstance | ( | google::spanner::admin::instance::v1::CreateInstanceRequest const & | ) |
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.
Deletes an existing Cloud Spanner instance.
StatusOr< google::iam::v1::Policy > google::cloud::spanner::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.
StatusOr< google::spanner::admin::instance::v1::Instance > google::cloud::spanner::InstanceAdminClient::GetInstance | ( | Instance const & | in | ) |
Retrieve metadata information about a Cloud Spanner Instance.
StatusOr< google::spanner::admin::instance::v1::InstanceConfig > google::cloud::spanner::InstanceAdminClient::GetInstanceConfig | ( | std::string const & | name | ) |
Retrieve information about a Cloud Spanner Instance Config.
ListInstanceConfigsRange google::cloud::spanner::InstanceAdminClient::ListInstanceConfigs | ( | std::string | project_id | ) |
Retrieve a list of instance configs for a given project.
ListInstancesRange google::cloud::spanner::InstanceAdminClient::ListInstances | ( | std::string | project_id, |
std::string | filter | ||
) |
Retrieve a list of instances for a given project.
|
default |
|
default |
StatusOr< google::iam::v1::Policy > google::cloud::spanner::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.StatusOr< google::iam::v1::Policy > google::cloud::spanner::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. |
StatusOr< google::iam::v1::Policy > google::cloud::spanner::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. |
StatusOr< google::iam::v1::TestIamPermissionsResponse > google::cloud::spanner::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.future< StatusOr< google::spanner::admin::instance::v1::Instance > > google::cloud::spanner::InstanceAdminClient::UpdateInstance | ( | google::spanner::admin::instance::v1::UpdateInstanceRequest const & | ) |
Updates a Cloud Spanner instance.
Use google::cloud::spanner::UpdateInstanceRequestBuilder
to build the google::spanner::admin::instance::v1::UpdateInstanceRequest
object.
|
friend |
|
friend |