aws logo
AWS Classic v5.28.0, Jan 23 23

aws.apigateway.UsagePlanKey

Provides an API Gateway Usage Plan Key.

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var test = new Aws.ApiGateway.RestApi("test");

    // ...
    var myusageplan = new Aws.ApiGateway.UsagePlan("myusageplan", new()
    {
        ApiStages = new[]
        {
            new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
            {
                ApiId = test.Id,
                Stage = aws_api_gateway_deployment.Foo.Stage_name,
            },
        },
    });

    var mykey = new Aws.ApiGateway.ApiKey("mykey");

    var main = new Aws.ApiGateway.UsagePlanKey("main", new()
    {
        KeyId = mykey.Id,
        KeyType = "API_KEY",
        UsagePlanId = myusageplan.Id,
    });

});
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 {
		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
	})
}
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.UsagePlan;
import com.pulumi.aws.apigateway.UsagePlanArgs;
import com.pulumi.aws.apigateway.inputs.UsagePlanApiStageArgs;
import com.pulumi.aws.apigateway.ApiKey;
import com.pulumi.aws.apigateway.UsagePlanKey;
import com.pulumi.aws.apigateway.UsagePlanKeyArgs;
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 test = new RestApi("test");

        var myusageplan = new UsagePlan("myusageplan", UsagePlanArgs.builder()        
            .apiStages(UsagePlanApiStageArgs.builder()
                .apiId(test.id())
                .stage(aws_api_gateway_deployment.foo().stage_name())
                .build())
            .build());

        var mykey = new ApiKey("mykey");

        var main = new UsagePlanKey("main", UsagePlanKeyArgs.builder()        
            .keyId(mykey.id())
            .keyType("API_KEY")
            .usagePlanId(myusageplan.id())
            .build());

    }
}
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,
});
resources:
  test: # ...
    type: aws:apigateway:RestApi
  myusageplan:
    type: aws:apigateway:UsagePlan
    properties:
      apiStages:
        - apiId: ${test.id}
          stage: ${aws_api_gateway_deployment.foo.stage_name}
  mykey:
    type: aws:apigateway:ApiKey
  main:
    type: aws:apigateway:UsagePlanKey
    properties:
      keyId: ${mykey.id}
      keyType: API_KEY
      usagePlanId: ${myusageplan.id}

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

Identifier of the API key resource.

KeyType string

Type of the API key resource. Currently, the valid key type is API_KEY.

UsagePlanId string

Id of the usage plan resource representing to associate the key to.

KeyId string

Identifier of the API key resource.

KeyType string

Type of the API key resource. Currently, the valid key type is API_KEY.

UsagePlanId string

Id of the usage plan resource representing to associate the key to.

keyId String

Identifier of the API key resource.

keyType String

Type of the API key resource. Currently, the valid key type is API_KEY.

usagePlanId String

Id of the usage plan resource representing to associate the key to.

keyId string

Identifier of the API key resource.

keyType string

Type of the API key resource. Currently, the valid key type is API_KEY.

usagePlanId string

Id of the usage plan resource representing to associate the key to.

key_id str

Identifier of the API key resource.

key_type str

Type of the API key resource. Currently, the valid key type is API_KEY.

usage_plan_id str

Id of the usage plan resource representing to associate the key to.

keyId String

Identifier of the API key resource.

keyType String

Type of the API key resource. Currently, the valid key type is API_KEY.

usagePlanId String

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

Name of a usage plan key.

Value string

Value of a usage plan key.

Id string

The provider-assigned unique ID for this managed resource.

Name string

Name of a usage plan key.

Value string

Value of a usage plan key.

id String

The provider-assigned unique ID for this managed resource.

name String

Name of a usage plan key.

value String

Value of a usage plan key.

id string

The provider-assigned unique ID for this managed resource.

name string

Name of a usage plan key.

value string

Value of a usage plan key.

id str

The provider-assigned unique ID for this managed resource.

name str

Name of a usage plan key.

value str

Value of a usage plan key.

id String

The provider-assigned unique ID for this managed resource.

name String

Name of a usage plan key.

value String

Value of a usage plan key.

Look up 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)
public static UsagePlanKey get(String name, Output<String> id, UsagePlanKeyState 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:
KeyId string

Identifier of the API key resource.

KeyType string

Type of the API key resource. Currently, the valid key type is API_KEY.

Name string

Name of a usage plan key.

UsagePlanId string

Id of the usage plan resource representing to associate the key to.

Value string

Value of a usage plan key.

KeyId string

Identifier of the API key resource.

KeyType string

Type of the API key resource. Currently, the valid key type is API_KEY.

Name string

Name of a usage plan key.

UsagePlanId string

Id of the usage plan resource representing to associate the key to.

Value string

Value of a usage plan key.

keyId String

Identifier of the API key resource.

keyType String

Type of the API key resource. Currently, the valid key type is API_KEY.

name String

Name of a usage plan key.

usagePlanId String

Id of the usage plan resource representing to associate the key to.

value String

Value of a usage plan key.

keyId string

Identifier of the API key resource.

keyType string

Type of the API key resource. Currently, the valid key type is API_KEY.

name string

Name of a usage plan key.

usagePlanId string

Id of the usage plan resource representing to associate the key to.

value string

Value of a usage plan key.

key_id str

Identifier of the API key resource.

key_type str

Type of the API key resource. Currently, the valid key type is API_KEY.

name str

Name of a usage plan key.

usage_plan_id str

Id of the usage plan resource representing to associate the key to.

value str

Value of a usage plan key.

keyId String

Identifier of the API key resource.

keyType String

Type of the API key resource. Currently, the valid key type is API_KEY.

name String

Name of a usage plan key.

usagePlanId String

Id of the usage plan resource representing to associate the key to.

value String

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

This Pulumi package is based on the aws Terraform Provider.