1. Packages
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. esa
  6. getNetworkOptimizations
Viewing docs for Alibaba Cloud v3.105.0
published on Thursday, Jul 16, 2026 by Pulumi
alicloud logo
Viewing docs for Alibaba Cloud v3.105.0
published on Thursday, Jul 16, 2026 by Pulumi

    This data source provides the Esa Network Optimizations of the current Alibaba Cloud user.

    NOTE: Available since v1.279.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 = alicloud.esa.getSites({
        planSubscribeType: "enterpriseplan",
    });
    const defaultNetworkOptimization = new alicloud.esa.NetworkOptimization("default", {
        siteId: output(_default.then(_default => _default.sites?.[0]?.id)).apply(x =>String(x)),
        siteVersion: 0,
        ruleEnable: "on",
        ruleName: name,
        rule: "true",
        sequence: 1,
        smartRouting: "on",
        websocket: "on",
        http2Origin: "on",
        grpc: "on",
        uploadMaxFilesize: "100",
    });
    const ids = alicloud.esa.getNetworkOptimizationsOutput({
        ids: [defaultNetworkOptimization.id],
        siteId: defaultNetworkOptimization.siteId,
    });
    export const esaNetworkOptimizationsId0 = ids.apply(ids => ids.optimizations?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.esa.get_sites(plan_subscribe_type="enterpriseplan")
    default_network_optimization = alicloud.esa.NetworkOptimization("default",
        site_id=output(default.sites[0].id).apply(lambda x: str(x)),
        site_version=0,
        rule_enable="on",
        rule_name=name,
        rule="true",
        sequence=1,
        smart_routing="on",
        websocket="on",
        http2_origin="on",
        grpc="on",
        upload_max_filesize="100")
    ids = alicloud.esa.get_network_optimizations_output(ids=[default_network_optimization.id],
        site_id=default_network_optimization.site_id)
    pulumi.export("esaNetworkOptimizationsId0", ids.optimizations[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/esa"
    	"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 := esa.GetSites(ctx, &esa.GetSitesArgs{
    			PlanSubscribeType: pulumi.StringRef("enterpriseplan"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultNetworkOptimization, err := esa.NewNetworkOptimization(ctx, "default", &esa.NetworkOptimizationArgs{
    			SiteId:            pulumi.Int(_default.Sites[0].Id),
    			SiteVersion:       pulumi.Int(0),
    			RuleEnable:        pulumi.String("on"),
    			RuleName:          pulumi.String(name),
    			Rule:              pulumi.String("true"),
    			Sequence:          pulumi.Int(1),
    			SmartRouting:      pulumi.String("on"),
    			Websocket:         pulumi.String("on"),
    			Http2Origin:       pulumi.String("on"),
    			Grpc:              pulumi.String("on"),
    			UploadMaxFilesize: pulumi.String("100"),
    		})
    		if err != nil {
    			return err
    		}
    		ids := esa.GetNetworkOptimizationsOutput(ctx, esa.GetNetworkOptimizationsOutputArgs{
    			Ids: pulumi.StringArray{
    				defaultNetworkOptimization.ID(),
    			},
    			SiteId: defaultNetworkOptimization.SiteId,
    		}, nil)
    		ctx.Export("esaNetworkOptimizationsId0", ids.ApplyT(func(ids esa.GetNetworkOptimizationsResult) (*string, error) {
    			return ids.Optimizations[0].Id, nil
    		}).(pulumi.StringPtrOutput))
    		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 = AliCloud.Esa.GetSites.Invoke(new()
        {
            PlanSubscribeType = "enterpriseplan",
        });
    
        var defaultNetworkOptimization = new AliCloud.Esa.NetworkOptimization("default", new()
        {
            SiteId = @default.Apply(@default => @default.Apply(getSitesResult => getSitesResult.Sites[0]?.Id)),
            SiteVersion = 0,
            RuleEnable = "on",
            RuleName = name,
            Rule = "true",
            Sequence = 1,
            SmartRouting = "on",
            Websocket = "on",
            Http2Origin = "on",
            Grpc = "on",
            UploadMaxFilesize = "100",
        });
    
        var ids = AliCloud.Esa.GetNetworkOptimizations.Invoke(new()
        {
            Ids = new[]
            {
                defaultNetworkOptimization.Id,
            },
            SiteId = defaultNetworkOptimization.SiteId,
        });
    
        return new Dictionary<string, object?>
        {
            ["esaNetworkOptimizationsId0"] = ids.Apply(getNetworkOptimizationsResult => getNetworkOptimizationsResult.Optimizations[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.esa.EsaFunctions;
    import com.pulumi.alicloud.esa.inputs.GetSitesArgs;
    import com.pulumi.alicloud.esa.NetworkOptimization;
    import com.pulumi.alicloud.esa.NetworkOptimizationArgs;
    import com.pulumi.alicloud.esa.inputs.GetNetworkOptimizationsArgs;
    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");
            final var default = EsaFunctions.getSites(GetSitesArgs.builder()
                .planSubscribeType("enterpriseplan")
                .build());
    
            var defaultNetworkOptimization = new NetworkOptimization("defaultNetworkOptimization", NetworkOptimizationArgs.builder()
                .siteId(default_.sites()[0].id())
                .siteVersion(0)
                .ruleEnable("on")
                .ruleName(name)
                .rule("true")
                .sequence(1)
                .smartRouting("on")
                .websocket("on")
                .http2Origin("on")
                .grpc("on")
                .uploadMaxFilesize("100")
                .build());
    
            final var ids = EsaFunctions.getNetworkOptimizations(GetNetworkOptimizationsArgs.builder()
                .ids(defaultNetworkOptimization.id())
                .siteId(defaultNetworkOptimization.siteId())
                .build());
    
            ctx.export("esaNetworkOptimizationsId0", ids.applyValue(_ids -> _ids.optimizations()[0].id()));
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      defaultNetworkOptimization:
        type: alicloud:esa:NetworkOptimization
        name: default
        properties:
          siteId: ${default.sites[0].id}
          siteVersion: 0
          ruleEnable: on
          ruleName: ${name}
          rule: 'true'
          sequence: 1
          smartRouting: on
          websocket: on
          http2Origin: on
          grpc: on
          uploadMaxFilesize: '100'
    variables:
      default:
        fn::invoke:
          function: alicloud:esa:getSites
          arguments:
            planSubscribeType: enterpriseplan
      ids:
        fn::invoke:
          function: alicloud:esa:getNetworkOptimizations
          arguments:
            ids:
              - ${defaultNetworkOptimization.id}
            siteId: ${defaultNetworkOptimization.siteId}
    outputs:
      esaNetworkOptimizationsId0: ${ids.optimizations[0].id}
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    data "alicloud_esa_getsites" "default" {
      plan_subscribe_type = "enterpriseplan"
    }
    data "alicloud_esa_getnetworkoptimizations" "ids" {
      ids     = [alicloud_esa_networkoptimization.default.id]
      site_id = alicloud_esa_networkoptimization.default.site_id
    }
    
    resource "alicloud_esa_networkoptimization" "default" {
      site_id             = data.alicloud_esa_getsites.default.sites[0].id
      site_version        = 0
      rule_enable         = "on"
      rule_name           = var.name
      rule                = "true"
      sequence            = 1
      smart_routing       = "on"
      websocket           = "on"
      http2_origin        = "on"
      grpc                = "on"
      upload_max_filesize = "100"
    }
    variable "name" {
      type    = string
      default = "terraform-example"
    }
    output "esaNetworkOptimizationsId0" {
      value = data.alicloud_esa_getnetworkoptimizations.ids.optimizations[0].id
    }
    

    Using getNetworkOptimizations

    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 getNetworkOptimizations(args: GetNetworkOptimizationsArgs, opts?: InvokeOptions): Promise<GetNetworkOptimizationsResult>
    function getNetworkOptimizationsOutput(args: GetNetworkOptimizationsOutputArgs, opts?: InvokeOptions): Output<GetNetworkOptimizationsResult>
    def get_network_optimizations(config_id: Optional[str] = None,
                                  config_type: Optional[str] = None,
                                  ids: Optional[Sequence[str]] = None,
                                  name_regex: Optional[str] = None,
                                  output_file: Optional[str] = None,
                                  rule_name: Optional[str] = None,
                                  site_id: Optional[str] = None,
                                  site_version: Optional[int] = None,
                                  opts: Optional[InvokeOptions] = None) -> GetNetworkOptimizationsResult
    def get_network_optimizations_output(config_id: pulumi.Input[Optional[str]] = None,
                                  config_type: pulumi.Input[Optional[str]] = None,
                                  ids: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
                                  name_regex: pulumi.Input[Optional[str]] = None,
                                  output_file: pulumi.Input[Optional[str]] = None,
                                  rule_name: pulumi.Input[Optional[str]] = None,
                                  site_id: pulumi.Input[Optional[str]] = None,
                                  site_version: pulumi.Input[Optional[int]] = None,
                                  opts: Optional[InvokeOptions] = None) -> Output[GetNetworkOptimizationsResult]
    func GetNetworkOptimizations(ctx *Context, args *GetNetworkOptimizationsArgs, opts ...InvokeOption) (*GetNetworkOptimizationsResult, error)
    func GetNetworkOptimizationsOutput(ctx *Context, args *GetNetworkOptimizationsOutputArgs, opts ...InvokeOption) GetNetworkOptimizationsResultOutput

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

    public static class GetNetworkOptimizations 
    {
        public static Task<GetNetworkOptimizationsResult> InvokeAsync(GetNetworkOptimizationsArgs args, InvokeOptions? opts = null)
        public static Output<GetNetworkOptimizationsResult> Invoke(GetNetworkOptimizationsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNetworkOptimizationsResult> getNetworkOptimizations(GetNetworkOptimizationsArgs args, InvokeOptions options)
    public static Output<GetNetworkOptimizationsResult> getNetworkOptimizations(GetNetworkOptimizationsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: alicloud:esa/getNetworkOptimizations:getNetworkOptimizations
      arguments:
        # arguments dictionary
    data "alicloud_esa_getnetworkoptimizations" "name" {
        # arguments
    }

    The following arguments are supported:

    SiteId string
    The ID of the Site.
    ConfigId string
    The ID of the Configuration.
    ConfigType string
    The type of the Configuration. Valid values: global, rule.
    Ids List<string>
    A list of Network Optimization IDs. It formats as <site_id>:<config_id>.
    NameRegex string
    A regex string to filter results by Network Optimization name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RuleName string
    The name of the rule.
    SiteVersion int
    The version of the site.
    SiteId string
    The ID of the Site.
    ConfigId string
    The ID of the Configuration.
    ConfigType string
    The type of the Configuration. Valid values: global, rule.
    Ids []string
    A list of Network Optimization IDs. It formats as <site_id>:<config_id>.
    NameRegex string
    A regex string to filter results by Network Optimization name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RuleName string
    The name of the rule.
    SiteVersion int
    The version of the site.
    site_id string
    The ID of the Site.
    config_id string
    The ID of the Configuration.
    config_type string
    The type of the Configuration. Valid values: global, rule.
    ids list(string)
    A list of Network Optimization IDs. It formats as <site_id>:<config_id>.
    name_regex string
    A regex string to filter results by Network Optimization name.
    output_file string
    File name where to save data source results (after running pulumi preview).
    rule_name string
    The name of the rule.
    site_version number
    The version of the site.
    siteId String
    The ID of the Site.
    configId String
    The ID of the Configuration.
    configType String
    The type of the Configuration. Valid values: global, rule.
    ids List<String>
    A list of Network Optimization IDs. It formats as <site_id>:<config_id>.
    nameRegex String
    A regex string to filter results by Network Optimization name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    ruleName String
    The name of the rule.
    siteVersion Integer
    The version of the site.
    siteId string
    The ID of the Site.
    configId string
    The ID of the Configuration.
    configType string
    The type of the Configuration. Valid values: global, rule.
    ids string[]
    A list of Network Optimization IDs. It formats as <site_id>:<config_id>.
    nameRegex string
    A regex string to filter results by Network Optimization name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    ruleName string
    The name of the rule.
    siteVersion number
    The version of the site.
    site_id str
    The ID of the Site.
    config_id str
    The ID of the Configuration.
    config_type str
    The type of the Configuration. Valid values: global, rule.
    ids Sequence[str]
    A list of Network Optimization IDs. It formats as <site_id>:<config_id>.
    name_regex str
    A regex string to filter results by Network Optimization name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    rule_name str
    The name of the rule.
    site_version int
    The version of the site.
    siteId String
    The ID of the Site.
    configId String
    The ID of the Configuration.
    configType String
    The type of the Configuration. Valid values: global, rule.
    ids List<String>
    A list of Network Optimization IDs. It formats as <site_id>:<config_id>.
    nameRegex String
    A regex string to filter results by Network Optimization name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    ruleName String
    The name of the rule.
    siteVersion Number
    The version of the site.

    getNetworkOptimizations Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    A list of Network Optimization names.
    Optimizations List<Pulumi.AliCloud.Esa.Outputs.GetNetworkOptimizationsOptimization>
    A list of Network Optimizations. Each element contains the following attributes:
    SiteId string
    ConfigId string
    The ID of the Configuration.
    ConfigType string
    The type of the Configuration.
    NameRegex string
    OutputFile string
    RuleName string
    Rule name.
    SiteVersion int
    The version of the site.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    A list of Network Optimization names.
    Optimizations []GetNetworkOptimizationsOptimization
    A list of Network Optimizations. Each element contains the following attributes:
    SiteId string
    ConfigId string
    The ID of the Configuration.
    ConfigType string
    The type of the Configuration.
    NameRegex string
    OutputFile string
    RuleName string
    Rule name.
    SiteVersion int
    The version of the site.
    id string
    The provider-assigned unique ID for this managed resource.
    ids list(string)
    names list(string)
    A list of Network Optimization names.
    optimizations list(object)
    A list of Network Optimizations. Each element contains the following attributes:
    site_id string
    config_id string
    The ID of the Configuration.
    config_type string
    The type of the Configuration.
    name_regex string
    output_file string
    rule_name string
    Rule name.
    site_version number
    The version of the site.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of Network Optimization names.
    optimizations List<GetNetworkOptimizationsOptimization>
    A list of Network Optimizations. Each element contains the following attributes:
    siteId String
    configId String
    The ID of the Configuration.
    configType String
    The type of the Configuration.
    nameRegex String
    outputFile String
    ruleName String
    Rule name.
    siteVersion Integer
    The version of the site.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    A list of Network Optimization names.
    optimizations GetNetworkOptimizationsOptimization[]
    A list of Network Optimizations. Each element contains the following attributes:
    siteId string
    configId string
    The ID of the Configuration.
    configType string
    The type of the Configuration.
    nameRegex string
    outputFile string
    ruleName string
    Rule name.
    siteVersion number
    The version of the site.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    A list of Network Optimization names.
    optimizations Sequence[GetNetworkOptimizationsOptimization]
    A list of Network Optimizations. Each element contains the following attributes:
    site_id str
    config_id str
    The ID of the Configuration.
    config_type str
    The type of the Configuration.
    name_regex str
    output_file str
    rule_name str
    Rule name.
    site_version int
    The version of the site.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of Network Optimization names.
    optimizations List<Property Map>
    A list of Network Optimizations. Each element contains the following attributes:
    siteId String
    configId String
    The ID of the Configuration.
    configType String
    The type of the Configuration.
    nameRegex String
    outputFile String
    ruleName String
    Rule name.
    siteVersion Number
    The version of the site.

    Supporting Types

    GetNetworkOptimizationsOptimization

    ConfigId string
    The ID of the Configuration.
    ConfigType string
    The type of the Configuration. Valid values: global, rule.
    Grpc string
    Whether to enable GRPC.
    Http2Origin string
    Whether to enable HTTP2 origin.
    Id string
    The ID of the Network Optimization.
    Rule string
    Rule content.
    RuleEnable string
    Rule switch.
    RuleName string
    The name of the rule.
    Sequence int
    The rule execution order prioritizes lower numerical values.
    SiteVersion int
    The version of the site.
    SmartRouting string
    Whether to enable smart routing service.
    UploadMaxFilesize string
    Maximum upload file size.
    Websocket string
    Whether to enable Websocket.
    ConfigId string
    The ID of the Configuration.
    ConfigType string
    The type of the Configuration. Valid values: global, rule.
    Grpc string
    Whether to enable GRPC.
    Http2Origin string
    Whether to enable HTTP2 origin.
    Id string
    The ID of the Network Optimization.
    Rule string
    Rule content.
    RuleEnable string
    Rule switch.
    RuleName string
    The name of the rule.
    Sequence int
    The rule execution order prioritizes lower numerical values.
    SiteVersion int
    The version of the site.
    SmartRouting string
    Whether to enable smart routing service.
    UploadMaxFilesize string
    Maximum upload file size.
    Websocket string
    Whether to enable Websocket.
    config_id string
    The ID of the Configuration.
    config_type string
    The type of the Configuration. Valid values: global, rule.
    grpc string
    Whether to enable GRPC.
    http2_origin string
    Whether to enable HTTP2 origin.
    id string
    The ID of the Network Optimization.
    rule string
    Rule content.
    rule_enable string
    Rule switch.
    rule_name string
    The name of the rule.
    sequence number
    The rule execution order prioritizes lower numerical values.
    site_version number
    The version of the site.
    smart_routing string
    Whether to enable smart routing service.
    upload_max_filesize string
    Maximum upload file size.
    websocket string
    Whether to enable Websocket.
    configId String
    The ID of the Configuration.
    configType String
    The type of the Configuration. Valid values: global, rule.
    grpc String
    Whether to enable GRPC.
    http2Origin String
    Whether to enable HTTP2 origin.
    id String
    The ID of the Network Optimization.
    rule String
    Rule content.
    ruleEnable String
    Rule switch.
    ruleName String
    The name of the rule.
    sequence Integer
    The rule execution order prioritizes lower numerical values.
    siteVersion Integer
    The version of the site.
    smartRouting String
    Whether to enable smart routing service.
    uploadMaxFilesize String
    Maximum upload file size.
    websocket String
    Whether to enable Websocket.
    configId string
    The ID of the Configuration.
    configType string
    The type of the Configuration. Valid values: global, rule.
    grpc string
    Whether to enable GRPC.
    http2Origin string
    Whether to enable HTTP2 origin.
    id string
    The ID of the Network Optimization.
    rule string
    Rule content.
    ruleEnable string
    Rule switch.
    ruleName string
    The name of the rule.
    sequence number
    The rule execution order prioritizes lower numerical values.
    siteVersion number
    The version of the site.
    smartRouting string
    Whether to enable smart routing service.
    uploadMaxFilesize string
    Maximum upload file size.
    websocket string
    Whether to enable Websocket.
    config_id str
    The ID of the Configuration.
    config_type str
    The type of the Configuration. Valid values: global, rule.
    grpc str
    Whether to enable GRPC.
    http2_origin str
    Whether to enable HTTP2 origin.
    id str
    The ID of the Network Optimization.
    rule str
    Rule content.
    rule_enable str
    Rule switch.
    rule_name str
    The name of the rule.
    sequence int
    The rule execution order prioritizes lower numerical values.
    site_version int
    The version of the site.
    smart_routing str
    Whether to enable smart routing service.
    upload_max_filesize str
    Maximum upload file size.
    websocket str
    Whether to enable Websocket.
    configId String
    The ID of the Configuration.
    configType String
    The type of the Configuration. Valid values: global, rule.
    grpc String
    Whether to enable GRPC.
    http2Origin String
    Whether to enable HTTP2 origin.
    id String
    The ID of the Network Optimization.
    rule String
    Rule content.
    ruleEnable String
    Rule switch.
    ruleName String
    The name of the rule.
    sequence Number
    The rule execution order prioritizes lower numerical values.
    siteVersion Number
    The version of the site.
    smartRouting String
    Whether to enable smart routing service.
    uploadMaxFilesize String
    Maximum upload file size.
    websocket String
    Whether to enable Websocket.

    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
    Viewing docs for Alibaba Cloud v3.105.0
    published on Thursday, Jul 16, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial