Google Cloud Native is in preview. Google Cloud Classic is fully supported.
google-native.spanner/v1.Session
Explore with Pulumi AI
Google Cloud Native is in preview. Google Cloud Classic is fully supported.
Creates a new session. A session can be used to perform transactions that read and/or modify data in a Cloud Spanner database. Sessions are meant to be reused for many consecutive transactions. Sessions can only execute one transaction at a time. To execute multiple concurrent read-write/write-only transactions, create multiple sessions. Note that standalone reads and queries use a transaction internally, and count toward the one transaction limit. Active sessions use additional server resources, so it is a good idea to delete idle and unneeded sessions. Aside from explicit deletes, Cloud Spanner may delete sessions for which no operations are sent for more than an hour. If a session is deleted, requests to it return NOT_FOUND
. Idle sessions can be kept alive by sending a trivial SQL query periodically, e.g., "SELECT 1"
.
Auto-naming is currently not supported for this resource.
Create Session Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Session(name: string, args: SessionArgs, opts?: CustomResourceOptions);
@overload
def Session(resource_name: str,
args: SessionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Session(resource_name: str,
opts: Optional[ResourceOptions] = None,
database_id: Optional[str] = None,
instance_id: Optional[str] = None,
creator_role: Optional[str] = None,
labels: Optional[Mapping[str, str]] = None,
project: Optional[str] = None)
func NewSession(ctx *Context, name string, args SessionArgs, opts ...ResourceOption) (*Session, error)
public Session(string name, SessionArgs args, CustomResourceOptions? opts = null)
public Session(String name, SessionArgs args)
public Session(String name, SessionArgs args, CustomResourceOptions options)
type: google-native:spanner/v1:Session
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args SessionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args SessionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SessionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SessionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SessionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var google_nativeSessionResource = new GoogleNative.Spanner.V1.Session("google-nativeSessionResource", new()
{
DatabaseId = "string",
InstanceId = "string",
CreatorRole = "string",
Labels =
{
{ "string", "string" },
},
Project = "string",
});
example, err := spanner.NewSession(ctx, "google-nativeSessionResource", &spanner.SessionArgs{
DatabaseId: pulumi.String("string"),
InstanceId: pulumi.String("string"),
CreatorRole: pulumi.String("string"),
Labels: pulumi.StringMap{
"string": pulumi.String("string"),
},
Project: pulumi.String("string"),
})
var google_nativeSessionResource = new Session("google-nativeSessionResource", SessionArgs.builder()
.databaseId("string")
.instanceId("string")
.creatorRole("string")
.labels(Map.of("string", "string"))
.project("string")
.build());
google_native_session_resource = google_native.spanner.v1.Session("google-nativeSessionResource",
database_id="string",
instance_id="string",
creator_role="string",
labels={
"string": "string",
},
project="string")
const google_nativeSessionResource = new google_native.spanner.v1.Session("google-nativeSessionResource", {
databaseId: "string",
instanceId: "string",
creatorRole: "string",
labels: {
string: "string",
},
project: "string",
});
type: google-native:spanner/v1:Session
properties:
creatorRole: string
databaseId: string
instanceId: string
labels:
string: string
project: string
Session Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Session resource accepts the following input properties:
- Database
Id string - Instance
Id string - Creator
Role string - The database role which created this session.
- Labels Dictionary<string, string>
- The labels for the session. * Label keys must be between 1 and 63 characters long and must conform to the following regular expression:
[a-z]([-a-z0-9]*[a-z0-9])?
. * Label values must be between 0 and 63 characters long and must conform to the regular expression([a-z]([-a-z0-9]*[a-z0-9])?)?
. * No more than 64 labels can be associated with a given session. See https://goo.gl/xmQnxf for more information on and examples of labels. - Project string
- Database
Id string - Instance
Id string - Creator
Role string - The database role which created this session.
- Labels map[string]string
- The labels for the session. * Label keys must be between 1 and 63 characters long and must conform to the following regular expression:
[a-z]([-a-z0-9]*[a-z0-9])?
. * Label values must be between 0 and 63 characters long and must conform to the regular expression([a-z]([-a-z0-9]*[a-z0-9])?)?
. * No more than 64 labels can be associated with a given session. See https://goo.gl/xmQnxf for more information on and examples of labels. - Project string
- database
Id String - instance
Id String - creator
Role String - The database role which created this session.
- labels Map<String,String>
- The labels for the session. * Label keys must be between 1 and 63 characters long and must conform to the following regular expression:
[a-z]([-a-z0-9]*[a-z0-9])?
. * Label values must be between 0 and 63 characters long and must conform to the regular expression([a-z]([-a-z0-9]*[a-z0-9])?)?
. * No more than 64 labels can be associated with a given session. See https://goo.gl/xmQnxf for more information on and examples of labels. - project String
- database
Id string - instance
Id string - creator
Role string - The database role which created this session.
- labels {[key: string]: string}
- The labels for the session. * Label keys must be between 1 and 63 characters long and must conform to the following regular expression:
[a-z]([-a-z0-9]*[a-z0-9])?
. * Label values must be between 0 and 63 characters long and must conform to the regular expression([a-z]([-a-z0-9]*[a-z0-9])?)?
. * No more than 64 labels can be associated with a given session. See https://goo.gl/xmQnxf for more information on and examples of labels. - project string
- database_
id str - instance_
id str - creator_
role str - The database role which created this session.
- labels Mapping[str, str]
- The labels for the session. * Label keys must be between 1 and 63 characters long and must conform to the following regular expression:
[a-z]([-a-z0-9]*[a-z0-9])?
. * Label values must be between 0 and 63 characters long and must conform to the regular expression([a-z]([-a-z0-9]*[a-z0-9])?)?
. * No more than 64 labels can be associated with a given session. See https://goo.gl/xmQnxf for more information on and examples of labels. - project str
- database
Id String - instance
Id String - creator
Role String - The database role which created this session.
- labels Map<String>
- The labels for the session. * Label keys must be between 1 and 63 characters long and must conform to the following regular expression:
[a-z]([-a-z0-9]*[a-z0-9])?
. * Label values must be between 0 and 63 characters long and must conform to the regular expression([a-z]([-a-z0-9]*[a-z0-9])?)?
. * No more than 64 labels can be associated with a given session. See https://goo.gl/xmQnxf for more information on and examples of labels. - project String
Outputs
All input properties are implicitly available as output properties. Additionally, the Session resource produces the following output properties:
- Approximate
Last stringUse Time - The approximate timestamp when the session is last used. It is typically earlier than the actual last use time.
- Create
Time string - The timestamp when the session is created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the session. This is always system-assigned.
- Approximate
Last stringUse Time - The approximate timestamp when the session is last used. It is typically earlier than the actual last use time.
- Create
Time string - The timestamp when the session is created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the session. This is always system-assigned.
- approximate
Last StringUse Time - The approximate timestamp when the session is last used. It is typically earlier than the actual last use time.
- create
Time String - The timestamp when the session is created.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the session. This is always system-assigned.
- approximate
Last stringUse Time - The approximate timestamp when the session is last used. It is typically earlier than the actual last use time.
- create
Time string - The timestamp when the session is created.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The name of the session. This is always system-assigned.
- approximate_
last_ struse_ time - The approximate timestamp when the session is last used. It is typically earlier than the actual last use time.
- create_
time str - The timestamp when the session is created.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The name of the session. This is always system-assigned.
- approximate
Last StringUse Time - The approximate timestamp when the session is last used. It is typically earlier than the actual last use time.
- create
Time String - The timestamp when the session is created.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the session. This is always system-assigned.
Package Details
- Repository
- Google Cloud Native pulumi/pulumi-google-native
- License
- Apache-2.0
Google Cloud Native is in preview. Google Cloud Classic is fully supported.