1. Packages
  2. Harness Provider
  3. API Docs
  4. autostopping
  5. getRules
Viewing docs for Harness v0.11.8
published on Friday, Mar 27, 2026 by Pulumi
harness logo
Viewing docs for Harness v0.11.8
published on Friday, Mar 27, 2026 by Pulumi

    Datasource for listing Harness AutoStopping rules.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@pulumi/harness";
    
    export = async () => {
        const all = await harness.autostopping.getRules({});
        const byInstanceKind = await harness.autostopping.getRules({
            kind: "instance",
        });
        const byK8sKind = await harness.autostopping.getRules({
            kind: "k8s",
        });
        const byNamePrefix = await harness.autostopping.getRules({
            name: "myname-.*",
        });
        const byNameRegex = await harness.autostopping.getRules({
            name: "^(app|svc).*",
        });
        return {
            allRules: all.rules,
            allRuleIds: .map(r => (r.id)),
            byInstanceKind: byInstanceKind.rules,
            byInstanceKindIds: .map(r => (r.id)),
            k8sRules: byK8sKind.rules,
            k8sRuleIds: .map(r => (r.id)),
            rulesByNamePrefix: byNamePrefix.rules,
            rulesByNamePrefixIds: .map(r => (r.id)),
            rulesByNameRegex: byNameRegex.rules,
            rulesByNameRegexIds: .map(r => (r.id)),
        };
    }
    
    import pulumi
    import pulumi_harness as harness
    
    all = harness.autostopping.get_rules()
    pulumi.export("allRules", all.rules)
    pulumi.export("allRuleIds", [r.id for r in all.rules])
    by_instance_kind = harness.autostopping.get_rules(kind="instance")
    pulumi.export("byInstanceKind", by_instance_kind.rules)
    pulumi.export("byInstanceKindIds", [r.id for r in by_instance_kind.rules])
    by_k8s_kind = harness.autostopping.get_rules(kind="k8s")
    pulumi.export("k8sRules", by_k8s_kind.rules)
    pulumi.export("k8sRuleIds", [r.id for r in by_k8s_kind.rules])
    by_name_prefix = harness.autostopping.get_rules(name="myname-.*")
    pulumi.export("rulesByNamePrefix", by_name_prefix.rules)
    pulumi.export("rulesByNamePrefixIds", [r.id for r in by_name_prefix.rules])
    by_name_regex = harness.autostopping.get_rules(name="^(app|svc).*")
    pulumi.export("rulesByNameRegex", by_name_regex.rules)
    pulumi.export("rulesByNameRegexIds", [r.id for r in by_name_regex.rules])
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Harness = Pulumi.Harness;
    
    return await Deployment.RunAsync(() => 
    {
        var all = Harness.Autostopping.GetRules.Invoke();
    
        var byInstanceKind = Harness.Autostopping.GetRules.Invoke(new()
        {
            Kind = "instance",
        });
    
        var byK8sKind = Harness.Autostopping.GetRules.Invoke(new()
        {
            Kind = "k8s",
        });
    
        var byNamePrefix = Harness.Autostopping.GetRules.Invoke(new()
        {
            Name = "myname-.*",
        });
    
        var byNameRegex = Harness.Autostopping.GetRules.Invoke(new()
        {
            Name = "^(app|svc).*",
        });
    
        return new Dictionary<string, object?>
        {
            ["allRules"] = all.Apply(getRulesResult => getRulesResult.Rules),
            ["allRuleIds"] = .Select(r => 
            {
                return r.Id;
            }).ToList(),
            ["byInstanceKind"] = byInstanceKind.Apply(getRulesResult => getRulesResult.Rules),
            ["byInstanceKindIds"] = .Select(r => 
            {
                return r.Id;
            }).ToList(),
            ["k8sRules"] = byK8sKind.Apply(getRulesResult => getRulesResult.Rules),
            ["k8sRuleIds"] = .Select(r => 
            {
                return r.Id;
            }).ToList(),
            ["rulesByNamePrefix"] = byNamePrefix.Apply(getRulesResult => getRulesResult.Rules),
            ["rulesByNamePrefixIds"] = .Select(r => 
            {
                return r.Id;
            }).ToList(),
            ["rulesByNameRegex"] = byNameRegex.Apply(getRulesResult => getRulesResult.Rules),
            ["rulesByNameRegexIds"] = .Select(r => 
            {
                return r.Id;
            }).ToList(),
        };
    });
    
    Example coming soon!
    
    Example coming soon!
    

    Using getRules

    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 getRules(args: GetRulesArgs, opts?: InvokeOptions): Promise<GetRulesResult>
    function getRulesOutput(args: GetRulesOutputArgs, opts?: InvokeOptions): Output<GetRulesResult>
    def get_rules(kind: Optional[str] = None,
                  name: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetRulesResult
    def get_rules_output(kind: Optional[pulumi.Input[str]] = None,
                  name: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetRulesResult]
    func GetRules(ctx *Context, args *GetRulesArgs, opts ...InvokeOption) (*GetRulesResult, error)
    func GetRulesOutput(ctx *Context, args *GetRulesOutputArgs, opts ...InvokeOption) GetRulesResultOutput

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

    public static class GetRules 
    {
        public static Task<GetRulesResult> InvokeAsync(GetRulesArgs args, InvokeOptions? opts = null)
        public static Output<GetRulesResult> Invoke(GetRulesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
    public static Output<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: harness:autostopping/getRules:getRules
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Kind string
    Return rules matching provided kind.
    Name string
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
    Kind string
    Return rules matching provided kind.
    Name string
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
    kind String
    Return rules matching provided kind.
    name String
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
    kind string
    Return rules matching provided kind.
    name string
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
    kind str
    Return rules matching provided kind.
    name str
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
    kind String
    Return rules matching provided kind.
    name String
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".

    getRules Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Rules List<GetRulesRule>
    List of AutoStopping rules.
    Kind string
    Return rules matching provided kind.
    Name string
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
    Id string
    The provider-assigned unique ID for this managed resource.
    Rules []GetRulesRule
    List of AutoStopping rules.
    Kind string
    Return rules matching provided kind.
    Name string
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
    id String
    The provider-assigned unique ID for this managed resource.
    rules List<GetRulesRule>
    List of AutoStopping rules.
    kind String
    Return rules matching provided kind.
    name String
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
    id string
    The provider-assigned unique ID for this managed resource.
    rules GetRulesRule[]
    List of AutoStopping rules.
    kind string
    Return rules matching provided kind.
    name string
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
    id str
    The provider-assigned unique ID for this managed resource.
    rules Sequence[GetRulesRule]
    List of AutoStopping rules.
    kind str
    Return rules matching provided kind.
    name str
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
    id String
    The provider-assigned unique ID for this managed resource.
    rules List<Property Map>
    List of AutoStopping rules.
    kind String
    Return rules matching provided kind.
    name String
    Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".

    Supporting Types

    GetRulesRule

    CloudConnectorId string
    Id of the cloud connector.
    Id double
    Unique identifier of the rule.
    Kind string
    Kind of the rule.
    Name string
    Name of the rule.
    CloudConnectorId string
    Id of the cloud connector.
    Id float64
    Unique identifier of the rule.
    Kind string
    Kind of the rule.
    Name string
    Name of the rule.
    cloudConnectorId String
    Id of the cloud connector.
    id Double
    Unique identifier of the rule.
    kind String
    Kind of the rule.
    name String
    Name of the rule.
    cloudConnectorId string
    Id of the cloud connector.
    id number
    Unique identifier of the rule.
    kind string
    Kind of the rule.
    name string
    Name of the rule.
    cloud_connector_id str
    Id of the cloud connector.
    id float
    Unique identifier of the rule.
    kind str
    Kind of the rule.
    name str
    Name of the rule.
    cloudConnectorId String
    Id of the cloud connector.
    id Number
    Unique identifier of the rule.
    kind String
    Kind of the rule.
    name String
    Name of the rule.

    Package Details

    Repository
    harness pulumi/pulumi-harness
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the harness Terraform Provider.
    harness logo
    Viewing docs for Harness v0.11.8
    published on Friday, Mar 27, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.