aws logo
AWS Classic v5.32.0, Mar 17 23

aws.apigatewayv2.Model

Manages an Amazon API Gateway Version 2 model.

Example Usage

Basic

using System.Collections.Generic;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.ApiGatewayV2.Model("example", new()
    {
        ApiId = aws_apigatewayv2_api.Example.Id,
        ContentType = "application/json",
        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 main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v5/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(aws_apigatewayv2_api.Example.Id),
			ContentType: pulumi.String("application/json"),
			Schema:      pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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(aws_apigatewayv2_api.example().id())
            .contentType("application/json")
            .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());

    }
}
import pulumi
import json
import pulumi_aws as aws

example = aws.apigatewayv2.Model("example",
    api_id=aws_apigatewayv2_api["example"]["id"],
    content_type="application/json",
    schema=json.dumps({
        "$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: JSON.stringify({
        $schema: "http://json-schema.org/draft-04/schema#",
        title: "ExampleModel",
        type: "object",
        properties: {
            id: {
                type: "string",
            },
        },
    }),
});
resources:
  example:
    type: aws:apigatewayv2:Model
    properties:
      apiId: ${aws_apigatewayv2_api.example.id}
      contentType: application/json
      schema:
        fn::toJSON:
          $schema: http://json-schema.org/draft-04/schema#
          title: ExampleModel
          type: object
          properties:
            id:
              type: string

Create Model Resource

new Model(name: string, args: ModelArgs, opts?: CustomResourceOptions);
@overload
def Model(resource_name: 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)
@overload
def Model(resource_name: str,
          args: ModelArgs,
          opts: Optional[ResourceOptions] = None)
func NewModel(ctx *Context, name string, args ModelArgs, opts ...ResourceOption) (*Model, error)
public Model(string name, ModelArgs args, CustomResourceOptions? opts = null)
public Model(String name, ModelArgs args)
public Model(String name, ModelArgs args, CustomResourceOptions options)
type: aws:apigatewayv2:Model
properties: # The arguments to resource properties.
options: # 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.
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.

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

The Model resource accepts the following input properties:

ApiId string

API identifier.

ContentType 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.

ApiId string

API identifier.

ContentType 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.

apiId String

API identifier.

contentType 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.

apiId string

API identifier.

contentType 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.

apiId String

API identifier.

contentType 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.
The following state arguments are supported:
ApiId string

API identifier.

ContentType 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.

ApiId string

API identifier.

ContentType 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.

apiId String

API identifier.

contentType 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.

apiId string

API identifier.

contentType 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.

apiId String

API identifier.

contentType 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

aws_apigatewayv2_model can be imported by using the API identifier and model identifier, e.g.,

 $ pulumi import aws:apigatewayv2/model:Model example aabbccddee/1122334

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.