1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. ApiGatewayUsagePlanAttachment
tencentcloud 1.81.183 published on Wednesday, Apr 16, 2025 by tencentcloudstack

tencentcloud.ApiGatewayUsagePlanAttachment

Explore with Pulumi AI

Use this resource to attach API gateway usage plan to service.

NOTE: If the auth_type parameter of API is not SECRET, it cannot be bound access key.

Example Usage

Normal creation

import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";

const exampleApiGatewayUsagePlan = new tencentcloud.ApiGatewayUsagePlan("exampleApiGatewayUsagePlan", {
    usagePlanName: "tf_example",
    usagePlanDesc: "desc.",
    maxRequestNum: 100,
    maxRequestNumPreSec: 10,
});
const exampleApiGatewayService = new tencentcloud.ApiGatewayService("exampleApiGatewayService", {
    serviceName: "tf_example",
    protocol: "http&https",
    serviceDesc: "desc.",
    netTypes: [
        "INNER",
        "OUTER",
    ],
    ipVersion: "IPv4",
});
const exampleApiGatewayApi = new tencentcloud.ApiGatewayApi("exampleApiGatewayApi", {
    serviceId: exampleApiGatewayService.apiGatewayServiceId,
    apiName: "tf_example",
    apiDesc: "my hello api update",
    authType: "SECRET",
    protocol: "HTTP",
    enableCors: true,
    requestConfigPath: "/user/info",
    requestConfigMethod: "POST",
    requestParameters: [{
        name: "email",
        position: "QUERY",
        type: "string",
        desc: "desc.",
        defaultValue: "test@qq.com",
        required: true,
    }],
    serviceConfigType: "HTTP",
    serviceConfigTimeout: 10,
    serviceConfigUrl: "http://www.tencent.com",
    serviceConfigPath: "/user",
    serviceConfigMethod: "POST",
    responseType: "XML",
    responseSuccessExample: "<note>success</note>",
    responseFailExample: "<note>fail</note>",
    responseErrorCodes: [{
        code: 500,
        msg: "system error",
        desc: "system error code",
        convertedCode: 5000,
        needConvert: true,
    }],
});
const exampleApiGatewayUsagePlanAttachment = new tencentcloud.ApiGatewayUsagePlanAttachment("exampleApiGatewayUsagePlanAttachment", {
    usagePlanId: exampleApiGatewayUsagePlan.apiGatewayUsagePlanId,
    serviceId: exampleApiGatewayService.apiGatewayServiceId,
    environment: "release",
    bindType: "API",
    apiId: exampleApiGatewayApi.apiGatewayApiId,
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

example_api_gateway_usage_plan = tencentcloud.ApiGatewayUsagePlan("exampleApiGatewayUsagePlan",
    usage_plan_name="tf_example",
    usage_plan_desc="desc.",
    max_request_num=100,
    max_request_num_pre_sec=10)
example_api_gateway_service = tencentcloud.ApiGatewayService("exampleApiGatewayService",
    service_name="tf_example",
    protocol="http&https",
    service_desc="desc.",
    net_types=[
        "INNER",
        "OUTER",
    ],
    ip_version="IPv4")
example_api_gateway_api = tencentcloud.ApiGatewayApi("exampleApiGatewayApi",
    service_id=example_api_gateway_service.api_gateway_service_id,
    api_name="tf_example",
    api_desc="my hello api update",
    auth_type="SECRET",
    protocol="HTTP",
    enable_cors=True,
    request_config_path="/user/info",
    request_config_method="POST",
    request_parameters=[{
        "name": "email",
        "position": "QUERY",
        "type": "string",
        "desc": "desc.",
        "default_value": "test@qq.com",
        "required": True,
    }],
    service_config_type="HTTP",
    service_config_timeout=10,
    service_config_url="http://www.tencent.com",
    service_config_path="/user",
    service_config_method="POST",
    response_type="XML",
    response_success_example="<note>success</note>",
    response_fail_example="<note>fail</note>",
    response_error_codes=[{
        "code": 500,
        "msg": "system error",
        "desc": "system error code",
        "converted_code": 5000,
        "need_convert": True,
    }])
example_api_gateway_usage_plan_attachment = tencentcloud.ApiGatewayUsagePlanAttachment("exampleApiGatewayUsagePlanAttachment",
    usage_plan_id=example_api_gateway_usage_plan.api_gateway_usage_plan_id,
    service_id=example_api_gateway_service.api_gateway_service_id,
    environment="release",
    bind_type="API",
    api_id=example_api_gateway_api.api_gateway_api_id)
Copy
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 {
		exampleApiGatewayUsagePlan, err := tencentcloud.NewApiGatewayUsagePlan(ctx, "exampleApiGatewayUsagePlan", &tencentcloud.ApiGatewayUsagePlanArgs{
			UsagePlanName:       pulumi.String("tf_example"),
			UsagePlanDesc:       pulumi.String("desc."),
			MaxRequestNum:       pulumi.Float64(100),
			MaxRequestNumPreSec: pulumi.Float64(10),
		})
		if err != nil {
			return err
		}
		exampleApiGatewayService, err := tencentcloud.NewApiGatewayService(ctx, "exampleApiGatewayService", &tencentcloud.ApiGatewayServiceArgs{
			ServiceName: pulumi.String("tf_example"),
			Protocol:    pulumi.String("http&https"),
			ServiceDesc: pulumi.String("desc."),
			NetTypes: pulumi.StringArray{
				pulumi.String("INNER"),
				pulumi.String("OUTER"),
			},
			IpVersion: pulumi.String("IPv4"),
		})
		if err != nil {
			return err
		}
		exampleApiGatewayApi, err := tencentcloud.NewApiGatewayApi(ctx, "exampleApiGatewayApi", &tencentcloud.ApiGatewayApiArgs{
			ServiceId:           exampleApiGatewayService.ApiGatewayServiceId,
			ApiName:             pulumi.String("tf_example"),
			ApiDesc:             pulumi.String("my hello api update"),
			AuthType:            pulumi.String("SECRET"),
			Protocol:            pulumi.String("HTTP"),
			EnableCors:          pulumi.Bool(true),
			RequestConfigPath:   pulumi.String("/user/info"),
			RequestConfigMethod: pulumi.String("POST"),
			RequestParameters: tencentcloud.ApiGatewayApiRequestParameterArray{
				&tencentcloud.ApiGatewayApiRequestParameterArgs{
					Name:         pulumi.String("email"),
					Position:     pulumi.String("QUERY"),
					Type:         pulumi.String("string"),
					Desc:         pulumi.String("desc."),
					DefaultValue: pulumi.String("test@qq.com"),
					Required:     pulumi.Bool(true),
				},
			},
			ServiceConfigType:      pulumi.String("HTTP"),
			ServiceConfigTimeout:   pulumi.Float64(10),
			ServiceConfigUrl:       pulumi.String("http://www.tencent.com"),
			ServiceConfigPath:      pulumi.String("/user"),
			ServiceConfigMethod:    pulumi.String("POST"),
			ResponseType:           pulumi.String("XML"),
			ResponseSuccessExample: pulumi.String("<note>success</note>"),
			ResponseFailExample:    pulumi.String("<note>fail</note>"),
			ResponseErrorCodes: tencentcloud.ApiGatewayApiResponseErrorCodeArray{
				&tencentcloud.ApiGatewayApiResponseErrorCodeArgs{
					Code:          pulumi.Float64(500),
					Msg:           pulumi.String("system error"),
					Desc:          pulumi.String("system error code"),
					ConvertedCode: pulumi.Float64(5000),
					NeedConvert:   pulumi.Bool(true),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = tencentcloud.NewApiGatewayUsagePlanAttachment(ctx, "exampleApiGatewayUsagePlanAttachment", &tencentcloud.ApiGatewayUsagePlanAttachmentArgs{
			UsagePlanId: exampleApiGatewayUsagePlan.ApiGatewayUsagePlanId,
			ServiceId:   exampleApiGatewayService.ApiGatewayServiceId,
			Environment: pulumi.String("release"),
			BindType:    pulumi.String("API"),
			ApiId:       exampleApiGatewayApi.ApiGatewayApiId,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var exampleApiGatewayUsagePlan = new Tencentcloud.ApiGatewayUsagePlan("exampleApiGatewayUsagePlan", new()
    {
        UsagePlanName = "tf_example",
        UsagePlanDesc = "desc.",
        MaxRequestNum = 100,
        MaxRequestNumPreSec = 10,
    });

    var exampleApiGatewayService = new Tencentcloud.ApiGatewayService("exampleApiGatewayService", new()
    {
        ServiceName = "tf_example",
        Protocol = "http&https",
        ServiceDesc = "desc.",
        NetTypes = new[]
        {
            "INNER",
            "OUTER",
        },
        IpVersion = "IPv4",
    });

    var exampleApiGatewayApi = new Tencentcloud.ApiGatewayApi("exampleApiGatewayApi", new()
    {
        ServiceId = exampleApiGatewayService.ApiGatewayServiceId,
        ApiName = "tf_example",
        ApiDesc = "my hello api update",
        AuthType = "SECRET",
        Protocol = "HTTP",
        EnableCors = true,
        RequestConfigPath = "/user/info",
        RequestConfigMethod = "POST",
        RequestParameters = new[]
        {
            new Tencentcloud.Inputs.ApiGatewayApiRequestParameterArgs
            {
                Name = "email",
                Position = "QUERY",
                Type = "string",
                Desc = "desc.",
                DefaultValue = "test@qq.com",
                Required = true,
            },
        },
        ServiceConfigType = "HTTP",
        ServiceConfigTimeout = 10,
        ServiceConfigUrl = "http://www.tencent.com",
        ServiceConfigPath = "/user",
        ServiceConfigMethod = "POST",
        ResponseType = "XML",
        ResponseSuccessExample = "<note>success</note>",
        ResponseFailExample = "<note>fail</note>",
        ResponseErrorCodes = new[]
        {
            new Tencentcloud.Inputs.ApiGatewayApiResponseErrorCodeArgs
            {
                Code = 500,
                Msg = "system error",
                Desc = "system error code",
                ConvertedCode = 5000,
                NeedConvert = true,
            },
        },
    });

    var exampleApiGatewayUsagePlanAttachment = new Tencentcloud.ApiGatewayUsagePlanAttachment("exampleApiGatewayUsagePlanAttachment", new()
    {
        UsagePlanId = exampleApiGatewayUsagePlan.ApiGatewayUsagePlanId,
        ServiceId = exampleApiGatewayService.ApiGatewayServiceId,
        Environment = "release",
        BindType = "API",
        ApiId = exampleApiGatewayApi.ApiGatewayApiId,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.ApiGatewayUsagePlan;
import com.pulumi.tencentcloud.ApiGatewayUsagePlanArgs;
import com.pulumi.tencentcloud.ApiGatewayService;
import com.pulumi.tencentcloud.ApiGatewayServiceArgs;
import com.pulumi.tencentcloud.ApiGatewayApi;
import com.pulumi.tencentcloud.ApiGatewayApiArgs;
import com.pulumi.tencentcloud.inputs.ApiGatewayApiRequestParameterArgs;
import com.pulumi.tencentcloud.inputs.ApiGatewayApiResponseErrorCodeArgs;
import com.pulumi.tencentcloud.ApiGatewayUsagePlanAttachment;
import com.pulumi.tencentcloud.ApiGatewayUsagePlanAttachmentArgs;
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 exampleApiGatewayUsagePlan = new ApiGatewayUsagePlan("exampleApiGatewayUsagePlan", ApiGatewayUsagePlanArgs.builder()
            .usagePlanName("tf_example")
            .usagePlanDesc("desc.")
            .maxRequestNum(100)
            .maxRequestNumPreSec(10)
            .build());

        var exampleApiGatewayService = new ApiGatewayService("exampleApiGatewayService", ApiGatewayServiceArgs.builder()
            .serviceName("tf_example")
            .protocol("http&https")
            .serviceDesc("desc.")
            .netTypes(            
                "INNER",
                "OUTER")
            .ipVersion("IPv4")
            .build());

        var exampleApiGatewayApi = new ApiGatewayApi("exampleApiGatewayApi", ApiGatewayApiArgs.builder()
            .serviceId(exampleApiGatewayService.apiGatewayServiceId())
            .apiName("tf_example")
            .apiDesc("my hello api update")
            .authType("SECRET")
            .protocol("HTTP")
            .enableCors(true)
            .requestConfigPath("/user/info")
            .requestConfigMethod("POST")
            .requestParameters(ApiGatewayApiRequestParameterArgs.builder()
                .name("email")
                .position("QUERY")
                .type("string")
                .desc("desc.")
                .defaultValue("test@qq.com")
                .required(true)
                .build())
            .serviceConfigType("HTTP")
            .serviceConfigTimeout(10)
            .serviceConfigUrl("http://www.tencent.com")
            .serviceConfigPath("/user")
            .serviceConfigMethod("POST")
            .responseType("XML")
            .responseSuccessExample("<note>success</note>")
            .responseFailExample("<note>fail</note>")
            .responseErrorCodes(ApiGatewayApiResponseErrorCodeArgs.builder()
                .code(500)
                .msg("system error")
                .desc("system error code")
                .convertedCode(5000)
                .needConvert(true)
                .build())
            .build());

        var exampleApiGatewayUsagePlanAttachment = new ApiGatewayUsagePlanAttachment("exampleApiGatewayUsagePlanAttachment", ApiGatewayUsagePlanAttachmentArgs.builder()
            .usagePlanId(exampleApiGatewayUsagePlan.apiGatewayUsagePlanId())
            .serviceId(exampleApiGatewayService.apiGatewayServiceId())
            .environment("release")
            .bindType("API")
            .apiId(exampleApiGatewayApi.apiGatewayApiId())
            .build());

    }
}
Copy
resources:
  exampleApiGatewayUsagePlan:
    type: tencentcloud:ApiGatewayUsagePlan
    properties:
      usagePlanName: tf_example
      usagePlanDesc: desc.
      maxRequestNum: 100
      maxRequestNumPreSec: 10
  exampleApiGatewayService:
    type: tencentcloud:ApiGatewayService
    properties:
      serviceName: tf_example
      protocol: http&https
      serviceDesc: desc.
      netTypes:
        - INNER
        - OUTER
      ipVersion: IPv4
  exampleApiGatewayApi:
    type: tencentcloud:ApiGatewayApi
    properties:
      serviceId: ${exampleApiGatewayService.apiGatewayServiceId}
      apiName: tf_example
      apiDesc: my hello api update
      authType: SECRET
      protocol: HTTP
      enableCors: true
      requestConfigPath: /user/info
      requestConfigMethod: POST
      requestParameters:
        - name: email
          position: QUERY
          type: string
          desc: desc.
          defaultValue: test@qq.com
          required: true
      serviceConfigType: HTTP
      serviceConfigTimeout: 10
      serviceConfigUrl: http://www.tencent.com
      serviceConfigPath: /user
      serviceConfigMethod: POST
      responseType: XML
      responseSuccessExample: <note>success</note>
      responseFailExample: <note>fail</note>
      responseErrorCodes:
        - code: 500
          msg: system error
          desc: system error code
          convertedCode: 5000
          needConvert: true
  exampleApiGatewayUsagePlanAttachment:
    type: tencentcloud:ApiGatewayUsagePlanAttachment
    properties:
      usagePlanId: ${exampleApiGatewayUsagePlan.apiGatewayUsagePlanId}
      serviceId: ${exampleApiGatewayService.apiGatewayServiceId}
      environment: release
      bindType: API
      apiId: ${exampleApiGatewayApi.apiGatewayApiId}
Copy

Bind the key to a usage plan

import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";

const exampleApiGatewayApiKey = new tencentcloud.ApiGatewayApiKey("exampleApiGatewayApiKey", {
    secretName: "tf_example",
    status: "on",
});
const exampleApiGatewayUsagePlanAttachment = new tencentcloud.ApiGatewayUsagePlanAttachment("exampleApiGatewayUsagePlanAttachment", {
    usagePlanId: tencentcloud_api_gateway_usage_plan.example.id,
    serviceId: tencentcloud_api_gateway_service.example.id,
    environment: "release",
    bindType: "API",
    apiId: tencentcloud_api_gateway_api.example.id,
    accessKeyIds: [exampleApiGatewayApiKey.apiGatewayApiKeyId],
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

example_api_gateway_api_key = tencentcloud.ApiGatewayApiKey("exampleApiGatewayApiKey",
    secret_name="tf_example",
    status="on")
example_api_gateway_usage_plan_attachment = tencentcloud.ApiGatewayUsagePlanAttachment("exampleApiGatewayUsagePlanAttachment",
    usage_plan_id=tencentcloud_api_gateway_usage_plan["example"]["id"],
    service_id=tencentcloud_api_gateway_service["example"]["id"],
    environment="release",
    bind_type="API",
    api_id=tencentcloud_api_gateway_api["example"]["id"],
    access_key_ids=[example_api_gateway_api_key.api_gateway_api_key_id])
Copy
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 {
		exampleApiGatewayApiKey, err := tencentcloud.NewApiGatewayApiKey(ctx, "exampleApiGatewayApiKey", &tencentcloud.ApiGatewayApiKeyArgs{
			SecretName: pulumi.String("tf_example"),
			Status:     pulumi.String("on"),
		})
		if err != nil {
			return err
		}
		_, err = tencentcloud.NewApiGatewayUsagePlanAttachment(ctx, "exampleApiGatewayUsagePlanAttachment", &tencentcloud.ApiGatewayUsagePlanAttachmentArgs{
			UsagePlanId: pulumi.Any(tencentcloud_api_gateway_usage_plan.Example.Id),
			ServiceId:   pulumi.Any(tencentcloud_api_gateway_service.Example.Id),
			Environment: pulumi.String("release"),
			BindType:    pulumi.String("API"),
			ApiId:       pulumi.Any(tencentcloud_api_gateway_api.Example.Id),
			AccessKeyIds: pulumi.StringArray{
				exampleApiGatewayApiKey.ApiGatewayApiKeyId,
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var exampleApiGatewayApiKey = new Tencentcloud.ApiGatewayApiKey("exampleApiGatewayApiKey", new()
    {
        SecretName = "tf_example",
        Status = "on",
    });

    var exampleApiGatewayUsagePlanAttachment = new Tencentcloud.ApiGatewayUsagePlanAttachment("exampleApiGatewayUsagePlanAttachment", new()
    {
        UsagePlanId = tencentcloud_api_gateway_usage_plan.Example.Id,
        ServiceId = tencentcloud_api_gateway_service.Example.Id,
        Environment = "release",
        BindType = "API",
        ApiId = tencentcloud_api_gateway_api.Example.Id,
        AccessKeyIds = new[]
        {
            exampleApiGatewayApiKey.ApiGatewayApiKeyId,
        },
    });

});
Copy
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.ApiGatewayUsagePlanAttachment;
import com.pulumi.tencentcloud.ApiGatewayUsagePlanAttachmentArgs;
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 exampleApiGatewayApiKey = new ApiGatewayApiKey("exampleApiGatewayApiKey", ApiGatewayApiKeyArgs.builder()
            .secretName("tf_example")
            .status("on")
            .build());

        var exampleApiGatewayUsagePlanAttachment = new ApiGatewayUsagePlanAttachment("exampleApiGatewayUsagePlanAttachment", ApiGatewayUsagePlanAttachmentArgs.builder()
            .usagePlanId(tencentcloud_api_gateway_usage_plan.example().id())
            .serviceId(tencentcloud_api_gateway_service.example().id())
            .environment("release")
            .bindType("API")
            .apiId(tencentcloud_api_gateway_api.example().id())
            .accessKeyIds(exampleApiGatewayApiKey.apiGatewayApiKeyId())
            .build());

    }
}
Copy
resources:
  exampleApiGatewayApiKey:
    type: tencentcloud:ApiGatewayApiKey
    properties:
      secretName: tf_example
      status: on
  exampleApiGatewayUsagePlanAttachment:
    type: tencentcloud:ApiGatewayUsagePlanAttachment
    properties:
      usagePlanId: ${tencentcloud_api_gateway_usage_plan.example.id}
      serviceId: ${tencentcloud_api_gateway_service.example.id}
      environment: release
      bindType: API
      apiId: ${tencentcloud_api_gateway_api.example.id}
      accessKeyIds:
        - ${exampleApiGatewayApiKey.apiGatewayApiKeyId}
Copy

Create ApiGatewayUsagePlanAttachment Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ApiGatewayUsagePlanAttachment(name: string, args: ApiGatewayUsagePlanAttachmentArgs, opts?: CustomResourceOptions);
@overload
def ApiGatewayUsagePlanAttachment(resource_name: str,
                                  args: ApiGatewayUsagePlanAttachmentArgs,
                                  opts: Optional[ResourceOptions] = None)

@overload
def ApiGatewayUsagePlanAttachment(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  environment: Optional[str] = None,
                                  service_id: Optional[str] = None,
                                  usage_plan_id: Optional[str] = None,
                                  access_key_ids: Optional[Sequence[str]] = None,
                                  api_gateway_usage_plan_attachment_id: Optional[str] = None,
                                  api_id: Optional[str] = None,
                                  bind_type: Optional[str] = None)
func NewApiGatewayUsagePlanAttachment(ctx *Context, name string, args ApiGatewayUsagePlanAttachmentArgs, opts ...ResourceOption) (*ApiGatewayUsagePlanAttachment, error)
public ApiGatewayUsagePlanAttachment(string name, ApiGatewayUsagePlanAttachmentArgs args, CustomResourceOptions? opts = null)
public ApiGatewayUsagePlanAttachment(String name, ApiGatewayUsagePlanAttachmentArgs args)
public ApiGatewayUsagePlanAttachment(String name, ApiGatewayUsagePlanAttachmentArgs args, CustomResourceOptions options)
type: tencentcloud:ApiGatewayUsagePlanAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ApiGatewayUsagePlanAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ApiGatewayUsagePlanAttachmentArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ApiGatewayUsagePlanAttachmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ApiGatewayUsagePlanAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ApiGatewayUsagePlanAttachmentArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

Environment This property is required. string
The environment to be bound. Valid values: test, prepub, release.
ServiceId This property is required. string
ID of the service.
UsagePlanId This property is required. string
ID of the usage plan.
AccessKeyIds List<string>
Array of key IDs to be bound.
ApiGatewayUsagePlanAttachmentId string
ID of the resource.
ApiId string
ID of the API. This parameter will be required when bind_type is API.
BindType string
Binding type. Valid values: API, SERVICE. Default value is SERVICE.
Environment This property is required. string
The environment to be bound. Valid values: test, prepub, release.
ServiceId This property is required. string
ID of the service.
UsagePlanId This property is required. string
ID of the usage plan.
AccessKeyIds []string
Array of key IDs to be bound.
ApiGatewayUsagePlanAttachmentId string
ID of the resource.
ApiId string
ID of the API. This parameter will be required when bind_type is API.
BindType string
Binding type. Valid values: API, SERVICE. Default value is SERVICE.
environment This property is required. String
The environment to be bound. Valid values: test, prepub, release.
serviceId This property is required. String
ID of the service.
usagePlanId This property is required. String
ID of the usage plan.
accessKeyIds List<String>
Array of key IDs to be bound.
apiGatewayUsagePlanAttachmentId String
ID of the resource.
apiId String
ID of the API. This parameter will be required when bind_type is API.
bindType String
Binding type. Valid values: API, SERVICE. Default value is SERVICE.
environment This property is required. string
The environment to be bound. Valid values: test, prepub, release.
serviceId This property is required. string
ID of the service.
usagePlanId This property is required. string
ID of the usage plan.
accessKeyIds string[]
Array of key IDs to be bound.
apiGatewayUsagePlanAttachmentId string
ID of the resource.
apiId string
ID of the API. This parameter will be required when bind_type is API.
bindType string
Binding type. Valid values: API, SERVICE. Default value is SERVICE.
environment This property is required. str
The environment to be bound. Valid values: test, prepub, release.
service_id This property is required. str
ID of the service.
usage_plan_id This property is required. str
ID of the usage plan.
access_key_ids Sequence[str]
Array of key IDs to be bound.
api_gateway_usage_plan_attachment_id str
ID of the resource.
api_id str
ID of the API. This parameter will be required when bind_type is API.
bind_type str
Binding type. Valid values: API, SERVICE. Default value is SERVICE.
environment This property is required. String
The environment to be bound. Valid values: test, prepub, release.
serviceId This property is required. String
ID of the service.
usagePlanId This property is required. String
ID of the usage plan.
accessKeyIds List<String>
Array of key IDs to be bound.
apiGatewayUsagePlanAttachmentId String
ID of the resource.
apiId String
ID of the API. This parameter will be required when bind_type is API.
bindType String
Binding type. Valid values: API, SERVICE. Default value is SERVICE.

Outputs

All input properties are implicitly available as output properties. Additionally, the ApiGatewayUsagePlanAttachment 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 ApiGatewayUsagePlanAttachment Resource

Get an existing ApiGatewayUsagePlanAttachment 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?: ApiGatewayUsagePlanAttachmentState, opts?: CustomResourceOptions): ApiGatewayUsagePlanAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        access_key_ids: Optional[Sequence[str]] = None,
        api_gateway_usage_plan_attachment_id: Optional[str] = None,
        api_id: Optional[str] = None,
        bind_type: Optional[str] = None,
        environment: Optional[str] = None,
        service_id: Optional[str] = None,
        usage_plan_id: Optional[str] = None) -> ApiGatewayUsagePlanAttachment
func GetApiGatewayUsagePlanAttachment(ctx *Context, name string, id IDInput, state *ApiGatewayUsagePlanAttachmentState, opts ...ResourceOption) (*ApiGatewayUsagePlanAttachment, error)
public static ApiGatewayUsagePlanAttachment Get(string name, Input<string> id, ApiGatewayUsagePlanAttachmentState? state, CustomResourceOptions? opts = null)
public static ApiGatewayUsagePlanAttachment get(String name, Output<String> id, ApiGatewayUsagePlanAttachmentState state, CustomResourceOptions options)
resources:  _:    type: tencentcloud:ApiGatewayUsagePlanAttachment    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AccessKeyIds List<string>
Array of key IDs to be bound.
ApiGatewayUsagePlanAttachmentId string
ID of the resource.
ApiId string
ID of the API. This parameter will be required when bind_type is API.
BindType string
Binding type. Valid values: API, SERVICE. Default value is SERVICE.
Environment string
The environment to be bound. Valid values: test, prepub, release.
ServiceId string
ID of the service.
UsagePlanId string
ID of the usage plan.
AccessKeyIds []string
Array of key IDs to be bound.
ApiGatewayUsagePlanAttachmentId string
ID of the resource.
ApiId string
ID of the API. This parameter will be required when bind_type is API.
BindType string
Binding type. Valid values: API, SERVICE. Default value is SERVICE.
Environment string
The environment to be bound. Valid values: test, prepub, release.
ServiceId string
ID of the service.
UsagePlanId string
ID of the usage plan.
accessKeyIds List<String>
Array of key IDs to be bound.
apiGatewayUsagePlanAttachmentId String
ID of the resource.
apiId String
ID of the API. This parameter will be required when bind_type is API.
bindType String
Binding type. Valid values: API, SERVICE. Default value is SERVICE.
environment String
The environment to be bound. Valid values: test, prepub, release.
serviceId String
ID of the service.
usagePlanId String
ID of the usage plan.
accessKeyIds string[]
Array of key IDs to be bound.
apiGatewayUsagePlanAttachmentId string
ID of the resource.
apiId string
ID of the API. This parameter will be required when bind_type is API.
bindType string
Binding type. Valid values: API, SERVICE. Default value is SERVICE.
environment string
The environment to be bound. Valid values: test, prepub, release.
serviceId string
ID of the service.
usagePlanId string
ID of the usage plan.
access_key_ids Sequence[str]
Array of key IDs to be bound.
api_gateway_usage_plan_attachment_id str
ID of the resource.
api_id str
ID of the API. This parameter will be required when bind_type is API.
bind_type str
Binding type. Valid values: API, SERVICE. Default value is SERVICE.
environment str
The environment to be bound. Valid values: test, prepub, release.
service_id str
ID of the service.
usage_plan_id str
ID of the usage plan.
accessKeyIds List<String>
Array of key IDs to be bound.
apiGatewayUsagePlanAttachmentId String
ID of the resource.
apiId String
ID of the API. This parameter will be required when bind_type is API.
bindType String
Binding type. Valid values: API, SERVICE. Default value is SERVICE.
environment String
The environment to be bound. Valid values: test, prepub, release.
serviceId String
ID of the service.
usagePlanId String
ID of the usage plan.

Import

API gateway usage plan attachment can be imported using the id, e.g.

$ pulumi import tencentcloud:index/apiGatewayUsagePlanAttachment:ApiGatewayUsagePlanAttachment attach_service usagePlan-pe7fbdgn#service-kuqd6xqk#release#API#api-p8gtanvy
Copy

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.