@pulumi/docker
Version:
A Pulumi package for interacting with Docker in Pulumi programs
123 lines • 3.79 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, { ...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?.auth;
resourceInputs["convergeConfig"] = state?.convergeConfig;
resourceInputs["endpointSpec"] = state?.endpointSpec;
resourceInputs["labels"] = state?.labels;
resourceInputs["mode"] = state?.mode;
resourceInputs["name"] = state?.name;
resourceInputs["rollbackConfig"] = state?.rollbackConfig;
resourceInputs["taskSpec"] = state?.taskSpec;
resourceInputs["updateConfig"] = state?.updateConfig;
}
else {
const args = argsOrState;
if (args?.taskSpec === undefined && !opts.urn) {
throw new Error("Missing required property 'taskSpec'");
}
resourceInputs["auth"] = args?.auth;
resourceInputs["convergeConfig"] = args?.convergeConfig;
resourceInputs["endpointSpec"] = args?.endpointSpec;
resourceInputs["labels"] = args?.labels;
resourceInputs["mode"] = args?.mode;
resourceInputs["name"] = args?.name;
resourceInputs["rollbackConfig"] = args?.rollbackConfig;
resourceInputs["taskSpec"] = args?.taskSpec;
resourceInputs["updateConfig"] = args?.updateConfig;
}
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
;