1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. FileStorage
  5. getSnapshots
Oracle Cloud Infrastructure v2.11.0 published on Thursday, Sep 19, 2024 by Pulumi

oci.FileStorage.getSnapshots

Explore with Pulumi AI

oci logo
Oracle Cloud Infrastructure v2.11.0 published on Thursday, Sep 19, 2024 by Pulumi

    This data source provides the list of Snapshots in Oracle Cloud Infrastructure File Storage service.

    Lists snapshots of the specified file system, or by file system snapshot policy and compartment, or by file system snapshot policy and file system.

    If file system ID is not specified, a file system snapshot policy ID and compartment ID must be specified.

    Users can only sort by time created when listing snapshots by file system snapshot policy ID and compartment ID (sort by name is NOT supported for listing snapshots by policy and compartment).

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testSnapshots = oci.FileStorage.getSnapshots({
        compartmentId: compartmentId,
        fileSystemId: testFileSystem.id,
        filesystemSnapshotPolicyId: testFilesystemSnapshotPolicy.id,
        id: snapshotId,
        state: snapshotState,
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_snapshots = oci.FileStorage.get_snapshots(compartment_id=compartment_id,
        file_system_id=test_file_system["id"],
        filesystem_snapshot_policy_id=test_filesystem_snapshot_policy["id"],
        id=snapshot_id,
        state=snapshot_state)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/FileStorage"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := FileStorage.GetSnapshots(ctx, &filestorage.GetSnapshotsArgs{
    			CompartmentId:              pulumi.StringRef(compartmentId),
    			FileSystemId:               pulumi.StringRef(testFileSystem.Id),
    			FilesystemSnapshotPolicyId: pulumi.StringRef(testFilesystemSnapshotPolicy.Id),
    			Id:                         pulumi.StringRef(snapshotId),
    			State:                      pulumi.StringRef(snapshotState),
    		}, 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 testSnapshots = Oci.FileStorage.GetSnapshots.Invoke(new()
        {
            CompartmentId = compartmentId,
            FileSystemId = testFileSystem.Id,
            FilesystemSnapshotPolicyId = testFilesystemSnapshotPolicy.Id,
            Id = snapshotId,
            State = snapshotState,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.oci.FileStorage.FileStorageFunctions;
    import com.pulumi.oci.FileStorage.inputs.GetSnapshotsArgs;
    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 testSnapshots = FileStorageFunctions.getSnapshots(GetSnapshotsArgs.builder()
                .compartmentId(compartmentId)
                .fileSystemId(testFileSystem.id())
                .filesystemSnapshotPolicyId(testFilesystemSnapshotPolicy.id())
                .id(snapshotId)
                .state(snapshotState)
                .build());
    
        }
    }
    
    variables:
      testSnapshots:
        fn::invoke:
          Function: oci:FileStorage:getSnapshots
          Arguments:
            compartmentId: ${compartmentId}
            fileSystemId: ${testFileSystem.id}
            filesystemSnapshotPolicyId: ${testFilesystemSnapshotPolicy.id}
            id: ${snapshotId}
            state: ${snapshotState}
    

    Using getSnapshots

    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 getSnapshots(args: GetSnapshotsArgs, opts?: InvokeOptions): Promise<GetSnapshotsResult>
    function getSnapshotsOutput(args: GetSnapshotsOutputArgs, opts?: InvokeOptions): Output<GetSnapshotsResult>
    def get_snapshots(compartment_id: Optional[str] = None,
                      file_system_id: Optional[str] = None,
                      filesystem_snapshot_policy_id: Optional[str] = None,
                      filters: Optional[Sequence[_filestorage.GetSnapshotsFilter]] = None,
                      id: Optional[str] = None,
                      state: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetSnapshotsResult
    def get_snapshots_output(compartment_id: Optional[pulumi.Input[str]] = None,
                      file_system_id: Optional[pulumi.Input[str]] = None,
                      filesystem_snapshot_policy_id: Optional[pulumi.Input[str]] = None,
                      filters: Optional[pulumi.Input[Sequence[pulumi.Input[_filestorage.GetSnapshotsFilterArgs]]]] = None,
                      id: Optional[pulumi.Input[str]] = None,
                      state: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetSnapshotsResult]
    func GetSnapshots(ctx *Context, args *GetSnapshotsArgs, opts ...InvokeOption) (*GetSnapshotsResult, error)
    func GetSnapshotsOutput(ctx *Context, args *GetSnapshotsOutputArgs, opts ...InvokeOption) GetSnapshotsResultOutput

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

    public static class GetSnapshots 
    {
        public static Task<GetSnapshotsResult> InvokeAsync(GetSnapshotsArgs args, InvokeOptions? opts = null)
        public static Output<GetSnapshotsResult> Invoke(GetSnapshotsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSnapshotsResult> getSnapshots(GetSnapshotsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: oci:FileStorage/getSnapshots:getSnapshots
      arguments:
        # arguments dictionary

    The following arguments are supported:

    CompartmentId string
    The OCID of the compartment.
    FileSystemId string
    The OCID of the file system.
    FilesystemSnapshotPolicyId string
    The OCID of the file system snapshot policy that is used to create the snapshots.
    Filters List<GetSnapshotsFilter>
    Id string
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    State string
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.
    CompartmentId string
    The OCID of the compartment.
    FileSystemId string
    The OCID of the file system.
    FilesystemSnapshotPolicyId string
    The OCID of the file system snapshot policy that is used to create the snapshots.
    Filters []GetSnapshotsFilter
    Id string
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    State string
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.
    compartmentId String
    The OCID of the compartment.
    fileSystemId String
    The OCID of the file system.
    filesystemSnapshotPolicyId String
    The OCID of the file system snapshot policy that is used to create the snapshots.
    filters List<GetSnapshotsFilter>
    id String
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    state String
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.
    compartmentId string
    The OCID of the compartment.
    fileSystemId string
    The OCID of the file system.
    filesystemSnapshotPolicyId string
    The OCID of the file system snapshot policy that is used to create the snapshots.
    filters GetSnapshotsFilter[]
    id string
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    state string
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.
    compartment_id str
    The OCID of the compartment.
    file_system_id str
    The OCID of the file system.
    filesystem_snapshot_policy_id str
    The OCID of the file system snapshot policy that is used to create the snapshots.
    filters Sequence[filestorage.GetSnapshotsFilter]
    id str
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    state str
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.
    compartmentId String
    The OCID of the compartment.
    fileSystemId String
    The OCID of the file system.
    filesystemSnapshotPolicyId String
    The OCID of the file system snapshot policy that is used to create the snapshots.
    filters List<Property Map>
    id String
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    state String
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.

    getSnapshots Result

    The following output properties are available:

    Snapshots List<GetSnapshotsSnapshot>
    The list of snapshots.
    CompartmentId string
    FileSystemId string
    The OCID of the file system from which the snapshot was created.
    FilesystemSnapshotPolicyId string
    The OCID of the file system snapshot policy that created this snapshot.
    Filters List<GetSnapshotsFilter>
    Id string
    The OCID of the snapshot.
    State string
    The current state of the snapshot.
    Snapshots []GetSnapshotsSnapshot
    The list of snapshots.
    CompartmentId string
    FileSystemId string
    The OCID of the file system from which the snapshot was created.
    FilesystemSnapshotPolicyId string
    The OCID of the file system snapshot policy that created this snapshot.
    Filters []GetSnapshotsFilter
    Id string
    The OCID of the snapshot.
    State string
    The current state of the snapshot.
    snapshots List<GetSnapshotsSnapshot>
    The list of snapshots.
    compartmentId String
    fileSystemId String
    The OCID of the file system from which the snapshot was created.
    filesystemSnapshotPolicyId String
    The OCID of the file system snapshot policy that created this snapshot.
    filters List<GetSnapshotsFilter>
    id String
    The OCID of the snapshot.
    state String
    The current state of the snapshot.
    snapshots GetSnapshotsSnapshot[]
    The list of snapshots.
    compartmentId string
    fileSystemId string
    The OCID of the file system from which the snapshot was created.
    filesystemSnapshotPolicyId string
    The OCID of the file system snapshot policy that created this snapshot.
    filters GetSnapshotsFilter[]
    id string
    The OCID of the snapshot.
    state string
    The current state of the snapshot.
    snapshots Sequence[filestorage.GetSnapshotsSnapshot]
    The list of snapshots.
    compartment_id str
    file_system_id str
    The OCID of the file system from which the snapshot was created.
    filesystem_snapshot_policy_id str
    The OCID of the file system snapshot policy that created this snapshot.
    filters Sequence[filestorage.GetSnapshotsFilter]
    id str
    The OCID of the snapshot.
    state str
    The current state of the snapshot.
    snapshots List<Property Map>
    The list of snapshots.
    compartmentId String
    fileSystemId String
    The OCID of the file system from which the snapshot was created.
    filesystemSnapshotPolicyId String
    The OCID of the file system snapshot policy that created this snapshot.
    filters List<Property Map>
    id String
    The OCID of the snapshot.
    state String
    The current state of the snapshot.

    Supporting Types

    GetSnapshotsFilter

    Name string
    Name of the snapshot. This value is immutable.
    Values List<string>
    Regex bool
    Name string
    Name of the snapshot. This value is immutable.
    Values []string
    Regex bool
    name String
    Name of the snapshot. This value is immutable.
    values List<String>
    regex Boolean
    name string
    Name of the snapshot. This value is immutable.
    values string[]
    regex boolean
    name str
    Name of the snapshot. This value is immutable.
    values Sequence[str]
    regex bool
    name String
    Name of the snapshot. This value is immutable.
    values List<String>
    regex Boolean

    GetSnapshotsSnapshot

    DefinedTags Dictionary<string, string>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    ExpirationTime string
    The time when this snapshot will be deleted.
    FileSystemId string
    The OCID of the file system.
    FilesystemSnapshotPolicyId string
    The OCID of the file system snapshot policy that is used to create the snapshots.
    FreeformTags Dictionary<string, string>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    Id string
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    IsCloneSource bool
    Specifies whether the snapshot has been cloned. See Cloning a File System.
    LifecycleDetails string
    Additional information about the current lifecycleState.
    Name string
    Name of the snapshot. This value is immutable.
    ProvenanceId string
    An OCID identifying the parent from which this snapshot was cloned. If this snapshot was not cloned, then the provenanceId is the same as the snapshot id value. If this snapshot was cloned, then the provenanceId value is the parent's provenanceId. See Cloning a File System.
    SnapshotTime string
    The date and time the snapshot was taken, expressed in RFC 3339 timestamp format. This value might be the same or different from timeCreated depending on the following factors:

    • If the snapshot is created in the original file system directory.
    • If the snapshot is cloned from a file system.
    • If the snapshot is replicated from a file system.
    SnapshotType string
    Specifies the generation type of the snapshot.
    State string
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.
    TimeCreated string
    The date and time the snapshot was created, expressed in RFC 3339 timestamp format. Example: 2016-08-25T21:10:29.600Z
    DefinedTags map[string]string
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    ExpirationTime string
    The time when this snapshot will be deleted.
    FileSystemId string
    The OCID of the file system.
    FilesystemSnapshotPolicyId string
    The OCID of the file system snapshot policy that is used to create the snapshots.
    FreeformTags map[string]string
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    Id string
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    IsCloneSource bool
    Specifies whether the snapshot has been cloned. See Cloning a File System.
    LifecycleDetails string
    Additional information about the current lifecycleState.
    Name string
    Name of the snapshot. This value is immutable.
    ProvenanceId string
    An OCID identifying the parent from which this snapshot was cloned. If this snapshot was not cloned, then the provenanceId is the same as the snapshot id value. If this snapshot was cloned, then the provenanceId value is the parent's provenanceId. See Cloning a File System.
    SnapshotTime string
    The date and time the snapshot was taken, expressed in RFC 3339 timestamp format. This value might be the same or different from timeCreated depending on the following factors:

    • If the snapshot is created in the original file system directory.
    • If the snapshot is cloned from a file system.
    • If the snapshot is replicated from a file system.
    SnapshotType string
    Specifies the generation type of the snapshot.
    State string
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.
    TimeCreated string
    The date and time the snapshot was created, expressed in RFC 3339 timestamp format. Example: 2016-08-25T21:10:29.600Z
    definedTags Map<String,String>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    expirationTime String
    The time when this snapshot will be deleted.
    fileSystemId String
    The OCID of the file system.
    filesystemSnapshotPolicyId String
    The OCID of the file system snapshot policy that is used to create the snapshots.
    freeformTags Map<String,String>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id String
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    isCloneSource Boolean
    Specifies whether the snapshot has been cloned. See Cloning a File System.
    lifecycleDetails String
    Additional information about the current lifecycleState.
    name String
    Name of the snapshot. This value is immutable.
    provenanceId String
    An OCID identifying the parent from which this snapshot was cloned. If this snapshot was not cloned, then the provenanceId is the same as the snapshot id value. If this snapshot was cloned, then the provenanceId value is the parent's provenanceId. See Cloning a File System.
    snapshotTime String
    The date and time the snapshot was taken, expressed in RFC 3339 timestamp format. This value might be the same or different from timeCreated depending on the following factors:

    • If the snapshot is created in the original file system directory.
    • If the snapshot is cloned from a file system.
    • If the snapshot is replicated from a file system.
    snapshotType String
    Specifies the generation type of the snapshot.
    state String
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.
    timeCreated String
    The date and time the snapshot was created, expressed in RFC 3339 timestamp format. Example: 2016-08-25T21:10:29.600Z
    definedTags {[key: string]: string}
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    expirationTime string
    The time when this snapshot will be deleted.
    fileSystemId string
    The OCID of the file system.
    filesystemSnapshotPolicyId string
    The OCID of the file system snapshot policy that is used to create the snapshots.
    freeformTags {[key: string]: string}
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id string
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    isCloneSource boolean
    Specifies whether the snapshot has been cloned. See Cloning a File System.
    lifecycleDetails string
    Additional information about the current lifecycleState.
    name string
    Name of the snapshot. This value is immutable.
    provenanceId string
    An OCID identifying the parent from which this snapshot was cloned. If this snapshot was not cloned, then the provenanceId is the same as the snapshot id value. If this snapshot was cloned, then the provenanceId value is the parent's provenanceId. See Cloning a File System.
    snapshotTime string
    The date and time the snapshot was taken, expressed in RFC 3339 timestamp format. This value might be the same or different from timeCreated depending on the following factors:

    • If the snapshot is created in the original file system directory.
    • If the snapshot is cloned from a file system.
    • If the snapshot is replicated from a file system.
    snapshotType string
    Specifies the generation type of the snapshot.
    state string
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.
    timeCreated string
    The date and time the snapshot was created, expressed in RFC 3339 timestamp format. Example: 2016-08-25T21:10:29.600Z
    defined_tags Mapping[str, str]
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    expiration_time str
    The time when this snapshot will be deleted.
    file_system_id str
    The OCID of the file system.
    filesystem_snapshot_policy_id str
    The OCID of the file system snapshot policy that is used to create the snapshots.
    freeform_tags Mapping[str, str]
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id str
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    is_clone_source bool
    Specifies whether the snapshot has been cloned. See Cloning a File System.
    lifecycle_details str
    Additional information about the current lifecycleState.
    name str
    Name of the snapshot. This value is immutable.
    provenance_id str
    An OCID identifying the parent from which this snapshot was cloned. If this snapshot was not cloned, then the provenanceId is the same as the snapshot id value. If this snapshot was cloned, then the provenanceId value is the parent's provenanceId. See Cloning a File System.
    snapshot_time str
    The date and time the snapshot was taken, expressed in RFC 3339 timestamp format. This value might be the same or different from timeCreated depending on the following factors:

    • If the snapshot is created in the original file system directory.
    • If the snapshot is cloned from a file system.
    • If the snapshot is replicated from a file system.
    snapshot_type str
    Specifies the generation type of the snapshot.
    state str
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.
    time_created str
    The date and time the snapshot was created, expressed in RFC 3339 timestamp format. Example: 2016-08-25T21:10:29.600Z
    definedTags Map<String>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    expirationTime String
    The time when this snapshot will be deleted.
    fileSystemId String
    The OCID of the file system.
    filesystemSnapshotPolicyId String
    The OCID of the file system snapshot policy that is used to create the snapshots.
    freeformTags Map<String>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id String
    Filter results by OCID. Must be an OCID of the correct type for the resouce type.
    isCloneSource Boolean
    Specifies whether the snapshot has been cloned. See Cloning a File System.
    lifecycleDetails String
    Additional information about the current lifecycleState.
    name String
    Name of the snapshot. This value is immutable.
    provenanceId String
    An OCID identifying the parent from which this snapshot was cloned. If this snapshot was not cloned, then the provenanceId is the same as the snapshot id value. If this snapshot was cloned, then the provenanceId value is the parent's provenanceId. See Cloning a File System.
    snapshotTime String
    The date and time the snapshot was taken, expressed in RFC 3339 timestamp format. This value might be the same or different from timeCreated depending on the following factors:

    • If the snapshot is created in the original file system directory.
    • If the snapshot is cloned from a file system.
    • If the snapshot is replicated from a file system.
    snapshotType String
    Specifies the generation type of the snapshot.
    state String
    Filter results by the specified lifecycle state. Must be a valid state for the resource type.
    timeCreated String
    The date and time the snapshot was created, expressed in RFC 3339 timestamp format. Example: 2016-08-25T21:10:29.600Z

    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 v2.11.0 published on Thursday, Sep 19, 2024 by Pulumi