@pulumi/kubernetes
Version:
[](https://travis-ci.com/pulumi/pulumi-kubernetes) [](https://slack.pulumi.com) [![NPM
88 lines • 3.98 kB
JavaScript
;
// Copyright 2016-2020, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomResource = void 0;
// *** WARNING: this file was generated by pulumigen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* CustomResource represents an instance of a CustomResourceDefinition (CRD). For example, the
* CoreOS Prometheus operator exposes a CRD `monitoring.coreos.com/ServiceMonitor`; to
* instantiate this as a Pulumi resource, one could call `new CustomResource`, passing the
* `ServiceMonitor` resource definition as an argument.
*/
class CustomResource extends pulumi.CustomResource {
/**
* Get an existing CustomResource 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 opts Uniquely specifies a CustomResource to select.
*/
static get(name, opts) {
// NOTE: `selectOpts` will be type `pulumi.CustomResource`. If we add a field that does
// not satisfy that interface, it will cause a compilation error in `...selectOpts` in
// the constructor call below.
const { apiVersion, kind, id } = opts, selectOpts = __rest(opts, ["apiVersion", "kind", "id"]);
return new CustomResource(name, { apiVersion: apiVersion, kind: kind }, Object.assign(Object.assign({}, selectOpts), { id: id }));
}
getInputs() { return this.__inputs; }
/**
* Create a CustomResource 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, args, opts) {
let inputs = {};
opts = opts || {};
if (!opts.id) {
if ((!args || args.apiVersion === undefined) && !opts.urn) {
throw new Error("Missing required property 'apiVersion'");
}
if ((!args || args.kind === undefined) && !opts.urn) {
throw new Error("Missing required property 'kind'");
}
for (const key of Object.keys(args)) {
inputs[key] = args[key];
}
}
else {
for (const key of Object.keys(args)) {
inputs[key] = undefined;
}
}
if (!opts.version) {
opts = pulumi.mergeOptions(opts, { version: utilities.getVersion() });
}
super(`kubernetes:${args.apiVersion}:${args.kind}`, name, inputs, opts);
this.__inputs = args;
}
}
exports.CustomResource = CustomResource;
//# sourceMappingURL=customResource.js.map