UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

97 lines 3.62 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.Model = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a Model for a REST API Gateway. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const myDemoAPI = new aws.apigateway.RestApi("MyDemoAPI", { * name: "MyDemoAPI", * description: "This is my API for demonstration purposes", * }); * const myDemoModel = new aws.apigateway.Model("MyDemoModel", { * restApi: myDemoAPI.id, * name: "user", * description: "a JSON schema", * contentType: "application/json", * schema: JSON.stringify({ * type: "object", * }), * }); * ``` * * ## Import * * Using `pulumi import`, import `aws_api_gateway_model` using `REST-API-ID/NAME`. For example: * * ```sh * $ pulumi import aws:apigateway/model:Model example 12345abcde/example * ``` */ class Model extends pulumi.CustomResource { /** * Get an existing Model 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 Model(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Model. 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'] === Model.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["contentType"] = state?.contentType; resourceInputs["description"] = state?.description; resourceInputs["name"] = state?.name; resourceInputs["region"] = state?.region; resourceInputs["restApi"] = state?.restApi; resourceInputs["schema"] = state?.schema; } else { const args = argsOrState; if (args?.contentType === undefined && !opts.urn) { throw new Error("Missing required property 'contentType'"); } if (args?.restApi === undefined && !opts.urn) { throw new Error("Missing required property 'restApi'"); } resourceInputs["contentType"] = args?.contentType; resourceInputs["description"] = args?.description; resourceInputs["name"] = args?.name; resourceInputs["region"] = args?.region; resourceInputs["restApi"] = args?.restApi; resourceInputs["schema"] = args?.schema; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Model.__pulumiType, name, resourceInputs, opts); } } exports.Model = Model; /** @internal */ Model.__pulumiType = 'aws:apigateway/model:Model'; //# sourceMappingURL=model.js.map