1. Packages
  2. AWS
  3. API Docs
  4. apigateway
  5. DocumentationPart
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.apigateway.DocumentationPart

Explore with Pulumi AI

Provides a settings of an API Gateway Documentation Part.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleRestApi = new aws.apigateway.RestApi("example", {name: "example_api"});
const example = new aws.apigateway.DocumentationPart("example", {
    location: {
        type: "METHOD",
        method: "GET",
        path: "/example",
    },
    properties: "{\"description\":\"Example description\"}",
    restApiId: exampleRestApi.id,
});
Copy
import pulumi
import pulumi_aws as aws

example_rest_api = aws.apigateway.RestApi("example", name="example_api")
example = aws.apigateway.DocumentationPart("example",
    location={
        "type": "METHOD",
        "method": "GET",
        "path": "/example",
    },
    properties="{\"description\":\"Example description\"}",
    rest_api_id=example_rest_api.id)
Copy
package main

import (
	"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 {
		exampleRestApi, err := apigateway.NewRestApi(ctx, "example", &apigateway.RestApiArgs{
			Name: pulumi.String("example_api"),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewDocumentationPart(ctx, "example", &apigateway.DocumentationPartArgs{
			Location: &apigateway.DocumentationPartLocationArgs{
				Type:   pulumi.String("METHOD"),
				Method: pulumi.String("GET"),
				Path:   pulumi.String("/example"),
			},
			Properties: pulumi.String("{\"description\":\"Example description\"}"),
			RestApiId:  exampleRestApi.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var exampleRestApi = new Aws.ApiGateway.RestApi("example", new()
    {
        Name = "example_api",
    });

    var example = new Aws.ApiGateway.DocumentationPart("example", new()
    {
        Location = new Aws.ApiGateway.Inputs.DocumentationPartLocationArgs
        {
            Type = "METHOD",
            Method = "GET",
            Path = "/example",
        },
        Properties = "{\"description\":\"Example description\"}",
        RestApiId = exampleRestApi.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigateway.RestApi;
import com.pulumi.aws.apigateway.RestApiArgs;
import com.pulumi.aws.apigateway.DocumentationPart;
import com.pulumi.aws.apigateway.DocumentationPartArgs;
import com.pulumi.aws.apigateway.inputs.DocumentationPartLocationArgs;
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 exampleRestApi = new RestApi("exampleRestApi", RestApiArgs.builder()
            .name("example_api")
            .build());

        var example = new DocumentationPart("example", DocumentationPartArgs.builder()
            .location(DocumentationPartLocationArgs.builder()
                .type("METHOD")
                .method("GET")
                .path("/example")
                .build())
            .properties("{\"description\":\"Example description\"}")
            .restApiId(exampleRestApi.id())
            .build());

    }
}
Copy
resources:
  example:
    type: aws:apigateway:DocumentationPart
    properties:
      location:
        type: METHOD
        method: GET
        path: /example
      properties: '{"description":"Example description"}'
      restApiId: ${exampleRestApi.id}
  exampleRestApi:
    type: aws:apigateway:RestApi
    name: example
    properties:
      name: example_api
Copy

Create DocumentationPart Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new DocumentationPart(name: string, args: DocumentationPartArgs, opts?: CustomResourceOptions);
@overload
def DocumentationPart(resource_name: str,
                      args: DocumentationPartArgs,
                      opts: Optional[ResourceOptions] = None)

@overload
def DocumentationPart(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      location: Optional[DocumentationPartLocationArgs] = None,
                      properties: Optional[str] = None,
                      rest_api_id: Optional[str] = None)
func NewDocumentationPart(ctx *Context, name string, args DocumentationPartArgs, opts ...ResourceOption) (*DocumentationPart, error)
public DocumentationPart(string name, DocumentationPartArgs args, CustomResourceOptions? opts = null)
public DocumentationPart(String name, DocumentationPartArgs args)
public DocumentationPart(String name, DocumentationPartArgs args, CustomResourceOptions options)
type: aws:apigateway:DocumentationPart
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. DocumentationPartArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. DocumentationPartArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. DocumentationPartArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. DocumentationPartArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. DocumentationPartArgs
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 documentationPartResource = new Aws.ApiGateway.DocumentationPart("documentationPartResource", new()
{
    Location = new Aws.ApiGateway.Inputs.DocumentationPartLocationArgs
    {
        Type = "string",
        Method = "string",
        Name = "string",
        Path = "string",
        StatusCode = "string",
    },
    Properties = "string",
    RestApiId = "string",
});
Copy
example, err := apigateway.NewDocumentationPart(ctx, "documentationPartResource", &apigateway.DocumentationPartArgs{
	Location: &apigateway.DocumentationPartLocationArgs{
		Type:       pulumi.String("string"),
		Method:     pulumi.String("string"),
		Name:       pulumi.String("string"),
		Path:       pulumi.String("string"),
		StatusCode: pulumi.String("string"),
	},
	Properties: pulumi.String("string"),
	RestApiId:  pulumi.String("string"),
})
Copy
var documentationPartResource = new DocumentationPart("documentationPartResource", DocumentationPartArgs.builder()
    .location(DocumentationPartLocationArgs.builder()
        .type("string")
        .method("string")
        .name("string")
        .path("string")
        .statusCode("string")
        .build())
    .properties("string")
    .restApiId("string")
    .build());
Copy
documentation_part_resource = aws.apigateway.DocumentationPart("documentationPartResource",
    location={
        "type": "string",
        "method": "string",
        "name": "string",
        "path": "string",
        "status_code": "string",
    },
    properties="string",
    rest_api_id="string")
Copy
const documentationPartResource = new aws.apigateway.DocumentationPart("documentationPartResource", {
    location: {
        type: "string",
        method: "string",
        name: "string",
        path: "string",
        statusCode: "string",
    },
    properties: "string",
    restApiId: "string",
});
Copy
type: aws:apigateway:DocumentationPart
properties:
    location:
        method: string
        name: string
        path: string
        statusCode: string
        type: string
    properties: string
    restApiId: string
Copy

DocumentationPart 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 DocumentationPart resource accepts the following input properties:

Location
This property is required.
Changes to this property will trigger replacement.
DocumentationPartLocation
Location of the targeted API entity of the to-be-created documentation part. See below.
Properties This property is required. string
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
RestApiId
This property is required.
Changes to this property will trigger replacement.
string
ID of the associated Rest API
Location
This property is required.
Changes to this property will trigger replacement.
DocumentationPartLocationArgs
Location of the targeted API entity of the to-be-created documentation part. See below.
Properties This property is required. string
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
RestApiId
This property is required.
Changes to this property will trigger replacement.
string
ID of the associated Rest API
location
This property is required.
Changes to this property will trigger replacement.
DocumentationPartLocation
Location of the targeted API entity of the to-be-created documentation part. See below.
properties This property is required. String
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
restApiId
This property is required.
Changes to this property will trigger replacement.
String
ID of the associated Rest API
location
This property is required.
Changes to this property will trigger replacement.
DocumentationPartLocation
Location of the targeted API entity of the to-be-created documentation part. See below.
properties This property is required. string
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
restApiId
This property is required.
Changes to this property will trigger replacement.
string
ID of the associated Rest API
location
This property is required.
Changes to this property will trigger replacement.
DocumentationPartLocationArgs
Location of the targeted API entity of the to-be-created documentation part. See below.
properties This property is required. str
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
rest_api_id
This property is required.
Changes to this property will trigger replacement.
str
ID of the associated Rest API
location
This property is required.
Changes to this property will trigger replacement.
Property Map
Location of the targeted API entity of the to-be-created documentation part. See below.
properties This property is required. String
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
restApiId
This property is required.
Changes to this property will trigger replacement.
String
ID of the associated Rest API

Outputs

All input properties are implicitly available as output properties. Additionally, the DocumentationPart resource produces the following output properties:

DocumentationPartId string
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
Id string
The provider-assigned unique ID for this managed resource.
DocumentationPartId string
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
Id string
The provider-assigned unique ID for this managed resource.
documentationPartId String
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
id String
The provider-assigned unique ID for this managed resource.
documentationPartId string
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
id string
The provider-assigned unique ID for this managed resource.
documentation_part_id str
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
id str
The provider-assigned unique ID for this managed resource.
documentationPartId String
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing DocumentationPart Resource

Get an existing DocumentationPart 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?: DocumentationPartState, opts?: CustomResourceOptions): DocumentationPart
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        documentation_part_id: Optional[str] = None,
        location: Optional[DocumentationPartLocationArgs] = None,
        properties: Optional[str] = None,
        rest_api_id: Optional[str] = None) -> DocumentationPart
func GetDocumentationPart(ctx *Context, name string, id IDInput, state *DocumentationPartState, opts ...ResourceOption) (*DocumentationPart, error)
public static DocumentationPart Get(string name, Input<string> id, DocumentationPartState? state, CustomResourceOptions? opts = null)
public static DocumentationPart get(String name, Output<String> id, DocumentationPartState state, CustomResourceOptions options)
resources:  _:    type: aws:apigateway:DocumentationPart    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
DocumentationPartId string
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
Location Changes to this property will trigger replacement. DocumentationPartLocation
Location of the targeted API entity of the to-be-created documentation part. See below.
Properties string
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
RestApiId Changes to this property will trigger replacement. string
ID of the associated Rest API
DocumentationPartId string
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
Location Changes to this property will trigger replacement. DocumentationPartLocationArgs
Location of the targeted API entity of the to-be-created documentation part. See below.
Properties string
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
RestApiId Changes to this property will trigger replacement. string
ID of the associated Rest API
documentationPartId String
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
location Changes to this property will trigger replacement. DocumentationPartLocation
Location of the targeted API entity of the to-be-created documentation part. See below.
properties String
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
restApiId Changes to this property will trigger replacement. String
ID of the associated Rest API
documentationPartId string
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
location Changes to this property will trigger replacement. DocumentationPartLocation
Location of the targeted API entity of the to-be-created documentation part. See below.
properties string
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
restApiId Changes to this property will trigger replacement. string
ID of the associated Rest API
documentation_part_id str
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
location Changes to this property will trigger replacement. DocumentationPartLocationArgs
Location of the targeted API entity of the to-be-created documentation part. See below.
properties str
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
rest_api_id Changes to this property will trigger replacement. str
ID of the associated Rest API
documentationPartId String
The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
location Changes to this property will trigger replacement. Property Map
Location of the targeted API entity of the to-be-created documentation part. See below.
properties String
Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ "description": "The API does ..." }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
restApiId Changes to this property will trigger replacement. String
ID of the associated Rest API

Supporting Types

DocumentationPartLocation
, DocumentationPartLocationArgs

Type
This property is required.
Changes to this property will trigger replacement.
string
Type of API entity to which the documentation content appliesE.g., API, METHOD or REQUEST_BODY
Method Changes to this property will trigger replacement. string
HTTP verb of a method. The default value is * for any method.
Name Changes to this property will trigger replacement. string
Name of the targeted API entity.
Path Changes to this property will trigger replacement. string
URL path of the target. The default value is / for the root resource.
StatusCode Changes to this property will trigger replacement. string
HTTP status code of a response. The default value is * for any status code.
Type
This property is required.
Changes to this property will trigger replacement.
string
Type of API entity to which the documentation content appliesE.g., API, METHOD or REQUEST_BODY
Method Changes to this property will trigger replacement. string
HTTP verb of a method. The default value is * for any method.
Name Changes to this property will trigger replacement. string
Name of the targeted API entity.
Path Changes to this property will trigger replacement. string
URL path of the target. The default value is / for the root resource.
StatusCode Changes to this property will trigger replacement. string
HTTP status code of a response. The default value is * for any status code.
type
This property is required.
Changes to this property will trigger replacement.
String
Type of API entity to which the documentation content appliesE.g., API, METHOD or REQUEST_BODY
method Changes to this property will trigger replacement. String
HTTP verb of a method. The default value is * for any method.
name Changes to this property will trigger replacement. String
Name of the targeted API entity.
path Changes to this property will trigger replacement. String
URL path of the target. The default value is / for the root resource.
statusCode Changes to this property will trigger replacement. String
HTTP status code of a response. The default value is * for any status code.
type
This property is required.
Changes to this property will trigger replacement.
string
Type of API entity to which the documentation content appliesE.g., API, METHOD or REQUEST_BODY
method Changes to this property will trigger replacement. string
HTTP verb of a method. The default value is * for any method.
name Changes to this property will trigger replacement. string
Name of the targeted API entity.
path Changes to this property will trigger replacement. string
URL path of the target. The default value is / for the root resource.
statusCode Changes to this property will trigger replacement. string
HTTP status code of a response. The default value is * for any status code.
type
This property is required.
Changes to this property will trigger replacement.
str
Type of API entity to which the documentation content appliesE.g., API, METHOD or REQUEST_BODY
method Changes to this property will trigger replacement. str
HTTP verb of a method. The default value is * for any method.
name Changes to this property will trigger replacement. str
Name of the targeted API entity.
path Changes to this property will trigger replacement. str
URL path of the target. The default value is / for the root resource.
status_code Changes to this property will trigger replacement. str
HTTP status code of a response. The default value is * for any status code.
type
This property is required.
Changes to this property will trigger replacement.
String
Type of API entity to which the documentation content appliesE.g., API, METHOD or REQUEST_BODY
method Changes to this property will trigger replacement. String
HTTP verb of a method. The default value is * for any method.
name Changes to this property will trigger replacement. String
Name of the targeted API entity.
path Changes to this property will trigger replacement. String
URL path of the target. The default value is / for the root resource.
statusCode Changes to this property will trigger replacement. String
HTTP status code of a response. The default value is * for any status code.

Import

Using pulumi import, import API Gateway documentation_parts using REST-API-ID/DOC-PART-ID. For example:

$ pulumi import aws:apigateway/documentationPart:DocumentationPart example 5i4e1ko720/3oyy3t
Copy

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.