Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

AWS Classic

v4.25.0 published on Friday, Oct 15, 2021 by Pulumi

Resource

Provides an API Gateway Resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
        {
            Description = "This is my API for demonstration purposes",
        });
        var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
        {
            RestApi = myDemoAPI.Id,
            ParentId = myDemoAPI.RootResourceId,
            PathPart = "mydemoresource",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		myDemoAPI, err := apigateway.NewRestApi(ctx, "myDemoAPI", &apigateway.RestApiArgs{
			Description: pulumi.String("This is my API for demonstration purposes"),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewResource(ctx, "myDemoResource", &apigateway.ResourceArgs{
			RestApi:  myDemoAPI.ID(),
			ParentId: myDemoAPI.RootResourceId,
			PathPart: pulumi.String("mydemoresource"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

my_demo_api = aws.apigateway.RestApi("myDemoAPI", description="This is my API for demonstration purposes")
my_demo_resource = aws.apigateway.Resource("myDemoResource",
    rest_api=my_demo_api.id,
    parent_id=my_demo_api.root_resource_id,
    path_part="mydemoresource")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const myDemoAPI = new aws.apigateway.RestApi("myDemoAPI", {description: "This is my API for demonstration purposes"});
const myDemoResource = new aws.apigateway.Resource("myDemoResource", {
    restApi: myDemoAPI.id,
    parentId: myDemoAPI.rootResourceId,
    pathPart: "mydemoresource",
});

Create a Resource Resource

new Resource(name: string, args: ResourceArgs, opts?: CustomResourceOptions);
@overload
def Resource(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             parent_id: Optional[str] = None,
             path_part: Optional[str] = None,
             rest_api: Optional[str] = None)
@overload
def Resource(resource_name: str,
             args: ResourceArgs,
             opts: Optional[ResourceOptions] = None)
func NewResource(ctx *Context, name string, args ResourceArgs, opts ...ResourceOption) (*Resource, error)
public Resource(string name, ResourceArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ResourceArgs
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 ResourceArgs
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 ResourceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ResourceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

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

ParentId string
The ID of the parent API resource
PathPart string
The last path segment of this API resource.
RestApi string | string
The ID of the associated REST API
ParentId string
The ID of the parent API resource
PathPart string
The last path segment of this API resource.
RestApi string | string
The ID of the associated REST API
parentId string
The ID of the parent API resource
pathPart string
The last path segment of this API resource.
restApi string | RestApi
The ID of the associated REST API
parent_id str
The ID of the parent API resource
path_part str
The last path segment of this API resource.
rest_api str | str
The ID of the associated REST API

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Path string
The complete path for this API resource, including all parent paths.
Id string
The provider-assigned unique ID for this managed resource.
Path string
The complete path for this API resource, including all parent paths.
id string
The provider-assigned unique ID for this managed resource.
path string
The complete path for this API resource, including all parent paths.
id str
The provider-assigned unique ID for this managed resource.
path str
The complete path for this API resource, including all parent paths.

Look up an Existing Resource Resource

Get an existing Resource 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?: ResourceState, opts?: CustomResourceOptions): Resource
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        parent_id: Optional[str] = None,
        path: Optional[str] = None,
        path_part: Optional[str] = None,
        rest_api: Optional[str] = None) -> Resource
func GetResource(ctx *Context, name string, id IDInput, state *ResourceState, opts ...ResourceOption) (*Resource, error)
public static Resource Get(string name, Input<string> id, ResourceState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

ParentId string
The ID of the parent API resource
Path string
The complete path for this API resource, including all parent paths.
PathPart string
The last path segment of this API resource.
RestApi string | string
The ID of the associated REST API
ParentId string
The ID of the parent API resource
Path string
The complete path for this API resource, including all parent paths.
PathPart string
The last path segment of this API resource.
RestApi string | string
The ID of the associated REST API
parentId string
The ID of the parent API resource
path string
The complete path for this API resource, including all parent paths.
pathPart string
The last path segment of this API resource.
restApi string | RestApi
The ID of the associated REST API
parent_id str
The ID of the parent API resource
path str
The complete path for this API resource, including all parent paths.
path_part str
The last path segment of this API resource.
rest_api str | str
The ID of the associated REST API

Import

aws_api_gateway_resource can be imported using REST-API-ID/RESOURCE-ID, e.g.

 $ pulumi import aws:apigateway/resource:Resource example 12345abcde/67890fghij

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.