1. Packages
  2. Alicloud Provider
  3. API Docs
  4. cms
  5. getSiteMonitors
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.cms.getSiteMonitors

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

    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.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    TaskId string
    Task ID.
    TaskType string
    Task Type.
    Ids []string
    A list of Site Monitor IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    TaskId string
    Task ID.
    TaskType string
    Task Type.
    ids List<String>
    A list of Site Monitor IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    taskId String
    Task ID.
    taskType String
    Task Type.
    ids string[]
    A list of Site Monitor IDs.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    taskId string
    Task ID.
    taskType 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.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    taskId String
    Task ID.
    taskType 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.AliCloud.Cms.Outputs.GetSiteMonitorsMonitor>
    A list of Site Monitor Entries. Each element contains the following attributes:
    OutputFile string
    TaskId string
    Task Id.
    TaskType string
    Task Type.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of Site Monitor IDs.
    Monitors []GetSiteMonitorsMonitor
    A list of Site Monitor Entries. Each element contains the following attributes:
    OutputFile string
    TaskId string
    Task Id.
    TaskType 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<GetSiteMonitorsMonitor>
    A list of Site Monitor Entries. Each element contains the following attributes:
    outputFile String
    taskId String
    Task Id.
    taskType String
    Task Type.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of Site Monitor IDs.
    monitors GetSiteMonitorsMonitor[]
    A list of Site Monitor Entries. Each element contains the following attributes:
    outputFile string
    taskId string
    Task Id.
    taskType 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[GetSiteMonitorsMonitor]
    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:
    outputFile String
    taskId String
    Task Id.
    taskType String
    Task Type.

    Supporting Types

    GetSiteMonitorsMonitor

    Address string
    Address.
    CreateTime string
    CreateTime.
    Interval string
    Monitoring frequency.
    TaskId string
    Task ID.
    TaskName string
    Task Name.
    TaskType string
    Task Type.
    Address string
    Address.
    CreateTime string
    CreateTime.
    Interval string
    Monitoring frequency.
    TaskId string
    Task ID.
    TaskName string
    Task Name.
    TaskType string
    Task Type.
    address String
    Address.
    createTime String
    CreateTime.
    interval String
    Monitoring frequency.
    taskId String
    Task ID.
    taskName String
    Task Name.
    taskType String
    Task Type.
    address string
    Address.
    createTime string
    CreateTime.
    interval string
    Monitoring frequency.
    taskId string
    Task ID.
    taskName string
    Task Name.
    taskType string
    Task Type.
    address str
    Address.
    create_time str
    CreateTime.
    interval str
    Monitoring frequency.
    task_id str
    Task ID.
    task_name str
    Task Name.
    task_type str
    Task Type.
    address String
    Address.
    createTime String
    CreateTime.
    interval String
    Monitoring frequency.
    taskId String
    Task ID.
    taskName String
    Task Name.
    taskType String
    Task Type.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi