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",
});
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")
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
})
}
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",
});
});
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());
}
}
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
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 string
- The unique name of the resource.
- args NetworkOptimizationArgs
- 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 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 string
- The unique name of the resource.
- args NetworkOptimizationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkOptimizationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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",
});
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"),
})
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());
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")
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",
});
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
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:
- Site
Id 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.
- Rule
Enable string - Rule switch. Values:
- Rule
Name string - Rule name.
- Site
Version int - Site version number.
- Smart
Routing string - Whether to enable smart routing service, default is disabled. Value range:
- Upload
Max stringFilesize - Maximum upload file size, in MB, value range: 100~500.
- Websocket string
- Whether to enable Websocket, default is enabled. Value range:
- Site
Id 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.
- Rule
Enable string - Rule switch. Values:
- Rule
Name string - Rule name.
- Site
Version int - Site version number.
- Smart
Routing string - Whether to enable smart routing service, default is disabled. Value range:
- Upload
Max stringFilesize - Maximum upload file size, in MB, value range: 100~500.
- Websocket string
- Whether to enable Websocket, default is enabled. Value range:
- site
Id 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.
- rule
Enable String - Rule switch. Values:
- rule
Name String - Rule name.
- site
Version Integer - Site version number.
- smart
Routing String - Whether to enable smart routing service, default is disabled. Value range:
- upload
Max StringFilesize - Maximum upload file size, in MB, value range: 100~500.
- websocket String
- Whether to enable Websocket, default is enabled. Value range:
- site
Id 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.
- rule
Enable string - Rule switch. Values:
- rule
Name string - Rule name.
- site
Version number - Site version number.
- smart
Routing string - Whether to enable smart routing service, default is disabled. Value range:
- upload
Max stringFilesize - Maximum upload file size, in MB, value range: 100~500.
- websocket string
- Whether to enable Websocket, default is enabled. Value range:
- site_
id 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 int - Site version number.
- smart_
routing str - Whether to enable smart routing service, default is disabled. Value range:
- upload_
max_ strfilesize - Maximum upload file size, in MB, value range: 100~500.
- websocket str
- Whether to enable Websocket, default is enabled. Value range:
- site
Id 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.
- rule
Enable String - Rule switch. Values:
- rule
Name String - Rule name.
- site
Version Number - Site version number.
- smart
Routing String - Whether to enable smart routing service, default is disabled. Value range:
- upload
Max StringFilesize - 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:
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
- 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.
- Config
Id 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.
- Rule
Enable string - Rule switch. Values:
- Rule
Name string - Rule name.
- Site
Id int - Site ID.
- Site
Version int - Site version number.
- Smart
Routing string - Whether to enable smart routing service, default is disabled. Value range:
- Upload
Max stringFilesize - 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 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.
- Rule
Enable string - Rule switch. Values:
- Rule
Name string - Rule name.
- Site
Id int - Site ID.
- Site
Version int - Site version number.
- Smart
Routing string - Whether to enable smart routing service, default is disabled. Value range:
- Upload
Max stringFilesize - Maximum upload file size, in MB, value range: 100~500.
- Websocket string
- Whether to enable Websocket, default is enabled. Value range:
- config
Id 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.
- rule
Enable String - Rule switch. Values:
- rule
Name String - Rule name.
- site
Id Integer - Site ID.
- site
Version Integer - Site version number.
- smart
Routing String - Whether to enable smart routing service, default is disabled. Value range:
- upload
Max StringFilesize - Maximum upload file size, in MB, value range: 100~500.
- websocket String
- Whether to enable Websocket, default is enabled. Value range:
- config
Id 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.
- rule
Enable string - Rule switch. Values:
- rule
Name string - Rule name.
- site
Id number - Site ID.
- site
Version number - Site version number.
- smart
Routing string - Whether to enable smart routing service, default is disabled. Value range:
- upload
Max stringFilesize - 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 int - Site ID.
- site_
version int - Site version number.
- smart_
routing str - Whether to enable smart routing service, default is disabled. Value range:
- upload_
max_ strfilesize - Maximum upload file size, in MB, value range: 100~500.
- websocket str
- Whether to enable Websocket, default is enabled. Value range:
- config
Id 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.
- rule
Enable String - Rule switch. Values:
- rule
Name String - Rule name.
- site
Id Number - Site ID.
- site
Version Number - Site version number.
- smart
Routing String - Whether to enable smart routing service, default is disabled. Value range:
- upload
Max StringFilesize - 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>
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.