Google Cloud Spanner C++ Client 2.13.0
A C++ Client Library for Google Cloud Spanner
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
google::cloud::spanner::Instance Class Reference

This class identifies a Cloud Spanner Instance. More...

#include <google/cloud/spanner/instance.h>

Public Member Functions

 Instance (Project project, std::string instance_id)
 Constructs an Instance object identified by the given project and instance_id. More...
 
 Instance (std::string project_id, std::string instance_id)
 Constructs an Instance object identified by the given IDs. More...
 
Project const & project () const
 Returns the Project containing this instance. More...
 
std::string const & project_id () const
 
std::string const & instance_id () const
 Returns the Instance ID. More...
 
std::string FullName () const
 Returns the fully qualified instance name as a string of the form: "projects/<project-id>/instances/<instance-id>". More...
 
Copy and move
 Instance (Instance const &)=default
 
Instanceoperator= (Instance const &)=default
 
 Instance (Instance &&)=default
 
Instanceoperator= (Instance &&)=default
 

Friends

std::ostream & operator<< (std::ostream &, Instance const &)
 Output the FullName() format. More...
 
Equality operators
bool operator== (Instance const &a, Instance const &b)
 
bool operator!= (Instance const &a, Instance const &b)
 

Detailed Description

This class identifies a Cloud Spanner Instance.

A Cloud Spanner instance is identified by its project_id and instance_id.

Note
This class makes no effort to validate the components of the database name. It is the application's responsibility to provide valid project, and instance ids. Passing invalid values will not be checked until the instance name is used in a RPC to spanner.

For more info about the instance_id format, see https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.instance.v1#createinstancerequest

Constructor & Destructor Documentation

◆ Instance() [1/4]

google::cloud::spanner::Instance::Instance ( Project  project,
std::string  instance_id 
)

Constructs an Instance object identified by the given project and instance_id.

◆ Instance() [2/4]

google::cloud::spanner::Instance::Instance ( std::string  project_id,
std::string  instance_id 
)

Constructs an Instance object identified by the given IDs.

This is equivalent to first constructing a Project from the given project_id and then calling the Instance(Project, std::string) constructor.

◆ Instance() [3/4]

google::cloud::spanner::Instance::Instance ( Instance const &  )
default

◆ Instance() [4/4]

google::cloud::spanner::Instance::Instance ( Instance &&  )
default

Member Function Documentation

◆ FullName()

std::string google::cloud::spanner::Instance::FullName ( ) const

Returns the fully qualified instance name as a string of the form: "projects/<project-id>/instances/<instance-id>".

◆ instance_id()

std::string const & google::cloud::spanner::Instance::instance_id ( ) const
inline

Returns the Instance ID.

◆ operator=() [1/2]

Instance & google::cloud::spanner::Instance::operator= ( Instance &&  )
default

◆ operator=() [2/2]

Instance & google::cloud::spanner::Instance::operator= ( Instance const &  )
default

◆ project()

Project const & google::cloud::spanner::Instance::project ( ) const
inline

Returns the Project containing this instance.

◆ project_id()

std::string const & google::cloud::spanner::Instance::project_id ( ) const
inline

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( Instance const &  a,
Instance const &  b 
)
friend

◆ operator<<

std::ostream & operator<< ( std::ostream &  ,
Instance const &   
)
friend

Output the FullName() format.

◆ operator==

bool operator== ( Instance const &  a,
Instance const &  b 
)
friend