1. Packages
  2. Dynatrace
  3. API Docs
  4. getManagementZones
Dynatrace v0.16.0 published on Tuesday, Sep 10, 2024 by Pulumiverse

dynatrace.getManagementZones

Explore with Pulumi AI

dynatrace logo
Dynatrace v0.16.0 published on Tuesday, Sep 10, 2024 by Pulumiverse

    The management zones data source allows retrieval of all management zones.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as dynatrace from "@pulumi/dynatrace";
    import * as dynatrace from "@pulumiverse/dynatrace";
    
    const test = dynatrace.getManagementZones({});
    const _name_ = new dynatrace.CalculatedServiceMetric("#name#", {
        enabled: true,
        managementZones: [test.then(test => test.values?.[0]?.id)],
        metricKey: "calc:service.#name#",
        unit: "MILLI_SECOND_PER_MINUTE",
        conditions: [{
            conditions: [{
                attribute: "HTTP_REQUEST_METHOD",
                comparison: {
                    negate: false,
                    httpMethod: {
                        operator: "EQUALS_ANY_OF",
                        values: [
                            "POST",
                            "GET",
                        ],
                    },
                },
            }],
        }],
        metricDefinition: {
            metric: "REQUEST_ATTRIBUTE",
            requestAttribute: "foo",
        },
    });
    
    import pulumi
    import pulumi_dynatrace as dynatrace
    import pulumiverse_dynatrace as dynatrace
    
    test = dynatrace.get_management_zones()
    _name_ = dynatrace.CalculatedServiceMetric("#name#",
        enabled=True,
        management_zones=[test.values[0].id],
        metric_key="calc:service.#name#",
        unit="MILLI_SECOND_PER_MINUTE",
        conditions=[{
            "conditions": [{
                "attribute": "HTTP_REQUEST_METHOD",
                "comparison": {
                    "negate": False,
                    "http_method": {
                        "operator": "EQUALS_ANY_OF",
                        "values": [
                            "POST",
                            "GET",
                        ],
                    },
                },
            }],
        }],
        metric_definition={
            "metric": "REQUEST_ATTRIBUTE",
            "request_attribute": "foo",
        })
    
    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.GetManagementZones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		_, err = dynatrace.NewCalculatedServiceMetric(ctx, "#name#", &dynatrace.CalculatedServiceMetricArgs{
    			Enabled: pulumi.Bool(true),
    			ManagementZones: pulumi.StringArray{
    				pulumi.String(test.Values[0].Id),
    			},
    			MetricKey: pulumi.String("calc:service.#name#"),
    			Unit:      pulumi.String("MILLI_SECOND_PER_MINUTE"),
    			Conditions: dynatrace.CalculatedServiceMetricConditionArray{
    				&dynatrace.CalculatedServiceMetricConditionArgs{
    					Conditions: dynatrace.CalculatedServiceMetricConditionConditionArray{
    						&dynatrace.CalculatedServiceMetricConditionConditionArgs{
    							Attribute: pulumi.String("HTTP_REQUEST_METHOD"),
    							Comparison: &dynatrace.CalculatedServiceMetricConditionConditionComparisonArgs{
    								Negate: pulumi.Bool(false),
    								HttpMethod: &dynatrace.CalculatedServiceMetricConditionConditionComparisonHttpMethodArgs{
    									Operator: pulumi.String("EQUALS_ANY_OF"),
    									Values: pulumi.StringArray{
    										pulumi.String("POST"),
    										pulumi.String("GET"),
    									},
    								},
    							},
    						},
    					},
    				},
    			},
    			MetricDefinition: &dynatrace.CalculatedServiceMetricMetricDefinitionArgs{
    				Metric:           pulumi.String("REQUEST_ATTRIBUTE"),
    				RequestAttribute: pulumi.String("foo"),
    			},
    		})
    		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.GetManagementZones.Invoke();
    
        var _name_ = new Dynatrace.CalculatedServiceMetric("#name#", new()
        {
            Enabled = true,
            ManagementZones = new[]
            {
                test.Apply(getManagementZonesResult => getManagementZonesResult.Values[0]?.Id),
            },
            MetricKey = "calc:service.#name#",
            Unit = "MILLI_SECOND_PER_MINUTE",
            Conditions = new[]
            {
                new Dynatrace.Inputs.CalculatedServiceMetricConditionArgs
                {
                    Conditions = new[]
                    {
                        new Dynatrace.Inputs.CalculatedServiceMetricConditionConditionArgs
                        {
                            Attribute = "HTTP_REQUEST_METHOD",
                            Comparison = new Dynatrace.Inputs.CalculatedServiceMetricConditionConditionComparisonArgs
                            {
                                Negate = false,
                                HttpMethod = new Dynatrace.Inputs.CalculatedServiceMetricConditionConditionComparisonHttpMethodArgs
                                {
                                    Operator = "EQUALS_ANY_OF",
                                    Values = new[]
                                    {
                                        "POST",
                                        "GET",
                                    },
                                },
                            },
                        },
                    },
                },
            },
            MetricDefinition = new Dynatrace.Inputs.CalculatedServiceMetricMetricDefinitionArgs
            {
                Metric = "REQUEST_ATTRIBUTE",
                RequestAttribute = "foo",
            },
        });
    
    });
    
    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.CalculatedServiceMetric;
    import com.pulumi.dynatrace.CalculatedServiceMetricArgs;
    import com.pulumi.dynatrace.inputs.CalculatedServiceMetricConditionArgs;
    import com.pulumi.dynatrace.inputs.CalculatedServiceMetricMetricDefinitionArgs;
    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.getManagementZones();
    
            var _name_ = new CalculatedServiceMetric("#name#", CalculatedServiceMetricArgs.builder()
                .enabled(true)
                .managementZones(test.applyValue(getManagementZonesResult -> getManagementZonesResult.values()[0].id()))
                .metricKey("calc:service.#name#")
                .unit("MILLI_SECOND_PER_MINUTE")
                .conditions(CalculatedServiceMetricConditionArgs.builder()
                    .conditions(CalculatedServiceMetricConditionConditionArgs.builder()
                        .attribute("HTTP_REQUEST_METHOD")
                        .comparison(CalculatedServiceMetricConditionConditionComparisonArgs.builder()
                            .negate(false)
                            .httpMethod(CalculatedServiceMetricConditionConditionComparisonHttpMethodArgs.builder()
                                .operator("EQUALS_ANY_OF")
                                .values(                            
                                    "POST",
                                    "GET")
                                .build())
                            .build())
                        .build())
                    .build())
                .metricDefinition(CalculatedServiceMetricMetricDefinitionArgs.builder()
                    .metric("REQUEST_ATTRIBUTE")
                    .requestAttribute("foo")
                    .build())
                .build());
    
        }
    }
    
    resources:
      '#name#':
        type: dynatrace:CalculatedServiceMetric
        properties:
          enabled: true
          managementZones:
            - ${test.values[0].id}
          metricKey: calc:service.#name#
          unit: MILLI_SECOND_PER_MINUTE
          conditions:
            - conditions:
                - attribute: HTTP_REQUEST_METHOD
                  comparison:
                    negate: false
                    httpMethod:
                      operator: EQUALS_ANY_OF
                      values:
                        - POST
                        - GET
          metricDefinition:
            metric: REQUEST_ATTRIBUTE
            requestAttribute: foo
    variables:
      test:
        fn::invoke:
          Function: dynatrace:getManagementZones
          Arguments: {}
    

    Using getManagementZones

    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 getManagementZones(opts?: InvokeOptions): Promise<GetManagementZonesResult>
    function getManagementZonesOutput(opts?: InvokeOptions): Output<GetManagementZonesResult>
    def get_management_zones(opts: Optional[InvokeOptions] = None) -> GetManagementZonesResult
    def get_management_zones_output(opts: Optional[InvokeOptions] = None) -> Output[GetManagementZonesResult]
    func GetManagementZones(ctx *Context, opts ...InvokeOption) (*GetManagementZonesResult, error)
    func GetManagementZonesOutput(ctx *Context, opts ...InvokeOption) GetManagementZonesResultOutput

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

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

    getManagementZones Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Values List<Pulumiverse.Dynatrace.Outputs.GetManagementZonesValue>
    Id string
    The provider-assigned unique ID for this managed resource.
    Values []GetManagementZonesValue
    id String
    The provider-assigned unique ID for this managed resource.
    values List<GetManagementZonesValue>
    id string
    The provider-assigned unique ID for this managed resource.
    values GetManagementZonesValue[]
    id str
    The provider-assigned unique ID for this managed resource.
    values Sequence[GetManagementZonesValue]
    id String
    The provider-assigned unique ID for this managed resource.
    values List<Property Map>

    Supporting Types

    GetManagementZonesValue

    Description string
    The description of the Management Zone
    Id string
    The ID of the Management Zone when referred to as a Settings 2.0 resource (e.g. from within dynatrace.SlackNotification)
    LegacyId string
    The ID of the Management Zone when referred to as a Configuration API resource (e.g. from within dynatrace.Notification)
    Name string
    The name of the Management Zone
    Description string
    The description of the Management Zone
    Id string
    The ID of the Management Zone when referred to as a Settings 2.0 resource (e.g. from within dynatrace.SlackNotification)
    LegacyId string
    The ID of the Management Zone when referred to as a Configuration API resource (e.g. from within dynatrace.Notification)
    Name string
    The name of the Management Zone
    description String
    The description of the Management Zone
    id String
    The ID of the Management Zone when referred to as a Settings 2.0 resource (e.g. from within dynatrace.SlackNotification)
    legacyId String
    The ID of the Management Zone when referred to as a Configuration API resource (e.g. from within dynatrace.Notification)
    name String
    The name of the Management Zone
    description string
    The description of the Management Zone
    id string
    The ID of the Management Zone when referred to as a Settings 2.0 resource (e.g. from within dynatrace.SlackNotification)
    legacyId string
    The ID of the Management Zone when referred to as a Configuration API resource (e.g. from within dynatrace.Notification)
    name string
    The name of the Management Zone
    description str
    The description of the Management Zone
    id str
    The ID of the Management Zone when referred to as a Settings 2.0 resource (e.g. from within dynatrace.SlackNotification)
    legacy_id str
    The ID of the Management Zone when referred to as a Configuration API resource (e.g. from within dynatrace.Notification)
    name str
    The name of the Management Zone
    description String
    The description of the Management Zone
    id String
    The ID of the Management Zone when referred to as a Settings 2.0 resource (e.g. from within dynatrace.SlackNotification)
    legacyId String
    The ID of the Management Zone when referred to as a Configuration API resource (e.g. from within dynatrace.Notification)
    name String
    The name of the Management Zone

    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.16.0 published on Tuesday, Sep 10, 2024 by Pulumiverse