Class CreateInstanceRequestBuilder (2.22.0)

CreateInstanceRequestBuilder is a builder class for google::spanner::admin::instance::v1::CreateInstanceRequest

This is useful when calling the InstanceAdminClient::CreateInstance() function.

Example
void CreateInstance(google::cloud::spanner_admin::InstanceAdminClient client,
                    std::string const& project_id,
                    std::string const& instance_id,
                    std::string const& display_name,
                    std::string const& config_id) {
  namespace spanner = ::google::cloud::spanner;
  spanner::Instance in(project_id, instance_id);

  auto project = google::cloud::Project(project_id);
  std::string config_name =
      project.FullName() + "/instanceConfigs/" + config_id;
  auto instance =
      client
          .CreateInstance(spanner::CreateInstanceRequestBuilder(in, config_name)
                              .SetDisplayName(display_name)
                              .SetNodeCount(1)
                              .SetLabels({{"cloud_spanner_samples", "true"}})
                              .Build())
          .get();
  if (!instance) throw std::move(instance).status();
  std::cout << "Created instance [" << in << "]:\n" << instance->DebugString();
}

Constructors

CreateInstanceRequestBuilder(CreateInstanceRequestBuilder const &)

Parameter
NameDescription
CreateInstanceRequestBuilder const &

CreateInstanceRequestBuilder(CreateInstanceRequestBuilder &&)

Parameter
NameDescription
CreateInstanceRequestBuilder &&

CreateInstanceRequestBuilder(Instance const &, std::string)

Constructor requires Instance and Cloud Spanner instance config name.

The display_name is set to a default value of in.instance_id().

Parameters
NameDescription
in Instance const &
config std::string

Operators

operator=(CreateInstanceRequestBuilder const &)

Parameter
NameDescription
CreateInstanceRequestBuilder const &
Returns
TypeDescription
CreateInstanceRequestBuilder &

operator=(CreateInstanceRequestBuilder &&)

Parameter
NameDescription
CreateInstanceRequestBuilder &&
Returns
TypeDescription
CreateInstanceRequestBuilder &

Functions

SetDisplayName(std::string) &

Parameter
NameDescription
display_name std::string
Returns
TypeDescription
CreateInstanceRequestBuilder &

SetDisplayName(std::string) &&

Parameter
NameDescription
display_name std::string
Returns
TypeDescription
CreateInstanceRequestBuilder &&

SetNodeCount(int) &

Parameter
NameDescription
node_count int
Returns
TypeDescription
CreateInstanceRequestBuilder &

SetNodeCount(int) &&

Parameter
NameDescription
node_count int
Returns
TypeDescription
CreateInstanceRequestBuilder &&

SetProcessingUnits(int) &

Parameter
NameDescription
processing_units int
Returns
TypeDescription
CreateInstanceRequestBuilder &

SetProcessingUnits(int) &&

Parameter
NameDescription
processing_units int
Returns
TypeDescription
CreateInstanceRequestBuilder &&

SetLabels(std::map< std::string, std::string > const &) &

Parameter
NameDescription
labels std::map< std::string, std::string > const &
Returns
TypeDescription
CreateInstanceRequestBuilder &

SetLabels(std::map< std::string, std::string > const &) &&

Parameter
NameDescription
labels std::map< std::string, std::string > const &
Returns
TypeDescription
CreateInstanceRequestBuilder &&

Build() &

Returns
TypeDescription
google::spanner::admin::instance::v1::CreateInstanceRequest &

Build() &&

Returns
TypeDescription
google::spanner::admin::instance::v1::CreateInstanceRequest &&