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/v2/go/aws/apigateway"
"github.com/pulumi/pulumi/sdk/v2/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.String(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=[{
"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.stageName,
}],
});
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);def UsagePlanKey(resource_name, opts=None, key_id=None, key_type=None, usage_plan_id=None, __props__=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.
- opts ResourceOptions
- A bag of options that control this 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 Programming Model docs.
Inputs
The UsagePlanKey resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the UsagePlanKey resource produces the following output properties:
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): UsagePlanKeystatic get(resource_name, id, opts=None, key_id=None, key_type=None, name=None, usage_plan_id=None, value=None, __props__=None);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:
- Key
Id string The identifier of the API key resource.
- Key
Type 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.
- Usage
Plan stringId The Id of the usage plan resource representing to associate the key to.
- Value string
The value of a usage plan key.
- Key
Id string The identifier of the API key resource.
- Key
Type 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.
- Usage
Plan stringId The Id of the usage plan resource representing to associate the key to.
- Value string
The value of a usage plan key.
- key
Id string The identifier of the API key resource.
- key
Type 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.
- usage
Plan stringId 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_ strid The Id of the usage plan resource representing to associate the key to.
- value str
The value of a usage plan key.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.