Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi
alicloud.cms.getSiteMonitors
Explore with Pulumi AI
This data source provides Cloud Monitor Service Site Monitor available to the user.What is Site Monitor
NOTE: Available since v1.224.0.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
const name = config.get("name") || "tf_example";
const defaultInteger = new random.index.Integer("default", {
min: 10000,
max: 99999,
});
const defaultSiteMonitor = new alicloud.cms.SiteMonitor("default", {
address: "http://www.alibabacloud.com",
taskName: `terraform-example-${defaultInteger.result}`,
taskType: "HTTP",
interval: 5,
ispCities: [{
city: "546",
isp: "465",
}],
optionsJson: `{
"http_method": "get",
"waitTime_after_completion": null,
"ipv6_task": false,
"diagnosis_ping": false,
"diagnosis_mtr": false,
"assertions": [
{
"operator": "lessThan",
"type": "response_time",
"target": 1000
}
],
"time_out": 30000
}
`,
});
const default = alicloud.cms.getSiteMonitorsOutput({
ids: [defaultSiteMonitor.id],
taskType: "HTTP",
});
export const alicloudCmsSiteMonitorExampleId = _default.apply(_default => _default.monitors?.[0]?.taskId);
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf_example"
default_integer = random.index.Integer("default",
min=10000,
max=99999)
default_site_monitor = alicloud.cms.SiteMonitor("default",
address="http://www.alibabacloud.com",
task_name=f"terraform-example-{default_integer['result']}",
task_type="HTTP",
interval=5,
isp_cities=[{
"city": "546",
"isp": "465",
}],
options_json="""{
"http_method": "get",
"waitTime_after_completion": null,
"ipv6_task": false,
"diagnosis_ping": false,
"diagnosis_mtr": false,
"assertions": [
{
"operator": "lessThan",
"type": "response_time",
"target": 1000
}
],
"time_out": 30000
}
""")
default = alicloud.cms.get_site_monitors_output(ids=[default_site_monitor.id],
task_type="HTTP")
pulumi.export("alicloudCmsSiteMonitorExampleId", default.monitors[0].task_id)
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cms"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "tf_example";
if param := cfg.Get("name"); param != ""{
name = param
}
defaultInteger, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000,
Max: 99999,
})
if err != nil {
return err
}
defaultSiteMonitor, err := cms.NewSiteMonitor(ctx, "default", &cms.SiteMonitorArgs{
Address: pulumi.String("http://www.alibabacloud.com"),
TaskName: pulumi.Sprintf("terraform-example-%v", defaultInteger.Result),
TaskType: pulumi.String("HTTP"),
Interval: pulumi.Int(5),
IspCities: cms.SiteMonitorIspCityArray{
&cms.SiteMonitorIspCityArgs{
City: pulumi.String("546"),
Isp: pulumi.String("465"),
},
},
OptionsJson: pulumi.String(`{
"http_method": "get",
"waitTime_after_completion": null,
"ipv6_task": false,
"diagnosis_ping": false,
"diagnosis_mtr": false,
"assertions": [
{
"operator": "lessThan",
"type": "response_time",
"target": 1000
}
],
"time_out": 30000
}
`),
})
if err != nil {
return err
}
_default := cms.GetSiteMonitorsOutput(ctx, cms.GetSiteMonitorsOutputArgs{
Ids: pulumi.StringArray{
defaultSiteMonitor.ID(),
},
TaskType: pulumi.String("HTTP"),
}, nil);
ctx.Export("alicloudCmsSiteMonitorExampleId", _default.ApplyT(func(_default cms.GetSiteMonitorsResult) (*string, error) {
return &default.Monitors[0].TaskId, nil
}).(pulumi.StringPtrOutput))
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tf_example";
var defaultInteger = new Random.Index.Integer("default", new()
{
Min = 10000,
Max = 99999,
});
var defaultSiteMonitor = new AliCloud.Cms.SiteMonitor("default", new()
{
Address = "http://www.alibabacloud.com",
TaskName = $"terraform-example-{defaultInteger.Result}",
TaskType = "HTTP",
Interval = 5,
IspCities = new[]
{
new AliCloud.Cms.Inputs.SiteMonitorIspCityArgs
{
City = "546",
Isp = "465",
},
},
OptionsJson = @"{
""http_method"": ""get"",
""waitTime_after_completion"": null,
""ipv6_task"": false,
""diagnosis_ping"": false,
""diagnosis_mtr"": false,
""assertions"": [
{
""operator"": ""lessThan"",
""type"": ""response_time"",
""target"": 1000
}
],
""time_out"": 30000
}
",
});
var @default = AliCloud.Cms.GetSiteMonitors.Invoke(new()
{
Ids = new[]
{
defaultSiteMonitor.Id,
},
TaskType = "HTTP",
});
return new Dictionary<string, object?>
{
["alicloudCmsSiteMonitorExampleId"] = @default.Apply(@default => @default.Apply(getSiteMonitorsResult => getSiteMonitorsResult.Monitors[0]?.TaskId)),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.IntegerArgs;
import com.pulumi.alicloud.cms.SiteMonitor;
import com.pulumi.alicloud.cms.SiteMonitorArgs;
import com.pulumi.alicloud.cms.inputs.SiteMonitorIspCityArgs;
import com.pulumi.alicloud.cms.CmsFunctions;
import com.pulumi.alicloud.cms.inputs.GetSiteMonitorsArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("tf_example");
var defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
.min(10000)
.max(99999)
.build());
var defaultSiteMonitor = new SiteMonitor("defaultSiteMonitor", SiteMonitorArgs.builder()
.address("http://www.alibabacloud.com")
.taskName(String.format("terraform-example-%s", defaultInteger.result()))
.taskType("HTTP")
.interval(5)
.ispCities(SiteMonitorIspCityArgs.builder()
.city("546")
.isp("465")
.build())
.optionsJson("""
{
"http_method": "get",
"waitTime_after_completion": null,
"ipv6_task": false,
"diagnosis_ping": false,
"diagnosis_mtr": false,
"assertions": [
{
"operator": "lessThan",
"type": "response_time",
"target": 1000
}
],
"time_out": 30000
}
""")
.build());
final var default = CmsFunctions.getSiteMonitors(GetSiteMonitorsArgs.builder()
.ids(defaultSiteMonitor.id())
.taskType("HTTP")
.build());
ctx.export("alicloudCmsSiteMonitorExampleId", default_.applyValue(default_ -> default_.monitors()[0].taskId()));
}
}
configuration:
name:
type: string
default: tf_example
resources:
defaultInteger:
type: random:integer
name: default
properties:
min: 10000
max: 99999
defaultSiteMonitor:
type: alicloud:cms:SiteMonitor
name: default
properties:
address: http://www.alibabacloud.com
taskName: terraform-example-${defaultInteger.result}
taskType: HTTP
interval: 5
ispCities:
- city: '546'
isp: '465'
optionsJson: |
{
"http_method": "get",
"waitTime_after_completion": null,
"ipv6_task": false,
"diagnosis_ping": false,
"diagnosis_mtr": false,
"assertions": [
{
"operator": "lessThan",
"type": "response_time",
"target": 1000
}
],
"time_out": 30000
}
variables:
default:
fn::invoke:
Function: alicloud:cms:getSiteMonitors
Arguments:
ids:
- ${defaultSiteMonitor.id}
taskType: HTTP
outputs:
alicloudCmsSiteMonitorExampleId: ${default.monitors[0].taskId}
Using getSiteMonitors
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 getSiteMonitors(args: GetSiteMonitorsArgs, opts?: InvokeOptions): Promise<GetSiteMonitorsResult>
function getSiteMonitorsOutput(args: GetSiteMonitorsOutputArgs, opts?: InvokeOptions): Output<GetSiteMonitorsResult>
def get_site_monitors(ids: Optional[Sequence[str]] = None,
output_file: Optional[str] = None,
task_id: Optional[str] = None,
task_type: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSiteMonitorsResult
def get_site_monitors_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
output_file: Optional[pulumi.Input[str]] = None,
task_id: Optional[pulumi.Input[str]] = None,
task_type: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSiteMonitorsResult]
func GetSiteMonitors(ctx *Context, args *GetSiteMonitorsArgs, opts ...InvokeOption) (*GetSiteMonitorsResult, error)
func GetSiteMonitorsOutput(ctx *Context, args *GetSiteMonitorsOutputArgs, opts ...InvokeOption) GetSiteMonitorsResultOutput
> Note: This function is named GetSiteMonitors
in the Go SDK.
public static class GetSiteMonitors
{
public static Task<GetSiteMonitorsResult> InvokeAsync(GetSiteMonitorsArgs args, InvokeOptions? opts = null)
public static Output<GetSiteMonitorsResult> Invoke(GetSiteMonitorsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetSiteMonitorsResult> getSiteMonitors(GetSiteMonitorsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:cms/getSiteMonitors:getSiteMonitors
arguments:
# arguments dictionary
The following arguments are supported:
- Ids List<string>
- A list of Site Monitor IDs.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Task
Id string - Task ID.
- Task
Type string - Task Type.
- Ids []string
- A list of Site Monitor IDs.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Task
Id string - Task ID.
- Task
Type string - Task Type.
- ids List<String>
- A list of Site Monitor IDs.
- output
File String - File name where to save data source results (after running
pulumi preview
). - task
Id String - Task ID.
- task
Type String - Task Type.
- ids string[]
- A list of Site Monitor IDs.
- output
File string - File name where to save data source results (after running
pulumi preview
). - task
Id string - Task ID.
- task
Type string - Task Type.
- ids Sequence[str]
- A list of Site Monitor IDs.
- output_
file str - File name where to save data source results (after running
pulumi preview
). - task_
id str - Task ID.
- task_
type str - Task Type.
- ids List<String>
- A list of Site Monitor IDs.
- output
File String - File name where to save data source results (after running
pulumi preview
). - task
Id String - Task ID.
- task
Type String - Task Type.
getSiteMonitors Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- A list of Site Monitor IDs.
- Monitors
List<Pulumi.
Ali Cloud. Cms. Outputs. Get Site Monitors Monitor> - A list of Site Monitor Entries. Each element contains the following attributes:
- Output
File string - Task
Id string - Task Id.
- Task
Type string - Task Type.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- A list of Site Monitor IDs.
- Monitors
[]Get
Site Monitors Monitor - A list of Site Monitor Entries. Each element contains the following attributes:
- Output
File string - Task
Id string - Task Id.
- Task
Type string - Task Type.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Site Monitor IDs.
- monitors
List<Get
Site Monitors Monitor> - A list of Site Monitor Entries. Each element contains the following attributes:
- output
File String - task
Id String - Task Id.
- task
Type String - Task Type.
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- A list of Site Monitor IDs.
- monitors
Get
Site Monitors Monitor[] - A list of Site Monitor Entries. Each element contains the following attributes:
- output
File string - task
Id string - Task Id.
- task
Type string - Task Type.
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- A list of Site Monitor IDs.
- monitors
Sequence[Get
Site Monitors Monitor] - A list of Site Monitor Entries. Each element contains the following attributes:
- output_
file str - task_
id str - Task Id.
- task_
type str - Task Type.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Site Monitor IDs.
- monitors List<Property Map>
- A list of Site Monitor Entries. Each element contains the following attributes:
- output
File String - task
Id String - Task Id.
- task
Type String - Task Type.
Supporting Types
GetSiteMonitorsMonitor
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.