aws logo
AWS Classic v5.33.0, Mar 24 23

aws.apigateway.Resource

Provides an API Gateway Resource.

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new()
    {
        Description = "This is my API for demonstration purposes",
    });

    var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new()
    {
        RestApi = myDemoAPI.Id,
        ParentId = myDemoAPI.RootResourceId,
        PathPart = "mydemoresource",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/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
	})
}
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.Resource;
import com.pulumi.aws.apigateway.ResourceArgs;
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 myDemoAPI = new RestApi("myDemoAPI", RestApiArgs.builder()        
            .description("This is my API for demonstration purposes")
            .build());

        var myDemoResource = new Resource("myDemoResource", ResourceArgs.builder()        
            .restApi(myDemoAPI.id())
            .parentId(myDemoAPI.rootResourceId())
            .pathPart("mydemoresource")
            .build());

    }
}
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",
});
resources:
  myDemoAPI:
    type: aws:apigateway:RestApi
    properties:
      description: This is my API for demonstration purposes
  myDemoResource:
    type: aws:apigateway:Resource
    properties:
      restApi: ${myDemoAPI.id}
      parentId: ${myDemoAPI.rootResourceId}
      pathPart: mydemoresource

Create 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)
public Resource(String name, ResourceArgs args)
public Resource(String name, ResourceArgs args, CustomResourceOptions options)
type: aws:apigateway:Resource
properties: # The arguments to resource properties.
options: # 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_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.
name String
The unique name of the resource.
args ResourceArgs
The arguments to resource properties.
options 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

ID of the parent API resource

PathPart string

Last path segment of this API resource.

RestApi string | string

ID of the associated REST API

ParentId string

ID of the parent API resource

PathPart string

Last path segment of this API resource.

RestApi string | string

ID of the associated REST API

parentId String

ID of the parent API resource

pathPart String

Last path segment of this API resource.

restApi String | String

ID of the associated REST API

parentId string

ID of the parent API resource

pathPart string

Last path segment of this API resource.

restApi string | RestApi

ID of the associated REST API

parent_id str

ID of the parent API resource

path_part str

Last path segment of this API resource.

rest_api str | str

ID of the associated REST API

parentId String

ID of the parent API resource

pathPart String

Last path segment of this API resource.

restApi String |

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

Complete path for this API resource, including all parent paths.

Id string

The provider-assigned unique ID for this managed resource.

Path string

Complete path for this API resource, including all parent paths.

id String

The provider-assigned unique ID for this managed resource.

path String

Complete path for this API resource, including all parent paths.

id string

The provider-assigned unique ID for this managed resource.

path string

Complete path for this API resource, including all parent paths.

id str

The provider-assigned unique ID for this managed resource.

path str

Complete path for this API resource, including all parent paths.

id String

The provider-assigned unique ID for this managed resource.

path String

Complete path for this API resource, including all parent paths.

Look up 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)
public static Resource get(String name, Output<String> id, ResourceState 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:
ParentId string

ID of the parent API resource

Path string

Complete path for this API resource, including all parent paths.

PathPart string

Last path segment of this API resource.

RestApi string | string

ID of the associated REST API

ParentId string

ID of the parent API resource

Path string

Complete path for this API resource, including all parent paths.

PathPart string

Last path segment of this API resource.

RestApi string | string

ID of the associated REST API

parentId String

ID of the parent API resource

path String

Complete path for this API resource, including all parent paths.

pathPart String

Last path segment of this API resource.

restApi String | String

ID of the associated REST API

parentId string

ID of the parent API resource

path string

Complete path for this API resource, including all parent paths.

pathPart string

Last path segment of this API resource.

restApi string | RestApi

ID of the associated REST API

parent_id str

ID of the parent API resource

path str

Complete path for this API resource, including all parent paths.

path_part str

Last path segment of this API resource.

rest_api str | str

ID of the associated REST API

parentId String

ID of the parent API resource

path String

Complete path for this API resource, including all parent paths.

pathPart String

Last path segment of this API resource.

restApi String |

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
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.