1. Registry
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. apig
  6. Policy
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi
alicloud logo alicloud logo
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi

    Provides a APIG Policy resource.

    For information about APIG Policy and how to use it, see What is Policy.

    NOTE: Available since v1.292.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const _default = new alicloud.vpc.Network("default", {
        vpcName: `${name}-vpc`,
        cidrBlock: "192.168.0.0/16",
    });
    const defaultSwitch = new alicloud.vpc.Switch("default", {
        vswitchName: `${name}-vsw`,
        vpcId: _default.id,
        zoneId: "cn-hangzhou-b",
        cidrBlock: "192.168.15.0/24",
    });
    const defaultGateway = new alicloud.apig.Gateway("default", {
        gatewayName: `${name}-gw`,
        gatewayType: "API",
        paymentType: "PayAsYouGo",
        spec: "apigw.small.x1",
        networkAccessConfig: {
            type: "Intranet",
        },
        vpc: {
            vpcId: _default.id,
        },
        vswitch: {
            vswitchId: defaultSwitch.id,
        },
        zoneConfig: {
            selectOption: "Auto",
        },
    });
    const defaultService = new alicloud.apig.Service("default", {
        serviceName: `${name}-svc`,
        sourceType: "DNS",
        gatewayId: defaultGateway.id,
        addresses: ["httpbin.org:8080"],
    });
    const defaultPolicy = new alicloud.apig.Policy("default", {
        policyName: name,
        policyClassName: "ServiceTls",
        policyConfig: "{\"mode\":\"SIMPLE\",\"sni\":\"aaaa\",\"enable\":true}",
        gatewayId: defaultGateway.id,
        environmentId: defaultGateway.environments[0].environmentId,
        attachResourceType: "GatewayService",
        attachResourceIds: [defaultService.id],
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.vpc.Network("default",
        vpc_name=f"{name}-vpc",
        cidr_block="192.168.0.0/16")
    default_switch = alicloud.vpc.Switch("default",
        vswitch_name=f"{name}-vsw",
        vpc_id=default.id,
        zone_id="cn-hangzhou-b",
        cidr_block="192.168.15.0/24")
    default_gateway = alicloud.apig.Gateway("default",
        gateway_name=f"{name}-gw",
        gateway_type="API",
        payment_type="PayAsYouGo",
        spec="apigw.small.x1",
        network_access_config={
            "type": "Intranet",
        },
        vpc={
            "vpc_id": default.id,
        },
        vswitch={
            "vswitch_id": default_switch.id,
        },
        zone_config={
            "select_option": "Auto",
        })
    default_service = alicloud.apig.Service("default",
        service_name=f"{name}-svc",
        source_type="DNS",
        gateway_id=default_gateway.id,
        addresses=["httpbin.org:8080"])
    default_policy = alicloud.apig.Policy("default",
        policy_name=name,
        policy_class_name="ServiceTls",
        policy_config="{\"mode\":\"SIMPLE\",\"sni\":\"aaaa\",\"enable\":true}",
        gateway_id=default_gateway.id,
        environment_id=default_gateway.environments[0].environment_id,
        attach_resource_type="GatewayService",
        attach_resource_ids=[default_service.id])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/apig"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
    			VpcName:   pulumi.Sprintf("%v-vpc", name),
    			CidrBlock: pulumi.String("192.168.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
    			VswitchName: pulumi.Sprintf("%v-vsw", name),
    			VpcId:       _default.ID().ToIDOutput().ToStringOutput(),
    			ZoneId:      pulumi.String("cn-hangzhou-b"),
    			CidrBlock:   pulumi.String("192.168.15.0/24"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultGateway, err := apig.NewGateway(ctx, "default", &apig.GatewayArgs{
    			GatewayName: pulumi.Sprintf("%v-gw", name),
    			GatewayType: pulumi.String("API"),
    			PaymentType: pulumi.String("PayAsYouGo"),
    			Spec:        pulumi.String("apigw.small.x1"),
    			NetworkAccessConfig: &apig.GatewayNetworkAccessConfigArgs{
    				Type: pulumi.String("Intranet"),
    			},
    			Vpc: &apig.GatewayVpcArgs{
    				VpcId: _default.ID().ToIDOutput().ToStringOutput(),
    			},
    			Vswitch: &apig.GatewayVswitchArgs{
    				VswitchId: defaultSwitch.ID().ToIDOutput().ToStringOutput(),
    			},
    			ZoneConfig: &apig.GatewayZoneConfigArgs{
    				SelectOption: pulumi.String("Auto"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		defaultService, err := apig.NewService(ctx, "default", &apig.ServiceArgs{
    			ServiceName: pulumi.Sprintf("%v-svc", name),
    			SourceType:  pulumi.String("DNS"),
    			GatewayId:   defaultGateway.ID().ToIDOutput().ToStringOutput(),
    			Addresses: pulumi.StringArray{
    				pulumi.String("httpbin.org:8080"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = apig.NewPolicy(ctx, "default", &apig.PolicyArgs{
    			PolicyName:      pulumi.String(name),
    			PolicyClassName: pulumi.String("ServiceTls"),
    			PolicyConfig:    pulumi.String("{\"mode\":\"SIMPLE\",\"sni\":\"aaaa\",\"enable\":true}"),
    			GatewayId:       defaultGateway.ID().ToIDOutput().ToStringOutput(),
    			EnvironmentId: defaultGateway.Environments.ApplyT(func(environments []apig.GatewayEnvironment) (*string, error) {
    				return environments[0].EnvironmentId, nil
    			}).(pulumi.StringPtrOutput),
    			AttachResourceType: pulumi.String("GatewayService"),
    			AttachResourceIds: pulumi.StringArray{
    				defaultService.ID().ToIDOutput().ToStringOutput(),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var @default = new AliCloud.Vpc.Network("default", new()
        {
            VpcName = $"{name}-vpc",
            CidrBlock = "192.168.0.0/16",
        });
    
        var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
        {
            VswitchName = $"{name}-vsw",
            VpcId = @default.Id,
            ZoneId = "cn-hangzhou-b",
            CidrBlock = "192.168.15.0/24",
        });
    
        var defaultGateway = new AliCloud.Apig.Gateway("default", new()
        {
            GatewayName = $"{name}-gw",
            GatewayType = "API",
            PaymentType = "PayAsYouGo",
            Spec = "apigw.small.x1",
            NetworkAccessConfig = new AliCloud.Apig.Inputs.GatewayNetworkAccessConfigArgs
            {
                Type = "Intranet",
            },
            Vpc = new AliCloud.Apig.Inputs.GatewayVpcArgs
            {
                VpcId = @default.Id,
            },
            Vswitch = new AliCloud.Apig.Inputs.GatewayVswitchArgs
            {
                VswitchId = defaultSwitch.Id,
            },
            ZoneConfig = new AliCloud.Apig.Inputs.GatewayZoneConfigArgs
            {
                SelectOption = "Auto",
            },
        });
    
        var defaultService = new AliCloud.Apig.Service("default", new()
        {
            ServiceName = $"{name}-svc",
            SourceType = "DNS",
            GatewayId = defaultGateway.Id,
            Addresses = new[]
            {
                "httpbin.org:8080",
            },
        });
    
        var defaultPolicy = new AliCloud.Apig.Policy("default", new()
        {
            PolicyName = name,
            PolicyClassName = "ServiceTls",
            PolicyConfig = "{\"mode\":\"SIMPLE\",\"sni\":\"aaaa\",\"enable\":true}",
            GatewayId = defaultGateway.Id,
            EnvironmentId = defaultGateway.Environments.Apply(environments => environments[0].EnvironmentId),
            AttachResourceType = "GatewayService",
            AttachResourceIds = new[]
            {
                defaultService.Id,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.vpc.Switch;
    import com.pulumi.alicloud.vpc.SwitchArgs;
    import com.pulumi.alicloud.apig.Gateway;
    import com.pulumi.alicloud.apig.GatewayArgs;
    import com.pulumi.alicloud.apig.inputs.GatewayNetworkAccessConfigArgs;
    import com.pulumi.alicloud.apig.inputs.GatewayVpcArgs;
    import com.pulumi.alicloud.apig.inputs.GatewayVswitchArgs;
    import com.pulumi.alicloud.apig.inputs.GatewayZoneConfigArgs;
    import com.pulumi.alicloud.apig.Service;
    import com.pulumi.alicloud.apig.ServiceArgs;
    import com.pulumi.alicloud.apig.Policy;
    import com.pulumi.alicloud.apig.PolicyArgs;
    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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var default_ = new Network("default", NetworkArgs.builder()
                .vpcName(String.format("%s-vpc", name))
                .cidrBlock("192.168.0.0/16")
                .build());
    
            var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
                .vswitchName(String.format("%s-vsw", name))
                .vpcId(default_.id())
                .zoneId("cn-hangzhou-b")
                .cidrBlock("192.168.15.0/24")
                .build());
    
            var defaultGateway = new Gateway("defaultGateway", GatewayArgs.builder()
                .gatewayName(String.format("%s-gw", name))
                .gatewayType("API")
                .paymentType("PayAsYouGo")
                .spec("apigw.small.x1")
                .networkAccessConfig(GatewayNetworkAccessConfigArgs.builder()
                    .type("Intranet")
                    .build())
                .vpc(GatewayVpcArgs.builder()
                    .vpcId(default_.id())
                    .build())
                .vswitch(GatewayVswitchArgs.builder()
                    .vswitchId(defaultSwitch.id())
                    .build())
                .zoneConfig(GatewayZoneConfigArgs.builder()
                    .selectOption("Auto")
                    .build())
                .build());
    
            var defaultService = new Service("defaultService", ServiceArgs.builder()
                .serviceName(String.format("%s-svc", name))
                .sourceType("DNS")
                .gatewayId(defaultGateway.id())
                .addresses("httpbin.org:8080")
                .build());
    
            var defaultPolicy = new Policy("defaultPolicy", PolicyArgs.builder()
                .policyName(name)
                .policyClassName("ServiceTls")
                .policyConfig("{\"mode\":\"SIMPLE\",\"sni\":\"aaaa\",\"enable\":true}")
                .gatewayId(defaultGateway.id())
                .environmentId(defaultGateway.environments().applyValue(_environments -> _environments[0].environmentId()))
                .attachResourceType("GatewayService")
                .attachResourceIds(defaultService.id())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      default:
        type: alicloud:vpc:Network
        properties:
          vpcName: ${name}-vpc
          cidrBlock: 192.168.0.0/16
      defaultSwitch:
        type: alicloud:vpc:Switch
        name: default
        properties:
          vswitchName: ${name}-vsw
          vpcId: ${default.id}
          zoneId: cn-hangzhou-b
          cidrBlock: 192.168.15.0/24
      defaultGateway:
        type: alicloud:apig:Gateway
        name: default
        properties:
          gatewayName: ${name}-gw
          gatewayType: API
          paymentType: PayAsYouGo
          spec: apigw.small.x1
          networkAccessConfig:
            type: Intranet
          vpc:
            vpcId: ${default.id}
          vswitch:
            vswitchId: ${defaultSwitch.id}
          zoneConfig:
            selectOption: Auto
      defaultService:
        type: alicloud:apig:Service
        name: default
        properties:
          serviceName: ${name}-svc
          sourceType: DNS
          gatewayId: ${defaultGateway.id}
          addresses:
            - httpbin.org:8080
      defaultPolicy:
        type: alicloud:apig:Policy
        name: default
        properties:
          policyName: ${name}
          policyClassName: ServiceTls
          policyConfig: '{"mode":"SIMPLE","sni":"aaaa","enable":true}'
          gatewayId: ${defaultGateway.id}
          environmentId: ${defaultGateway.environments[0].environmentId}
          attachResourceType: GatewayService
          attachResourceIds:
            - ${defaultService.id}
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    resource "alicloud_vpc_network" "default" {
      vpc_name   ="${var.name}-vpc"
      cidr_block = "192.168.0.0/16"
    }
    resource "alicloud_vpc_switch" "default" {
      vswitch_name ="${var.name}-vsw"
      vpc_id       = alicloud_vpc_network.default.id
      zone_id      = "cn-hangzhou-b"
      cidr_block   = "192.168.15.0/24"
    }
    resource "alicloud_apig_gateway" "default" {
      gateway_name ="${var.name}-gw"
      gateway_type = "API"
      payment_type = "PayAsYouGo"
      spec         = "apigw.small.x1"
      network_access_config = {
        type = "Intranet"
      }
      vpc = {
        vpc_id = alicloud_vpc_network.default.id
      }
      vswitch = {
        vswitch_id = alicloud_vpc_switch.default.id
      }
      zone_config = {
        select_option = "Auto"
      }
    }
    resource "alicloud_apig_service" "default" {
      service_name ="${var.name}-svc"
      source_type  = "DNS"
      gateway_id   = alicloud_apig_gateway.default.id
      addresses    = ["httpbin.org:8080"]
    }
    resource "alicloud_apig_policy" "default" {
      policy_name          = var.name
      policy_class_name    = "ServiceTls"
      policy_config        = "{\"mode\":\"SIMPLE\",\"sni\":\"aaaa\",\"enable\":true}"
      gateway_id           = alicloud_apig_gateway.default.id
      environment_id       = alicloud_apig_gateway.default.environments[0].environment_id
      attach_resource_type = "GatewayService"
      attach_resource_ids  = [alicloud_apig_service.default.id]
    }
    variable "name" {
      type    = string
      default = "terraform-example"
    }
    

    📚 Need more examples? VIEW MORE EXAMPLES

    Create Policy Resource

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

    Constructor syntax

    new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);
    @overload
    def Policy(resource_name: str,
               args: PolicyArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Policy(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               attach_resource_ids: Optional[Sequence[str]] = None,
               attach_resource_type: Optional[str] = None,
               policy_class_name: Optional[str] = None,
               policy_config: Optional[str] = None,
               environment_id: Optional[str] = None,
               gateway_id: Optional[str] = None,
               policy_name: Optional[str] = None)
    func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)
    public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
    public Policy(String name, PolicyArgs args)
    public Policy(String name, PolicyArgs args, CustomResourceOptions options)
    
    type: alicloud:apig:Policy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "alicloud_apig_policy" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args PolicyArgs
    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 PolicyArgs
    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 PolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var policyResource = new AliCloud.Apig.Policy("policyResource", new()
    {
        AttachResourceIds = new[]
        {
            "string",
        },
        AttachResourceType = "string",
        PolicyClassName = "string",
        PolicyConfig = "string",
        EnvironmentId = "string",
        GatewayId = "string",
        PolicyName = "string",
    });
    
    example, err := apig.NewPolicy(ctx, "policyResource", &apig.PolicyArgs{
    	AttachResourceIds: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	AttachResourceType: pulumi.String("string"),
    	PolicyClassName:    pulumi.String("string"),
    	PolicyConfig:       pulumi.String("string"),
    	EnvironmentId:      pulumi.String("string"),
    	GatewayId:          pulumi.String("string"),
    	PolicyName:         pulumi.String("string"),
    })
    
    resource "alicloud_apig_policy" "policyResource" {
      lifecycle {
        create_before_destroy = true
      }
      attach_resource_ids  = ["string"]
      attach_resource_type = "string"
      policy_class_name    = "string"
      policy_config        = "string"
      environment_id       = "string"
      gateway_id           = "string"
      policy_name          = "string"
    }
    
    var policyResource = new com.pulumi.alicloud.apig.Policy("policyResource", com.pulumi.alicloud.apig.PolicyArgs.builder()
        .attachResourceIds("string")
        .attachResourceType("string")
        .policyClassName("string")
        .policyConfig("string")
        .environmentId("string")
        .gatewayId("string")
        .policyName("string")
        .build());
    
    policy_resource = alicloud.apig.Policy("policyResource",
        attach_resource_ids=["string"],
        attach_resource_type="string",
        policy_class_name="string",
        policy_config="string",
        environment_id="string",
        gateway_id="string",
        policy_name="string")
    
    const policyResource = new alicloud.apig.Policy("policyResource", {
        attachResourceIds: ["string"],
        attachResourceType: "string",
        policyClassName: "string",
        policyConfig: "string",
        environmentId: "string",
        gatewayId: "string",
        policyName: "string",
    });
    
    type: alicloud:apig:Policy
    properties:
        attachResourceIds:
            - string
        attachResourceType: string
        environmentId: string
        gatewayId: string
        policyClassName: string
        policyConfig: string
        policyName: string
    

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

    AttachResourceIds List<string>
    The Mount point id list.
    AttachResourceType string
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    PolicyClassName string
    policy class name
    PolicyConfig string
    Policy Configuration
    EnvironmentId string
    Environment id
    GatewayId string
    Gateway id
    PolicyName string
    Policy Name
    AttachResourceIds []string
    The Mount point id list.
    AttachResourceType string
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    PolicyClassName string
    policy class name
    PolicyConfig string
    Policy Configuration
    EnvironmentId string
    Environment id
    GatewayId string
    Gateway id
    PolicyName string
    Policy Name
    attach_resource_ids list(string)
    The Mount point id list.
    attach_resource_type string
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    policy_class_name string
    policy class name
    policy_config string
    Policy Configuration
    environment_id string
    Environment id
    gateway_id string
    Gateway id
    policy_name string
    Policy Name
    attachResourceIds List<String>
    The Mount point id list.
    attachResourceType String
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    policyClassName String
    policy class name
    policyConfig String
    Policy Configuration
    environmentId String
    Environment id
    gatewayId String
    Gateway id
    policyName String
    Policy Name
    attachResourceIds string[]
    The Mount point id list.
    attachResourceType string
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    policyClassName string
    policy class name
    policyConfig string
    Policy Configuration
    environmentId string
    Environment id
    gatewayId string
    Gateway id
    policyName string
    Policy Name
    attach_resource_ids Sequence[str]
    The Mount point id list.
    attach_resource_type str
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    policy_class_name str
    policy class name
    policy_config str
    Policy Configuration
    environment_id str
    Environment id
    gateway_id str
    Gateway id
    policy_name str
    Policy Name
    attachResourceIds List<String>
    The Mount point id list.
    attachResourceType String
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    policyClassName String
    policy class name
    policyConfig String
    Policy Configuration
    environmentId String
    Environment id
    gatewayId String
    Gateway id
    policyName String
    Policy Name

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Policy resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    PolicyClassId string
    policy class id.
    Id string
    The provider-assigned unique ID for this managed resource.
    PolicyClassId string
    policy class id.
    id string
    The provider-assigned unique ID for this managed resource.
    policy_class_id string
    policy class id.
    id String
    The provider-assigned unique ID for this managed resource.
    policyClassId String
    policy class id.
    id string
    The provider-assigned unique ID for this managed resource.
    policyClassId string
    policy class id.
    id str
    The provider-assigned unique ID for this managed resource.
    policy_class_id str
    policy class id.
    id String
    The provider-assigned unique ID for this managed resource.
    policyClassId String
    policy class id.

    Look up Existing Policy Resource

    Get an existing Policy 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?: PolicyState, opts?: CustomResourceOptions): Policy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            attach_resource_ids: Optional[Sequence[str]] = None,
            attach_resource_type: Optional[str] = None,
            environment_id: Optional[str] = None,
            gateway_id: Optional[str] = None,
            policy_class_id: Optional[str] = None,
            policy_class_name: Optional[str] = None,
            policy_config: Optional[str] = None,
            policy_name: Optional[str] = None) -> Policy
    func GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)
    public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)
    public static Policy get(String name, Output<String> id, PolicyState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:apig:Policy    get:      id: ${id}
    import {
      to = alicloud_apig_policy.example
      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.
    The following state arguments are supported:
    AttachResourceIds List<string>
    The Mount point id list.
    AttachResourceType string
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    EnvironmentId string
    Environment id
    GatewayId string
    Gateway id
    PolicyClassId string
    policy class id.
    PolicyClassName string
    policy class name
    PolicyConfig string
    Policy Configuration
    PolicyName string
    Policy Name
    AttachResourceIds []string
    The Mount point id list.
    AttachResourceType string
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    EnvironmentId string
    Environment id
    GatewayId string
    Gateway id
    PolicyClassId string
    policy class id.
    PolicyClassName string
    policy class name
    PolicyConfig string
    Policy Configuration
    PolicyName string
    Policy Name
    attach_resource_ids list(string)
    The Mount point id list.
    attach_resource_type string
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    environment_id string
    Environment id
    gateway_id string
    Gateway id
    policy_class_id string
    policy class id.
    policy_class_name string
    policy class name
    policy_config string
    Policy Configuration
    policy_name string
    Policy Name
    attachResourceIds List<String>
    The Mount point id list.
    attachResourceType String
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    environmentId String
    Environment id
    gatewayId String
    Gateway id
    policyClassId String
    policy class id.
    policyClassName String
    policy class name
    policyConfig String
    Policy Configuration
    policyName String
    Policy Name
    attachResourceIds string[]
    The Mount point id list.
    attachResourceType string
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    environmentId string
    Environment id
    gatewayId string
    Gateway id
    policyClassId string
    policy class id.
    policyClassName string
    policy class name
    policyConfig string
    Policy Configuration
    policyName string
    Policy Name
    attach_resource_ids Sequence[str]
    The Mount point id list.
    attach_resource_type str
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    environment_id str
    Environment id
    gateway_id str
    Gateway id
    policy_class_id str
    policy class id.
    policy_class_name str
    policy class name
    policy_config str
    Policy Configuration
    policy_name str
    Policy Name
    attachResourceIds List<String>
    The Mount point id list.
    attachResourceType String
    Policies support mount point types.

    • HttpApi:HttpApi.
    • Operation: the Operation of the HttpApi.
    • GatewayRoute: Gateway route.
    • GatewayService: Gateway service.
    • GatewayServicePort: The Gateway service port.
    • Domain: The Gateway Domain name.
    • Gateway: Gateway.
    environmentId String
    Environment id
    gatewayId String
    Gateway id
    policyClassId String
    policy class id.
    policyClassName String
    policy class name
    policyConfig String
    Policy Configuration
    policyName String
    Policy Name

    Import

    APIG Policy can be imported using the id, e.g.

    $ pulumi import alicloud:apig/policy:Policy example <policy_id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo alicloud logo
    Viewing docs for Alibaba Cloud v3.108.0
    published on Thursday, Sep 17, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial