1. Packages
  2. Opensearch Provider
  3. API Docs
  4. SnapshotRepository
opensearch 2.3.1 published on Monday, Apr 14, 2025 by opensearch-project

opensearch.SnapshotRepository

Explore with Pulumi AI

opensearch logo
opensearch 2.3.1 published on Monday, Apr 14, 2025 by opensearch-project

    Provides an OpenSearch snapshot repository resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as opensearch from "@pulumi/opensearch";
    
    // Create a snapshot repository
    const repo = new opensearch.SnapshotRepository("repo", {
        settings: {
            bucket: "es-index-backups",
            region: "us-east-1",
            role_arn: "arn:aws:iam::123456789012:role/MyRole",
        },
        type: "s3",
    });
    
    import pulumi
    import pulumi_opensearch as opensearch
    
    # Create a snapshot repository
    repo = opensearch.SnapshotRepository("repo",
        settings={
            "bucket": "es-index-backups",
            "region": "us-east-1",
            "role_arn": "arn:aws:iam::123456789012:role/MyRole",
        },
        type="s3")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/opensearch/v2/opensearch"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create a snapshot repository
    		_, err := opensearch.NewSnapshotRepository(ctx, "repo", &opensearch.SnapshotRepositoryArgs{
    			Settings: pulumi.StringMap{
    				"bucket":   pulumi.String("es-index-backups"),
    				"region":   pulumi.String("us-east-1"),
    				"role_arn": pulumi.String("arn:aws:iam::123456789012:role/MyRole"),
    			},
    			Type: pulumi.String("s3"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Opensearch = Pulumi.Opensearch;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a snapshot repository
        var repo = new Opensearch.SnapshotRepository("repo", new()
        {
            Settings = 
            {
                { "bucket", "es-index-backups" },
                { "region", "us-east-1" },
                { "role_arn", "arn:aws:iam::123456789012:role/MyRole" },
            },
            Type = "s3",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.opensearch.SnapshotRepository;
    import com.pulumi.opensearch.SnapshotRepositoryArgs;
    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) {
            // Create a snapshot repository
            var repo = new SnapshotRepository("repo", SnapshotRepositoryArgs.builder()
                .settings(Map.ofEntries(
                    Map.entry("bucket", "es-index-backups"),
                    Map.entry("region", "us-east-1"),
                    Map.entry("role_arn", "arn:aws:iam::123456789012:role/MyRole")
                ))
                .type("s3")
                .build());
    
        }
    }
    
    resources:
      # Create a snapshot repository
      repo:
        type: opensearch:SnapshotRepository
        properties:
          settings:
            bucket: es-index-backups
            region: us-east-1
            role_arn: arn:aws:iam::123456789012:role/MyRole
          type: s3
    

    Create SnapshotRepository Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new SnapshotRepository(name: string, args: SnapshotRepositoryArgs, opts?: CustomResourceOptions);
    @overload
    def SnapshotRepository(resource_name: str,
                           args: SnapshotRepositoryArgs,
                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def SnapshotRepository(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           type: Optional[str] = None,
                           name: Optional[str] = None,
                           settings: Optional[Mapping[str, str]] = None,
                           snapshot_repository_id: Optional[str] = None)
    func NewSnapshotRepository(ctx *Context, name string, args SnapshotRepositoryArgs, opts ...ResourceOption) (*SnapshotRepository, error)
    public SnapshotRepository(string name, SnapshotRepositoryArgs args, CustomResourceOptions? opts = null)
    public SnapshotRepository(String name, SnapshotRepositoryArgs args)
    public SnapshotRepository(String name, SnapshotRepositoryArgs args, CustomResourceOptions options)
    
    type: opensearch:SnapshotRepository
    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 SnapshotRepositoryArgs
    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 SnapshotRepositoryArgs
    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 SnapshotRepositoryArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SnapshotRepositoryArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SnapshotRepositoryArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var snapshotRepositoryResource = new Opensearch.SnapshotRepository("snapshotRepositoryResource", new()
    {
        Type = "string",
        Name = "string",
        Settings = 
        {
            { "string", "string" },
        },
        SnapshotRepositoryId = "string",
    });
    
    example, err := opensearch.NewSnapshotRepository(ctx, "snapshotRepositoryResource", &opensearch.SnapshotRepositoryArgs{
    	Type: pulumi.String("string"),
    	Name: pulumi.String("string"),
    	Settings: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	SnapshotRepositoryId: pulumi.String("string"),
    })
    
    var snapshotRepositoryResource = new SnapshotRepository("snapshotRepositoryResource", SnapshotRepositoryArgs.builder()
        .type("string")
        .name("string")
        .settings(Map.of("string", "string"))
        .snapshotRepositoryId("string")
        .build());
    
    snapshot_repository_resource = opensearch.SnapshotRepository("snapshotRepositoryResource",
        type="string",
        name="string",
        settings={
            "string": "string",
        },
        snapshot_repository_id="string")
    
    const snapshotRepositoryResource = new opensearch.SnapshotRepository("snapshotRepositoryResource", {
        type: "string",
        name: "string",
        settings: {
            string: "string",
        },
        snapshotRepositoryId: "string",
    });
    
    type: opensearch:SnapshotRepository
    properties:
        name: string
        settings:
            string: string
        snapshotRepositoryId: string
        type: string
    

    SnapshotRepository Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

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

    The SnapshotRepository resource accepts the following input properties:

    Type string
    The name of the repository backend (required plugins must be installed).
    Name string
    The name of the repository.
    Settings Dictionary<string, string>
    The settings map applicable for the backend, see official documentation for plugins.
    SnapshotRepositoryId string
    The ID of this resource.
    Type string
    The name of the repository backend (required plugins must be installed).
    Name string
    The name of the repository.
    Settings map[string]string
    The settings map applicable for the backend, see official documentation for plugins.
    SnapshotRepositoryId string
    The ID of this resource.
    type String
    The name of the repository backend (required plugins must be installed).
    name String
    The name of the repository.
    settings Map<String,String>
    The settings map applicable for the backend, see official documentation for plugins.
    snapshotRepositoryId String
    The ID of this resource.
    type string
    The name of the repository backend (required plugins must be installed).
    name string
    The name of the repository.
    settings {[key: string]: string}
    The settings map applicable for the backend, see official documentation for plugins.
    snapshotRepositoryId string
    The ID of this resource.
    type str
    The name of the repository backend (required plugins must be installed).
    name str
    The name of the repository.
    settings Mapping[str, str]
    The settings map applicable for the backend, see official documentation for plugins.
    snapshot_repository_id str
    The ID of this resource.
    type String
    The name of the repository backend (required plugins must be installed).
    name String
    The name of the repository.
    settings Map<String>
    The settings map applicable for the backend, see official documentation for plugins.
    snapshotRepositoryId String
    The ID of this resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SnapshotRepository resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing SnapshotRepository Resource

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

    public static get(name: string, id: Input<ID>, state?: SnapshotRepositoryState, opts?: CustomResourceOptions): SnapshotRepository
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            settings: Optional[Mapping[str, str]] = None,
            snapshot_repository_id: Optional[str] = None,
            type: Optional[str] = None) -> SnapshotRepository
    func GetSnapshotRepository(ctx *Context, name string, id IDInput, state *SnapshotRepositoryState, opts ...ResourceOption) (*SnapshotRepository, error)
    public static SnapshotRepository Get(string name, Input<string> id, SnapshotRepositoryState? state, CustomResourceOptions? opts = null)
    public static SnapshotRepository get(String name, Output<String> id, SnapshotRepositoryState state, CustomResourceOptions options)
    resources:  _:    type: opensearch:SnapshotRepository    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Name string
    The name of the repository.
    Settings Dictionary<string, string>
    The settings map applicable for the backend, see official documentation for plugins.
    SnapshotRepositoryId string
    The ID of this resource.
    Type string
    The name of the repository backend (required plugins must be installed).
    Name string
    The name of the repository.
    Settings map[string]string
    The settings map applicable for the backend, see official documentation for plugins.
    SnapshotRepositoryId string
    The ID of this resource.
    Type string
    The name of the repository backend (required plugins must be installed).
    name String
    The name of the repository.
    settings Map<String,String>
    The settings map applicable for the backend, see official documentation for plugins.
    snapshotRepositoryId String
    The ID of this resource.
    type String
    The name of the repository backend (required plugins must be installed).
    name string
    The name of the repository.
    settings {[key: string]: string}
    The settings map applicable for the backend, see official documentation for plugins.
    snapshotRepositoryId string
    The ID of this resource.
    type string
    The name of the repository backend (required plugins must be installed).
    name str
    The name of the repository.
    settings Mapping[str, str]
    The settings map applicable for the backend, see official documentation for plugins.
    snapshot_repository_id str
    The ID of this resource.
    type str
    The name of the repository backend (required plugins must be installed).
    name String
    The name of the repository.
    settings Map<String>
    The settings map applicable for the backend, see official documentation for plugins.
    snapshotRepositoryId String
    The ID of this resource.
    type String
    The name of the repository backend (required plugins must be installed).

    Import

    $ pulumi import opensearch:index/snapshotRepository:SnapshotRepository repo es-index-backups
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    opensearch opensearch-project/terraform-provider-opensearch
    License
    Notes
    This Pulumi package is based on the opensearch Terraform Provider.
    opensearch logo
    opensearch 2.3.1 published on Monday, Apr 14, 2025 by opensearch-project