Oracle Cloud Infrastructure v2.17.0 published on Friday, Nov 15, 2024 by Pulumi
oci.Bastion.getSessions
Explore with Pulumi AI
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: testBastion.id,
displayName: sessionDisplayName,
sessionId: testSession.id,
sessionLifecycleState: sessionSessionLifecycleState,
});
import pulumi
import pulumi_oci as oci
test_sessions = oci.Bastion.get_sessions(bastion_id=test_bastion["id"],
display_name=session_display_name,
session_id=test_session["id"],
session_lifecycle_state=session_session_lifecycle_state)
package main
import (
"github.com/pulumi/pulumi-oci/sdk/v2/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: testBastion.Id,
DisplayName: pulumi.StringRef(sessionDisplayName),
SessionId: pulumi.StringRef(testSession.Id),
SessionLifecycleState: pulumi.StringRef(sessionSessionLifecycleState),
}, 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 = testBastion.Id,
DisplayName = sessionDisplayName,
SessionId = testSession.Id,
SessionLifecycleState = sessionSessionLifecycleState,
});
});
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(testBastion.id())
.displayName(sessionDisplayName)
.sessionId(testSession.id())
.sessionLifecycleState(sessionSessionLifecycleState)
.build());
}
}
variables:
testSessions:
fn::invoke:
Function: oci:Bastion:getSessions
Arguments:
bastionId: ${testBastion.id}
displayName: ${sessionDisplayName}
sessionId: ${testSession.id}
sessionLifecycleState: ${sessionSessionLifecycleState}
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:
- Bastion
Id string - The unique identifier (OCID) of the bastion in which to list sessions.
- Display
Name string - A filter to return only resources that match the entire display name given.
- Filters
List<Get
Sessions Filter> - Session
Id string - The unique identifier (OCID) of the session in which to list resources.
- Session
Lifecycle stringState - A filter to return only resources their lifecycleState matches the given lifecycleState.
- Bastion
Id string - The unique identifier (OCID) of the bastion in which to list sessions.
- Display
Name string - A filter to return only resources that match the entire display name given.
- Filters
[]Get
Sessions Filter - Session
Id string - The unique identifier (OCID) of the session in which to list resources.
- Session
Lifecycle stringState - A filter to return only resources their lifecycleState matches the given lifecycleState.
- bastion
Id String - The unique identifier (OCID) of the bastion in which to list sessions.
- display
Name String - A filter to return only resources that match the entire display name given.
- filters
List<Get
Sessions Filter> - session
Id String - The unique identifier (OCID) of the session in which to list resources.
- session
Lifecycle StringState - A filter to return only resources their lifecycleState matches the given lifecycleState.
- bastion
Id string - The unique identifier (OCID) of the bastion in which to list sessions.
- display
Name string - A filter to return only resources that match the entire display name given.
- filters
Get
Sessions Filter[] - session
Id string - The unique identifier (OCID) of the session in which to list resources.
- session
Lifecycle stringState - 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.
Get Sessions Filter] - session_
id str - The unique identifier (OCID) of the session in which to list resources.
- session_
lifecycle_ strstate - A filter to return only resources their lifecycleState matches the given lifecycleState.
- bastion
Id String - The unique identifier (OCID) of the bastion in which to list sessions.
- display
Name String - A filter to return only resources that match the entire display name given.
- filters List<Property Map>
- session
Id String - The unique identifier (OCID) of the session in which to list resources.
- session
Lifecycle StringState - A filter to return only resources their lifecycleState matches the given lifecycleState.
getSessions Result
The following output properties are available:
- Bastion
Id 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<Get
Sessions Session> - The list of sessions.
- Display
Name string - The name of the session.
- Filters
List<Get
Sessions Filter> - Session
Id string - Session
Lifecycle stringState
- Bastion
Id 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
[]Get
Sessions Session - The list of sessions.
- Display
Name string - The name of the session.
- Filters
[]Get
Sessions Filter - Session
Id string - Session
Lifecycle stringState
- bastion
Id 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<Get
Sessions Session> - The list of sessions.
- display
Name String - The name of the session.
- filters
List<Get
Sessions Filter> - session
Id String - session
Lifecycle StringState
- bastion
Id 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
Get
Sessions Session[] - The list of sessions.
- display
Name string - The name of the session.
- filters
Get
Sessions Filter[] - session
Id string - session
Lifecycle stringState
- 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.
Get Sessions Session] - The list of sessions.
- display_
name str - The name of the session.
- filters
Sequence[bastion.
Get Sessions Filter] - session_
id str - session_
lifecycle_ strstate
- bastion
Id 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.
- display
Name String - The name of the session.
- filters List<Property Map>
- session
Id String - session
Lifecycle StringState
Supporting Types
GetSessionsFilter
GetSessionsSession
- Bastion
Id string - The unique identifier (OCID) of the bastion in which to list sessions.
- Bastion
Name string - The name of the bastion that is hosting this session.
- Bastion
Public stringHost Key Info - The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
- Bastion
User stringName - The username that the session uses to connect to the target resource.
- Display
Name 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.
- Key
Details List<GetSessions Session Key Detail> - Public key details for a bastion session.
- Key
Type string - The type of the key used to connect to the session. PUB is a standard public key in OpenSSH format.
- Lifecycle
Details string - A message describing the current session state in more detail.
- Session
Ttl intIn Seconds - The amount of time the session can remain active.
- Ssh
Metadata Dictionary<string, string> - The connection message for the session.
- State string
- The current state of the session.
- Target
Resource List<GetDetails Sessions Session Target Resource Detail> - Details about a bastion session's target resource.
- Time
Created string - The time the session was created. Format is defined by RFC3339. Example:
2020-01-25T21:10:29.600Z
- Time
Updated string - The time the session was updated. Format is defined by RFC3339. Example:
2020-01-25T21:10:29.600Z
- Bastion
Id string - The unique identifier (OCID) of the bastion in which to list sessions.
- Bastion
Name string - The name of the bastion that is hosting this session.
- Bastion
Public stringHost Key Info - The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
- Bastion
User stringName - The username that the session uses to connect to the target resource.
- Display
Name 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.
- Key
Details []GetSessions Session Key Detail - Public key details for a bastion session.
- Key
Type string - The type of the key used to connect to the session. PUB is a standard public key in OpenSSH format.
- Lifecycle
Details string - A message describing the current session state in more detail.
- Session
Ttl intIn Seconds - The amount of time the session can remain active.
- Ssh
Metadata map[string]string - The connection message for the session.
- State string
- The current state of the session.
- Target
Resource []GetDetails Sessions Session Target Resource Detail - Details about a bastion session's target resource.
- Time
Created string - The time the session was created. Format is defined by RFC3339. Example:
2020-01-25T21:10:29.600Z
- Time
Updated string - The time the session was updated. Format is defined by RFC3339. Example:
2020-01-25T21:10:29.600Z
- bastion
Id String - The unique identifier (OCID) of the bastion in which to list sessions.
- bastion
Name String - The name of the bastion that is hosting this session.
- bastion
Public StringHost Key Info - The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
- bastion
User StringName - The username that the session uses to connect to the target resource.
- display
Name 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.
- key
Details List<GetSessions Session Key Detail> - Public key details for a bastion session.
- key
Type String - The type of the key used to connect to the session. PUB is a standard public key in OpenSSH format.
- lifecycle
Details String - A message describing the current session state in more detail.
- session
Ttl IntegerIn Seconds - The amount of time the session can remain active.
- ssh
Metadata Map<String,String> - The connection message for the session.
- state String
- The current state of the session.
- target
Resource List<GetDetails Sessions Session Target Resource Detail> - Details about a bastion session's target resource.
- time
Created String - The time the session was created. Format is defined by RFC3339. Example:
2020-01-25T21:10:29.600Z
- time
Updated String - The time the session was updated. Format is defined by RFC3339. Example:
2020-01-25T21:10:29.600Z
- bastion
Id string - The unique identifier (OCID) of the bastion in which to list sessions.
- bastion
Name string - The name of the bastion that is hosting this session.
- bastion
Public stringHost Key Info - The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
- bastion
User stringName - The username that the session uses to connect to the target resource.
- display
Name 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.
- key
Details GetSessions Session Key Detail[] - Public key details for a bastion session.
- key
Type string - The type of the key used to connect to the session. PUB is a standard public key in OpenSSH format.
- lifecycle
Details string - A message describing the current session state in more detail.
- session
Ttl numberIn Seconds - The amount of time the session can remain active.
- ssh
Metadata {[key: string]: string} - The connection message for the session.
- state string
- The current state of the session.
- target
Resource GetDetails Sessions Session Target Resource Detail[] - Details about a bastion session's target resource.
- time
Created string - The time the session was created. Format is defined by RFC3339. Example:
2020-01-25T21:10:29.600Z
- time
Updated 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_ strhost_ key_ info - The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
- bastion_
user_ strname - 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.Get Sessions Session Key Detail] - 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_ intin_ seconds - The amount of time the session can remain active.
- ssh_
metadata Mapping[str, str] - The connection message for the session.
- state str
- The current state of the session.
- target_
resource_ Sequence[bastion.details Get Sessions Session Target Resource Detail] - 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
- bastion
Id String - The unique identifier (OCID) of the bastion in which to list sessions.
- bastion
Name String - The name of the bastion that is hosting this session.
- bastion
Public StringHost Key Info - The public key of the bastion host. You can use this to verify that you're connecting to the correct bastion.
- bastion
User StringName - The username that the session uses to connect to the target resource.
- display
Name 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.
- key
Details List<Property Map> - Public key details for a bastion session.
- key
Type String - The type of the key used to connect to the session. PUB is a standard public key in OpenSSH format.
- lifecycle
Details String - A message describing the current session state in more detail.
- session
Ttl NumberIn Seconds - The amount of time the session can remain active.
- ssh
Metadata Map<String> - The connection message for the session.
- state String
- The current state of the session.
- target
Resource List<Property Map>Details - Details about a bastion session's target resource.
- time
Created String - The time the session was created. Format is defined by RFC3339. Example:
2020-01-25T21:10:29.600Z
- time
Updated String - The time the session was updated. Format is defined by RFC3339. Example:
2020-01-25T21:10:29.600Z
GetSessionsSessionKeyDetail
- Public
Key stringContent - 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 stringContent - 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 StringContent - 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 stringContent - 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_ strcontent - 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 StringContent - 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
- Session
Type 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.
- Target
Resource stringDisplay Name - The display name of the target Compute instance that the session connects to.
- Target
Resource stringFqdn - The Fully Qualified Domain Name of the target resource that the session connects to.
- Target
Resource stringId - The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
- Target
Resource stringOperating System User Name - The name of the user on the target resource operating system that the session uses for the connection.
- Target
Resource intPort - The port number to connect to on the target resource.
- Target
Resource stringPrivate Ip Address - The private IP address of the target resource that the session connects to.
- Session
Type 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.
- Target
Resource stringDisplay Name - The display name of the target Compute instance that the session connects to.
- Target
Resource stringFqdn - The Fully Qualified Domain Name of the target resource that the session connects to.
- Target
Resource stringId - The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
- Target
Resource stringOperating System User Name - The name of the user on the target resource operating system that the session uses for the connection.
- Target
Resource intPort - The port number to connect to on the target resource.
- Target
Resource stringPrivate Ip Address - The private IP address of the target resource that the session connects to.
- session
Type 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.
- target
Resource StringDisplay Name - The display name of the target Compute instance that the session connects to.
- target
Resource StringFqdn - The Fully Qualified Domain Name of the target resource that the session connects to.
- target
Resource StringId - The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
- target
Resource StringOperating System User Name - The name of the user on the target resource operating system that the session uses for the connection.
- target
Resource IntegerPort - The port number to connect to on the target resource.
- target
Resource StringPrivate Ip Address - The private IP address of the target resource that the session connects to.
- session
Type 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.
- target
Resource stringDisplay Name - The display name of the target Compute instance that the session connects to.
- target
Resource stringFqdn - The Fully Qualified Domain Name of the target resource that the session connects to.
- target
Resource stringId - The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
- target
Resource stringOperating System User Name - The name of the user on the target resource operating system that the session uses for the connection.
- target
Resource numberPort - The port number to connect to on the target resource.
- target
Resource stringPrivate Ip Address - 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_ strdisplay_ name - The display name of the target Compute instance that the session connects to.
- target_
resource_ strfqdn - The Fully Qualified Domain Name of the target resource that the session connects to.
- target_
resource_ strid - The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
- target_
resource_ stroperating_ system_ user_ name - The name of the user on the target resource operating system that the session uses for the connection.
- target_
resource_ intport - The port number to connect to on the target resource.
- target_
resource_ strprivate_ ip_ address - The private IP address of the target resource that the session connects to.
- session
Type 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.
- target
Resource StringDisplay Name - The display name of the target Compute instance that the session connects to.
- target
Resource StringFqdn - The Fully Qualified Domain Name of the target resource that the session connects to.
- target
Resource StringId - The unique identifier (OCID) of the target resource (a Compute instance, for example) that the session connects to.
- target
Resource StringOperating System User Name - The name of the user on the target resource operating system that the session uses for the connection.
- target
Resource NumberPort - The port number to connect to on the target resource.
- target
Resource StringPrivate Ip Address - 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.