UNPKG

@pulumi/openstack

Version:

A Pulumi package for creating and managing OpenStack cloud resources.

109 lines 4.75 kB
"use strict"; // *** 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.Flavor = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a V2 flavor resource within OpenStack. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as openstack from "@pulumi/openstack"; * * const test_flavor = new openstack.compute.Flavor("test-flavor", { * name: "my-flavor", * ram: 8096, * vcpus: 2, * disk: 20, * extraSpecs: { * "hw:cpu_policy": "CPU-POLICY", * "hw:cpu_thread_policy": "CPU-THREAD-POLICY", * }, * }); * ``` * * ## Import * * Flavors can be imported using the `ID`, e.g. * * ```sh * $ pulumi import openstack:compute/flavor:Flavor my-flavor 4142e64b-1b35-44a0-9b1e-5affc7af1106 * ``` */ class Flavor extends pulumi.CustomResource { /** * Get an existing Flavor 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 Flavor(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Flavor. 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'] === Flavor.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["disk"] = state ? state.disk : undefined; resourceInputs["ephemeral"] = state ? state.ephemeral : undefined; resourceInputs["extraSpecs"] = state ? state.extraSpecs : undefined; resourceInputs["flavorId"] = state ? state.flavorId : undefined; resourceInputs["isPublic"] = state ? state.isPublic : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["ram"] = state ? state.ram : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["rxTxFactor"] = state ? state.rxTxFactor : undefined; resourceInputs["swap"] = state ? state.swap : undefined; resourceInputs["vcpus"] = state ? state.vcpus : undefined; } else { const args = argsOrState; if ((!args || args.disk === undefined) && !opts.urn) { throw new Error("Missing required property 'disk'"); } if ((!args || args.ram === undefined) && !opts.urn) { throw new Error("Missing required property 'ram'"); } if ((!args || args.vcpus === undefined) && !opts.urn) { throw new Error("Missing required property 'vcpus'"); } resourceInputs["description"] = args ? args.description : undefined; resourceInputs["disk"] = args ? args.disk : undefined; resourceInputs["ephemeral"] = args ? args.ephemeral : undefined; resourceInputs["extraSpecs"] = args ? args.extraSpecs : undefined; resourceInputs["flavorId"] = args ? args.flavorId : undefined; resourceInputs["isPublic"] = args ? args.isPublic : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["ram"] = args ? args.ram : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["rxTxFactor"] = args ? args.rxTxFactor : undefined; resourceInputs["swap"] = args ? args.swap : undefined; resourceInputs["vcpus"] = args ? args.vcpus : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Flavor.__pulumiType, name, resourceInputs, opts); } } exports.Flavor = Flavor; /** @internal */ Flavor.__pulumiType = 'openstack:compute/flavor:Flavor'; //# sourceMappingURL=flavor.js.map