@pulumi/docker
Version:
A Pulumi package for interacting with Docker in Pulumi programs
102 lines • 3.44 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Volume = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* <!-- Bug: Type and Name are switched -->
* Creates and destroys a volume in Docker. This can be used alongside docker.Container to prepare volumes that can be shared across containers.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker from "@pulumi/docker";
*
* const sharedVolume = new docker.Volume("shared_volume", {name: "shared_volume"});
* ```
*
* ## Import
*
* ### Example
*
* Assuming you created a `volume` as follows
*
* #!/bin/bash
*
* docker volume create
*
* prints the long ID
*
* 524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d
*
* you provide the definition for the resource as follows
*
* terraform
*
* resource "docker_volume" "foo" {
*
* name = "524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d"
*
* }
*
* then the import command is as follows
*
* #!/bin/bash
*
* ```sh
* $ pulumi import docker:index/volume:Volume foo 524b0457aa2a87dd2b75c74c3e4e53f406974249e63ab3ed9bf21e5644f9dc7d
* ```
*/
class Volume extends pulumi.CustomResource {
/**
* Get an existing Volume 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, id, state, opts) {
return new Volume(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Volume. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Volume.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["driver"] = state?.driver;
resourceInputs["driverOpts"] = state?.driverOpts;
resourceInputs["labels"] = state?.labels;
resourceInputs["mountpoint"] = state?.mountpoint;
resourceInputs["name"] = state?.name;
}
else {
const args = argsOrState;
resourceInputs["driver"] = args?.driver;
resourceInputs["driverOpts"] = args?.driverOpts;
resourceInputs["labels"] = args?.labels;
resourceInputs["name"] = args?.name;
resourceInputs["mountpoint"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Volume.__pulumiType, name, resourceInputs, opts);
}
}
exports.Volume = Volume;
/** @internal */
Volume.__pulumiType = 'docker:index/volume:Volume';
//# sourceMappingURL=volume.js.map
;