1. Packages
  2. Dynatrace
  3. API Docs
  4. getSyntheticLocations
Dynatrace v0.21.0 published on Sunday, Nov 17, 2024 by Pulumiverse

dynatrace.getSyntheticLocations

Explore with Pulumi AI

dynatrace logo
Dynatrace v0.21.0 published on Sunday, Nov 17, 2024 by Pulumiverse

    The synthetic locations data source allows the location IDs to be retrieved based off of provided parameters.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as dynatrace from "@pulumi/dynatrace";
    import * as dynatrace from "@pulumiverse/dynatrace";
    
    const test = dynatrace.getSyntheticLocations({
        name: "Sydney",
    });
    const _name_ = new dynatrace.HttpMonitor("#name#", {
        enabled: true,
        frequency: 60,
        locations: [test.then(test => test.locations?.entityId)],
        anomalyDetections: [{
            loadingTimeThresholds: [{
                enabled: true,
            }],
            outageHandlings: [{
                globalOutage: true,
                localOutage: false,
                retryOnError: false,
            }],
        }],
        script: {
            requests: [{
                description: "google.com",
                method: "GET",
                url: "https://www.google.com",
                configuration: {
                    acceptAnyCertificate: true,
                    followRedirects: true,
                },
                validation: {
                    rules: [{
                        type: "httpStatusesList",
                        passIfFound: false,
                        value: ">=400",
                    }],
                },
            }],
        },
    });
    
    import pulumi
    import pulumi_dynatrace as dynatrace
    import pulumiverse_dynatrace as dynatrace
    
    test = dynatrace.get_synthetic_locations(name="Sydney")
    _name_ = dynatrace.HttpMonitor("#name#",
        enabled=True,
        frequency=60,
        locations=[test.locations.entity_id],
        anomaly_detections=[{
            "loading_time_thresholds": [{
                "enabled": True,
            }],
            "outage_handlings": [{
                "global_outage": True,
                "local_outage": False,
                "retry_on_error": False,
            }],
        }],
        script={
            "requests": [{
                "description": "google.com",
                "method": "GET",
                "url": "https://www.google.com",
                "configuration": {
                    "accept_any_certificate": True,
                    "follow_redirects": True,
                },
                "validation": {
                    "rules": [{
                        "type": "httpStatusesList",
                        "pass_if_found": False,
                        "value": ">=400",
                    }],
                },
            }],
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-dynatrace/sdk/go/dynatrace"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		test, err := dynatrace.GetSyntheticLocations(ctx, &dynatrace.GetSyntheticLocationsArgs{
    			Name: pulumi.StringRef("Sydney"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = dynatrace.NewHttpMonitor(ctx, "#name#", &dynatrace.HttpMonitorArgs{
    			Enabled:   pulumi.Bool(true),
    			Frequency: pulumi.Int(60),
    			Locations: pulumi.StringArray{
    				pulumi.String(test.Locations.EntityId),
    			},
    			AnomalyDetections: dynatrace.HttpMonitorAnomalyDetectionArray{
    				&dynatrace.HttpMonitorAnomalyDetectionArgs{
    					LoadingTimeThresholds: dynatrace.HttpMonitorAnomalyDetectionLoadingTimeThresholdArray{
    						&dynatrace.HttpMonitorAnomalyDetectionLoadingTimeThresholdArgs{
    							Enabled: pulumi.Bool(true),
    						},
    					},
    					OutageHandlings: dynatrace.HttpMonitorAnomalyDetectionOutageHandlingArray{
    						&dynatrace.HttpMonitorAnomalyDetectionOutageHandlingArgs{
    							GlobalOutage: pulumi.Bool(true),
    							LocalOutage:  pulumi.Bool(false),
    							RetryOnError: pulumi.Bool(false),
    						},
    					},
    				},
    			},
    			Script: &dynatrace.HttpMonitorScriptTypeArgs{
    				Requests: dynatrace.HttpMonitorScriptRequestArray{
    					&dynatrace.HttpMonitorScriptRequestArgs{
    						Description: pulumi.String("google.com"),
    						Method:      pulumi.String("GET"),
    						Url:         pulumi.String("https://www.google.com"),
    						Configuration: &dynatrace.HttpMonitorScriptRequestConfigurationArgs{
    							AcceptAnyCertificate: pulumi.Bool(true),
    							FollowRedirects:      pulumi.Bool(true),
    						},
    						Validation: &dynatrace.HttpMonitorScriptRequestValidationArgs{
    							Rules: dynatrace.HttpMonitorScriptRequestValidationRuleArray{
    								&dynatrace.HttpMonitorScriptRequestValidationRuleArgs{
    									Type:        pulumi.String("httpStatusesList"),
    									PassIfFound: pulumi.Bool(false),
    									Value:       pulumi.String(">=400"),
    								},
    							},
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Dynatrace = Pulumi.Dynatrace;
    using Dynatrace = Pulumiverse.Dynatrace;
    
    return await Deployment.RunAsync(() => 
    {
        var test = Dynatrace.GetSyntheticLocations.Invoke(new()
        {
            Name = "Sydney",
        });
    
        var _name_ = new Dynatrace.HttpMonitor("#name#", new()
        {
            Enabled = true,
            Frequency = 60,
            Locations = new[]
            {
                test.Apply(getSyntheticLocationsResult => getSyntheticLocationsResult.Locations?.EntityId),
            },
            AnomalyDetections = new[]
            {
                new Dynatrace.Inputs.HttpMonitorAnomalyDetectionArgs
                {
                    LoadingTimeThresholds = new[]
                    {
                        new Dynatrace.Inputs.HttpMonitorAnomalyDetectionLoadingTimeThresholdArgs
                        {
                            Enabled = true,
                        },
                    },
                    OutageHandlings = new[]
                    {
                        new Dynatrace.Inputs.HttpMonitorAnomalyDetectionOutageHandlingArgs
                        {
                            GlobalOutage = true,
                            LocalOutage = false,
                            RetryOnError = false,
                        },
                    },
                },
            },
            Script = new Dynatrace.Inputs.HttpMonitorScriptArgs
            {
                Requests = new[]
                {
                    new Dynatrace.Inputs.HttpMonitorScriptRequestArgs
                    {
                        Description = "google.com",
                        Method = "GET",
                        Url = "https://www.google.com",
                        Configuration = new Dynatrace.Inputs.HttpMonitorScriptRequestConfigurationArgs
                        {
                            AcceptAnyCertificate = true,
                            FollowRedirects = true,
                        },
                        Validation = new Dynatrace.Inputs.HttpMonitorScriptRequestValidationArgs
                        {
                            Rules = new[]
                            {
                                new Dynatrace.Inputs.HttpMonitorScriptRequestValidationRuleArgs
                                {
                                    Type = "httpStatusesList",
                                    PassIfFound = false,
                                    Value = ">=400",
                                },
                            },
                        },
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.dynatrace.DynatraceFunctions;
    import com.pulumi.dynatrace.inputs.GetSyntheticLocationsArgs;
    import com.pulumi.dynatrace.HttpMonitor;
    import com.pulumi.dynatrace.HttpMonitorArgs;
    import com.pulumi.dynatrace.inputs.HttpMonitorAnomalyDetectionArgs;
    import com.pulumi.dynatrace.inputs.HttpMonitorScriptArgs;
    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 test = DynatraceFunctions.getSyntheticLocations(GetSyntheticLocationsArgs.builder()
                .name("Sydney")
                .build());
    
            var _name_ = new HttpMonitor("#name#", HttpMonitorArgs.builder()
                .enabled(true)
                .frequency(60)
                .locations(test.applyValue(getSyntheticLocationsResult -> getSyntheticLocationsResult.locations().entityId()))
                .anomalyDetections(HttpMonitorAnomalyDetectionArgs.builder()
                    .loadingTimeThresholds(HttpMonitorAnomalyDetectionLoadingTimeThresholdArgs.builder()
                        .enabled(true)
                        .build())
                    .outageHandlings(HttpMonitorAnomalyDetectionOutageHandlingArgs.builder()
                        .globalOutage(true)
                        .localOutage(false)
                        .retryOnError(false)
                        .build())
                    .build())
                .script(HttpMonitorScriptArgs.builder()
                    .requests(HttpMonitorScriptRequestArgs.builder()
                        .description("google.com")
                        .method("GET")
                        .url("https://www.google.com")
                        .configuration(HttpMonitorScriptRequestConfigurationArgs.builder()
                            .acceptAnyCertificate(true)
                            .followRedirects(true)
                            .build())
                        .validation(HttpMonitorScriptRequestValidationArgs.builder()
                            .rules(HttpMonitorScriptRequestValidationRuleArgs.builder()
                                .type("httpStatusesList")
                                .passIfFound(false)
                                .value(">=400")
                                .build())
                            .build())
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      '#name#':
        type: dynatrace:HttpMonitor
        properties:
          enabled: true
          frequency: 60
          locations:
            - ${test.locations.entityId}
          anomalyDetections:
            - loadingTimeThresholds:
                - enabled: true
              outageHandlings:
                - globalOutage: true
                  localOutage: false
                  retryOnError: false
          script:
            requests:
              - description: google.com
                method: GET
                url: https://www.google.com
                configuration:
                  acceptAnyCertificate: true
                  followRedirects: true
                validation:
                  rules:
                    - type: httpStatusesList
                      passIfFound: false
                      value: '>=400'
    variables:
      test:
        fn::invoke:
          Function: dynatrace:getSyntheticLocations
          Arguments:
            name: Sydney
    

    Using getSyntheticLocations

    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 getSyntheticLocations(args: GetSyntheticLocationsArgs, opts?: InvokeOptions): Promise<GetSyntheticLocationsResult>
    function getSyntheticLocationsOutput(args: GetSyntheticLocationsOutputArgs, opts?: InvokeOptions): Output<GetSyntheticLocationsResult>
    def get_synthetic_locations(id: Optional[str] = None,
                                locations: Optional[GetSyntheticLocationsLocations] = None,
                                name: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetSyntheticLocationsResult
    def get_synthetic_locations_output(id: Optional[pulumi.Input[str]] = None,
                                locations: Optional[pulumi.Input[GetSyntheticLocationsLocationsArgs]] = None,
                                name: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetSyntheticLocationsResult]
    func GetSyntheticLocations(ctx *Context, args *GetSyntheticLocationsArgs, opts ...InvokeOption) (*GetSyntheticLocationsResult, error)
    func GetSyntheticLocationsOutput(ctx *Context, args *GetSyntheticLocationsOutputArgs, opts ...InvokeOption) GetSyntheticLocationsResultOutput

    > Note: This function is named GetSyntheticLocations in the Go SDK.

    public static class GetSyntheticLocations 
    {
        public static Task<GetSyntheticLocationsResult> InvokeAsync(GetSyntheticLocationsArgs args, InvokeOptions? opts = null)
        public static Output<GetSyntheticLocationsResult> Invoke(GetSyntheticLocationsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSyntheticLocationsResult> getSyntheticLocations(GetSyntheticLocationsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: dynatrace:index/getSyntheticLocations:getSyntheticLocations
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    The ID of this resource.
    Locations GetSyntheticLocationsLocations
    Name string
    id String
    The ID of this resource.
    locations GetSyntheticLocationsLocations
    name String
    id string
    The ID of this resource.
    locations GetSyntheticLocationsLocations
    name string
    id str
    The ID of this resource.
    locations GetSyntheticLocationsLocations
    name str
    id String
    The ID of this resource.
    locations Property Map
    name String

    getSyntheticLocations Result

    The following output properties are available:

    Locations GetSyntheticLocationsLocations
    Id string
    The ID of this resource.
    Name string
    locations GetSyntheticLocationsLocations
    id String
    The ID of this resource.
    name String
    locations GetSyntheticLocationsLocations
    id string
    The ID of this resource.
    name string
    locations GetSyntheticLocationsLocations
    id str
    The ID of this resource.
    name str
    locations Property Map
    id String
    The ID of this resource.
    name String

    Supporting Types

    GetSyntheticLocationsLocations

    CloudPlatform string
    The cloud provider where the location is hosted.
    Ips List<string>

    The list of IP addresses assigned to the location.

    Only applicable to PUBLIC locations

    Stage string
    The release stage of the location
    Status string
    The status of the location:

    • ENABLED: The location is displayed as active in the UI. You can assign monitors to the location.
    • DISABLED: The location is displayed as inactive in the UI. You can't assign monitors to the location. Monitors already assigned to the location will stay there and will be executed from the location.
    • HIDDEN: The location is not displayed in the UI. You can't assign monitors to the location. You can only set location as HIDDEN when no monitor is assigned to it
    EntityId string
    The unique ID of the location
    Name string
    The name of the location
    Type string
    The type of the location. Supported values are PUBLIC, PRIVATE and CLUSTER
    CloudPlatform string
    The cloud provider where the location is hosted.
    Ips []string

    The list of IP addresses assigned to the location.

    Only applicable to PUBLIC locations

    Stage string
    The release stage of the location
    Status string
    The status of the location:

    • ENABLED: The location is displayed as active in the UI. You can assign monitors to the location.
    • DISABLED: The location is displayed as inactive in the UI. You can't assign monitors to the location. Monitors already assigned to the location will stay there and will be executed from the location.
    • HIDDEN: The location is not displayed in the UI. You can't assign monitors to the location. You can only set location as HIDDEN when no monitor is assigned to it
    EntityId string
    The unique ID of the location
    Name string
    The name of the location
    Type string
    The type of the location. Supported values are PUBLIC, PRIVATE and CLUSTER
    cloudPlatform String
    The cloud provider where the location is hosted.
    ips List<String>

    The list of IP addresses assigned to the location.

    Only applicable to PUBLIC locations

    stage String
    The release stage of the location
    status String
    The status of the location:

    • ENABLED: The location is displayed as active in the UI. You can assign monitors to the location.
    • DISABLED: The location is displayed as inactive in the UI. You can't assign monitors to the location. Monitors already assigned to the location will stay there and will be executed from the location.
    • HIDDEN: The location is not displayed in the UI. You can't assign monitors to the location. You can only set location as HIDDEN when no monitor is assigned to it
    entityId String
    The unique ID of the location
    name String
    The name of the location
    type String
    The type of the location. Supported values are PUBLIC, PRIVATE and CLUSTER
    cloudPlatform string
    The cloud provider where the location is hosted.
    ips string[]

    The list of IP addresses assigned to the location.

    Only applicable to PUBLIC locations

    stage string
    The release stage of the location
    status string
    The status of the location:

    • ENABLED: The location is displayed as active in the UI. You can assign monitors to the location.
    • DISABLED: The location is displayed as inactive in the UI. You can't assign monitors to the location. Monitors already assigned to the location will stay there and will be executed from the location.
    • HIDDEN: The location is not displayed in the UI. You can't assign monitors to the location. You can only set location as HIDDEN when no monitor is assigned to it
    entityId string
    The unique ID of the location
    name string
    The name of the location
    type string
    The type of the location. Supported values are PUBLIC, PRIVATE and CLUSTER
    cloud_platform str
    The cloud provider where the location is hosted.
    ips Sequence[str]

    The list of IP addresses assigned to the location.

    Only applicable to PUBLIC locations

    stage str
    The release stage of the location
    status str
    The status of the location:

    • ENABLED: The location is displayed as active in the UI. You can assign monitors to the location.
    • DISABLED: The location is displayed as inactive in the UI. You can't assign monitors to the location. Monitors already assigned to the location will stay there and will be executed from the location.
    • HIDDEN: The location is not displayed in the UI. You can't assign monitors to the location. You can only set location as HIDDEN when no monitor is assigned to it
    entity_id str
    The unique ID of the location
    name str
    The name of the location
    type str
    The type of the location. Supported values are PUBLIC, PRIVATE and CLUSTER
    cloudPlatform String
    The cloud provider where the location is hosted.
    ips List<String>

    The list of IP addresses assigned to the location.

    Only applicable to PUBLIC locations

    stage String
    The release stage of the location
    status String
    The status of the location:

    • ENABLED: The location is displayed as active in the UI. You can assign monitors to the location.
    • DISABLED: The location is displayed as inactive in the UI. You can't assign monitors to the location. Monitors already assigned to the location will stay there and will be executed from the location.
    • HIDDEN: The location is not displayed in the UI. You can't assign monitors to the location. You can only set location as HIDDEN when no monitor is assigned to it
    entityId String
    The unique ID of the location
    name String
    The name of the location
    type String
    The type of the location. Supported values are PUBLIC, PRIVATE and CLUSTER

    Package Details

    Repository
    dynatrace pulumiverse/pulumi-dynatrace
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the dynatrace Terraform Provider.
    dynatrace logo
    Dynatrace v0.21.0 published on Sunday, Nov 17, 2024 by Pulumiverse