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

Google Cloud Native is in preview. Google Cloud Classic is fully supported.

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

google-native.spanner/v1.Session

Explore with Pulumi AI

google-native logo

Google Cloud Native is in preview. Google Cloud Classic is fully supported.

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.
    
    

    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.

    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:

    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
    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.
    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.

    Package Details

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

    Google Cloud Native is in preview. Google Cloud Classic is fully supported.

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