1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. rocketmq
  5. QosPolicy
Alibaba Cloud v3.86.1 published on Saturday, Sep 27, 2025 by Pulumi

alicloud.rocketmq.QosPolicy

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.86.1 published on Saturday, Sep 27, 2025 by Pulumi
    Deprecated: alicloud.rocketmq/qospolicy.QosPolicy has been deprecated in favor of alicloud.sag/qospolicy.QosPolicy

    Provides a Sag qos policy resource. You need to create a QoS policy to set priorities, rate limits, and quintuple rules for different messages.

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

    NOTE: Available since v1.60.0.

    NOTE: Only the following regions support. [cn-shanghai, cn-shanghai-finance-1, cn-hongkong, ap-southeast-1, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1]

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as std from "@pulumi/std";
    import * as time from "@pulumi/time";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const _default = new alicloud.sag.Qos("default", {name: name});
    const example = new time.index.Static("example", {});
    const defaultQosPolicy = new alicloud.sag.QosPolicy("default", {
        qosId: _default.id,
        name: name,
        description: name,
        priority: 1,
        ipProtocol: "ALL",
        sourceCidr: "192.168.0.0/24",
        sourcePortRange: "-1/-1",
        destCidr: "10.10.0.0/24",
        destPortRange: "-1/-1",
        startTime: std.replace({
            text: example.rfc3339,
            search: "Z",
            replace: "+0800",
        }).then(invoke => invoke.result),
        endTime: std.timeadd({
            duration: example.rfc3339,
            timestamp: "24h",
        }).then(invoke => std.replace({
            text: invoke.result,
            search: "Z",
            replace: "+0800",
        })).then(invoke => invoke.result),
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_std as std
    import pulumi_time as time
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default = alicloud.sag.Qos("default", name=name)
    example = time.index.Static("example")
    default_qos_policy = alicloud.sag.QosPolicy("default",
        qos_id=default.id,
        name=name,
        description=name,
        priority=1,
        ip_protocol="ALL",
        source_cidr="192.168.0.0/24",
        source_port_range="-1/-1",
        dest_cidr="10.10.0.0/24",
        dest_port_range="-1/-1",
        start_time=std.replace(text=example["rfc3339"],
            search="Z",
            replace="+0800").result,
        end_time=std.replace(text=std.timeadd(duration=example["rfc3339"],
                timestamp="24h").result,
            search="Z",
            replace="+0800").result)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/sag"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi-time/sdk/go/time"
    	"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 := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := sag.NewQos(ctx, "default", &sag.QosArgs{
    			Name: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		example, err := time.NewStatic(ctx, "example", nil)
    		if err != nil {
    			return err
    		}
    		invokeReplace, err := std.Replace(ctx, &std.ReplaceArgs{
    			Text:    example.Rfc3339,
    			Search:  "Z",
    			Replace: "+0800",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		invokeReplace1, err := std.Replace(ctx, &std.ReplaceArgs{
    			Text: std.Timeadd(ctx, &std.TimeaddArgs{
    				Duration:  example.Rfc3339,
    				Timestamp: "24h",
    			}, nil).Result,
    			Search:  "Z",
    			Replace: "+0800",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = sag.NewQosPolicy(ctx, "default", &sag.QosPolicyArgs{
    			QosId:           _default.ID(),
    			Name:            pulumi.String(name),
    			Description:     pulumi.String(name),
    			Priority:        pulumi.Int(1),
    			IpProtocol:      pulumi.String("ALL"),
    			SourceCidr:      pulumi.String("192.168.0.0/24"),
    			SourcePortRange: pulumi.String("-1/-1"),
    			DestCidr:        pulumi.String("10.10.0.0/24"),
    			DestPortRange:   pulumi.String("-1/-1"),
    			StartTime:       pulumi.String(invokeReplace.Result),
    			EndTime:         pulumi.String(invokeReplace1.Result),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Std = Pulumi.Std;
    using Time = Pulumi.Time;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var @default = new AliCloud.Sag.Qos("default", new()
        {
            Name = name,
        });
    
        var example = new Time.Index.Static("example");
    
        var defaultQosPolicy = new AliCloud.Sag.QosPolicy("default", new()
        {
            QosId = @default.Id,
            Name = name,
            Description = name,
            Priority = 1,
            IpProtocol = "ALL",
            SourceCidr = "192.168.0.0/24",
            SourcePortRange = "-1/-1",
            DestCidr = "10.10.0.0/24",
            DestPortRange = "-1/-1",
            StartTime = Std.Replace.Invoke(new()
            {
                Text = example.Rfc3339,
                Search = "Z",
                Replace = "+0800",
            }).Apply(invoke => invoke.Result),
            EndTime = Std.Timeadd.Invoke(new()
            {
                Duration = example.Rfc3339,
                Timestamp = "24h",
            }).Apply(invoke => Std.Replace.Invoke(new()
            {
                Text = invoke.Result,
                Search = "Z",
                Replace = "+0800",
            })).Apply(invoke => invoke.Result),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.sag.Qos;
    import com.pulumi.alicloud.sag.QosArgs;
    import com.pulumi.time.Static;
    import com.pulumi.alicloud.sag.QosPolicy;
    import com.pulumi.alicloud.sag.QosPolicyArgs;
    import com.pulumi.std.StdFunctions;
    import com.pulumi.std.inputs.ReplaceArgs;
    import com.pulumi.std.inputs.TimeaddArgs;
    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 config = ctx.config();
            final var name = config.get("name").orElse("tf-example");
            var default_ = new Qos("default", QosArgs.builder()
                .name(name)
                .build());
    
            var example = new Static("example");
    
            var defaultQosPolicy = new QosPolicy("defaultQosPolicy", QosPolicyArgs.builder()
                .qosId(default_.id())
                .name(name)
                .description(name)
                .priority(1)
                .ipProtocol("ALL")
                .sourceCidr("192.168.0.0/24")
                .sourcePortRange("-1/-1")
                .destCidr("10.10.0.0/24")
                .destPortRange("-1/-1")
                .startTime(StdFunctions.replace(ReplaceArgs.builder()
                    .text(example.rfc3339())
                    .search("Z")
                    .replace("+0800")
                    .build()).result())
                .endTime(StdFunctions.replace(ReplaceArgs.builder()
                    .text(StdFunctions.timeadd(TimeaddArgs.builder()
                        .duration(example.rfc3339())
                        .timestamp("24h")
                        .build()).result())
                    .search("Z")
                    .replace("+0800")
                    .build()).result())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      default:
        type: alicloud:sag:Qos
        properties:
          name: ${name}
      example:
        type: time:Static
      defaultQosPolicy:
        type: alicloud:sag:QosPolicy
        name: default
        properties:
          qosId: ${default.id}
          name: ${name}
          description: ${name}
          priority: '1'
          ipProtocol: ALL
          sourceCidr: 192.168.0.0/24
          sourcePortRange: -1/-1
          destCidr: 10.10.0.0/24
          destPortRange: -1/-1
          startTime:
            fn::invoke:
              function: std:replace
              arguments:
                text: ${example.rfc3339}
                search: Z
                replace: '+0800'
              return: result
          endTime:
            fn::invoke:
              function: std:replace
              arguments:
                text:
                  fn::invoke:
                    function: std:timeadd
                    arguments:
                      duration: ${example.rfc3339}
                      timestamp: 24h
                    return: result
                search: Z
                replace: '+0800'
              return: result
    

    Create QosPolicy Resource

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

    Constructor syntax

    new QosPolicy(name: string, args: QosPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def QosPolicy(resource_name: str,
                  args: QosPolicyArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def QosPolicy(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  description: Optional[str] = None,
                  dest_cidr: Optional[str] = None,
                  dest_port_range: Optional[str] = None,
                  end_time: Optional[str] = None,
                  ip_protocol: Optional[str] = None,
                  name: Optional[str] = None,
                  priority: Optional[int] = None,
                  qos_id: Optional[str] = None,
                  source_cidr: Optional[str] = None,
                  source_port_range: Optional[str] = None,
                  start_time: Optional[str] = None)
    func NewQosPolicy(ctx *Context, name string, args QosPolicyArgs, opts ...ResourceOption) (*QosPolicy, error)
    public QosPolicy(string name, QosPolicyArgs args, CustomResourceOptions? opts = null)
    public QosPolicy(String name, QosPolicyArgs args)
    public QosPolicy(String name, QosPolicyArgs args, CustomResourceOptions options)
    
    type: alicloud:rocketmq:QosPolicy
    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 QosPolicyArgs
    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 QosPolicyArgs
    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 QosPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args QosPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args QosPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    DestCidr string
    The destination CIDR block.
    DestPortRange string
    The destination port range.
    IpProtocol string
    The transport layer protocol.
    Priority int
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    QosId string
    The instance ID of the QoS policy to which the quintuple rule is created.
    SourceCidr string
    The source CIDR block.
    SourcePortRange string
    The source port range of the transport layer.
    Description string
    The description of the QoS policy.
    EndTime string
    The expiration time of the quintuple rule.
    Name string
    The name of the QoS policy.
    StartTime string
    The time when the quintuple rule takes effect.
    DestCidr string
    The destination CIDR block.
    DestPortRange string
    The destination port range.
    IpProtocol string
    The transport layer protocol.
    Priority int
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    QosId string
    The instance ID of the QoS policy to which the quintuple rule is created.
    SourceCidr string
    The source CIDR block.
    SourcePortRange string
    The source port range of the transport layer.
    Description string
    The description of the QoS policy.
    EndTime string
    The expiration time of the quintuple rule.
    Name string
    The name of the QoS policy.
    StartTime string
    The time when the quintuple rule takes effect.
    destCidr String
    The destination CIDR block.
    destPortRange String
    The destination port range.
    ipProtocol String
    The transport layer protocol.
    priority Integer
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    qosId String
    The instance ID of the QoS policy to which the quintuple rule is created.
    sourceCidr String
    The source CIDR block.
    sourcePortRange String
    The source port range of the transport layer.
    description String
    The description of the QoS policy.
    endTime String
    The expiration time of the quintuple rule.
    name String
    The name of the QoS policy.
    startTime String
    The time when the quintuple rule takes effect.
    destCidr string
    The destination CIDR block.
    destPortRange string
    The destination port range.
    ipProtocol string
    The transport layer protocol.
    priority number
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    qosId string
    The instance ID of the QoS policy to which the quintuple rule is created.
    sourceCidr string
    The source CIDR block.
    sourcePortRange string
    The source port range of the transport layer.
    description string
    The description of the QoS policy.
    endTime string
    The expiration time of the quintuple rule.
    name string
    The name of the QoS policy.
    startTime string
    The time when the quintuple rule takes effect.
    dest_cidr str
    The destination CIDR block.
    dest_port_range str
    The destination port range.
    ip_protocol str
    The transport layer protocol.
    priority int
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    qos_id str
    The instance ID of the QoS policy to which the quintuple rule is created.
    source_cidr str
    The source CIDR block.
    source_port_range str
    The source port range of the transport layer.
    description str
    The description of the QoS policy.
    end_time str
    The expiration time of the quintuple rule.
    name str
    The name of the QoS policy.
    start_time str
    The time when the quintuple rule takes effect.
    destCidr String
    The destination CIDR block.
    destPortRange String
    The destination port range.
    ipProtocol String
    The transport layer protocol.
    priority Number
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    qosId String
    The instance ID of the QoS policy to which the quintuple rule is created.
    sourceCidr String
    The source CIDR block.
    sourcePortRange String
    The source port range of the transport layer.
    description String
    The description of the QoS policy.
    endTime String
    The expiration time of the quintuple rule.
    name String
    The name of the QoS policy.
    startTime String
    The time when the quintuple rule takes effect.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing QosPolicy Resource

    Get an existing QosPolicy 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?: QosPolicyState, opts?: CustomResourceOptions): QosPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            dest_cidr: Optional[str] = None,
            dest_port_range: Optional[str] = None,
            end_time: Optional[str] = None,
            ip_protocol: Optional[str] = None,
            name: Optional[str] = None,
            priority: Optional[int] = None,
            qos_id: Optional[str] = None,
            source_cidr: Optional[str] = None,
            source_port_range: Optional[str] = None,
            start_time: Optional[str] = None) -> QosPolicy
    func GetQosPolicy(ctx *Context, name string, id IDInput, state *QosPolicyState, opts ...ResourceOption) (*QosPolicy, error)
    public static QosPolicy Get(string name, Input<string> id, QosPolicyState? state, CustomResourceOptions? opts = null)
    public static QosPolicy get(String name, Output<String> id, QosPolicyState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:rocketmq:QosPolicy    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.
    The following state arguments are supported:
    Description string
    The description of the QoS policy.
    DestCidr string
    The destination CIDR block.
    DestPortRange string
    The destination port range.
    EndTime string
    The expiration time of the quintuple rule.
    IpProtocol string
    The transport layer protocol.
    Name string
    The name of the QoS policy.
    Priority int
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    QosId string
    The instance ID of the QoS policy to which the quintuple rule is created.
    SourceCidr string
    The source CIDR block.
    SourcePortRange string
    The source port range of the transport layer.
    StartTime string
    The time when the quintuple rule takes effect.
    Description string
    The description of the QoS policy.
    DestCidr string
    The destination CIDR block.
    DestPortRange string
    The destination port range.
    EndTime string
    The expiration time of the quintuple rule.
    IpProtocol string
    The transport layer protocol.
    Name string
    The name of the QoS policy.
    Priority int
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    QosId string
    The instance ID of the QoS policy to which the quintuple rule is created.
    SourceCidr string
    The source CIDR block.
    SourcePortRange string
    The source port range of the transport layer.
    StartTime string
    The time when the quintuple rule takes effect.
    description String
    The description of the QoS policy.
    destCidr String
    The destination CIDR block.
    destPortRange String
    The destination port range.
    endTime String
    The expiration time of the quintuple rule.
    ipProtocol String
    The transport layer protocol.
    name String
    The name of the QoS policy.
    priority Integer
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    qosId String
    The instance ID of the QoS policy to which the quintuple rule is created.
    sourceCidr String
    The source CIDR block.
    sourcePortRange String
    The source port range of the transport layer.
    startTime String
    The time when the quintuple rule takes effect.
    description string
    The description of the QoS policy.
    destCidr string
    The destination CIDR block.
    destPortRange string
    The destination port range.
    endTime string
    The expiration time of the quintuple rule.
    ipProtocol string
    The transport layer protocol.
    name string
    The name of the QoS policy.
    priority number
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    qosId string
    The instance ID of the QoS policy to which the quintuple rule is created.
    sourceCidr string
    The source CIDR block.
    sourcePortRange string
    The source port range of the transport layer.
    startTime string
    The time when the quintuple rule takes effect.
    description str
    The description of the QoS policy.
    dest_cidr str
    The destination CIDR block.
    dest_port_range str
    The destination port range.
    end_time str
    The expiration time of the quintuple rule.
    ip_protocol str
    The transport layer protocol.
    name str
    The name of the QoS policy.
    priority int
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    qos_id str
    The instance ID of the QoS policy to which the quintuple rule is created.
    source_cidr str
    The source CIDR block.
    source_port_range str
    The source port range of the transport layer.
    start_time str
    The time when the quintuple rule takes effect.
    description String
    The description of the QoS policy.
    destCidr String
    The destination CIDR block.
    destPortRange String
    The destination port range.
    endTime String
    The expiration time of the quintuple rule.
    ipProtocol String
    The transport layer protocol.
    name String
    The name of the QoS policy.
    priority Number
    The priority of the quintuple rule. A smaller value indicates a higher priority. If the priorities of two quintuple rules are the same, the rule created earlier is applied first.Value range: 1 to 7.
    qosId String
    The instance ID of the QoS policy to which the quintuple rule is created.
    sourceCidr String
    The source CIDR block.
    sourcePortRange String
    The source port range of the transport layer.
    startTime String
    The time when the quintuple rule takes effect.

    Import

    The Sag Qos Policy can be imported using the id, e.g.

    $ pulumi import alicloud:rocketmq/qosPolicy:QosPolicy example qos-abc123456:qospy-abc123456
    

    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
    Alibaba Cloud v3.86.1 published on Saturday, Sep 27, 2025 by Pulumi