alicloud.arms.getPrometheusAlertRules
Explore with Pulumi AI
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
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),
};
});
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
})
}
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.applyValue(getPrometheusAlertRulesResult -> getPrometheusAlertRulesResult.rules()[0].id()));
final var nameRegex = ArmsFunctions.getPrometheusAlertRules(GetPrometheusAlertRulesArgs.builder()
.clusterId("example_value")
.nameRegex("^my-PrometheusAlertRule")
.build());
ctx.export("armsPrometheusAlertRuleId2", nameRegex.applyValue(getPrometheusAlertRulesResult -> getPrometheusAlertRulesResult.rules()[0].id()));
}
}
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)
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);
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}
Using getPrometheusAlertRules
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 getPrometheusAlertRules(args: GetPrometheusAlertRulesArgs, opts?: InvokeOptions): Promise<GetPrometheusAlertRulesResult>
function getPrometheusAlertRulesOutput(args: GetPrometheusAlertRulesOutputArgs, opts?: InvokeOptions): Output<GetPrometheusAlertRulesResult>
def get_prometheus_alert_rules(cluster_id: Optional[str] = None,
ids: Optional[Sequence[str]] = None,
match_expressions: Optional[str] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
status: Optional[int] = None,
type: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPrometheusAlertRulesResult
def get_prometheus_alert_rules_output(cluster_id: Optional[pulumi.Input[str]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
match_expressions: Optional[pulumi.Input[str]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
status: Optional[pulumi.Input[int]] = None,
type: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPrometheusAlertRulesResult]
func GetPrometheusAlertRules(ctx *Context, args *GetPrometheusAlertRulesArgs, opts ...InvokeOption) (*GetPrometheusAlertRulesResult, error)
func GetPrometheusAlertRulesOutput(ctx *Context, args *GetPrometheusAlertRulesOutputArgs, opts ...InvokeOption) GetPrometheusAlertRulesResultOutput
> Note: This function is named GetPrometheusAlertRules
in the Go SDK.
public static class GetPrometheusAlertRules
{
public static Task<GetPrometheusAlertRulesResult> InvokeAsync(GetPrometheusAlertRulesArgs args, InvokeOptions? opts = null)
public static Output<GetPrometheusAlertRulesResult> Invoke(GetPrometheusAlertRulesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPrometheusAlertRulesResult> getPrometheusAlertRules(GetPrometheusAlertRulesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:arms/getPrometheusAlertRules:getPrometheusAlertRules
arguments:
# arguments dictionary
The following arguments are supported:
- Cluster
Id string The ID of the cluster.
- Ids List<string>
A list of Prometheus Alert Rule IDs.
- Match
Expressions string - Name
Regex string A regex string to filter results by Prometheus Alert Rule name.
- Output
File string File name where to save data source results (after running
pulumi preview
).- Status int
The status of the resource. Valid values:
0
,1
.- Type string
The type of the alert rule.
- Cluster
Id string The ID of the cluster.
- Ids []string
A list of Prometheus Alert Rule IDs.
- Match
Expressions string - Name
Regex string A regex string to filter results by Prometheus Alert Rule name.
- Output
File string File name where to save data source results (after running
pulumi preview
).- Status int
The status of the resource. Valid values:
0
,1
.- Type string
The type of the alert rule.
- cluster
Id String The ID of the cluster.
- ids List<String>
A list of Prometheus Alert Rule IDs.
- match
Expressions String - name
Regex String A regex string to filter results by Prometheus Alert Rule name.
- output
File String File name where to save data source results (after running
pulumi preview
).- status Integer
The status of the resource. Valid values:
0
,1
.- type String
The type of the alert rule.
- cluster
Id string The ID of the cluster.
- ids string[]
A list of Prometheus Alert Rule IDs.
- match
Expressions string - name
Regex string A regex string to filter results by Prometheus Alert Rule name.
- output
File string File name where to save data source results (after running
pulumi preview
).- status number
The status of the resource. Valid values:
0
,1
.- type string
The type of the alert rule.
- cluster_
id str The ID of the cluster.
- ids Sequence[str]
A list of Prometheus Alert Rule IDs.
- match_
expressions str - name_
regex str A regex string to filter results by Prometheus Alert Rule name.
- output_
file str File name where to save data source results (after running
pulumi preview
).- status int
The status of the resource. Valid values:
0
,1
.- type str
The type of the alert rule.
- cluster
Id String The ID of the cluster.
- ids List<String>
A list of Prometheus Alert Rule IDs.
- match
Expressions String - name
Regex String A regex string to filter results by Prometheus Alert Rule name.
- output
File String File name where to save data source results (after running
pulumi preview
).- status Number
The status of the resource. Valid values:
0
,1
.- type String
The type of the alert rule.
getPrometheusAlertRules Result
The following output properties are available:
- Cluster
Id string - Id string
The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Names List<string>
- Rules
List<Pulumi.
Ali Cloud. Arms. Outputs. Get Prometheus Alert Rules Rule> - Match
Expressions string - Name
Regex string - Output
File string - Status int
- Type string
- Cluster
Id string - Id string
The provider-assigned unique ID for this managed resource.
- Ids []string
- Names []string
- Rules
[]Get
Prometheus Alert Rules Rule - Match
Expressions string - Name
Regex string - Output
File string - Status int
- Type string
- cluster
Id String - id String
The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- rules
List<Get
Prometheus Alert Rules Rule> - match
Expressions String - name
Regex String - output
File String - status Integer
- type String
- cluster
Id string - id string
The provider-assigned unique ID for this managed resource.
- ids string[]
- names string[]
- rules
Get
Prometheus Alert Rules Rule[] - match
Expressions string - name
Regex string - output
File string - status number
- type string
- cluster_
id str - id str
The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- names Sequence[str]
- rules
Sequence[Get
Prometheus Alert Rules Rule] - match_
expressions str - name_
regex str - output_
file str - status int
- type str
- cluster
Id String - id String
The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- rules List<Property Map>
- match
Expressions String - name
Regex String - output
File String - status Number
- type String
Supporting Types
GetPrometheusAlertRulesRule
- Annotations
List<Pulumi.
Ali Cloud. Arms. Inputs. Get Prometheus Alert Rules Rule Annotation> The annotations of the alert rule.
- Cluster
Id string The ID of the cluster.
- Dispatch
Rule stringId The ID of the notification policy. This parameter is required when the
notify_type
parameter is set toDISPATCH_RULE
.- Duration string
The duration of the alert.
- Expression string
The alert rule expression that follows the PromQL syntax..
- Id string
The ID of the Prometheus Alert Rule.
- Labels
List<Pulumi.
Ali Cloud. Arms. Inputs. Get Prometheus Alert Rules Rule Label> The labels of the resource.
- Message string
The message of the alert notification.
- Notify
Type string The method of sending the alert notification. Valid values:
ALERT_MANAGER
,DISPATCH_RULE
.- Prometheus
Alert stringRule Id The first ID of the resource.
- Prometheus
Alert stringRule Name The name of the resource.
- Status int
The status of the resource. Valid values:
0
,1
.- Type string
The type of the alert rule.
- Annotations
[]Get
Prometheus Alert Rules Rule Annotation The annotations of the alert rule.
- Cluster
Id string The ID of the cluster.
- Dispatch
Rule stringId The ID of the notification policy. This parameter is required when the
notify_type
parameter is set toDISPATCH_RULE
.- Duration string
The duration of the alert.
- Expression string
The alert rule expression that follows the PromQL syntax..
- Id string
The ID of the Prometheus Alert Rule.
- Labels
[]Get
Prometheus Alert Rules Rule Label The labels of the resource.
- Message string
The message of the alert notification.
- Notify
Type string The method of sending the alert notification. Valid values:
ALERT_MANAGER
,DISPATCH_RULE
.- Prometheus
Alert stringRule Id The first ID of the resource.
- Prometheus
Alert stringRule Name The name of the resource.
- Status int
The status of the resource. Valid values:
0
,1
.- Type string
The type of the alert rule.
- annotations
List<Get
Prometheus Alert Rules Rule Annotation> The annotations of the alert rule.
- cluster
Id String The ID of the cluster.
- dispatch
Rule StringId The ID of the notification policy. This parameter is required when the
notify_type
parameter is set toDISPATCH_RULE
.- duration String
The duration of the alert.
- expression String
The alert rule expression that follows the PromQL syntax..
- id String
The ID of the Prometheus Alert Rule.
- labels
List<Get
Prometheus Alert Rules Rule Label> The labels of the resource.
- message String
The message of the alert notification.
- notify
Type String The method of sending the alert notification. Valid values:
ALERT_MANAGER
,DISPATCH_RULE
.- prometheus
Alert StringRule Id The first ID of the resource.
- prometheus
Alert StringRule Name The name of the resource.
- status Integer
The status of the resource. Valid values:
0
,1
.- type String
The type of the alert rule.
- annotations
Get
Prometheus Alert Rules Rule Annotation[] The annotations of the alert rule.
- cluster
Id string The ID of the cluster.
- dispatch
Rule stringId The ID of the notification policy. This parameter is required when the
notify_type
parameter is set toDISPATCH_RULE
.- duration string
The duration of the alert.
- expression string
The alert rule expression that follows the PromQL syntax..
- id string
The ID of the Prometheus Alert Rule.
- labels
Get
Prometheus Alert Rules Rule Label[] The labels of the resource.
- message string
The message of the alert notification.
- notify
Type string The method of sending the alert notification. Valid values:
ALERT_MANAGER
,DISPATCH_RULE
.- prometheus
Alert stringRule Id The first ID of the resource.
- prometheus
Alert stringRule Name The name of the resource.
- status number
The status of the resource. Valid values:
0
,1
.- type string
The type of the alert rule.
- annotations
Sequence[Get
Prometheus Alert Rules Rule Annotation] The annotations of the alert rule.
- cluster_
id str The ID of the cluster.
- dispatch_
rule_ strid The ID of the notification policy. This parameter is required when the
notify_type
parameter is set toDISPATCH_RULE
.- duration str
The duration of the alert.
- expression str
The alert rule expression that follows the PromQL syntax..
- id str
The ID of the Prometheus Alert Rule.
- labels
Sequence[Get
Prometheus Alert Rules Rule Label] The labels of the resource.
- message str
The message of the alert notification.
- notify_
type str The method of sending the alert notification. Valid values:
ALERT_MANAGER
,DISPATCH_RULE
.- prometheus_
alert_ strrule_ id The first ID of the resource.
- prometheus_
alert_ strrule_ name The name of the resource.
- status int
The status of the resource. Valid values:
0
,1
.- type str
The type of the alert rule.
- annotations List<Property Map>
The annotations of the alert rule.
- cluster
Id String The ID of the cluster.
- dispatch
Rule StringId The ID of the notification policy. This parameter is required when the
notify_type
parameter is set toDISPATCH_RULE
.- duration String
The duration of the alert.
- expression String
The alert rule expression that follows the PromQL syntax..
- id String
The ID of the Prometheus Alert Rule.
- labels List<Property Map>
The labels of the resource.
- message String
The message of the alert notification.
- notify
Type String The method of sending the alert notification. Valid values:
ALERT_MANAGER
,DISPATCH_RULE
.- prometheus
Alert StringRule Id The first ID of the resource.
- prometheus
Alert StringRule Name The name of the resource.
- status Number
The status of the resource. Valid values:
0
,1
.- type String
The type of the alert rule.
GetPrometheusAlertRulesRuleAnnotation
GetPrometheusAlertRulesRuleLabel
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.