1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Bastion
  5. getSessions
Oracle Cloud Infrastructure v1.32.0 published on Thursday, Apr 18, 2024 by Pulumi

oci.Bastion.getSessions

Explore with Pulumi AI

oci logo
Oracle Cloud Infrastructure v1.32.0 published on Thursday, Apr 18, 2024 by Pulumi

    This data source provides the list of Sessions in Oracle Cloud Infrastructure Bastion service.

    Retrieves a list of SessionSummary objects for an existing bastion. Bastion sessions let authorized users connect to a target resource for a predetermined amount of time.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testSessions = oci.Bastion.getSessions({
        bastionId: oci_bastion_bastion.test_bastion.id,
        displayName: _var.session_display_name,
        sessionId: oci_bastion_session.test_session.id,
        sessionLifecycleState: _var.session_session_lifecycle_state,
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_sessions = oci.Bastion.get_sessions(bastion_id=oci_bastion_bastion["test_bastion"]["id"],
        display_name=var["session_display_name"],
        session_id=oci_bastion_session["test_session"]["id"],
        session_lifecycle_state=var["session_session_lifecycle_state"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/go/oci/Bastion"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := Bastion.GetSessions(ctx, &bastion.GetSessionsArgs{
    			BastionId:             oci_bastion_bastion.Test_bastion.Id,
    			DisplayName:           pulumi.StringRef(_var.Session_display_name),
    			SessionId:             pulumi.StringRef(oci_bastion_session.Test_session.Id),
    			SessionLifecycleState: pulumi.StringRef(_var.Session_session_lifecycle_state),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Oci = Pulumi.Oci;
    
    return await Deployment.RunAsync(() => 
    {
        var testSessions = Oci.Bastion.GetSessions.Invoke(new()
        {
            BastionId = oci_bastion_bastion.Test_bastion.Id,
            DisplayName = @var.Session_display_name,
            SessionId = oci_bastion_session.Test_session.Id,
            SessionLifecycleState = @var.Session_session_lifecycle_state,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.oci.Bastion.BastionFunctions;
    import com.pulumi.oci.Bastion.inputs.GetSessionsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var testSessions = BastionFunctions.getSessions(GetSessionsArgs.builder()
                .bastionId(oci_bastion_bastion.test_bastion().id())
                .displayName(var_.session_display_name())
                .sessionId(oci_bastion_session.test_session().id())
                .sessionLifecycleState(var_.session_session_lifecycle_state())
                .build());
    
        }
    }
    
    variables:
      testSessions:
        fn::invoke:
          Function: oci:Bastion:getSessions
          Arguments:
            bastionId: ${oci_bastion_bastion.test_bastion.id}
            displayName: ${var.session_display_name}
            sessionId: ${oci_bastion_session.test_session.id}
            sessionLifecycleState: ${var.session_session_lifecycle_state}
    

    Using getSessions

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSessions(args: GetSessionsArgs, opts?: InvokeOptions): Promise<GetSessionsResult>
    function getSessionsOutput(args: GetSessionsOutputArgs, opts?: InvokeOptions): Output<GetSessionsResult>
    def get_sessions(bastion_id: Optional[str] = None,
                     display_name: Optional[str] = None,
                     filters: Optional[Sequence[_bastion.GetSessionsFilter]] = None,
                     session_id: Optional[str] = None,
                     session_lifecycle_state: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetSessionsResult
    def get_sessions_output(bastion_id: Optional[pulumi.Input[str]] = None,
                     display_name: Optional[pulumi.Input[str]] = None,
                     filters: Optional[pulumi.Input[Sequence[pulumi.Input[_bastion.GetSessionsFilterArgs]]]] = None,
                     session_id: Optional[pulumi.Input[str]] = None,
                     session_lifecycle_state: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetSessionsResult]
    func GetSessions(ctx *Context, args *GetSessionsArgs, opts ...InvokeOption) (*GetSessionsResult, error)
    func GetSessionsOutput(ctx *Context, args *GetSessionsOutputArgs, opts ...InvokeOption) GetSessionsResultOutput

    > Note: This function is named GetSessions in the Go SDK.

    public static class GetSessions 
    {
        public static Task<GetSessionsResult> InvokeAsync(GetSessionsArgs args, InvokeOptions? opts = null)
        public static Output<GetSessionsResult> Invoke(GetSessionsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSessionsResult> getSessions(GetSessionsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: oci:Bastion/getSessions:getSessions
      arguments:
        # arguments dictionary

    The following arguments are supported:

    BastionId string
    The unique identifier (OCID) of the bastion in which to list sessions.
    DisplayName string
    A filter to return only resources that match the entire display name given.
    Filters List<GetSessionsFilter>
    SessionId string
    The unique identifier (OCID) of the session in which to list resources.
    SessionLifecycleState string
    A filter to return only resources their lifecycleState matches the given lifecycleState.
    BastionId string
    The unique identifier (OCID) of the bastion in which to list sessions.
    DisplayName string
    A filter to return only resources that match the entire display name given.
    Filters []GetSessionsFilter
    SessionId string
    The unique identifier (OCID) of the session in which to list resources.
    SessionLifecycleState string
    A filter to return only resources their lifecycleState matches the given lifecycleState.
    bastionId String
    The unique identifier (OCID) of the bastion in which to list sessions.
    displayName String
    A filter to return only resources that match the entire display name given.
    filters List<GetSessionsFilter>
    sessionId String
    The unique identifier (OCID) of the session in which to list resources.
    sessionLifecycleState String
    A filter to return only resources their lifecycleState matches the given lifecycleState.
    bastionId string
    The unique identifier (OCID) of the bastion in which to list sessions.
    displayName string
    A filter to return only resources that match the entire display name given.
    filters GetSessionsFilter[]
    sessionId string
    The unique identifier (OCID) of the session in which to list resources.
    sessionLifecycleState string
    A filter to return only resources their lifecycleState matches the given lifecycleState.
    bastion_id str
    The unique identifier (OCID) of the bastion in which to list sessions.
    display_name str
    A filter to return only resources that match the entire display name given.
    filters Sequence[bastion.GetSessionsFilter]
    session_id str
    The unique identifier (OCID) of the session in which to list resources.
    session_lifecycle_state str
    A filter to return only resources their lifecycleState matches the given lifecycleState.
    bastionId String
    The unique identifier (OCID) of the bastion in which to list sessions.
    displayName String
    A filter to return only resources that match the entire display name given.
    filters List<Property Map>
    sessionId String
    The unique identifier (OCID) of the session in which to list resources.
    sessionLifecycleState String
    A filter to return only resources their lifecycleState matches the given lifecycleState.

    getSessions Result

    The following output properties are available:

    BastionId string
    The unique identifier (OCID) of the bastion that is hosting this session.
    Id string
    The provider-assigned unique ID for this managed resource.
    Sessions List<GetSessionsSession>
    The list of sessions.
    DisplayName string
    The name of the session.
    Filters List<GetSessionsFilter>
    SessionId string
    SessionLifecycleState string
    BastionId string
    The unique identifier (OCID) of the bastion that is hosting this session.
    Id string
    The provider-assigned unique ID for this managed resource.
    Sessions []GetSessionsSession
    The list of sessions.
    DisplayName string
    The name of the session.
    Filters []GetSessionsFilter
    SessionId string
    SessionLifecycleState string
    bastionId String
    The unique identifier (OCID) of the bastion that is hosting this session.
    id String
    The provider-assigned unique ID for this managed resource.
    sessions List<GetSessionsSession>
    The list of sessions.
    displayName String
    The name of the session.
    filters List<GetSessionsFilter>
    sessionId String
    sessionLifecycleState String
    bastionId string
    The unique identifier (OCID) of the bastion that is hosting this session.
    id string
    The provider-assigned unique ID for this managed resource.
    sessions GetSessionsSession[]
    The list of sessions.
    displayName string
    The name of the session.
    filters GetSessionsFilter[]
    sessionId string
    sessionLifecycleState string
    bastion_id str
    The unique identifier (OCID) of the bastion that is hosting this session.
    id str
    The provider-assigned unique ID for this managed resource.
    sessions Sequence[bastion.GetSessionsSession]
    The list of sessions.
    display_name str
    The name of the session.
    filters Sequence[bastion.GetSessionsFilter]
    session_id str
    session_lifecycle_state str
    bastionId String
    The unique identifier (OCID) of the bastion that is hosting this session.
    id String
    The provider-assigned unique ID for this managed resource.
    sessions List<Property Map>
    The list of sessions.
    displayName String
    The name of the session.
    filters List<Property Map>
    sessionId String
    sessionLifecycleState String

    Supporting Types

    GetSessionsFilter

    Name string
    Values List<string>
    Regex bool
    Name string
    Values []string
    Regex bool
    name String
    values List<String>
    regex Boolean
    name string
    values string[]
    regex boolean
    name str
    values Sequence[str]
    regex bool
    name String
    values List<String>
    regex Boolean

    GetSessionsSession

    BastionId string
    The unique identifier (OCID) of the bastion in which to list sessions.
    BastionName string
    The name of the bastion that is hosting this session.
    BastionPublicHostKeyInfo string
    The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
    BastionUserName string
    The username that the session uses to connect to the target resource.
    DisplayName string
    A filter to return only resources that match the entire display name given.
    Id string
    The unique identifier (OCID) of the session, which can't be changed after creation.
    KeyDetails List<GetSessionsSessionKeyDetail>
    Public key details for a bastion session.
    KeyType string
    The type of the key used to connect to the session. PUB is a standard public key in OpenSSH format.
    LifecycleDetails string
    A message describing the current session state in more detail.
    SessionTtlInSeconds int
    The amount of time the session can remain active.
    SshMetadata Dictionary<string, object>
    The connection message for the session.
    State string
    The current state of the session.
    TargetResourceDetails List<GetSessionsSessionTargetResourceDetail>
    Details about a bastion session's target resource.
    TimeCreated string
    The time the session was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
    TimeUpdated string
    The time the session was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
    BastionId string
    The unique identifier (OCID) of the bastion in which to list sessions.
    BastionName string
    The name of the bastion that is hosting this session.
    BastionPublicHostKeyInfo string
    The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
    BastionUserName string
    The username that the session uses to connect to the target resource.
    DisplayName string
    A filter to return only resources that match the entire display name given.
    Id string
    The unique identifier (OCID) of the session, which can't be changed after creation.
    KeyDetails []GetSessionsSessionKeyDetail
    Public key details for a bastion session.
    KeyType string
    The type of the key used to connect to the session. PUB is a standard public key in OpenSSH format.
    LifecycleDetails string
    A message describing the current session state in more detail.
    SessionTtlInSeconds int
    The amount of time the session can remain active.
    SshMetadata map[string]interface{}
    The connection message for the session.
    State string
    The current state of the session.
    TargetResourceDetails []GetSessionsSessionTargetResourceDetail
    Details about a bastion session's target resource.
    TimeCreated string
    The time the session was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
    TimeUpdated string
    The time the session was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
    bastionId String
    The unique identifier (OCID) of the bastion in which to list sessions.
    bastionName String
    The name of the bastion that is hosting this session.
    bastionPublicHostKeyInfo String
    The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
    bastionUserName String
    The username that the session uses to connect to the target resource.
    displayName String
    A filter to return only resources that match the entire display name given.
    id String
    The unique identifier (OCID) of the session, which can't be changed after creation.
    keyDetails List<GetSessionsSessionKeyDetail>
    Public key details for a bastion session.
    keyType String
    The type of the key used to connect to the session. PUB is a standard public key in OpenSSH format.
    lifecycleDetails String
    A message describing the current session state in more detail.
    sessionTtlInSeconds Integer
    The amount of time the session can remain active.
    sshMetadata Map<String,Object>
    The connection message for the session.
    state String
    The current state of the session.
    targetResourceDetails List<GetSessionsSessionTargetResourceDetail>
    Details about a bastion session's target resource.
    timeCreated String
    The time the session was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
    timeUpdated String
    The time the session was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
    bastionId string
    The unique identifier (OCID) of the bastion in which to list sessions.
    bastionName string
    The name of the bastion that is hosting this session.
    bastionPublicHostKeyInfo string
    The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
    bastionUserName string
    The username that the session uses to connect to the target resource.
    displayName string
    A filter to return only resources that match the entire display name given.
    id string
    The unique identifier (OCID) of the session, which can't be changed after creation.
    keyDetails GetSessionsSessionKeyDetail[]
    Public key details for a bastion session.
    keyType string
    The type of the key used to connect to the session. PUB is a standard public key in OpenSSH format.
    lifecycleDetails string
    A message describing the current session state in more detail.
    sessionTtlInSeconds number
    The amount of time the session can remain active.
    sshMetadata {[key: string]: any}
    The connection message for the session.
    state string
    The current state of the session.
    targetResourceDetails GetSessionsSessionTargetResourceDetail[]
    Details about a bastion session's target resource.
    timeCreated string
    The time the session was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
    timeUpdated string
    The time the session was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
    bastion_id str
    The unique identifier (OCID) of the bastion in which to list sessions.
    bastion_name str
    The name of the bastion that is hosting this session.
    bastion_public_host_key_info str
    The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
    bastion_user_name str
    The username that the session uses to connect to the target resource.
    display_name str
    A filter to return only resources that match the entire display name given.
    id str
    The unique identifier (OCID) of the session, which can't be changed after creation.
    key_details Sequence[bastion.GetSessionsSessionKeyDetail]
    Public key details for a bastion session.
    key_type str
    The type of the key used to connect to the session. PUB is a standard public key in OpenSSH format.
    lifecycle_details str
    A message describing the current session state in more detail.
    session_ttl_in_seconds int
    The amount of time the session can remain active.
    ssh_metadata Mapping[str, Any]
    The connection message for the session.
    state str
    The current state of the session.
    target_resource_details Sequence[bastion.GetSessionsSessionTargetResourceDetail]
    Details about a bastion session's target resource.
    time_created str
    The time the session was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
    time_updated str
    The time the session was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
    bastionId String
    The unique identifier (OCID) of the bastion in which to list sessions.
    bastionName String
    The name of the bastion that is hosting this session.
    bastionPublicHostKeyInfo String
    The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
    bastionUserName String
    The username that the session uses to connect to the target resource.
    displayName String
    A filter to return only resources that match the entire display name given.
    id String
    The unique identifier (OCID) of the session, which can't be changed after creation.
    keyDetails List<Property Map>
    Public key details for a bastion session.
    keyType String
    The type of the key used to connect to the session. PUB is a standard public key in OpenSSH format.
    lifecycleDetails String
    A message describing the current session state in more detail.
    sessionTtlInSeconds Number
    The amount of time the session can remain active.
    sshMetadata Map<Any>
    The connection message for the session.
    state String
    The current state of the session.
    targetResourceDetails List<Property Map>
    Details about a bastion session's target resource.
    timeCreated String
    The time the session was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
    timeUpdated String
    The time the session was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z

    GetSessionsSessionKeyDetail

    PublicKeyContent string
    The public key in OpenSSH format of the SSH key pair for the session. When you connect to the session, you must provide the private key of the same SSH key pair.
    PublicKeyContent string
    The public key in OpenSSH format of the SSH key pair for the session. When you connect to the session, you must provide the private key of the same SSH key pair.
    publicKeyContent String
    The public key in OpenSSH format of the SSH key pair for the session. When you connect to the session, you must provide the private key of the same SSH key pair.
    publicKeyContent string
    The public key in OpenSSH format of the SSH key pair for the session. When you connect to the session, you must provide the private key of the same SSH key pair.
    public_key_content str
    The public key in OpenSSH format of the SSH key pair for the session. When you connect to the session, you must provide the private key of the same SSH key pair.
    publicKeyContent String
    The public key in OpenSSH format of the SSH key pair for the session. When you connect to the session, you must provide the private key of the same SSH key pair.

    GetSessionsSessionTargetResourceDetail

    SessionType string
    The Bastion service recognizes three types of sessions, managed SSH sessions, SSH port forwarding sessions, and Dynamic SSH port forwarding sessions. Managed SSH sessions require that the target resource has an OpenSSH server and the Oracle Cloud Agent both running.
    TargetResourceDisplayName string
    The display name of the target Compute instance that the session connects to.
    TargetResourceFqdn string
    The Fully Qualified Domain Name of the target resource that the session connects to.
    TargetResourceId string
    The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
    TargetResourceOperatingSystemUserName string
    The name of the user on the target resource operating system that the session uses for the connection.
    TargetResourcePort int
    The port number to connect to on the target resource.
    TargetResourcePrivateIpAddress string
    The private IP address of the target resource that the session connects to.
    SessionType string
    The Bastion service recognizes three types of sessions, managed SSH sessions, SSH port forwarding sessions, and Dynamic SSH port forwarding sessions. Managed SSH sessions require that the target resource has an OpenSSH server and the Oracle Cloud Agent both running.
    TargetResourceDisplayName string
    The display name of the target Compute instance that the session connects to.
    TargetResourceFqdn string
    The Fully Qualified Domain Name of the target resource that the session connects to.
    TargetResourceId string
    The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
    TargetResourceOperatingSystemUserName string
    The name of the user on the target resource operating system that the session uses for the connection.
    TargetResourcePort int
    The port number to connect to on the target resource.
    TargetResourcePrivateIpAddress string
    The private IP address of the target resource that the session connects to.
    sessionType String
    The Bastion service recognizes three types of sessions, managed SSH sessions, SSH port forwarding sessions, and Dynamic SSH port forwarding sessions. Managed SSH sessions require that the target resource has an OpenSSH server and the Oracle Cloud Agent both running.
    targetResourceDisplayName String
    The display name of the target Compute instance that the session connects to.
    targetResourceFqdn String
    The Fully Qualified Domain Name of the target resource that the session connects to.
    targetResourceId String
    The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
    targetResourceOperatingSystemUserName String
    The name of the user on the target resource operating system that the session uses for the connection.
    targetResourcePort Integer
    The port number to connect to on the target resource.
    targetResourcePrivateIpAddress String
    The private IP address of the target resource that the session connects to.
    sessionType string
    The Bastion service recognizes three types of sessions, managed SSH sessions, SSH port forwarding sessions, and Dynamic SSH port forwarding sessions. Managed SSH sessions require that the target resource has an OpenSSH server and the Oracle Cloud Agent both running.
    targetResourceDisplayName string
    The display name of the target Compute instance that the session connects to.
    targetResourceFqdn string
    The Fully Qualified Domain Name of the target resource that the session connects to.
    targetResourceId string
    The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
    targetResourceOperatingSystemUserName string
    The name of the user on the target resource operating system that the session uses for the connection.
    targetResourcePort number
    The port number to connect to on the target resource.
    targetResourcePrivateIpAddress string
    The private IP address of the target resource that the session connects to.
    session_type str
    The Bastion service recognizes three types of sessions, managed SSH sessions, SSH port forwarding sessions, and Dynamic SSH port forwarding sessions. Managed SSH sessions require that the target resource has an OpenSSH server and the Oracle Cloud Agent both running.
    target_resource_display_name str
    The display name of the target Compute instance that the session connects to.
    target_resource_fqdn str
    The Fully Qualified Domain Name of the target resource that the session connects to.
    target_resource_id str
    The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
    target_resource_operating_system_user_name str
    The name of the user on the target resource operating system that the session uses for the connection.
    target_resource_port int
    The port number to connect to on the target resource.
    target_resource_private_ip_address str
    The private IP address of the target resource that the session connects to.
    sessionType String
    The Bastion service recognizes three types of sessions, managed SSH sessions, SSH port forwarding sessions, and Dynamic SSH port forwarding sessions. Managed SSH sessions require that the target resource has an OpenSSH server and the Oracle Cloud Agent both running.
    targetResourceDisplayName String
    The display name of the target Compute instance that the session connects to.
    targetResourceFqdn String
    The Fully Qualified Domain Name of the target resource that the session connects to.
    targetResourceId String
    The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
    targetResourceOperatingSystemUserName String
    The name of the user on the target resource operating system that the session uses for the connection.
    targetResourcePort Number
    The port number to connect to on the target resource.
    targetResourcePrivateIpAddress String
    The private IP address of the target resource that the session connects to.

    Package Details

    Repository
    oci pulumi/pulumi-oci
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the oci Terraform Provider.
    oci logo
    Oracle Cloud Infrastructure v1.32.0 published on Thursday, Apr 18, 2024 by Pulumi