@pulumi/docker
Version:
A Pulumi package for interacting with Docker in Pulumi programs
123 lines • 4.17 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.Service = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* ## Import
*
* ### Example
*
* Assuming you created a `service` as follows
*
* #!/bin/bash
*
* docker service create --name foo -p 8080:80 nginx
*
* prints th ID
*
* 4pcphbxkfn2rffhbhe6czytgi
*
* you provide the definition for the resource as follows
*
* terraform
*
* resource "docker_service" "foo" {
*
* name = "foo"
*
* task_spec {
*
* container_spec {
*
* image = "nginx"
*
* }
*
* }
*
* endpoint_spec {
*
* ports {
*
* target_port = "80"
*
* published_port = "8080"
*
* }
*
* }
*
* }
*
* then the import command is as follows
*
* #!/bin/bash
*
* ```sh
* $ pulumi import docker:index/service:Service foo 4pcphbxkfn2rffhbhe6czytgi
* ```
*/
class Service extends pulumi.CustomResource {
/**
* Get an existing Service 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 Service(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Service. 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'] === Service.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["auth"] = state ? state.auth : undefined;
resourceInputs["convergeConfig"] = state ? state.convergeConfig : undefined;
resourceInputs["endpointSpec"] = state ? state.endpointSpec : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["mode"] = state ? state.mode : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["rollbackConfig"] = state ? state.rollbackConfig : undefined;
resourceInputs["taskSpec"] = state ? state.taskSpec : undefined;
resourceInputs["updateConfig"] = state ? state.updateConfig : undefined;
}
else {
const args = argsOrState;
if ((!args || args.taskSpec === undefined) && !opts.urn) {
throw new Error("Missing required property 'taskSpec'");
}
resourceInputs["auth"] = args ? args.auth : undefined;
resourceInputs["convergeConfig"] = args ? args.convergeConfig : undefined;
resourceInputs["endpointSpec"] = args ? args.endpointSpec : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["mode"] = args ? args.mode : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["rollbackConfig"] = args ? args.rollbackConfig : undefined;
resourceInputs["taskSpec"] = args ? args.taskSpec : undefined;
resourceInputs["updateConfig"] = args ? args.updateConfig : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Service.__pulumiType, name, resourceInputs, opts);
}
}
exports.Service = Service;
/** @internal */
Service.__pulumiType = 'docker:index/service:Service';
//# sourceMappingURL=service.js.map