Model
Provides a Model for a REST API Gateway.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var myDemoModel = new Aws.ApiGateway.Model("myDemoModel", new Aws.ApiGateway.ModelArgs
{
ContentType = "application/json",
Description = "a JSON schema",
RestApi = myDemoAPI.Id,
Schema = @"{
""type"": ""object""
}
",
});
}
}
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/apigateway"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myDemoAPI, err := apigateway.NewRestApi(ctx, "myDemoAPI", &apigateway.RestApiArgs{
Description: pulumi.String("This is my API for demonstration purposes"),
})
if err != nil {
return err
}
_, err = apigateway.NewModel(ctx, "myDemoModel", &apigateway.ModelArgs{
ContentType: pulumi.String("application/json"),
Description: pulumi.String("a JSON schema"),
RestApi: myDemoAPI.ID(),
Schema: pulumi.String(fmt.Sprintf("%v%v%v%v", "{\n", " \"type\": \"object\"\n", "}\n", "\n")),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
my_demo_api = aws.apigateway.RestApi("myDemoAPI", description="This is my API for demonstration purposes")
my_demo_model = aws.apigateway.Model("myDemoModel",
content_type="application/json",
description="a JSON schema",
rest_api=my_demo_api.id,
schema="""{
"type": "object"
}
""")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const myDemoAPI = new aws.apigateway.RestApi("MyDemoAPI", {
description: "This is my API for demonstration purposes",
});
const myDemoModel = new aws.apigateway.Model("MyDemoModel", {
contentType: "application/json",
description: "a JSON schema",
restApi: myDemoAPI.id,
schema: `{
"type": "object"
}
`,
});Create a Model Resource
new Model(name: string, args: ModelArgs, opts?: CustomResourceOptions);def Model(resource_name, opts=None, content_type=None, description=None, name=None, rest_api=None, schema=None, __props__=None);public Model(string name, ModelArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args ModelArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ModelArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ModelArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Model Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Model resource accepts the following input properties:
- Content
Type string The content type of the model
- Rest
Api string The ID of the associated REST API
- Description string
The description of the model
- Name string
The name of the model
- Schema string
The schema of the model in a JSON form
- Content
Type string The content type of the model
- Rest
Api interface{} The ID of the associated REST API
- Description string
The description of the model
- Name string
The name of the model
- Schema string
The schema of the model in a JSON form
- content
Type string The content type of the model
- rest
Api string | RestApi The ID of the associated REST API
- description string
The description of the model
- name string
The name of the model
- schema string
The schema of the model in a JSON form
- content_
type str The content type of the model
- rest_
api string | str The ID of the associated REST API
- description str
The description of the model
- name str
The name of the model
- schema str
The schema of the model in a JSON form
Outputs
All input properties are implicitly available as output properties. Additionally, the Model resource produces the following output properties:
Look up an Existing Model Resource
Get an existing Model resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ModelState, opts?: CustomResourceOptions): Modelstatic get(resource_name, id, opts=None, content_type=None, description=None, name=None, rest_api=None, schema=None, __props__=None);func GetModel(ctx *Context, name string, id IDInput, state *ModelState, opts ...ResourceOption) (*Model, error)public static Model Get(string name, Input<string> id, ModelState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Content
Type string The content type of the model
- Description string
The description of the model
- Name string
The name of the model
- Rest
Api string The ID of the associated REST API
- Schema string
The schema of the model in a JSON form
- Content
Type string The content type of the model
- Description string
The description of the model
- Name string
The name of the model
- Rest
Api interface{} The ID of the associated REST API
- Schema string
The schema of the model in a JSON form
- content
Type string The content type of the model
- description string
The description of the model
- name string
The name of the model
- rest
Api string | RestApi The ID of the associated REST API
- schema string
The schema of the model in a JSON form
- content_
type str The content type of the model
- description str
The description of the model
- name str
The name of the model
- rest_
api string | str The ID of the associated REST API
- schema str
The schema of the model in a JSON form
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.