1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. getApiGatewayUsagePlanEnvironments
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.getApiGatewayUsagePlanEnvironments

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Used to query the environment list bound by the plan.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const plan = new tencentcloud.ApiGatewayUsagePlan("plan", {
        usagePlanName: "my_plan",
        usagePlanDesc: "nice plan",
        maxRequestNum: 100,
        maxRequestNumPreSec: 10,
    });
    const service = new tencentcloud.ApiGatewayService("service", {
        serviceName: "niceservice",
        protocol: "http&https",
        serviceDesc: "your nice service",
        netTypes: [
            "INNER",
            "OUTER",
        ],
        ipVersion: "IPv4",
    });
    const attachService = new tencentcloud.ApiGatewayUsagePlanAttachment("attachService", {
        usagePlanId: plan.apiGatewayUsagePlanId,
        serviceId: service.apiGatewayServiceId,
        environment: "test",
        bindType: "SERVICE",
    });
    const environmentTest = tencentcloud.getApiGatewayUsagePlanEnvironmentsOutput({
        usagePlanId: attachService.usagePlanId,
        bindType: "SERVICE",
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    plan = tencentcloud.ApiGatewayUsagePlan("plan",
        usage_plan_name="my_plan",
        usage_plan_desc="nice plan",
        max_request_num=100,
        max_request_num_pre_sec=10)
    service = tencentcloud.ApiGatewayService("service",
        service_name="niceservice",
        protocol="http&https",
        service_desc="your nice service",
        net_types=[
            "INNER",
            "OUTER",
        ],
        ip_version="IPv4")
    attach_service = tencentcloud.ApiGatewayUsagePlanAttachment("attachService",
        usage_plan_id=plan.api_gateway_usage_plan_id,
        service_id=service.api_gateway_service_id,
        environment="test",
        bind_type="SERVICE")
    environment_test = tencentcloud.get_api_gateway_usage_plan_environments_output(usage_plan_id=attach_service.usage_plan_id,
        bind_type="SERVICE")
    
    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 {
    		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
    		}
    		service, err := tencentcloud.NewApiGatewayService(ctx, "service", &tencentcloud.ApiGatewayServiceArgs{
    			ServiceName: pulumi.String("niceservice"),
    			Protocol:    pulumi.String("http&https"),
    			ServiceDesc: pulumi.String("your nice service"),
    			NetTypes: pulumi.StringArray{
    				pulumi.String("INNER"),
    				pulumi.String("OUTER"),
    			},
    			IpVersion: pulumi.String("IPv4"),
    		})
    		if err != nil {
    			return err
    		}
    		attachService, err := tencentcloud.NewApiGatewayUsagePlanAttachment(ctx, "attachService", &tencentcloud.ApiGatewayUsagePlanAttachmentArgs{
    			UsagePlanId: plan.ApiGatewayUsagePlanId,
    			ServiceId:   service.ApiGatewayServiceId,
    			Environment: pulumi.String("test"),
    			BindType:    pulumi.String("SERVICE"),
    		})
    		if err != nil {
    			return err
    		}
    		_ = tencentcloud.GetApiGatewayUsagePlanEnvironmentsOutput(ctx, tencentcloud.GetApiGatewayUsagePlanEnvironmentsOutputArgs{
    			UsagePlanId: attachService.UsagePlanId,
    			BindType:    pulumi.String("SERVICE"),
    		}, nil)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var plan = new Tencentcloud.ApiGatewayUsagePlan("plan", new()
        {
            UsagePlanName = "my_plan",
            UsagePlanDesc = "nice plan",
            MaxRequestNum = 100,
            MaxRequestNumPreSec = 10,
        });
    
        var service = new Tencentcloud.ApiGatewayService("service", new()
        {
            ServiceName = "niceservice",
            Protocol = "http&https",
            ServiceDesc = "your nice service",
            NetTypes = new[]
            {
                "INNER",
                "OUTER",
            },
            IpVersion = "IPv4",
        });
    
        var attachService = new Tencentcloud.ApiGatewayUsagePlanAttachment("attachService", new()
        {
            UsagePlanId = plan.ApiGatewayUsagePlanId,
            ServiceId = service.ApiGatewayServiceId,
            Environment = "test",
            BindType = "SERVICE",
        });
    
        var environmentTest = Tencentcloud.GetApiGatewayUsagePlanEnvironments.Invoke(new()
        {
            UsagePlanId = attachService.UsagePlanId,
            BindType = "SERVICE",
        });
    
    });
    
    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.ApiGatewayUsagePlanAttachment;
    import com.pulumi.tencentcloud.ApiGatewayUsagePlanAttachmentArgs;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetApiGatewayUsagePlanEnvironmentsArgs;
    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 plan = new ApiGatewayUsagePlan("plan", ApiGatewayUsagePlanArgs.builder()
                .usagePlanName("my_plan")
                .usagePlanDesc("nice plan")
                .maxRequestNum(100)
                .maxRequestNumPreSec(10)
                .build());
    
            var service = new ApiGatewayService("service", ApiGatewayServiceArgs.builder()
                .serviceName("niceservice")
                .protocol("http&https")
                .serviceDesc("your nice service")
                .netTypes(            
                    "INNER",
                    "OUTER")
                .ipVersion("IPv4")
                .build());
    
            var attachService = new ApiGatewayUsagePlanAttachment("attachService", ApiGatewayUsagePlanAttachmentArgs.builder()
                .usagePlanId(plan.apiGatewayUsagePlanId())
                .serviceId(service.apiGatewayServiceId())
                .environment("test")
                .bindType("SERVICE")
                .build());
    
            final var environmentTest = TencentcloudFunctions.getApiGatewayUsagePlanEnvironments(GetApiGatewayUsagePlanEnvironmentsArgs.builder()
                .usagePlanId(attachService.usagePlanId())
                .bindType("SERVICE")
                .build());
    
        }
    }
    
    resources:
      plan:
        type: tencentcloud:ApiGatewayUsagePlan
        properties:
          usagePlanName: my_plan
          usagePlanDesc: nice plan
          maxRequestNum: 100
          maxRequestNumPreSec: 10
      service:
        type: tencentcloud:ApiGatewayService
        properties:
          serviceName: niceservice
          protocol: http&https
          serviceDesc: your nice service
          netTypes:
            - INNER
            - OUTER
          ipVersion: IPv4
      attachService:
        type: tencentcloud:ApiGatewayUsagePlanAttachment
        properties:
          usagePlanId: ${plan.apiGatewayUsagePlanId}
          serviceId: ${service.apiGatewayServiceId}
          environment: test
          bindType: SERVICE
    variables:
      environmentTest:
        fn::invoke:
          function: tencentcloud:getApiGatewayUsagePlanEnvironments
          arguments:
            usagePlanId: ${attachService.usagePlanId}
            bindType: SERVICE
    

    Using getApiGatewayUsagePlanEnvironments

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getApiGatewayUsagePlanEnvironments(args: GetApiGatewayUsagePlanEnvironmentsArgs, opts?: InvokeOptions): Promise<GetApiGatewayUsagePlanEnvironmentsResult>
    function getApiGatewayUsagePlanEnvironmentsOutput(args: GetApiGatewayUsagePlanEnvironmentsOutputArgs, opts?: InvokeOptions): Output<GetApiGatewayUsagePlanEnvironmentsResult>
    def get_api_gateway_usage_plan_environments(bind_type: Optional[str] = None,
                                                id: Optional[str] = None,
                                                result_output_file: Optional[str] = None,
                                                usage_plan_id: Optional[str] = None,
                                                opts: Optional[InvokeOptions] = None) -> GetApiGatewayUsagePlanEnvironmentsResult
    def get_api_gateway_usage_plan_environments_output(bind_type: Optional[pulumi.Input[str]] = None,
                                                id: Optional[pulumi.Input[str]] = None,
                                                result_output_file: Optional[pulumi.Input[str]] = None,
                                                usage_plan_id: Optional[pulumi.Input[str]] = None,
                                                opts: Optional[InvokeOptions] = None) -> Output[GetApiGatewayUsagePlanEnvironmentsResult]
    func GetApiGatewayUsagePlanEnvironments(ctx *Context, args *GetApiGatewayUsagePlanEnvironmentsArgs, opts ...InvokeOption) (*GetApiGatewayUsagePlanEnvironmentsResult, error)
    func GetApiGatewayUsagePlanEnvironmentsOutput(ctx *Context, args *GetApiGatewayUsagePlanEnvironmentsOutputArgs, opts ...InvokeOption) GetApiGatewayUsagePlanEnvironmentsResultOutput

    > Note: This function is named GetApiGatewayUsagePlanEnvironments in the Go SDK.

    public static class GetApiGatewayUsagePlanEnvironments 
    {
        public static Task<GetApiGatewayUsagePlanEnvironmentsResult> InvokeAsync(GetApiGatewayUsagePlanEnvironmentsArgs args, InvokeOptions? opts = null)
        public static Output<GetApiGatewayUsagePlanEnvironmentsResult> Invoke(GetApiGatewayUsagePlanEnvironmentsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetApiGatewayUsagePlanEnvironmentsResult> getApiGatewayUsagePlanEnvironments(GetApiGatewayUsagePlanEnvironmentsArgs args, InvokeOptions options)
    public static Output<GetApiGatewayUsagePlanEnvironmentsResult> getApiGatewayUsagePlanEnvironments(GetApiGatewayUsagePlanEnvironmentsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: tencentcloud:index/getApiGatewayUsagePlanEnvironments:getApiGatewayUsagePlanEnvironments
      arguments:
        # arguments dictionary

    The following arguments are supported:

    UsagePlanId string
    ID of the usage plan to be queried.
    BindType string
    Binding type. Valid values: API, SERVICE. Default value: SERVICE.
    Id string
    ResultOutputFile string
    Used to save results.
    UsagePlanId string
    ID of the usage plan to be queried.
    BindType string
    Binding type. Valid values: API, SERVICE. Default value: SERVICE.
    Id string
    ResultOutputFile string
    Used to save results.
    usagePlanId String
    ID of the usage plan to be queried.
    bindType String
    Binding type. Valid values: API, SERVICE. Default value: SERVICE.
    id String
    resultOutputFile String
    Used to save results.
    usagePlanId string
    ID of the usage plan to be queried.
    bindType string
    Binding type. Valid values: API, SERVICE. Default value: SERVICE.
    id string
    resultOutputFile string
    Used to save results.
    usage_plan_id str
    ID of the usage plan to be queried.
    bind_type str
    Binding type. Valid values: API, SERVICE. Default value: SERVICE.
    id str
    result_output_file str
    Used to save results.
    usagePlanId String
    ID of the usage plan to be queried.
    bindType String
    Binding type. Valid values: API, SERVICE. Default value: SERVICE.
    id String
    resultOutputFile String
    Used to save results.

    getApiGatewayUsagePlanEnvironments Result

    The following output properties are available:

    Id string
    Lists List<GetApiGatewayUsagePlanEnvironmentsList>
    A list of usage plan binding details.
    UsagePlanId string
    BindType string
    ResultOutputFile string
    Id string
    Lists []GetApiGatewayUsagePlanEnvironmentsList
    A list of usage plan binding details.
    UsagePlanId string
    BindType string
    ResultOutputFile string
    id String
    lists List<GetApiGatewayUsagePlanEnvironmentsList>
    A list of usage plan binding details.
    usagePlanId String
    bindType String
    resultOutputFile String
    id string
    lists GetApiGatewayUsagePlanEnvironmentsList[]
    A list of usage plan binding details.
    usagePlanId string
    bindType string
    resultOutputFile string
    id String
    lists List<Property Map>
    A list of usage plan binding details.
    usagePlanId String
    bindType String
    resultOutputFile String

    Supporting Types

    GetApiGatewayUsagePlanEnvironmentsList

    ApiId string
    The API ID, this value is empty if attach service.
    ApiName string
    The API name, this value is empty if attach service.
    CreateTime string
    Creation time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    Environment string
    The environment name.
    Method string
    The API method, this value is empty if attach service.
    ModifyTime string
    Last modified time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    Path string
    The API path, this value is empty if attach service.
    ServiceId string
    The service ID.
    ServiceName string
    The service name.
    ApiId string
    The API ID, this value is empty if attach service.
    ApiName string
    The API name, this value is empty if attach service.
    CreateTime string
    Creation time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    Environment string
    The environment name.
    Method string
    The API method, this value is empty if attach service.
    ModifyTime string
    Last modified time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    Path string
    The API path, this value is empty if attach service.
    ServiceId string
    The service ID.
    ServiceName string
    The service name.
    apiId String
    The API ID, this value is empty if attach service.
    apiName String
    The API name, this value is empty if attach service.
    createTime String
    Creation time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    environment String
    The environment name.
    method String
    The API method, this value is empty if attach service.
    modifyTime String
    Last modified time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    path String
    The API path, this value is empty if attach service.
    serviceId String
    The service ID.
    serviceName String
    The service name.
    apiId string
    The API ID, this value is empty if attach service.
    apiName string
    The API name, this value is empty if attach service.
    createTime string
    Creation time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    environment string
    The environment name.
    method string
    The API method, this value is empty if attach service.
    modifyTime string
    Last modified time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    path string
    The API path, this value is empty if attach service.
    serviceId string
    The service ID.
    serviceName string
    The service name.
    api_id str
    The API ID, this value is empty if attach service.
    api_name str
    The API name, this value is empty if attach service.
    create_time str
    Creation time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    environment str
    The environment name.
    method str
    The API method, this value is empty if attach service.
    modify_time str
    Last modified time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    path str
    The API path, this value is empty if attach service.
    service_id str
    The service ID.
    service_name str
    The service name.
    apiId String
    The API ID, this value is empty if attach service.
    apiName String
    The API name, this value is empty if attach service.
    createTime String
    Creation time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    environment String
    The environment name.
    method String
    The API method, this value is empty if attach service.
    modifyTime String
    Last modified time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
    path String
    The API path, this value is empty if attach service.
    serviceId String
    The service ID.
    serviceName String
    The service name.

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack