1. Registry
  2. Packages
  3. Google Cloud Native
  4. API Docs
  5. spanner
  6. spanner/v1
  7. Session

This package is deprecated. Active development has stopped. We recommend using the Google Cloud package instead.

Viewing docs for Google Cloud Native v0.32.0
published on Wednesday, Nov 29, 2023 by Pulumi
google-native logo Google Cloud Native

This package is deprecated. Active development has stopped. We recommend using the Google Cloud package instead.

Viewing docs for Google Cloud Native v0.32.0
published on Wednesday, Nov 29, 2023 by Pulumi

    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.
    
    
    resource "google-native_spanner_v1_session" "name" {
        # resource properties
    }

    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"),
    })
    
    resource "google-native_spanner_v1_session" "google-nativeSessionResource" {
      lifecycle {
        create_before_destroy = true
      }
      database_id  = "string"
      instance_id  = "string"
      creator_role = "string"
      labels = {
        "string" = "string"
      }
      project = "string"
    }
    
    var google_nativeSessionResource = new com.pulumi.googlenative.spanner_v1.Session("google-nativeSessionResource", com.pulumi.googlenative.spanner_v1.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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Session resource accepts the following input properties:

    DatabaseId string
    InstanceId string
    CreatorRole 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
    DatabaseId string
    InstanceId string
    CreatorRole 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)
    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
    databaseId String
    instanceId String
    creatorRole 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
    databaseId string
    instanceId string
    creatorRole 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
    databaseId String
    instanceId String
    creatorRole 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:

    ApproximateLastUseTime string
    The approximate timestamp when the session is last used. It is typically earlier than the actual last use time.
    CreateTime 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.
    ApproximateLastUseTime string
    The approximate timestamp when the session is last used. It is typically earlier than the actual last use time.
    CreateTime 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_use_time string
    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.
    approximateLastUseTime String
    The approximate timestamp when the session is last used. It is typically earlier than the actual last use time.
    createTime 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.
    approximateLastUseTime string
    The approximate timestamp when the session is last used. It is typically earlier than the actual last use time.
    createTime 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_use_time str
    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.
    approximateLastUseTime String
    The approximate timestamp when the session is last used. It is typically earlier than the actual last use time.
    createTime 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.

    Look up Existing Session Resource

    Get an existing Session resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, opts?: CustomResourceOptions): Session
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None) -> Session
    func GetSession(ctx *Context, name string, id IDInput, state *SessionState, opts ...ResourceOption) (*Session, error)
    public static Session Get(string name, Input<string> id, CustomResourceOptions? opts = null)
    public static Session get(String name, Output<String> id, CustomResourceOptions options)
    resources:  existingSession:    type: google-native:spanner/v1:Session    get:      id: ${id}
    import {
      to = google-native_spanner_v1_session.example
      id = "${id}"
    }
    
    name string
    The unique name of the resulting resource.
    id Input<ID>
    The unique provider ID of the resource to look up.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resulting resource.
    id str
    The unique provider ID of the resource to look up.
    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 resulting resource.
    id IDInput
    The unique provider ID of the resource to look up.
    state SessionState
    Pass nil. This resource has no state arguments.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resulting resource.
    id Input<string>
    The unique provider ID of the resource to look up.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resulting resource.
    id Output<String>
    The unique provider ID of the resource to look up.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Package Details

    Repository
    Google Cloud Native pulumi/pulumi-google-native
    License
    Apache-2.0
    google-native logo Google Cloud Native

    This package is deprecated. Active development has stopped. We recommend using the Google Cloud package instead.

    Viewing docs for Google Cloud Native v0.32.0
    published on Wednesday, Nov 29, 2023 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial