@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
104 lines • 3.93 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");
/**
* Manages an Amazon API Gateway Version 2 [model](https://docs.aws.amazon.com/apigateway/latest/developerguide/models-mappings.html#models-mappings-models).
*
* ## Example Usage
*
* ### Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.apigatewayv2.Model("example", {
* apiId: exampleAwsApigatewayv2Api.id,
* contentType: "application/json",
* name: "example",
* schema: JSON.stringify({
* $schema: "http://json-schema.org/draft-04/schema#",
* title: "ExampleModel",
* type: "object",
* properties: {
* id: {
* type: "string",
* },
* },
* }),
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import `aws_apigatewayv2_model` using the API identifier and model identifier. For example:
*
* ```sh
* $ pulumi import aws:apigatewayv2/model:Model example aabbccddee/1122334
* ```
*/
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["apiId"] = state?.apiId;
resourceInputs["contentType"] = state?.contentType;
resourceInputs["description"] = state?.description;
resourceInputs["name"] = state?.name;
resourceInputs["region"] = state?.region;
resourceInputs["schema"] = state?.schema;
}
else {
const args = argsOrState;
if (args?.apiId === undefined && !opts.urn) {
throw new Error("Missing required property 'apiId'");
}
if (args?.contentType === undefined && !opts.urn) {
throw new Error("Missing required property 'contentType'");
}
if (args?.schema === undefined && !opts.urn) {
throw new Error("Missing required property 'schema'");
}
resourceInputs["apiId"] = args?.apiId;
resourceInputs["contentType"] = args?.contentType;
resourceInputs["description"] = args?.description;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
resourceInputs["schema"] = args?.schema;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Model.__pulumiType, name, resourceInputs, opts);
}
}
exports.Model = Model;
/** @internal */
Model.__pulumiType = 'aws:apigatewayv2/model:Model';
//# sourceMappingURL=model.js.map
;