RestApiPutArgs

data class RestApiPutArgs(val body: Output<String>? = null, val failOnWarnings: Output<Boolean>? = null, val parameters: Output<Map<String, String>>? = null, val restApiId: Output<String>? = null, val timeouts: Output<RestApiPutTimeoutsArgs>? = null, val triggers: Output<Map<String, String>>? = null) : ConvertibleToJava<RestApiPutArgs>

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.apigateway.RestApiPut("example", {
body: JSON.stringify({
swagger: "2.0",
info: {
title: "Example API",
version: "v1",
},
schemes: ["https"],
paths: {
"/example": {
get: {
responses: {
"200": {
description: "OK",
},
},
"x-amazon-apigateway-integration": {
httpMethod: "GET",
type: "HTTP",
responses: {
"default": {
statusCode: 200,
},
},
uri: "https://api.example.com/",
},
},
},
},
}),
failOnWarnings: true,
restApiId: exampleAwsApiGatewayRestApi.id,
});
import pulumi
import json
import pulumi_aws as aws
example = aws.apigateway.RestApiPut("example",
body=json.dumps({
"swagger": "2.0",
"info": {
"title": "Example API",
"version": "v1",
},
"schemes": ["https"],
"paths": {
"/example": {
"get": {
"responses": {
"200": {
"description": "OK",
},
},
"x-amazon-apigateway-integration": {
"httpMethod": "GET",
"type": "HTTP",
"responses": {
"default": {
"statusCode": 200,
},
},
"uri": "https://api.example.com/",
},
},
},
},
}),
fail_on_warnings=True,
rest_api_id=example_aws_api_gateway_rest_api["id"])
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.ApiGateway.RestApiPut("example", new()
{
Body = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["swagger"] = "2.0",
["info"] = new Dictionary<string, object?>
{
["title"] = "Example API",
["version"] = "v1",
},
["schemes"] = new[]
{
"https",
},
["paths"] = new Dictionary<string, object?>
{
["/example"] = new Dictionary<string, object?>
{
["get"] = new Dictionary<string, object?>
{
["responses"] = new Dictionary<string, object?>
{
["200"] = new Dictionary<string, object?>
{
["description"] = "OK",
},
},
["x-amazon-apigateway-integration"] = new Dictionary<string, object?>
{
["httpMethod"] = "GET",
["type"] = "HTTP",
["responses"] = new Dictionary<string, object?>
{
["default"] = new Dictionary<string, object?>
{
["statusCode"] = 200,
},
},
["uri"] = "https://api.example.com/",
},
},
},
},
}),
FailOnWarnings = true,
RestApiId = exampleAwsApiGatewayRestApi.Id,
});
});
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"swagger": "2.0",
"info": map[string]interface{}{
"title": "Example API",
"version": "v1",
},
"schemes": []string{
"https",
},
"paths": map[string]interface{}{
"/example": map[string]interface{}{
"get": map[string]interface{}{
"responses": map[string]interface{}{
"200": map[string]interface{}{
"description": "OK",
},
},
"x-amazon-apigateway-integration": map[string]interface{}{
"httpMethod": "GET",
"type": "HTTP",
"responses": map[string]interface{}{
"default": map[string]interface{}{
"statusCode": 200,
},
},
"uri": "https://api.example.com/",
},
},
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = apigateway.NewRestApiPut(ctx, "example", &apigateway.RestApiPutArgs{
Body: pulumi.String(json0),
FailOnWarnings: pulumi.Bool(true),
RestApiId: pulumi.Any(exampleAwsApiGatewayRestApi.Id),
})
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.apigateway.RestApiPut;
import com.pulumi.aws.apigateway.RestApiPutArgs;
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 RestApiPut("example", RestApiPutArgs.builder()
.body(serializeJson(
jsonObject(
jsonProperty("swagger", "2.0"),
jsonProperty("info", jsonObject(
jsonProperty("title", "Example API"),
jsonProperty("version", "v1")
)),
jsonProperty("schemes", jsonArray("https")),
jsonProperty("paths", jsonObject(
jsonProperty("/example", jsonObject(
jsonProperty("get", jsonObject(
jsonProperty("responses", jsonObject(
jsonProperty("200", jsonObject(
jsonProperty("description", "OK")
))
)),
jsonProperty("x-amazon-apigateway-integration", jsonObject(
jsonProperty("httpMethod", "GET"),
jsonProperty("type", "HTTP"),
jsonProperty("responses", jsonObject(
jsonProperty("default", jsonObject(
jsonProperty("statusCode", 200)
))
)),
jsonProperty("uri", "https://api.example.com/")
))
))
))
))
)))
.failOnWarnings(true)
.restApiId(exampleAwsApiGatewayRestApi.id())
.build());
}
}
resources:
example:
type: aws:apigateway:RestApiPut
properties:
body:
fn::toJSON:
swagger: '2.0'
info:
title: Example API
version: v1
schemes:
- https
paths:
/example:
get:
responses:
'200':
description: OK
x-amazon-apigateway-integration:
httpMethod: GET
type: HTTP
responses:
default:
statusCode: 200
uri: https://api.example.com/
failOnWarnings: true
restApiId: ${exampleAwsApiGatewayRestApi.id}

Import

Using pulumi import, import API Gateway REST API Put using the rest_api_id. For example:

$ pulumi import aws:apigateway/restApiPut:RestApiPut example import-id-12345678

Constructors

Link copied to clipboard
constructor(body: Output<String>? = null, failOnWarnings: Output<Boolean>? = null, parameters: Output<Map<String, String>>? = null, restApiId: Output<String>? = null, timeouts: Output<RestApiPutTimeoutsArgs>? = null, triggers: Output<Map<String, String>>? = null)

Properties

Link copied to clipboard
val body: Output<String>? = null

PUT request body containing external API definitions. Currently, only OpenAPI definition JSON/YAML files are supported. The maximum size of the API definition file is 6MB.

Link copied to clipboard
val failOnWarnings: Output<Boolean>? = null

Whether to rollback the API update when a warning is encountered. The default value is false.

Link copied to clipboard
val parameters: Output<Map<String, String>>? = null

Map of customizations for importing the specification in the body argument. For example, to exclude DocumentationParts from an imported API, use ignore = "documentation". Additional documentation, including other parameters such as basepath, can be found in the API Gateway Developer Guide.

Link copied to clipboard
val restApiId: Output<String>? = null

Identifier of the associated REST API. The following arguments are optional:

Link copied to clipboard
val timeouts: Output<RestApiPutTimeoutsArgs>? = null
Link copied to clipboard
val triggers: Output<Map<String, String>>? = null

Map of arbitrary keys and values that, when changed, will trigger a redeployment. To force a redeployment without changing these keys/values, use the -replace option with pulumi preview or pulumi up.

Functions

Link copied to clipboard
open override fun toJava(): RestApiPutArgs