tencentcloud.ApiGatewayApiKeyAttachment
Explore with Pulumi AI
Use this resource to API gateway attach access key to usage plan.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const key = new tencentcloud.ApiGatewayApiKey("key", {
secretName: "my_api_key",
status: "on",
});
const plan = new tencentcloud.ApiGatewayUsagePlan("plan", {
usagePlanName: "my_plan",
usagePlanDesc: "nice plan",
maxRequestNum: 100,
maxRequestNumPreSec: 10,
});
const attach = new tencentcloud.ApiGatewayApiKeyAttachment("attach", {
apiKeyId: key.apiGatewayApiKeyId,
usagePlanId: plan.apiGatewayUsagePlanId,
});
import pulumi
import pulumi_tencentcloud as tencentcloud
key = tencentcloud.ApiGatewayApiKey("key",
secret_name="my_api_key",
status="on")
plan = tencentcloud.ApiGatewayUsagePlan("plan",
usage_plan_name="my_plan",
usage_plan_desc="nice plan",
max_request_num=100,
max_request_num_pre_sec=10)
attach = tencentcloud.ApiGatewayApiKeyAttachment("attach",
api_key_id=key.api_gateway_api_key_id,
usage_plan_id=plan.api_gateway_usage_plan_id)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
key, err := tencentcloud.NewApiGatewayApiKey(ctx, "key", &tencentcloud.ApiGatewayApiKeyArgs{
SecretName: pulumi.String("my_api_key"),
Status: pulumi.String("on"),
})
if err != nil {
return err
}
plan, err := tencentcloud.NewApiGatewayUsagePlan(ctx, "plan", &tencentcloud.ApiGatewayUsagePlanArgs{
UsagePlanName: pulumi.String("my_plan"),
UsagePlanDesc: pulumi.String("nice plan"),
MaxRequestNum: pulumi.Float64(100),
MaxRequestNumPreSec: pulumi.Float64(10),
})
if err != nil {
return err
}
_, err = tencentcloud.NewApiGatewayApiKeyAttachment(ctx, "attach", &tencentcloud.ApiGatewayApiKeyAttachmentArgs{
ApiKeyId: key.ApiGatewayApiKeyId,
UsagePlanId: plan.ApiGatewayUsagePlanId,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;
return await Deployment.RunAsync(() =>
{
var key = new Tencentcloud.ApiGatewayApiKey("key", new()
{
SecretName = "my_api_key",
Status = "on",
});
var plan = new Tencentcloud.ApiGatewayUsagePlan("plan", new()
{
UsagePlanName = "my_plan",
UsagePlanDesc = "nice plan",
MaxRequestNum = 100,
MaxRequestNumPreSec = 10,
});
var attach = new Tencentcloud.ApiGatewayApiKeyAttachment("attach", new()
{
ApiKeyId = key.ApiGatewayApiKeyId,
UsagePlanId = plan.ApiGatewayUsagePlanId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.ApiGatewayApiKey;
import com.pulumi.tencentcloud.ApiGatewayApiKeyArgs;
import com.pulumi.tencentcloud.ApiGatewayUsagePlan;
import com.pulumi.tencentcloud.ApiGatewayUsagePlanArgs;
import com.pulumi.tencentcloud.ApiGatewayApiKeyAttachment;
import com.pulumi.tencentcloud.ApiGatewayApiKeyAttachmentArgs;
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 key = new ApiGatewayApiKey("key", ApiGatewayApiKeyArgs.builder()
.secretName("my_api_key")
.status("on")
.build());
var plan = new ApiGatewayUsagePlan("plan", ApiGatewayUsagePlanArgs.builder()
.usagePlanName("my_plan")
.usagePlanDesc("nice plan")
.maxRequestNum(100)
.maxRequestNumPreSec(10)
.build());
var attach = new ApiGatewayApiKeyAttachment("attach", ApiGatewayApiKeyAttachmentArgs.builder()
.apiKeyId(key.apiGatewayApiKeyId())
.usagePlanId(plan.apiGatewayUsagePlanId())
.build());
}
}
resources:
key:
type: tencentcloud:ApiGatewayApiKey
properties:
secretName: my_api_key
status: on
plan:
type: tencentcloud:ApiGatewayUsagePlan
properties:
usagePlanName: my_plan
usagePlanDesc: nice plan
maxRequestNum: 100
maxRequestNumPreSec: 10
attach:
type: tencentcloud:ApiGatewayApiKeyAttachment
properties:
apiKeyId: ${key.apiGatewayApiKeyId}
usagePlanId: ${plan.apiGatewayUsagePlanId}
Create ApiGatewayApiKeyAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApiGatewayApiKeyAttachment(name: string, args: ApiGatewayApiKeyAttachmentArgs, opts?: CustomResourceOptions);
@overload
def ApiGatewayApiKeyAttachment(resource_name: str,
args: ApiGatewayApiKeyAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ApiGatewayApiKeyAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
api_key_id: Optional[str] = None,
usage_plan_id: Optional[str] = None,
api_gateway_api_key_attachment_id: Optional[str] = None)
func NewApiGatewayApiKeyAttachment(ctx *Context, name string, args ApiGatewayApiKeyAttachmentArgs, opts ...ResourceOption) (*ApiGatewayApiKeyAttachment, error)
public ApiGatewayApiKeyAttachment(string name, ApiGatewayApiKeyAttachmentArgs args, CustomResourceOptions? opts = null)
public ApiGatewayApiKeyAttachment(String name, ApiGatewayApiKeyAttachmentArgs args)
public ApiGatewayApiKeyAttachment(String name, ApiGatewayApiKeyAttachmentArgs args, CustomResourceOptions options)
type: tencentcloud:ApiGatewayApiKeyAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ApiGatewayApiKeyAttachmentArgs
- 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 ApiGatewayApiKeyAttachmentArgs
- 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 ApiGatewayApiKeyAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiGatewayApiKeyAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApiGatewayApiKeyAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
ApiGatewayApiKeyAttachment Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ApiGatewayApiKeyAttachment resource accepts the following input properties:
- Api
Key stringId - ID of API key.
- Usage
Plan stringId - ID of the usage plan.
- Api
Gateway stringApi Key Attachment Id - ID of the resource.
- Api
Key stringId - ID of API key.
- Usage
Plan stringId - ID of the usage plan.
- Api
Gateway stringApi Key Attachment Id - ID of the resource.
- api
Key StringId - ID of API key.
- usage
Plan StringId - ID of the usage plan.
- api
Gateway StringApi Key Attachment Id - ID of the resource.
- api
Key stringId - ID of API key.
- usage
Plan stringId - ID of the usage plan.
- api
Gateway stringApi Key Attachment Id - ID of the resource.
- api_
key_ strid - ID of API key.
- usage_
plan_ strid - ID of the usage plan.
- api_
gateway_ strapi_ key_ attachment_ id - ID of the resource.
- api
Key StringId - ID of API key.
- usage
Plan StringId - ID of the usage plan.
- api
Gateway StringApi Key Attachment Id - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the ApiGatewayApiKeyAttachment resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing ApiGatewayApiKeyAttachment Resource
Get an existing ApiGatewayApiKeyAttachment 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?: ApiGatewayApiKeyAttachmentState, opts?: CustomResourceOptions): ApiGatewayApiKeyAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
api_gateway_api_key_attachment_id: Optional[str] = None,
api_key_id: Optional[str] = None,
usage_plan_id: Optional[str] = None) -> ApiGatewayApiKeyAttachment
func GetApiGatewayApiKeyAttachment(ctx *Context, name string, id IDInput, state *ApiGatewayApiKeyAttachmentState, opts ...ResourceOption) (*ApiGatewayApiKeyAttachment, error)
public static ApiGatewayApiKeyAttachment Get(string name, Input<string> id, ApiGatewayApiKeyAttachmentState? state, CustomResourceOptions? opts = null)
public static ApiGatewayApiKeyAttachment get(String name, Output<String> id, ApiGatewayApiKeyAttachmentState state, CustomResourceOptions options)
resources: _: type: tencentcloud:ApiGatewayApiKeyAttachment get: id: ${id}
- 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.
- Api
Gateway stringApi Key Attachment Id - ID of the resource.
- Api
Key stringId - ID of API key.
- Usage
Plan stringId - ID of the usage plan.
- Api
Gateway stringApi Key Attachment Id - ID of the resource.
- Api
Key stringId - ID of API key.
- Usage
Plan stringId - ID of the usage plan.
- api
Gateway StringApi Key Attachment Id - ID of the resource.
- api
Key StringId - ID of API key.
- usage
Plan StringId - ID of the usage plan.
- api
Gateway stringApi Key Attachment Id - ID of the resource.
- api
Key stringId - ID of API key.
- usage
Plan stringId - ID of the usage plan.
- api_
gateway_ strapi_ key_ attachment_ id - ID of the resource.
- api_
key_ strid - ID of API key.
- usage_
plan_ strid - ID of the usage plan.
- api
Gateway StringApi Key Attachment Id - ID of the resource.
- api
Key StringId - ID of API key.
- usage
Plan StringId - ID of the usage plan.
Import
API gateway attach access key can be imported using the id, e.g.
$ pulumi import tencentcloud:index/apiGatewayApiKeyAttachment:ApiGatewayApiKeyAttachment attach [your api_key_id]#usagePlan-gyeafpab
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- tencentcloud tencentcloudstack/terraform-provider-tencentcloud
- License
- Notes
- This Pulumi package is based on the
tencentcloud
Terraform Provider.