get Prometheus Alert Rules
suspend fun getPrometheusAlertRules(argument: GetPrometheusAlertRulesPlainArgs): GetPrometheusAlertRulesResult
This data source provides the Arms Prometheus Alert Rules of the current Alibaba Cloud user.
NOTE: Available in v1.136.0+.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.arms.getPrometheusAlertRules({
clusterId: "example_value",
ids: [
"example_value-1",
"example_value-2",
],
});
export const armsPrometheusAlertRuleId1 = ids.then(ids => ids.rules?.[0]?.id);
const nameRegex = alicloud.arms.getPrometheusAlertRules({
clusterId: "example_value",
nameRegex: "^my-PrometheusAlertRule",
});
export const armsPrometheusAlertRuleId2 = nameRegex.then(nameRegex => nameRegex.rules?.[0]?.id);
Content copied to clipboard
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.arms.get_prometheus_alert_rules(cluster_id="example_value",
ids=[
"example_value-1",
"example_value-2",
])
pulumi.export("armsPrometheusAlertRuleId1", ids.rules[0].id)
name_regex = alicloud.arms.get_prometheus_alert_rules(cluster_id="example_value",
name_regex="^my-PrometheusAlertRule")
pulumi.export("armsPrometheusAlertRuleId2", name_regex.rules[0].id)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Arms.GetPrometheusAlertRules.Invoke(new()
{
ClusterId = "example_value",
Ids = new[]
{
"example_value-1",
"example_value-2",
},
});
var nameRegex = AliCloud.Arms.GetPrometheusAlertRules.Invoke(new()
{
ClusterId = "example_value",
NameRegex = "^my-PrometheusAlertRule",
});
return new Dictionary<string, object?>
{
["armsPrometheusAlertRuleId1"] = ids.Apply(getPrometheusAlertRulesResult => getPrometheusAlertRulesResult.Rules[0]?.Id),
["armsPrometheusAlertRuleId2"] = nameRegex.Apply(getPrometheusAlertRulesResult => getPrometheusAlertRulesResult.Rules[0]?.Id),
};
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/arms"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := arms.GetPrometheusAlertRules(ctx, &arms.GetPrometheusAlertRulesArgs{
ClusterId: "example_value",
Ids: []string{
"example_value-1",
"example_value-2",
},
}, nil)
if err != nil {
return err
}
ctx.Export("armsPrometheusAlertRuleId1", ids.Rules[0].Id)
nameRegex, err := arms.GetPrometheusAlertRules(ctx, &arms.GetPrometheusAlertRulesArgs{
ClusterId: "example_value",
NameRegex: pulumi.StringRef("^my-PrometheusAlertRule"),
}, nil)
if err != nil {
return err
}
ctx.Export("armsPrometheusAlertRuleId2", nameRegex.Rules[0].Id)
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.arms.ArmsFunctions;
import com.pulumi.alicloud.arms.inputs.GetPrometheusAlertRulesArgs;
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 ids = ArmsFunctions.getPrometheusAlertRules(GetPrometheusAlertRulesArgs.builder()
.clusterId("example_value")
.ids(
"example_value-1",
"example_value-2")
.build());
ctx.export("armsPrometheusAlertRuleId1", ids.rules()[0].id());
final var nameRegex = ArmsFunctions.getPrometheusAlertRules(GetPrometheusAlertRulesArgs.builder()
.clusterId("example_value")
.nameRegex("^my-PrometheusAlertRule")
.build());
ctx.export("armsPrometheusAlertRuleId2", nameRegex.rules()[0].id());
}
}
Content copied to clipboard
variables:
ids:
fn::invoke:
function: alicloud:arms:getPrometheusAlertRules
arguments:
clusterId: example_value
ids:
- example_value-1
- example_value-2
nameRegex:
fn::invoke:
function: alicloud:arms:getPrometheusAlertRules
arguments:
clusterId: example_value
nameRegex: ^my-PrometheusAlertRule
outputs:
armsPrometheusAlertRuleId1: ${ids.rules[0].id}
armsPrometheusAlertRuleId2: ${nameRegex.rules[0].id}
Content copied to clipboard
Return
A collection of values returned by getPrometheusAlertRules.
Parameters
argument
A collection of arguments for invoking getPrometheusAlertRules.
suspend fun getPrometheusAlertRules(clusterId: String, ids: List<String>? = null, matchExpressions: String? = null, nameRegex: String? = null, outputFile: String? = null, status: Int? = null, type: String? = null): GetPrometheusAlertRulesResult
Return
A collection of values returned by getPrometheusAlertRules.
Parameters
cluster Id
The ID of the cluster.
ids
A list of Prometheus Alert Rule IDs.
match Expressions
name Regex
A regex string to filter results by Prometheus Alert Rule name.
output File
File name where to save data source results (after running pulumi preview
).
status
The status of the resource. Valid values: 0
, 1
.
type
The type of the alert rule.
See also
suspend fun getPrometheusAlertRules(argument: suspend GetPrometheusAlertRulesPlainArgsBuilder.() -> Unit): GetPrometheusAlertRulesResult
Return
A collection of values returned by getPrometheusAlertRules.
Parameters
argument
Builder for com.pulumi.alicloud.arms.kotlin.inputs.GetPrometheusAlertRulesPlainArgs.