@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
97 lines • 3.89 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.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, Object.assign(Object.assign({}, 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 ? state.contentType : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["restApi"] = state ? state.restApi : undefined;
resourceInputs["schema"] = state ? state.schema : undefined;
}
else {
const args = argsOrState;
if ((!args || args.contentType === undefined) && !opts.urn) {
throw new Error("Missing required property 'contentType'");
}
if ((!args || args.restApi === undefined) && !opts.urn) {
throw new Error("Missing required property 'restApi'");
}
resourceInputs["contentType"] = args ? args.contentType : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["restApi"] = args ? args.restApi : undefined;
resourceInputs["schema"] = args ? args.schema : undefined;
}
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