alicloud.esa.CompressionRule
Explore with Pulumi AI
Provides a ESA Compression Rule resource.
For information about ESA Compression Rule and how to use it, see What is Compression Rule.
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 example = new alicloud.esa.Site("example", {
siteName: "compression.example.com",
instanceId: _default.then(_default => _default.sites?.[0]?.instanceId),
coverage: "domestic",
accessType: "NS",
});
const defaultCompressionRule = new alicloud.esa.CompressionRule("default", {
gzip: "off",
brotli: "off",
rule: "http.host eq \"video.example.com\"",
siteVersion: 0,
ruleName: "rule_example",
siteId: example.id,
zstd: "off",
ruleEnable: "off",
});
import pulumi
import pulumi_alicloud as alicloud
default = alicloud.esa.get_sites(plan_subscribe_type="enterpriseplan")
example = alicloud.esa.Site("example",
site_name="compression.example.com",
instance_id=default.sites[0].instance_id,
coverage="domestic",
access_type="NS")
default_compression_rule = alicloud.esa.CompressionRule("default",
gzip="off",
brotli="off",
rule="http.host eq \"video.example.com\"",
site_version=0,
rule_name="rule_example",
site_id=example.id,
zstd="off",
rule_enable="off")
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
}
example, err := esa.NewSite(ctx, "example", &esa.SiteArgs{
SiteName: pulumi.String("compression.example.com"),
InstanceId: pulumi.String(_default.Sites[0].InstanceId),
Coverage: pulumi.String("domestic"),
AccessType: pulumi.String("NS"),
})
if err != nil {
return err
}
_, err = esa.NewCompressionRule(ctx, "default", &esa.CompressionRuleArgs{
Gzip: pulumi.String("off"),
Brotli: pulumi.String("off"),
Rule: pulumi.String("http.host eq \"video.example.com\""),
SiteVersion: pulumi.Int(0),
RuleName: pulumi.String("rule_example"),
SiteId: example.ID(),
Zstd: pulumi.String("off"),
RuleEnable: pulumi.String("off"),
})
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 example = new AliCloud.Esa.Site("example", new()
{
SiteName = "compression.example.com",
InstanceId = @default.Apply(@default => @default.Apply(getSitesResult => getSitesResult.Sites[0]?.InstanceId)),
Coverage = "domestic",
AccessType = "NS",
});
var defaultCompressionRule = new AliCloud.Esa.CompressionRule("default", new()
{
Gzip = "off",
Brotli = "off",
Rule = "http.host eq \"video.example.com\"",
SiteVersion = 0,
RuleName = "rule_example",
SiteId = example.Id,
Zstd = "off",
RuleEnable = "off",
});
});
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.CompressionRule;
import com.pulumi.alicloud.esa.CompressionRuleArgs;
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 example = new Site("example", SiteArgs.builder()
.siteName("compression.example.com")
.instanceId(default_.sites()[0].instanceId())
.coverage("domestic")
.accessType("NS")
.build());
var defaultCompressionRule = new CompressionRule("defaultCompressionRule", CompressionRuleArgs.builder()
.gzip("off")
.brotli("off")
.rule("http.host eq \"video.example.com\"")
.siteVersion("0")
.ruleName("rule_example")
.siteId(example.id())
.zstd("off")
.ruleEnable("off")
.build());
}
}
resources:
example:
type: alicloud:esa:Site
properties:
siteName: compression.example.com
instanceId: ${default.sites[0].instanceId}
coverage: domestic
accessType: NS
defaultCompressionRule:
type: alicloud:esa:CompressionRule
name: default
properties:
gzip: off
brotli: off
rule: http.host eq "video.example.com"
siteVersion: '0'
ruleName: rule_example
siteId: ${example.id}
zstd: off
ruleEnable: off
variables:
default:
fn::invoke:
function: alicloud:esa:getSites
arguments:
planSubscribeType: enterpriseplan
Create CompressionRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CompressionRule(name: string, args: CompressionRuleArgs, opts?: CustomResourceOptions);
@overload
def CompressionRule(resource_name: str,
args: CompressionRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def CompressionRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
site_id: Optional[int] = None,
brotli: Optional[str] = None,
gzip: Optional[str] = None,
rule: Optional[str] = None,
rule_enable: Optional[str] = None,
rule_name: Optional[str] = None,
site_version: Optional[int] = None,
zstd: Optional[str] = None)
func NewCompressionRule(ctx *Context, name string, args CompressionRuleArgs, opts ...ResourceOption) (*CompressionRule, error)
public CompressionRule(string name, CompressionRuleArgs args, CustomResourceOptions? opts = null)
public CompressionRule(String name, CompressionRuleArgs args)
public CompressionRule(String name, CompressionRuleArgs args, CustomResourceOptions options)
type: alicloud:esa:CompressionRule
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 CompressionRuleArgs
- 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 CompressionRuleArgs
- 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 CompressionRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CompressionRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CompressionRuleArgs
- 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 compressionRuleResource = new AliCloud.Esa.CompressionRule("compressionRuleResource", new()
{
SiteId = 0,
Brotli = "string",
Gzip = "string",
Rule = "string",
RuleEnable = "string",
RuleName = "string",
SiteVersion = 0,
Zstd = "string",
});
example, err := esa.NewCompressionRule(ctx, "compressionRuleResource", &esa.CompressionRuleArgs{
SiteId: pulumi.Int(0),
Brotli: pulumi.String("string"),
Gzip: pulumi.String("string"),
Rule: pulumi.String("string"),
RuleEnable: pulumi.String("string"),
RuleName: pulumi.String("string"),
SiteVersion: pulumi.Int(0),
Zstd: pulumi.String("string"),
})
var compressionRuleResource = new CompressionRule("compressionRuleResource", CompressionRuleArgs.builder()
.siteId(0)
.brotli("string")
.gzip("string")
.rule("string")
.ruleEnable("string")
.ruleName("string")
.siteVersion(0)
.zstd("string")
.build());
compression_rule_resource = alicloud.esa.CompressionRule("compressionRuleResource",
site_id=0,
brotli="string",
gzip="string",
rule="string",
rule_enable="string",
rule_name="string",
site_version=0,
zstd="string")
const compressionRuleResource = new alicloud.esa.CompressionRule("compressionRuleResource", {
siteId: 0,
brotli: "string",
gzip: "string",
rule: "string",
ruleEnable: "string",
ruleName: "string",
siteVersion: 0,
zstd: "string",
});
type: alicloud:esa:CompressionRule
properties:
brotli: string
gzip: string
rule: string
ruleEnable: string
ruleName: string
siteId: 0
siteVersion: 0
zstd: string
CompressionRule 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 CompressionRule resource accepts the following input properties:
- Site
Id int - The site ID, which can be obtained by calling the ListSites API.
- Brotli string
- Brotli compression. Value range:
- Gzip string
- Gzip compression. Value range:
- Rule string
- Rule Content.
- Rule
Enable string - Rule switch. Value range:
- Rule
Name string - Rule name, you can find out the rule whose rule name is the passed field.
- Site
Version int - The version of the website configurations.
- Zstd string
- Zstd compression. Value range:
- Site
Id int - The site ID, which can be obtained by calling the ListSites API.
- Brotli string
- Brotli compression. Value range:
- Gzip string
- Gzip compression. Value range:
- Rule string
- Rule Content.
- Rule
Enable string - Rule switch. Value range:
- Rule
Name string - Rule name, you can find out the rule whose rule name is the passed field.
- Site
Version int - The version of the website configurations.
- Zstd string
- Zstd compression. Value range:
- site
Id Integer - The site ID, which can be obtained by calling the ListSites API.
- brotli String
- Brotli compression. Value range:
- gzip String
- Gzip compression. Value range:
- rule String
- Rule Content.
- rule
Enable String - Rule switch. Value range:
- rule
Name String - Rule name, you can find out the rule whose rule name is the passed field.
- site
Version Integer - The version of the website configurations.
- zstd String
- Zstd compression. Value range:
- site
Id number - The site ID, which can be obtained by calling the ListSites API.
- brotli string
- Brotli compression. Value range:
- gzip string
- Gzip compression. Value range:
- rule string
- Rule Content.
- rule
Enable string - Rule switch. Value range:
- rule
Name string - Rule name, you can find out the rule whose rule name is the passed field.
- site
Version number - The version of the website configurations.
- zstd string
- Zstd compression. Value range:
- site_
id int - The site ID, which can be obtained by calling the ListSites API.
- brotli str
- Brotli compression. Value range:
- gzip str
- Gzip compression. Value range:
- rule str
- Rule Content.
- rule_
enable str - Rule switch. Value range:
- rule_
name str - Rule name, you can find out the rule whose rule name is the passed field.
- site_
version int - The version of the website configurations.
- zstd str
- Zstd compression. Value range:
- site
Id Number - The site ID, which can be obtained by calling the ListSites API.
- brotli String
- Brotli compression. Value range:
- gzip String
- Gzip compression. Value range:
- rule String
- Rule Content.
- rule
Enable String - Rule switch. Value range:
- rule
Name String - Rule name, you can find out the rule whose rule name is the passed field.
- site
Version Number - The version of the website configurations.
- zstd String
- Zstd compression. Value range:
Outputs
All input properties are implicitly available as output properties. Additionally, the CompressionRule resource produces the following output properties:
Look up Existing CompressionRule Resource
Get an existing CompressionRule 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?: CompressionRuleState, opts?: CustomResourceOptions): CompressionRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
brotli: Optional[str] = None,
config_id: Optional[int] = None,
gzip: 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,
zstd: Optional[str] = None) -> CompressionRule
func GetCompressionRule(ctx *Context, name string, id IDInput, state *CompressionRuleState, opts ...ResourceOption) (*CompressionRule, error)
public static CompressionRule Get(string name, Input<string> id, CompressionRuleState? state, CustomResourceOptions? opts = null)
public static CompressionRule get(String name, Output<String> id, CompressionRuleState state, CustomResourceOptions options)
resources: _: type: alicloud:esa:CompressionRule 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.
- Brotli string
- Brotli compression. Value range:
- Config
Id int - Config Id
- Gzip string
- Gzip compression. Value range:
- Rule string
- Rule Content.
- Rule
Enable string - Rule switch. Value range:
- Rule
Name string - Rule name, you can find out the rule whose rule name is the passed field.
- Site
Id int - The site ID, which can be obtained by calling the ListSites API.
- Site
Version int - The version of the website configurations.
- Zstd string
- Zstd compression. Value range:
- Brotli string
- Brotli compression. Value range:
- Config
Id int - Config Id
- Gzip string
- Gzip compression. Value range:
- Rule string
- Rule Content.
- Rule
Enable string - Rule switch. Value range:
- Rule
Name string - Rule name, you can find out the rule whose rule name is the passed field.
- Site
Id int - The site ID, which can be obtained by calling the ListSites API.
- Site
Version int - The version of the website configurations.
- Zstd string
- Zstd compression. Value range:
- brotli String
- Brotli compression. Value range:
- config
Id Integer - Config Id
- gzip String
- Gzip compression. Value range:
- rule String
- Rule Content.
- rule
Enable String - Rule switch. Value range:
- rule
Name String - Rule name, you can find out the rule whose rule name is the passed field.
- site
Id Integer - The site ID, which can be obtained by calling the ListSites API.
- site
Version Integer - The version of the website configurations.
- zstd String
- Zstd compression. Value range:
- brotli string
- Brotli compression. Value range:
- config
Id number - Config Id
- gzip string
- Gzip compression. Value range:
- rule string
- Rule Content.
- rule
Enable string - Rule switch. Value range:
- rule
Name string - Rule name, you can find out the rule whose rule name is the passed field.
- site
Id number - The site ID, which can be obtained by calling the ListSites API.
- site
Version number - The version of the website configurations.
- zstd string
- Zstd compression. Value range:
- brotli str
- Brotli compression. Value range:
- config_
id int - Config Id
- gzip str
- Gzip compression. Value range:
- rule str
- Rule Content.
- rule_
enable str - Rule switch. Value range:
- rule_
name str - Rule name, you can find out the rule whose rule name is the passed field.
- site_
id int - The site ID, which can be obtained by calling the ListSites API.
- site_
version int - The version of the website configurations.
- zstd str
- Zstd compression. Value range:
- brotli String
- Brotli compression. Value range:
- config
Id Number - Config Id
- gzip String
- Gzip compression. Value range:
- rule String
- Rule Content.
- rule
Enable String - Rule switch. Value range:
- rule
Name String - Rule name, you can find out the rule whose rule name is the passed field.
- site
Id Number - The site ID, which can be obtained by calling the ListSites API.
- site
Version Number - The version of the website configurations.
- zstd String
- Zstd compression. Value range:
Import
ESA Compression Rule can be imported using the id, e.g.
$ pulumi import alicloud:esa/compressionRule:CompressionRule 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.