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

UsagePlanKey

Provides an API Gateway Usage Plan Key.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var test = new Aws.ApiGateway.RestApi("test", new Aws.ApiGateway.RestApiArgs
        {
        });
        // ...
        var myusageplan = new Aws.ApiGateway.UsagePlan("myusageplan", new Aws.ApiGateway.UsagePlanArgs
        {
            ApiStages = 
            {
                new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
                {
                    ApiId = test.Id,
                    Stage = aws_api_gateway_deployment.Foo.Stage_name,
                },
            },
        });
        var mykey = new Aws.ApiGateway.ApiKey("mykey", new Aws.ApiGateway.ApiKeyArgs
        {
        });
        var main = new Aws.ApiGateway.UsagePlanKey("main", new Aws.ApiGateway.UsagePlanKeyArgs
        {
            KeyId = mykey.Id,
            KeyType = "API_KEY",
            UsagePlanId = myusageplan.Id,
        });
    }

}
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 {
		test, err := apigateway.NewRestApi(ctx, "test", nil)
		if err != nil {
			return err
		}
		myusageplan, err := apigateway.NewUsagePlan(ctx, "myusageplan", &apigateway.UsagePlanArgs{
			ApiStages: apigateway.UsagePlanApiStageArray{
				&apigateway.UsagePlanApiStageArgs{
					ApiId: test.ID(),
					Stage: pulumi.Any(aws_api_gateway_deployment.Foo.Stage_name),
				},
			},
		})
		if err != nil {
			return err
		}
		mykey, err := apigateway.NewApiKey(ctx, "mykey", nil)
		if err != nil {
			return err
		}
		_, err = apigateway.NewUsagePlanKey(ctx, "main", &apigateway.UsagePlanKeyArgs{
			KeyId:       mykey.ID(),
			KeyType:     pulumi.String("API_KEY"),
			UsagePlanId: myusageplan.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

test = aws.apigateway.RestApi("test")
# ...
myusageplan = aws.apigateway.UsagePlan("myusageplan", api_stages=[aws.apigateway.UsagePlanApiStageArgs(
    api_id=test.id,
    stage=aws_api_gateway_deployment["foo"]["stage_name"],
)])
mykey = aws.apigateway.ApiKey("mykey")
main = aws.apigateway.UsagePlanKey("main",
    key_id=mykey.id,
    key_type="API_KEY",
    usage_plan_id=myusageplan.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const test = new aws.apigateway.RestApi("test", {});
// ...
const myusageplan = new aws.apigateway.UsagePlan("myusageplan", {apiStages: [{
    apiId: test.id,
    stage: aws_api_gateway_deployment.foo.stage_name,
}]});
const mykey = new aws.apigateway.ApiKey("mykey", {});
const main = new aws.apigateway.UsagePlanKey("main", {
    keyId: mykey.id,
    keyType: "API_KEY",
    usagePlanId: myusageplan.id,
});

Create a UsagePlanKey Resource

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

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

KeyId string
The identifier of the API key resource.
KeyType string
The type of the API key resource. Currently, the valid key type is API_KEY.
UsagePlanId string
The Id of the usage plan resource representing to associate the key to.
KeyId string
The identifier of the API key resource.
KeyType string
The type of the API key resource. Currently, the valid key type is API_KEY.
UsagePlanId string
The Id of the usage plan resource representing to associate the key to.
keyId string
The identifier of the API key resource.
keyType string
The type of the API key resource. Currently, the valid key type is API_KEY.
usagePlanId string
The Id of the usage plan resource representing to associate the key to.
key_id str
The identifier of the API key resource.
key_type str
The type of the API key resource. Currently, the valid key type is API_KEY.
usage_plan_id str
The Id of the usage plan resource representing to associate the key to.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of a usage plan key.
Value string
The value of a usage plan key.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of a usage plan key.
Value string
The value of a usage plan key.
id string
The provider-assigned unique ID for this managed resource.
name string
The name of a usage plan key.
value string
The value of a usage plan key.
id str
The provider-assigned unique ID for this managed resource.
name str
The name of a usage plan key.
value str
The value of a usage plan key.

Look up an Existing UsagePlanKey Resource

Get an existing UsagePlanKey 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?: UsagePlanKeyState, opts?: CustomResourceOptions): UsagePlanKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        key_id: Optional[str] = None,
        key_type: Optional[str] = None,
        name: Optional[str] = None,
        usage_plan_id: Optional[str] = None,
        value: Optional[str] = None) -> UsagePlanKey
func GetUsagePlanKey(ctx *Context, name string, id IDInput, state *UsagePlanKeyState, opts ...ResourceOption) (*UsagePlanKey, error)
public static UsagePlanKey Get(string name, Input<string> id, UsagePlanKeyState? 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:

KeyId string
The identifier of the API key resource.
KeyType string
The type of the API key resource. Currently, the valid key type is API_KEY.
Name string
The name of a usage plan key.
UsagePlanId string
The Id of the usage plan resource representing to associate the key to.
Value string
The value of a usage plan key.
KeyId string
The identifier of the API key resource.
KeyType string
The type of the API key resource. Currently, the valid key type is API_KEY.
Name string
The name of a usage plan key.
UsagePlanId string
The Id of the usage plan resource representing to associate the key to.
Value string
The value of a usage plan key.
keyId string
The identifier of the API key resource.
keyType string
The type of the API key resource. Currently, the valid key type is API_KEY.
name string
The name of a usage plan key.
usagePlanId string
The Id of the usage plan resource representing to associate the key to.
value string
The value of a usage plan key.
key_id str
The identifier of the API key resource.
key_type str
The type of the API key resource. Currently, the valid key type is API_KEY.
name str
The name of a usage plan key.
usage_plan_id str
The Id of the usage plan resource representing to associate the key to.
value str
The value of a usage plan key.

Import

AWS API Gateway Usage Plan Key can be imported using the USAGE-PLAN-ID/USAGE-PLAN-KEY-ID, e.g.

 $ pulumi import aws:apigateway/usagePlanKey:UsagePlanKey key 12345abcde/zzz

Package Details

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