UsagePlanKey class
Provides an API Gateway Usage Plan Key.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.apigateway.RestApi("test", {name: "MyDemoAPI"});
// ...
const myusageplan = new aws.apigateway.UsagePlan("myusageplan", {
apiStages: [{
apiId: test.id,
stage: foo.stageName,
}],
name: "my_usage_plan",
});
const mykey = new aws.apigateway.ApiKey("mykey", {name: "my_key"});
const main = new aws.apigateway.UsagePlanKey("main", {
keyId: mykey.id,
keyType: "API_KEY",
usagePlanId: myusageplan.id,
});
import pulumi
import pulumi_aws as aws
test = aws.apigateway.RestApi("test", name="MyDemoAPI")
# ...
myusageplan = aws.apigateway.UsagePlan("myusageplan",
api_stages=[{
"api_id": test.id,
"stage": foo["stageName"],
}],
name="my_usage_plan")
mykey = aws.apigateway.ApiKey("mykey", name="my_key")
main = aws.apigateway.UsagePlanKey("main",
key_id=mykey.id,
key_type="API_KEY",
usage_plan_id=myusageplan.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.ApiGateway.RestApi("test", new()
{
Name = "MyDemoAPI",
});
// ...
var myusageplan = new Aws.ApiGateway.UsagePlan("myusageplan", new()
{
ApiStages = new[]
{
new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
{
ApiId = test.Id,
Stage = foo.StageName,
},
},
Name = "my_usage_plan",
});
var mykey = new Aws.ApiGateway.ApiKey("mykey", new()
{
Name = "my_key",
});
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/v7/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", &apigateway.RestApiArgs{
Name: pulumi.String("MyDemoAPI"),
})
if err != nil {
return err
}
// ...
myusageplan, err := apigateway.NewUsagePlan(ctx, "myusageplan", &apigateway.UsagePlanArgs{
ApiStages: apigateway.UsagePlanApiStageArray{
&apigateway.UsagePlanApiStageArgs{
ApiId: test.ID().ToIDOutput().ToStringOutput(),
Stage: pulumi.Any(foo.StageName),
},
},
Name: pulumi.String("my_usage_plan"),
})
if err != nil {
return err
}
mykey, err := apigateway.NewApiKey(ctx, "mykey", &apigateway.ApiKeyArgs{
Name: pulumi.String("my_key"),
})
if err != nil {
return err
}
_, err = apigateway.NewUsagePlanKey(ctx, "main", &apigateway.UsagePlanKeyArgs{
KeyId: mykey.ID().ToIDOutput().ToStringOutput(),
KeyType: pulumi.String("API_KEY"),
UsagePlanId: myusageplan.ID().ToIDOutput().ToStringOutput(),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_apigateway_restapi" "test" {
name = "MyDemoAPI"
}
# ...
resource "aws_apigateway_usageplan" "myusageplan" {
api_stages {
api_id = aws_apigateway_restapi.test.id
stage = foo.stageName
}
name = "my_usage_plan"
}
resource "aws_apigateway_apikey" "mykey" {
name = "my_key"
}
resource "aws_apigateway_usageplankey" "main" {
key_id = aws_apigateway_apikey.mykey.id
key_type = "API_KEY"
usage_plan_id = aws_apigateway_usageplan.myusageplan.id
}
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.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.ApiKeyArgs;
import com.pulumi.aws.apigateway.UsagePlanKey;
import com.pulumi.aws.apigateway.UsagePlanKeyArgs;
import java.util.ArrayList;
import java.util.Arrays;
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", RestApiArgs.builder()
.name("MyDemoAPI")
.build());
// ...
var myusageplan = new UsagePlan("myusageplan", UsagePlanArgs.builder()
.apiStages(UsagePlanApiStageArgs.builder()
.apiId(test.id())
.stage(foo.stageName())
.build())
.name("my_usage_plan")
.build());
var mykey = new ApiKey("mykey", ApiKeyArgs.builder()
.name("my_key")
.build());
var main = new UsagePlanKey("main", UsagePlanKeyArgs.builder()
.keyId(mykey.id())
.keyType("API_KEY")
.usagePlanId(myusageplan.id())
.build());
}
}
resources:
test:
type: aws:apigateway:RestApi
properties:
name: MyDemoAPI
# ...
myusageplan:
type: aws:apigateway:UsagePlan
properties:
apiStages:
- apiId: ${test.id}
stage: ${foo.stageName}
name: my_usage_plan
mykey:
type: aws:apigateway:ApiKey
properties:
name: my_key
main:
type: aws:apigateway:UsagePlanKey
properties:
keyId: ${mykey.id}
keyType: API_KEY
usagePlanId: ${myusageplan.id}
Import
Using pulumi import, import AWS API Gateway Usage Plan Key using the USAGE-PLAN-ID/USAGE-PLAN-KEY-ID. For example:
$ pulumi import aws:apigateway/usagePlanKey:UsagePlanKey key 12345abcde/zzz
Constructors
- UsagePlanKey(String name, {UsagePlanKeyArgs? args, CustomResourceOptions? options})
-
Creates a new UsagePlanKey.
nameThe Pulumi resource name.argsArguments used to configure this UsagePlanKey. The set of arguments for UsagePlanKey.optionsResource options controlling this resource's behavior. - UsagePlanKey.reference(String urn)
- Creates a typed reference to an existing UsagePlanKey resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
keyId
↔ Output<
String> -
Identifier of the API key resource.
latefinal
-
keyType
↔ Output<
String> -
Type of the API key resource. Currently, the valid key type is API_KEY.
latefinal
-
name
↔ Output<
String> -
Name of a usage plan key.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
usagePlanId
↔ Output<
String> -
Id of the usage plan resource representing to associate the key to.
latefinal
-
value
↔ Output<
String> -
Value of a usage plan key.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {UsagePlanKeyState? state, CustomResourceOptions? options}) → UsagePlanKey -
Gets an existing UsagePlanKey resource's state with the given
nameandid.