1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. ess
  5. getScalingRules
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.ess.getScalingRules

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    This data source provides available scaling rule resources.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const scalingrulesDs = alicloud.ess.getScalingRules({
        scalingGroupId: "scaling_group_id",
        ids: [
            "scaling_rule_id1",
            "scaling_rule_id2",
        ],
        nameRegex: "scaling_rule_name",
    });
    export const firstScalingRule = scalingrulesDs.then(scalingrulesDs => scalingrulesDs.rules?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    scalingrules_ds = alicloud.ess.get_scaling_rules(scaling_group_id="scaling_group_id",
        ids=[
            "scaling_rule_id1",
            "scaling_rule_id2",
        ],
        name_regex="scaling_rule_name")
    pulumi.export("firstScalingRule", scalingrules_ds.rules[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ess"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		scalingrulesDs, err := ess.GetScalingRules(ctx, &ess.GetScalingRulesArgs{
    			ScalingGroupId: pulumi.StringRef("scaling_group_id"),
    			Ids: []string{
    				"scaling_rule_id1",
    				"scaling_rule_id2",
    			},
    			NameRegex: pulumi.StringRef("scaling_rule_name"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstScalingRule", scalingrulesDs.Rules[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var scalingrulesDs = AliCloud.Ess.GetScalingRules.Invoke(new()
        {
            ScalingGroupId = "scaling_group_id",
            Ids = new[]
            {
                "scaling_rule_id1",
                "scaling_rule_id2",
            },
            NameRegex = "scaling_rule_name",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstScalingRule"] = scalingrulesDs.Apply(getScalingRulesResult => getScalingRulesResult.Rules[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ess.EssFunctions;
    import com.pulumi.alicloud.ess.inputs.GetScalingRulesArgs;
    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 scalingrulesDs = EssFunctions.getScalingRules(GetScalingRulesArgs.builder()
                .scalingGroupId("scaling_group_id")
                .ids(            
                    "scaling_rule_id1",
                    "scaling_rule_id2")
                .nameRegex("scaling_rule_name")
                .build());
    
            ctx.export("firstScalingRule", scalingrulesDs.applyValue(getScalingRulesResult -> getScalingRulesResult.rules()[0].id()));
        }
    }
    
    variables:
      scalingrulesDs:
        fn::invoke:
          Function: alicloud:ess:getScalingRules
          Arguments:
            scalingGroupId: scaling_group_id
            ids:
              - scaling_rule_id1
              - scaling_rule_id2
            nameRegex: scaling_rule_name
    outputs:
      firstScalingRule: ${scalingrulesDs.rules[0].id}
    

    Using getScalingRules

    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 getScalingRules(args: GetScalingRulesArgs, opts?: InvokeOptions): Promise<GetScalingRulesResult>
    function getScalingRulesOutput(args: GetScalingRulesOutputArgs, opts?: InvokeOptions): Output<GetScalingRulesResult>
    def get_scaling_rules(ids: Optional[Sequence[str]] = None,
                          name_regex: Optional[str] = None,
                          output_file: Optional[str] = None,
                          scaling_group_id: Optional[str] = None,
                          type: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetScalingRulesResult
    def get_scaling_rules_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                          name_regex: Optional[pulumi.Input[str]] = None,
                          output_file: Optional[pulumi.Input[str]] = None,
                          scaling_group_id: Optional[pulumi.Input[str]] = None,
                          type: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetScalingRulesResult]
    func GetScalingRules(ctx *Context, args *GetScalingRulesArgs, opts ...InvokeOption) (*GetScalingRulesResult, error)
    func GetScalingRulesOutput(ctx *Context, args *GetScalingRulesOutputArgs, opts ...InvokeOption) GetScalingRulesResultOutput

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

    public static class GetScalingRules 
    {
        public static Task<GetScalingRulesResult> InvokeAsync(GetScalingRulesArgs args, InvokeOptions? opts = null)
        public static Output<GetScalingRulesResult> Invoke(GetScalingRulesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetScalingRulesResult> getScalingRules(GetScalingRulesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:ess/getScalingRules:getScalingRules
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids List<string>
    A list of scaling rule IDs.
    NameRegex string
    A regex string to filter resulting scaling rules by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ScalingGroupId string
    Scaling group id the scaling rules belong to.
    Type string
    Type of scaling rule.
    Ids []string
    A list of scaling rule IDs.
    NameRegex string
    A regex string to filter resulting scaling rules by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ScalingGroupId string
    Scaling group id the scaling rules belong to.
    Type string
    Type of scaling rule.
    ids List<String>
    A list of scaling rule IDs.
    nameRegex String
    A regex string to filter resulting scaling rules by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    scalingGroupId String
    Scaling group id the scaling rules belong to.
    type String
    Type of scaling rule.
    ids string[]
    A list of scaling rule IDs.
    nameRegex string
    A regex string to filter resulting scaling rules by name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    scalingGroupId string
    Scaling group id the scaling rules belong to.
    type string
    Type of scaling rule.
    ids Sequence[str]
    A list of scaling rule IDs.
    name_regex str
    A regex string to filter resulting scaling rules by name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    scaling_group_id str
    Scaling group id the scaling rules belong to.
    type str
    Type of scaling rule.
    ids List<String>
    A list of scaling rule IDs.
    nameRegex String
    A regex string to filter resulting scaling rules by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    scalingGroupId String
    Scaling group id the scaling rules belong to.
    type String
    Type of scaling rule.

    getScalingRules Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of scaling rule ids.
    Names List<string>
    A list of scaling rule names.
    Rules List<Pulumi.AliCloud.Ess.Outputs.GetScalingRulesRule>
    A list of scaling rules. Each element contains the following attributes:
    NameRegex string
    OutputFile string
    ScalingGroupId string
    ID of the scaling group.
    Type string
    Type of the scaling rule.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of scaling rule ids.
    Names []string
    A list of scaling rule names.
    Rules []GetScalingRulesRule
    A list of scaling rules. Each element contains the following attributes:
    NameRegex string
    OutputFile string
    ScalingGroupId string
    ID of the scaling group.
    Type string
    Type of the scaling rule.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of scaling rule ids.
    names List<String>
    A list of scaling rule names.
    rules List<GetScalingRulesRule>
    A list of scaling rules. Each element contains the following attributes:
    nameRegex String
    outputFile String
    scalingGroupId String
    ID of the scaling group.
    type String
    Type of the scaling rule.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of scaling rule ids.
    names string[]
    A list of scaling rule names.
    rules GetScalingRulesRule[]
    A list of scaling rules. Each element contains the following attributes:
    nameRegex string
    outputFile string
    scalingGroupId string
    ID of the scaling group.
    type string
    Type of the scaling rule.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of scaling rule ids.
    names Sequence[str]
    A list of scaling rule names.
    rules Sequence[GetScalingRulesRule]
    A list of scaling rules. Each element contains the following attributes:
    name_regex str
    output_file str
    scaling_group_id str
    ID of the scaling group.
    type str
    Type of the scaling rule.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of scaling rule ids.
    names List<String>
    A list of scaling rule names.
    rules List<Property Map>
    A list of scaling rules. Each element contains the following attributes:
    nameRegex String
    outputFile String
    scalingGroupId String
    ID of the scaling group.
    type String
    Type of the scaling rule.

    Supporting Types

    GetScalingRulesRule

    AdjustmentType string
    Adjustment type of the scaling rule.
    AdjustmentValue int
    Adjustment value of the scaling rule.
    Cooldown int
    Cooldown time of the scaling rule.
    Id string
    ID of the scaling rule.
    MinAdjustmentMagnitude int
    Min adjustment magnitude of scaling rule.
    Name string
    Name of the scaling rule.
    ScalingGroupId string
    Scaling group id the scaling rules belong to.
    ScalingRuleAri string
    Ari of scaling rule.
    Type string
    Type of scaling rule.
    AdjustmentType string
    Adjustment type of the scaling rule.
    AdjustmentValue int
    Adjustment value of the scaling rule.
    Cooldown int
    Cooldown time of the scaling rule.
    Id string
    ID of the scaling rule.
    MinAdjustmentMagnitude int
    Min adjustment magnitude of scaling rule.
    Name string
    Name of the scaling rule.
    ScalingGroupId string
    Scaling group id the scaling rules belong to.
    ScalingRuleAri string
    Ari of scaling rule.
    Type string
    Type of scaling rule.
    adjustmentType String
    Adjustment type of the scaling rule.
    adjustmentValue Integer
    Adjustment value of the scaling rule.
    cooldown Integer
    Cooldown time of the scaling rule.
    id String
    ID of the scaling rule.
    minAdjustmentMagnitude Integer
    Min adjustment magnitude of scaling rule.
    name String
    Name of the scaling rule.
    scalingGroupId String
    Scaling group id the scaling rules belong to.
    scalingRuleAri String
    Ari of scaling rule.
    type String
    Type of scaling rule.
    adjustmentType string
    Adjustment type of the scaling rule.
    adjustmentValue number
    Adjustment value of the scaling rule.
    cooldown number
    Cooldown time of the scaling rule.
    id string
    ID of the scaling rule.
    minAdjustmentMagnitude number
    Min adjustment magnitude of scaling rule.
    name string
    Name of the scaling rule.
    scalingGroupId string
    Scaling group id the scaling rules belong to.
    scalingRuleAri string
    Ari of scaling rule.
    type string
    Type of scaling rule.
    adjustment_type str
    Adjustment type of the scaling rule.
    adjustment_value int
    Adjustment value of the scaling rule.
    cooldown int
    Cooldown time of the scaling rule.
    id str
    ID of the scaling rule.
    min_adjustment_magnitude int
    Min adjustment magnitude of scaling rule.
    name str
    Name of the scaling rule.
    scaling_group_id str
    Scaling group id the scaling rules belong to.
    scaling_rule_ari str
    Ari of scaling rule.
    type str
    Type of scaling rule.
    adjustmentType String
    Adjustment type of the scaling rule.
    adjustmentValue Number
    Adjustment value of the scaling rule.
    cooldown Number
    Cooldown time of the scaling rule.
    id String
    ID of the scaling rule.
    minAdjustmentMagnitude Number
    Min adjustment magnitude of scaling rule.
    name String
    Name of the scaling rule.
    scalingGroupId String
    Scaling group id the scaling rules belong to.
    scalingRuleAri String
    Ari of scaling rule.
    type String
    Type of scaling rule.

    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.66.0 published on Friday, Nov 15, 2024 by Pulumi