// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "./types"; import * as utilities from "./utilities"; /** * Creates or updates a snapshot lifecycle policy. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put-policy.html * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as elasticstack from "@pulumi/elasticstack"; * * // create a repository for snapshots * const repo = new elasticstack.ElasticsearchSnapshotRepository("repo", {fs: { * location: "/tmp/snapshots", * compress: true, * maxRestoreBytesPerSec: "20mb", * }}); * // create a SLM policy and use the above created repository * const slmPolicy = new elasticstack.ElasticsearchSnapshotLifecycle("slmPolicy", { * schedule: "0 30 1 * * ?", * snapshotName: "", * repository: repo.name, * indices: [ * "data-*", * "important", * ], * ignoreUnavailable: false, * includeGlobalState: false, * expireAfter: "30d", * minCount: 5, * maxCount: 50, * }); * ``` * * ## Import * * ```sh * $ pulumi import elasticstack:index/elasticsearchSnapshotLifecycle:ElasticsearchSnapshotLifecycle my_policy / * ``` */ export class ElasticsearchSnapshotLifecycle extends pulumi.CustomResource { /** * Get an existing ElasticsearchSnapshotLifecycle resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ public static get(name: string, id: pulumi.Input, state?: ElasticsearchSnapshotLifecycleState, opts?: pulumi.CustomResourceOptions): ElasticsearchSnapshotLifecycle { return new ElasticsearchSnapshotLifecycle(name, state, { ...opts, id: id }); } /** @internal */ public static readonly __pulumiType = 'elasticstack:index/elasticsearchSnapshotLifecycle:ElasticsearchSnapshotLifecycle'; /** * Returns true if the given object is an instance of ElasticsearchSnapshotLifecycle. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ public static isInstance(obj: any): obj is ElasticsearchSnapshotLifecycle { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === ElasticsearchSnapshotLifecycle.__pulumiType; } /** * Used to establish connection to Elasticsearch server. Overrides environment variables if present. */ public readonly elasticsearchConnection!: pulumi.Output; /** * Determines how wildcard patterns in the `indices` parameter match data streams and indices. Supports comma-separated values, such as `closed,hidden`. */ public readonly expandWildcards!: pulumi.Output; /** * Time period after which a snapshot is considered expired and eligible for deletion. */ public readonly expireAfter!: pulumi.Output; /** * Feature states to include in the snapshot. */ public readonly featureStates!: pulumi.Output; /** * Internal identifier of the resource */ public /*out*/ readonly id!: pulumi.Output; /** * If `false`, the snapshot fails if any data stream or index in indices is missing or closed. If `true`, the snapshot ignores missing or closed data streams and indices. */ public readonly ignoreUnavailable!: pulumi.Output; /** * If `true`, include the cluster state in the snapshot. */ public readonly includeGlobalState!: pulumi.Output; /** * Comma-separated list of data streams and indices to include in the snapshot. */ public readonly indices!: pulumi.Output; /** * Maximum number of snapshots to retain, even if the snapshots have not yet expired. */ public readonly maxCount!: pulumi.Output; /** * Attaches arbitrary metadata to the snapshot. */ public readonly metadata!: pulumi.Output; /** * Minimum number of snapshots to retain, even if the snapshots have expired. */ public readonly minCount!: pulumi.Output; /** * ID for the snapshot lifecycle policy you want to create or update. */ public readonly name!: pulumi.Output; /** * If `false`, the entire snapshot will fail if one or more indices included in the snapshot do not have all primary shards available. */ public readonly partial!: pulumi.Output; /** * Repository used to store snapshots created by this policy. */ public readonly repository!: pulumi.Output; /** * Periodic or absolute schedule at which the policy creates snapshots. */ public readonly schedule!: pulumi.Output; /** * Name automatically assigned to each snapshot created by the policy. */ public readonly snapshotName!: pulumi.Output; /** * Create a ElasticsearchSnapshotLifecycle resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: ElasticsearchSnapshotLifecycleArgs, opts?: pulumi.CustomResourceOptions) constructor(name: string, argsOrState?: ElasticsearchSnapshotLifecycleArgs | ElasticsearchSnapshotLifecycleState, opts?: pulumi.CustomResourceOptions) { let resourceInputs: pulumi.Inputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState as ElasticsearchSnapshotLifecycleState | undefined; resourceInputs["elasticsearchConnection"] = state ? state.elasticsearchConnection : undefined; resourceInputs["expandWildcards"] = state ? state.expandWildcards : undefined; resourceInputs["expireAfter"] = state ? state.expireAfter : undefined; resourceInputs["featureStates"] = state ? state.featureStates : undefined; resourceInputs["id"] = state ? state.id : undefined; resourceInputs["ignoreUnavailable"] = state ? state.ignoreUnavailable : undefined; resourceInputs["includeGlobalState"] = state ? state.includeGlobalState : undefined; resourceInputs["indices"] = state ? state.indices : undefined; resourceInputs["maxCount"] = state ? state.maxCount : undefined; resourceInputs["metadata"] = state ? state.metadata : undefined; resourceInputs["minCount"] = state ? state.minCount : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["partial"] = state ? state.partial : undefined; resourceInputs["repository"] = state ? state.repository : undefined; resourceInputs["schedule"] = state ? state.schedule : undefined; resourceInputs["snapshotName"] = state ? state.snapshotName : undefined; } else { const args = argsOrState as ElasticsearchSnapshotLifecycleArgs | undefined; if ((!args || args.repository === undefined) && !opts.urn) { throw new Error("Missing required property 'repository'"); } if ((!args || args.schedule === undefined) && !opts.urn) { throw new Error("Missing required property 'schedule'"); } resourceInputs["elasticsearchConnection"] = args ? args.elasticsearchConnection : undefined; resourceInputs["expandWildcards"] = args ? args.expandWildcards : undefined; resourceInputs["expireAfter"] = args ? args.expireAfter : undefined; resourceInputs["featureStates"] = args ? args.featureStates : undefined; resourceInputs["ignoreUnavailable"] = args ? args.ignoreUnavailable : undefined; resourceInputs["includeGlobalState"] = args ? args.includeGlobalState : undefined; resourceInputs["indices"] = args ? args.indices : undefined; resourceInputs["maxCount"] = args ? args.maxCount : undefined; resourceInputs["metadata"] = args ? args.metadata : undefined; resourceInputs["minCount"] = args ? args.minCount : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["partial"] = args ? args.partial : undefined; resourceInputs["repository"] = args ? args.repository : undefined; resourceInputs["schedule"] = args ? args.schedule : undefined; resourceInputs["snapshotName"] = args ? args.snapshotName : undefined; resourceInputs["id"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ElasticsearchSnapshotLifecycle.__pulumiType, name, resourceInputs, opts); } } /** * Input properties used for looking up and filtering ElasticsearchSnapshotLifecycle resources. */ export interface ElasticsearchSnapshotLifecycleState { /** * Used to establish connection to Elasticsearch server. Overrides environment variables if present. */ elasticsearchConnection?: pulumi.Input; /** * Determines how wildcard patterns in the `indices` parameter match data streams and indices. Supports comma-separated values, such as `closed,hidden`. */ expandWildcards?: pulumi.Input; /** * Time period after which a snapshot is considered expired and eligible for deletion. */ expireAfter?: pulumi.Input; /** * Feature states to include in the snapshot. */ featureStates?: pulumi.Input[]>; /** * Internal identifier of the resource */ id?: pulumi.Input; /** * If `false`, the snapshot fails if any data stream or index in indices is missing or closed. If `true`, the snapshot ignores missing or closed data streams and indices. */ ignoreUnavailable?: pulumi.Input; /** * If `true`, include the cluster state in the snapshot. */ includeGlobalState?: pulumi.Input; /** * Comma-separated list of data streams and indices to include in the snapshot. */ indices?: pulumi.Input[]>; /** * Maximum number of snapshots to retain, even if the snapshots have not yet expired. */ maxCount?: pulumi.Input; /** * Attaches arbitrary metadata to the snapshot. */ metadata?: pulumi.Input; /** * Minimum number of snapshots to retain, even if the snapshots have expired. */ minCount?: pulumi.Input; /** * ID for the snapshot lifecycle policy you want to create or update. */ name?: pulumi.Input; /** * If `false`, the entire snapshot will fail if one or more indices included in the snapshot do not have all primary shards available. */ partial?: pulumi.Input; /** * Repository used to store snapshots created by this policy. */ repository?: pulumi.Input; /** * Periodic or absolute schedule at which the policy creates snapshots. */ schedule?: pulumi.Input; /** * Name automatically assigned to each snapshot created by the policy. */ snapshotName?: pulumi.Input; } /** * The set of arguments for constructing a ElasticsearchSnapshotLifecycle resource. */ export interface ElasticsearchSnapshotLifecycleArgs { /** * Used to establish connection to Elasticsearch server. Overrides environment variables if present. */ elasticsearchConnection?: pulumi.Input; /** * Determines how wildcard patterns in the `indices` parameter match data streams and indices. Supports comma-separated values, such as `closed,hidden`. */ expandWildcards?: pulumi.Input; /** * Time period after which a snapshot is considered expired and eligible for deletion. */ expireAfter?: pulumi.Input; /** * Feature states to include in the snapshot. */ featureStates?: pulumi.Input[]>; /** * If `false`, the snapshot fails if any data stream or index in indices is missing or closed. If `true`, the snapshot ignores missing or closed data streams and indices. */ ignoreUnavailable?: pulumi.Input; /** * If `true`, include the cluster state in the snapshot. */ includeGlobalState?: pulumi.Input; /** * Comma-separated list of data streams and indices to include in the snapshot. */ indices?: pulumi.Input[]>; /** * Maximum number of snapshots to retain, even if the snapshots have not yet expired. */ maxCount?: pulumi.Input; /** * Attaches arbitrary metadata to the snapshot. */ metadata?: pulumi.Input; /** * Minimum number of snapshots to retain, even if the snapshots have expired. */ minCount?: pulumi.Input; /** * ID for the snapshot lifecycle policy you want to create or update. */ name?: pulumi.Input; /** * If `false`, the entire snapshot will fail if one or more indices included in the snapshot do not have all primary shards available. */ partial?: pulumi.Input; /** * Repository used to store snapshots created by this policy. */ repository: pulumi.Input; /** * Periodic or absolute schedule at which the policy creates snapshots. */ schedule: pulumi.Input; /** * Name automatically assigned to each snapshot created by the policy. */ snapshotName?: pulumi.Input; }