get Alert Robots
This data source provides the Arms Alert Robots of the current Alibaba Cloud user.
NOTE: Available since v1.237.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const _default = new alicloud.arms.AlertRobot("default", {
alertRobotName: "my-AlertRobot",
robotType: "wechat",
robotAddr: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=1c704e23",
});
const nameRegex = alicloud.arms.getAlertRobotsOutput({
alertRobotName: _default.alertRobotName,
});
export const armsAlertRobotId = nameRegex.apply(nameRegex => nameRegex.robots?.[0]?.id);
Content copied to clipboard
import pulumi
import pulumi_alicloud as alicloud
default = alicloud.arms.AlertRobot("default",
alert_robot_name="my-AlertRobot",
robot_type="wechat",
robot_addr="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=1c704e23")
name_regex = alicloud.arms.get_alert_robots_output(alert_robot_name=default.alert_robot_name)
pulumi.export("armsAlertRobotId", name_regex.robots[0].id)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var @default = new AliCloud.Arms.AlertRobot("default", new()
{
AlertRobotName = "my-AlertRobot",
RobotType = "wechat",
RobotAddr = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=1c704e23",
});
var nameRegex = AliCloud.Arms.GetAlertRobots.Invoke(new()
{
AlertRobotName = @default.AlertRobotName,
});
return new Dictionary<string, object?>
{
["armsAlertRobotId"] = nameRegex.Apply(getAlertRobotsResult => getAlertRobotsResult.Robots[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 {
_default, err := arms.NewAlertRobot(ctx, "default", &arms.AlertRobotArgs{
AlertRobotName: pulumi.String("my-AlertRobot"),
RobotType: pulumi.String("wechat"),
RobotAddr: pulumi.String("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=1c704e23"),
})
if err != nil {
return err
}
nameRegex := arms.GetAlertRobotsOutput(ctx, arms.GetAlertRobotsOutputArgs{
AlertRobotName: _default.AlertRobotName,
}, nil)
ctx.Export("armsAlertRobotId", nameRegex.ApplyT(func(nameRegex arms.GetAlertRobotsResult) (*string, error) {
return &nameRegex.Robots[0].Id, nil
}).(pulumi.StringPtrOutput))
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.AlertRobot;
import com.pulumi.alicloud.arms.AlertRobotArgs;
import com.pulumi.alicloud.arms.ArmsFunctions;
import com.pulumi.alicloud.arms.inputs.GetAlertRobotsArgs;
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) {
var default_ = new AlertRobot("default", AlertRobotArgs.builder()
.alertRobotName("my-AlertRobot")
.robotType("wechat")
.robotAddr("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=1c704e23")
.build());
final var nameRegex = ArmsFunctions.getAlertRobots(GetAlertRobotsArgs.builder()
.alertRobotName(default_.alertRobotName())
.build());
ctx.export("armsAlertRobotId", nameRegex.applyValue(_nameRegex -> _nameRegex.robots()[0].id()));
}
}
Content copied to clipboard
resources:
default:
type: alicloud:arms:AlertRobot
properties:
alertRobotName: my-AlertRobot
robotType: wechat
robotAddr: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=1c704e23
variables:
nameRegex:
fn::invoke:
function: alicloud:arms:getAlertRobots
arguments:
alertRobotName: ${default.alertRobotName}
outputs:
armsAlertRobotId: ${nameRegex.robots[0].id}
Content copied to clipboard
Return
A collection of values returned by getAlertRobots.
Parameters
argument
A collection of arguments for invoking getAlertRobots.
suspend fun getAlertRobots(alertRobotName: String? = null, ids: List<String>? = null, nameRegex: String? = null, outputFile: String? = null, robotType: String? = null): GetAlertRobotsResult
Return
A collection of values returned by getAlertRobots.
Parameters
alert Robot Name
The robot name.
ids
A list of Alert Robot IDs.
name Regex
A regex string to filter results by Alert Robot name.
output File
File name where to save data source results (after running pulumi preview
).
robot Type
The robot type.
See also
suspend fun getAlertRobots(argument: suspend GetAlertRobotsPlainArgsBuilder.() -> Unit): GetAlertRobotsResult
Return
A collection of values returned by getAlertRobots.
Parameters
argument
Builder for com.pulumi.alicloud.arms.kotlin.inputs.GetAlertRobotsPlainArgs.