Rest Api Put
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,
});Content copied to clipboard
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"])Content copied to clipboard
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,
});
});Content copied to clipboard
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
})
}Content copied to clipboard
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());
}
}Content copied to clipboard
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}Content copied to clipboard
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-12345678Content copied to clipboard
Properties
Link copied to clipboard
Whether to rollback the API update when a warning is encountered. The default value is false.
Link copied to clipboard
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
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard