Model
Manages an Amazon API Gateway Version 2 model.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Model("example", new Aws.ApiGatewayV2.ModelArgs
{
ApiId = aws_apigatewayv2_api.Example.Id,
ContentType = "application/json",
Schema = @"{
""$schema"": ""http://json-schema.org/draft-04/schema#"",
""title"": ""ExampleModel"",
""type"": ""object"",
""properties"": {
""id"": { ""type"": ""string"" }
}
}
",
});
}
}
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/apigatewayv2"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := apigatewayv2.NewModel(ctx, "example", &apigatewayv2.ModelArgs{
ApiId: pulumi.String(aws_apigatewayv2_api.Example.Id),
ContentType: pulumi.String("application/json"),
Schema: pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v", "{\n", " \"", "$", "schema\": \"http://json-schema.org/draft-04/schema#\",\n", " \"title\": \"ExampleModel\",\n", " \"type\": \"object\",\n", " \"properties\": {\n", " \"id\": { \"type\": \"string\" }\n", " }\n", "}\n", "\n")),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example = aws.apigatewayv2.Model("example",
api_id=aws_apigatewayv2_api["example"]["id"],
content_type="application/json",
schema="""{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ExampleModel",
"type": "object",
"properties": {
"id": { "type": "string" }
}
}
""")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.apigatewayv2.Model("example", {
apiId: aws_apigatewayv2_api_example.id,
contentType: "application/json",
schema: `{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ExampleModel",
"type": "object",
"properties": {
"id": { "type": "string" }
}
}
`,
});Create a Model Resource
new Model(name: string, args: ModelArgs, opts?: CustomResourceOptions);def Model(resource_name, opts=None, api_id=None, content_type=None, description=None, name=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:
- Api
Id string The API identifier.
- Content
Type string The content-type for the model, for example,
application/json.- Schema string
The schema for the model. This should be a JSON schema draft 4 model.
- Description string
The description of the model.
- Name string
The name of the model. Must be alphanumeric.
- Api
Id string The API identifier.
- Content
Type string The content-type for the model, for example,
application/json.- Schema string
The schema for the model. This should be a JSON schema draft 4 model.
- Description string
The description of the model.
- Name string
The name of the model. Must be alphanumeric.
- api
Id string The API identifier.
- content
Type string The content-type for the model, for example,
application/json.- schema string
The schema for the model. This should be a JSON schema draft 4 model.
- description string
The description of the model.
- name string
The name of the model. Must be alphanumeric.
- api_
id str The API identifier.
- content_
type str The content-type for the model, for example,
application/json.- schema str
The schema for the model. This should be a JSON schema draft 4 model.
- description str
The description of the model.
- name str
The name of the model. Must be alphanumeric.
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, api_id=None, content_type=None, description=None, name=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:
- Api
Id string The API identifier.
- Content
Type string The content-type for the model, for example,
application/json.- Description string
The description of the model.
- Name string
The name of the model. Must be alphanumeric.
- Schema string
The schema for the model. This should be a JSON schema draft 4 model.
- Api
Id string The API identifier.
- Content
Type string The content-type for the model, for example,
application/json.- Description string
The description of the model.
- Name string
The name of the model. Must be alphanumeric.
- Schema string
The schema for the model. This should be a JSON schema draft 4 model.
- api
Id string The API identifier.
- content
Type string The content-type for the model, for example,
application/json.- description string
The description of the model.
- name string
The name of the model. Must be alphanumeric.
- schema string
The schema for the model. This should be a JSON schema draft 4 model.
- api_
id str The API identifier.
- content_
type str The content-type for the model, for example,
application/json.- description str
The description of the model.
- name str
The name of the model. Must be alphanumeric.
- schema str
The schema for the model. This should be a JSON schema draft 4 model.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.