1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. esa
  5. NetworkOptimization
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.esa.NetworkOptimization

Explore with Pulumi AI

Provides a ESA Network Optimization resource.

For information about ESA Network Optimization and how to use it, see What is Network Optimization.

NOTE: Available since v1.244.0.

Example Usage

Basic Usage

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

const _default = alicloud.esa.getSites({
    planSubscribeType: "enterpriseplan",
});
const defaultSite = new alicloud.esa.Site("default", {
    siteName: "gositecdn.cn",
    instanceId: _default.then(_default => _default.sites?.[0]?.instanceId),
    coverage: "overseas",
    accessType: "NS",
});
const defaultNetworkOptimization = new alicloud.esa.NetworkOptimization("default", {
    siteVersion: 0,
    siteId: defaultSite.id,
    ruleEnable: "on",
    websocket: "off",
    rule: "(http.host eq \"tf.example.com\")",
    grpc: "off",
    http2Origin: "off",
    smartRouting: "off",
    uploadMaxFilesize: "100",
    ruleName: "network_optimization",
});
Copy
import pulumi
import pulumi_alicloud as alicloud

default = alicloud.esa.get_sites(plan_subscribe_type="enterpriseplan")
default_site = alicloud.esa.Site("default",
    site_name="gositecdn.cn",
    instance_id=default.sites[0].instance_id,
    coverage="overseas",
    access_type="NS")
default_network_optimization = alicloud.esa.NetworkOptimization("default",
    site_version=0,
    site_id=default_site.id,
    rule_enable="on",
    websocket="off",
    rule="(http.host eq \"tf.example.com\")",
    grpc="off",
    http2_origin="off",
    smart_routing="off",
    upload_max_filesize="100",
    rule_name="network_optimization")
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/esa"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := esa.GetSites(ctx, &esa.GetSitesArgs{
			PlanSubscribeType: pulumi.StringRef("enterpriseplan"),
		}, nil)
		if err != nil {
			return err
		}
		defaultSite, err := esa.NewSite(ctx, "default", &esa.SiteArgs{
			SiteName:   pulumi.String("gositecdn.cn"),
			InstanceId: pulumi.String(_default.Sites[0].InstanceId),
			Coverage:   pulumi.String("overseas"),
			AccessType: pulumi.String("NS"),
		})
		if err != nil {
			return err
		}
		_, err = esa.NewNetworkOptimization(ctx, "default", &esa.NetworkOptimizationArgs{
			SiteVersion:       pulumi.Int(0),
			SiteId:            defaultSite.ID(),
			RuleEnable:        pulumi.String("on"),
			Websocket:         pulumi.String("off"),
			Rule:              pulumi.String("(http.host eq \"tf.example.com\")"),
			Grpc:              pulumi.String("off"),
			Http2Origin:       pulumi.String("off"),
			SmartRouting:      pulumi.String("off"),
			UploadMaxFilesize: pulumi.String("100"),
			RuleName:          pulumi.String("network_optimization"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var @default = AliCloud.Esa.GetSites.Invoke(new()
    {
        PlanSubscribeType = "enterpriseplan",
    });

    var defaultSite = new AliCloud.Esa.Site("default", new()
    {
        SiteName = "gositecdn.cn",
        InstanceId = @default.Apply(@default => @default.Apply(getSitesResult => getSitesResult.Sites[0]?.InstanceId)),
        Coverage = "overseas",
        AccessType = "NS",
    });

    var defaultNetworkOptimization = new AliCloud.Esa.NetworkOptimization("default", new()
    {
        SiteVersion = 0,
        SiteId = defaultSite.Id,
        RuleEnable = "on",
        Websocket = "off",
        Rule = "(http.host eq \"tf.example.com\")",
        Grpc = "off",
        Http2Origin = "off",
        SmartRouting = "off",
        UploadMaxFilesize = "100",
        RuleName = "network_optimization",
    });

});
Copy
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.Site;
import com.pulumi.alicloud.esa.SiteArgs;
import com.pulumi.alicloud.esa.NetworkOptimization;
import com.pulumi.alicloud.esa.NetworkOptimizationArgs;
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) {
        final var default = EsaFunctions.getSites(GetSitesArgs.builder()
            .planSubscribeType("enterpriseplan")
            .build());

        var defaultSite = new Site("defaultSite", SiteArgs.builder()
            .siteName("gositecdn.cn")
            .instanceId(default_.sites()[0].instanceId())
            .coverage("overseas")
            .accessType("NS")
            .build());

        var defaultNetworkOptimization = new NetworkOptimization("defaultNetworkOptimization", NetworkOptimizationArgs.builder()
            .siteVersion("0")
            .siteId(defaultSite.id())
            .ruleEnable("on")
            .websocket("off")
            .rule("(http.host eq \"tf.example.com\")")
            .grpc("off")
            .http2Origin("off")
            .smartRouting("off")
            .uploadMaxFilesize("100")
            .ruleName("network_optimization")
            .build());

    }
}
Copy
resources:
  defaultSite:
    type: alicloud:esa:Site
    name: default
    properties:
      siteName: gositecdn.cn
      instanceId: ${default.sites[0].instanceId}
      coverage: overseas
      accessType: NS
  defaultNetworkOptimization:
    type: alicloud:esa:NetworkOptimization
    name: default
    properties:
      siteVersion: '0'
      siteId: ${defaultSite.id}
      ruleEnable: on
      websocket: off
      rule: (http.host eq "tf.example.com")
      grpc: off
      http2Origin: off
      smartRouting: off
      uploadMaxFilesize: '100'
      ruleName: network_optimization
variables:
  default:
    fn::invoke:
      function: alicloud:esa:getSites
      arguments:
        planSubscribeType: enterpriseplan
Copy

Create NetworkOptimization Resource

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

Constructor syntax

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

@overload
def NetworkOptimization(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        site_id: Optional[int] = None,
                        grpc: Optional[str] = None,
                        http2_origin: Optional[str] = None,
                        rule: Optional[str] = None,
                        rule_enable: Optional[str] = None,
                        rule_name: Optional[str] = None,
                        site_version: Optional[int] = None,
                        smart_routing: Optional[str] = None,
                        upload_max_filesize: Optional[str] = None,
                        websocket: Optional[str] = None)
func NewNetworkOptimization(ctx *Context, name string, args NetworkOptimizationArgs, opts ...ResourceOption) (*NetworkOptimization, error)
public NetworkOptimization(string name, NetworkOptimizationArgs args, CustomResourceOptions? opts = null)
public NetworkOptimization(String name, NetworkOptimizationArgs args)
public NetworkOptimization(String name, NetworkOptimizationArgs args, CustomResourceOptions options)
type: alicloud:esa:NetworkOptimization
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. NetworkOptimizationArgs
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. NetworkOptimizationArgs
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. NetworkOptimizationArgs
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. NetworkOptimizationArgs
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. NetworkOptimizationArgs
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 networkOptimizationResource = new AliCloud.Esa.NetworkOptimization("networkOptimizationResource", new()
{
    SiteId = 0,
    Grpc = "string",
    Http2Origin = "string",
    Rule = "string",
    RuleEnable = "string",
    RuleName = "string",
    SiteVersion = 0,
    SmartRouting = "string",
    UploadMaxFilesize = "string",
    Websocket = "string",
});
Copy
example, err := esa.NewNetworkOptimization(ctx, "networkOptimizationResource", &esa.NetworkOptimizationArgs{
	SiteId:            pulumi.Int(0),
	Grpc:              pulumi.String("string"),
	Http2Origin:       pulumi.String("string"),
	Rule:              pulumi.String("string"),
	RuleEnable:        pulumi.String("string"),
	RuleName:          pulumi.String("string"),
	SiteVersion:       pulumi.Int(0),
	SmartRouting:      pulumi.String("string"),
	UploadMaxFilesize: pulumi.String("string"),
	Websocket:         pulumi.String("string"),
})
Copy
var networkOptimizationResource = new NetworkOptimization("networkOptimizationResource", NetworkOptimizationArgs.builder()
    .siteId(0)
    .grpc("string")
    .http2Origin("string")
    .rule("string")
    .ruleEnable("string")
    .ruleName("string")
    .siteVersion(0)
    .smartRouting("string")
    .uploadMaxFilesize("string")
    .websocket("string")
    .build());
Copy
network_optimization_resource = alicloud.esa.NetworkOptimization("networkOptimizationResource",
    site_id=0,
    grpc="string",
    http2_origin="string",
    rule="string",
    rule_enable="string",
    rule_name="string",
    site_version=0,
    smart_routing="string",
    upload_max_filesize="string",
    websocket="string")
Copy
const networkOptimizationResource = new alicloud.esa.NetworkOptimization("networkOptimizationResource", {
    siteId: 0,
    grpc: "string",
    http2Origin: "string",
    rule: "string",
    ruleEnable: "string",
    ruleName: "string",
    siteVersion: 0,
    smartRouting: "string",
    uploadMaxFilesize: "string",
    websocket: "string",
});
Copy
type: alicloud:esa:NetworkOptimization
properties:
    grpc: string
    http2Origin: string
    rule: string
    ruleEnable: string
    ruleName: string
    siteId: 0
    siteVersion: 0
    smartRouting: string
    uploadMaxFilesize: string
    websocket: string
Copy

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

SiteId
This property is required.
Changes to this property will trigger replacement.
int
Site ID.
Grpc string
Whether to enable GRPC, default is disabled. Value range:
Http2Origin string
Whether to enable HTTP2 origin, default is disabled. Value range:
Rule string
Rule content.
RuleEnable string
Rule switch. Values:
RuleName string
Rule name.
SiteVersion Changes to this property will trigger replacement. int
Site version number.
SmartRouting string
Whether to enable smart routing service, default is disabled. Value range:
UploadMaxFilesize string
Maximum upload file size, in MB, value range: 100~500.
Websocket string
Whether to enable Websocket, default is enabled. Value range:
SiteId
This property is required.
Changes to this property will trigger replacement.
int
Site ID.
Grpc string
Whether to enable GRPC, default is disabled. Value range:
Http2Origin string
Whether to enable HTTP2 origin, default is disabled. Value range:
Rule string
Rule content.
RuleEnable string
Rule switch. Values:
RuleName string
Rule name.
SiteVersion Changes to this property will trigger replacement. int
Site version number.
SmartRouting string
Whether to enable smart routing service, default is disabled. Value range:
UploadMaxFilesize string
Maximum upload file size, in MB, value range: 100~500.
Websocket string
Whether to enable Websocket, default is enabled. Value range:
siteId
This property is required.
Changes to this property will trigger replacement.
Integer
Site ID.
grpc String
Whether to enable GRPC, default is disabled. Value range:
http2Origin String
Whether to enable HTTP2 origin, default is disabled. Value range:
rule String
Rule content.
ruleEnable String
Rule switch. Values:
ruleName String
Rule name.
siteVersion Changes to this property will trigger replacement. Integer
Site version number.
smartRouting String
Whether to enable smart routing service, default is disabled. Value range:
uploadMaxFilesize String
Maximum upload file size, in MB, value range: 100~500.
websocket String
Whether to enable Websocket, default is enabled. Value range:
siteId
This property is required.
Changes to this property will trigger replacement.
number
Site ID.
grpc string
Whether to enable GRPC, default is disabled. Value range:
http2Origin string
Whether to enable HTTP2 origin, default is disabled. Value range:
rule string
Rule content.
ruleEnable string
Rule switch. Values:
ruleName string
Rule name.
siteVersion Changes to this property will trigger replacement. number
Site version number.
smartRouting string
Whether to enable smart routing service, default is disabled. Value range:
uploadMaxFilesize string
Maximum upload file size, in MB, value range: 100~500.
websocket string
Whether to enable Websocket, default is enabled. Value range:
site_id
This property is required.
Changes to this property will trigger replacement.
int
Site ID.
grpc str
Whether to enable GRPC, default is disabled. Value range:
http2_origin str
Whether to enable HTTP2 origin, default is disabled. Value range:
rule str
Rule content.
rule_enable str
Rule switch. Values:
rule_name str
Rule name.
site_version Changes to this property will trigger replacement. int
Site version number.
smart_routing str
Whether to enable smart routing service, default is disabled. Value range:
upload_max_filesize str
Maximum upload file size, in MB, value range: 100~500.
websocket str
Whether to enable Websocket, default is enabled. Value range:
siteId
This property is required.
Changes to this property will trigger replacement.
Number
Site ID.
grpc String
Whether to enable GRPC, default is disabled. Value range:
http2Origin String
Whether to enable HTTP2 origin, default is disabled. Value range:
rule String
Rule content.
ruleEnable String
Rule switch. Values:
ruleName String
Rule name.
siteVersion Changes to this property will trigger replacement. Number
Site version number.
smartRouting String
Whether to enable smart routing service, default is disabled. Value range:
uploadMaxFilesize String
Maximum upload file size, in MB, value range: 100~500.
websocket String
Whether to enable Websocket, default is enabled. Value range:

Outputs

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

ConfigId int
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
Id string
The provider-assigned unique ID for this managed resource.
ConfigId int
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
Id string
The provider-assigned unique ID for this managed resource.
configId Integer
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
id String
The provider-assigned unique ID for this managed resource.
configId number
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
id string
The provider-assigned unique ID for this managed resource.
config_id int
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
id str
The provider-assigned unique ID for this managed resource.
configId Number
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing NetworkOptimization Resource

Get an existing NetworkOptimization 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?: NetworkOptimizationState, opts?: CustomResourceOptions): NetworkOptimization
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        config_id: Optional[int] = None,
        grpc: Optional[str] = None,
        http2_origin: Optional[str] = None,
        rule: Optional[str] = None,
        rule_enable: Optional[str] = None,
        rule_name: Optional[str] = None,
        site_id: Optional[int] = None,
        site_version: Optional[int] = None,
        smart_routing: Optional[str] = None,
        upload_max_filesize: Optional[str] = None,
        websocket: Optional[str] = None) -> NetworkOptimization
func GetNetworkOptimization(ctx *Context, name string, id IDInput, state *NetworkOptimizationState, opts ...ResourceOption) (*NetworkOptimization, error)
public static NetworkOptimization Get(string name, Input<string> id, NetworkOptimizationState? state, CustomResourceOptions? opts = null)
public static NetworkOptimization get(String name, Output<String> id, NetworkOptimizationState state, CustomResourceOptions options)
resources:  _:    type: alicloud:esa:NetworkOptimization    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:
ConfigId int
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
Grpc string
Whether to enable GRPC, default is disabled. Value range:
Http2Origin string
Whether to enable HTTP2 origin, default is disabled. Value range:
Rule string
Rule content.
RuleEnable string
Rule switch. Values:
RuleName string
Rule name.
SiteId Changes to this property will trigger replacement. int
Site ID.
SiteVersion Changes to this property will trigger replacement. int
Site version number.
SmartRouting string
Whether to enable smart routing service, default is disabled. Value range:
UploadMaxFilesize string
Maximum upload file size, in MB, value range: 100~500.
Websocket string
Whether to enable Websocket, default is enabled. Value range:
ConfigId int
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
Grpc string
Whether to enable GRPC, default is disabled. Value range:
Http2Origin string
Whether to enable HTTP2 origin, default is disabled. Value range:
Rule string
Rule content.
RuleEnable string
Rule switch. Values:
RuleName string
Rule name.
SiteId Changes to this property will trigger replacement. int
Site ID.
SiteVersion Changes to this property will trigger replacement. int
Site version number.
SmartRouting string
Whether to enable smart routing service, default is disabled. Value range:
UploadMaxFilesize string
Maximum upload file size, in MB, value range: 100~500.
Websocket string
Whether to enable Websocket, default is enabled. Value range:
configId Integer
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
grpc String
Whether to enable GRPC, default is disabled. Value range:
http2Origin String
Whether to enable HTTP2 origin, default is disabled. Value range:
rule String
Rule content.
ruleEnable String
Rule switch. Values:
ruleName String
Rule name.
siteId Changes to this property will trigger replacement. Integer
Site ID.
siteVersion Changes to this property will trigger replacement. Integer
Site version number.
smartRouting String
Whether to enable smart routing service, default is disabled. Value range:
uploadMaxFilesize String
Maximum upload file size, in MB, value range: 100~500.
websocket String
Whether to enable Websocket, default is enabled. Value range:
configId number
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
grpc string
Whether to enable GRPC, default is disabled. Value range:
http2Origin string
Whether to enable HTTP2 origin, default is disabled. Value range:
rule string
Rule content.
ruleEnable string
Rule switch. Values:
ruleName string
Rule name.
siteId Changes to this property will trigger replacement. number
Site ID.
siteVersion Changes to this property will trigger replacement. number
Site version number.
smartRouting string
Whether to enable smart routing service, default is disabled. Value range:
uploadMaxFilesize string
Maximum upload file size, in MB, value range: 100~500.
websocket string
Whether to enable Websocket, default is enabled. Value range:
config_id int
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
grpc str
Whether to enable GRPC, default is disabled. Value range:
http2_origin str
Whether to enable HTTP2 origin, default is disabled. Value range:
rule str
Rule content.
rule_enable str
Rule switch. Values:
rule_name str
Rule name.
site_id Changes to this property will trigger replacement. int
Site ID.
site_version Changes to this property will trigger replacement. int
Site version number.
smart_routing str
Whether to enable smart routing service, default is disabled. Value range:
upload_max_filesize str
Maximum upload file size, in MB, value range: 100~500.
websocket str
Whether to enable Websocket, default is enabled. Value range:
configId Number
ConfigId of the configuration, which can be obtained by calling the ListNetworkOptimizations.
grpc String
Whether to enable GRPC, default is disabled. Value range:
http2Origin String
Whether to enable HTTP2 origin, default is disabled. Value range:
rule String
Rule content.
ruleEnable String
Rule switch. Values:
ruleName String
Rule name.
siteId Changes to this property will trigger replacement. Number
Site ID.
siteVersion Changes to this property will trigger replacement. Number
Site version number.
smartRouting String
Whether to enable smart routing service, default is disabled. Value range:
uploadMaxFilesize String
Maximum upload file size, in MB, value range: 100~500.
websocket String
Whether to enable Websocket, default is enabled. Value range:

Import

ESA Network Optimization can be imported using the id, e.g.

$ pulumi import alicloud:esa/networkOptimization:NetworkOptimization example <site_id>:<config_id>
Copy

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.