UNPKG

@pulumi/linode

Version:

A Pulumi package for creating and managing linode cloud resources.

146 lines (145 loc) 5.23 kB
import * as pulumi from "@pulumi/pulumi"; /** * > **Early Access** Locks are in Early Access and may not be available to all users. * * > **Important** Only unrestricted users can create and delete locks. Restricted users cannot manage locks even if they have read/write permissions for the resource. * * Manages a Linode Lock which prevents accidental deletion and modification of resources. Locks protect against deletion, rebuild operations, and service transfers. The `cannotDeleteWithSubresources` lock type also protects subresources such as disks, configs, interfaces, and IP addresses. * * For more information, see the Linode APIv4 docs (TBD). * * > **Note** Only one lock can exist per resource at a time. You cannot have both `cannotDelete` and `cannotDeleteWithSubresources` locks on the same resource simultaneously. * * ## Example Usage * * Create a basic lock that prevents a Linode from being deleted: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const my_inst = new linode.Instance("my-inst", { * label: "my-inst", * region: "us-east", * type: "g6-nanode-1", * }); * const my_lock = new linode.Lock("my-lock", { * entityId: my_inst.id, * entityType: "linode", * lockType: "cannot_delete", * }); * ``` * * Create a lock that prevents a Linode and its subresources (disks, configs, etc.) from being deleted: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const my_inst = new linode.Instance("my-inst", { * label: "my-inst", * region: "us-east", * type: "g6-nanode-1", * }); * const my_lock = new linode.Lock("my-lock", { * entityId: my_inst.id, * entityType: "linode", * lockType: "cannot_delete_with_subresources", * }); * ``` * * ## Import * * Locks can be imported using the Lock's ID, e.g. * * ```sh * $ pulumi import linode:index/lock:Lock my-lock 1234567 * ``` */ export declare class Lock extends pulumi.CustomResource { /** * Get an existing Lock 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. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: LockState, opts?: pulumi.CustomResourceOptions): Lock; /** * Returns true if the given object is an instance of Lock. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Lock; /** * The ID of the entity to lock. */ readonly entityId: pulumi.Output<number>; /** * The label of the locked entity. */ readonly entityLabel: pulumi.Output<string>; /** * The type of the entity to lock. Currently only `linode` is supported. Note: Linodes that are part of an LKE cluster cannot be locked. */ readonly entityType: pulumi.Output<string>; /** * The URL of the locked entity. */ readonly entityUrl: pulumi.Output<string>; /** * The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are: */ readonly lockType: pulumi.Output<string>; /** * Create a Lock 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: LockArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Lock resources. */ export interface LockState { /** * The ID of the entity to lock. */ entityId?: pulumi.Input<number>; /** * The label of the locked entity. */ entityLabel?: pulumi.Input<string>; /** * The type of the entity to lock. Currently only `linode` is supported. Note: Linodes that are part of an LKE cluster cannot be locked. */ entityType?: pulumi.Input<string>; /** * The URL of the locked entity. */ entityUrl?: pulumi.Input<string>; /** * The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are: */ lockType?: pulumi.Input<string>; } /** * The set of arguments for constructing a Lock resource. */ export interface LockArgs { /** * The ID of the entity to lock. */ entityId: pulumi.Input<number>; /** * The type of the entity to lock. Currently only `linode` is supported. Note: Linodes that are part of an LKE cluster cannot be locked. */ entityType: pulumi.Input<string>; /** * The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are: */ lockType: pulumi.Input<string>; }