aws.apigatewayv2.Model
Explore with Pulumi AI
Manages an Amazon API Gateway Version 2 model.
Example Usage
Basic
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 pulumi
import json
import pulumi_aws as aws
example = aws.apigatewayv2.Model("example",
api_id=example_aws_apigatewayv2_api["id"],
content_type="application/json",
name="example",
schema=json.dumps({
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ExampleModel",
"type": "object",
"properties": {
"id": {
"type": "string",
},
},
}))
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ExampleModel",
"type": "object",
"properties": map[string]interface{}{
"id": map[string]interface{}{
"type": "string",
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = apigatewayv2.NewModel(ctx, "example", &apigatewayv2.ModelArgs{
ApiId: pulumi.Any(exampleAwsApigatewayv2Api.Id),
ContentType: pulumi.String("application/json"),
Name: pulumi.String("example"),
Schema: pulumi.String(json0),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.ApiGatewayV2.Model("example", new()
{
ApiId = exampleAwsApigatewayv2Api.Id,
ContentType = "application/json",
Name = "example",
Schema = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["$schema"] = "http://json-schema.org/draft-04/schema#",
["title"] = "ExampleModel",
["type"] = "object",
["properties"] = new Dictionary<string, object?>
{
["id"] = new Dictionary<string, object?>
{
["type"] = "string",
},
},
}),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigatewayv2.Model;
import com.pulumi.aws.apigatewayv2.ModelArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Model("example", ModelArgs.builder()
.apiId(exampleAwsApigatewayv2Api.id())
.contentType("application/json")
.name("example")
.schema(serializeJson(
jsonObject(
jsonProperty("$schema", "http://json-schema.org/draft-04/schema#"),
jsonProperty("title", "ExampleModel"),
jsonProperty("type", "object"),
jsonProperty("properties", jsonObject(
jsonProperty("id", jsonObject(
jsonProperty("type", "string")
))
))
)))
.build());
}
}
resources:
example:
type: aws:apigatewayv2:Model
properties:
apiId: ${exampleAwsApigatewayv2Api.id}
contentType: application/json
name: example
schema:
fn::toJSON:
$schema: http://json-schema.org/draft-04/schema#
title: ExampleModel
type: object
properties:
id:
type: string
Create Model Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Model(name: string, args: ModelArgs, opts?: CustomResourceOptions);
@overload
def Model(resource_name: str,
args: ModelArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Model(resource_name: str,
opts: Optional[ResourceOptions] = None,
api_id: Optional[str] = None,
content_type: Optional[str] = None,
schema: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None)
func NewModel(ctx *Context, name string, args ModelArgs, opts ...ResourceOption) (*Model, error)
public Model(string name, ModelArgs args, CustomResourceOptions? opts = null)
type: aws:apigatewayv2:Model
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- 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.
- args ModelArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control 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.
- name String
- The unique name of the resource.
- args ModelArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var awsModelResource = new Aws.ApiGatewayV2.Model("awsModelResource", new()
{
ApiId = "string",
ContentType = "string",
Schema = "string",
Description = "string",
Name = "string",
});
example, err := apigatewayv2.NewModel(ctx, "awsModelResource", &apigatewayv2.ModelArgs{
ApiId: pulumi.String("string"),
ContentType: pulumi.String("string"),
Schema: pulumi.String("string"),
Description: pulumi.String("string"),
Name: pulumi.String("string"),
})
var awsModelResource = new Model("awsModelResource", ModelArgs.builder()
.apiId("string")
.contentType("string")
.schema("string")
.description("string")
.name("string")
.build());
aws_model_resource = aws.apigatewayv2.Model("awsModelResource",
api_id="string",
content_type="string",
schema="string",
description="string",
name="string")
const awsModelResource = new aws.apigatewayv2.Model("awsModelResource", {
apiId: "string",
contentType: "string",
schema: "string",
description: "string",
name: "string",
});
type: aws:apigatewayv2:Model
properties:
apiId: string
contentType: string
description: string
name: string
schema: string
Model Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Model resource accepts the following input properties:
- Api
Id string - API identifier.
- Content
Type string - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - Schema string
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
- Description string
- Description of the model. Must be between 1 and 128 characters in length.
- Name string
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
- Api
Id string - API identifier.
- Content
Type string - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - Schema string
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
- Description string
- Description of the model. Must be between 1 and 128 characters in length.
- Name string
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
- api
Id String - API identifier.
- content
Type String - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - schema String
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
- description String
- Description of the model. Must be between 1 and 128 characters in length.
- name String
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
- api
Id string - API identifier.
- content
Type string - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - schema string
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
- description string
- Description of the model. Must be between 1 and 128 characters in length.
- name string
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
- api_
id str - API identifier.
- content_
type str - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - schema str
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
- description str
- Description of the model. Must be between 1 and 128 characters in length.
- name str
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
- api
Id String - API identifier.
- content
Type String - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - schema String
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
- description String
- Description of the model. Must be between 1 and 128 characters in length.
- name String
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
Outputs
All input properties are implicitly available as output properties. Additionally, the Model resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up 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): Model
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
api_id: Optional[str] = None,
content_type: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None,
schema: Optional[str] = None) -> Model
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)
public static Model get(String name, Output<String> id, ModelState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- Api
Id string - API identifier.
- Content
Type string - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - Description string
- Description of the model. Must be between 1 and 128 characters in length.
- Name string
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
- Schema string
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
- Api
Id string - API identifier.
- Content
Type string - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - Description string
- Description of the model. Must be between 1 and 128 characters in length.
- Name string
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
- Schema string
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
- api
Id String - API identifier.
- content
Type String - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - description String
- Description of the model. Must be between 1 and 128 characters in length.
- name String
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
- schema String
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
- api
Id string - API identifier.
- content
Type string - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - description string
- Description of the model. Must be between 1 and 128 characters in length.
- name string
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
- schema string
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
- api_
id str - API identifier.
- content_
type str - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - description str
- Description of the model. Must be between 1 and 128 characters in length.
- name str
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
- schema str
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
- api
Id String - API identifier.
- content
Type String - The content-type for the model, for example,
application/json
. Must be between 1 and 256 characters in length. - description String
- Description of the model. Must be between 1 and 128 characters in length.
- name String
- Name of the model. Must be alphanumeric. Must be between 1 and 128 characters in length.
- schema String
- Schema for the model. This should be a JSON schema draft 4 model. Must be less than or equal to 32768 characters in length.
Import
Using pulumi import
, import aws_apigatewayv2_model
using the API identifier and model identifier. For example:
$ pulumi import aws:apigatewayv2/model:Model example aabbccddee/1122334
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.