dynatrace logo
Dynatrace v0.0.2, Nov 1 22

dynatrace.getManagementZone

The management zone data source allows the management zone ID to be retrieved by its name.

  • name queries for all management zones with the specified name

Example Usage

using System.Collections.Generic;
using Pulumi;
using Dynatrace = Lbrlabs.PulumiPackage.Dynatrace;
using Dynatrace = Pulumi.Dynatrace;

return await Deployment.RunAsync(() => 
{
    var test = Dynatrace.GetManagementZone.Invoke(new()
    {
        Name = "Example",
    });

    var _name_ = new Dynatrace.CalculatedServiceMetric("#name#", new()
    {
        Conditions = new[]
        {
            new Dynatrace.Inputs.CalculatedServiceMetricConditionArgs
            {
                Conditions = new[]
                {
                    new Dynatrace.Inputs.CalculatedServiceMetricConditionConditionArgs
                    {
                        Attribute = "HTTP_REQUEST_METHOD",
                        Comparison = new Dynatrace.Inputs.CalculatedServiceMetricConditionConditionComparisonArgs
                        {
                            HttpMethod = new Dynatrace.Inputs.CalculatedServiceMetricConditionConditionComparisonHttpMethodArgs
                            {
                                Operator = "EQUALS_ANY_OF",
                                Values = new[]
                                {
                                    "POST",
                                    "GET",
                                },
                            },
                            Negate = false,
                        },
                    },
                },
            },
        },
        Enabled = true,
        ManagementZones = new[]
        {
            test.Apply(getManagementZoneResult => getManagementZoneResult.Id),
        },
        MetricDefinition = new Dynatrace.Inputs.CalculatedServiceMetricMetricDefinitionArgs
        {
            Metric = "REQUEST_ATTRIBUTE",
            RequestAttribute = "foo",
        },
        MetricKey = "calc:service.#name#",
        Unit = "MILLI_SECOND_PER_MINUTE",
    });

});
package main

import (
	"github.com/pulumi/pulumi-dynatrace/sdk/go/dynatrace"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		test, err := dynatrace.LookupManagementZone(ctx, &GetManagementZoneArgs{
			Name: "Example",
		}, nil)
		if err != nil {
			return err
		}
		_, err = dynatrace.NewCalculatedServiceMetric(ctx, "#name#", &dynatrace.CalculatedServiceMetricArgs{
			Conditions: CalculatedServiceMetricConditionArray{
				&CalculatedServiceMetricConditionArgs{
					Conditions: CalculatedServiceMetricConditionConditionArray{
						&CalculatedServiceMetricConditionConditionArgs{
							Attribute: pulumi.String("HTTP_REQUEST_METHOD"),
							Comparison: &CalculatedServiceMetricConditionConditionComparisonArgs{
								HttpMethod: &CalculatedServiceMetricConditionConditionComparisonHttpMethodArgs{
									Operator: pulumi.String("EQUALS_ANY_OF"),
									Values: pulumi.StringArray{
										pulumi.String("POST"),
										pulumi.String("GET"),
									},
								},
								Negate: pulumi.Bool(false),
							},
						},
					},
				},
			},
			Enabled: pulumi.Bool(true),
			ManagementZones: pulumi.StringArray{
				pulumi.String(test.Id),
			},
			MetricDefinition: &CalculatedServiceMetricMetricDefinitionArgs{
				Metric:           pulumi.String("REQUEST_ATTRIBUTE"),
				RequestAttribute: pulumi.String("foo"),
			},
			MetricKey: pulumi.String("calc:service.#name#"),
			Unit:      pulumi.String("MILLI_SECOND_PER_MINUTE"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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.GetManagementZoneArgs;
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.getManagementZone(GetManagementZoneArgs.builder()
            .name("Example")
            .build());

        var _name_ = new CalculatedServiceMetric("#name#", CalculatedServiceMetricArgs.builder()        
            .conditions(CalculatedServiceMetricConditionArgs.builder()
                .conditions(CalculatedServiceMetricConditionConditionArgs.builder()
                    .attribute("HTTP_REQUEST_METHOD")
                    .comparison(CalculatedServiceMetricConditionConditionComparisonArgs.builder()
                        .httpMethod(CalculatedServiceMetricConditionConditionComparisonHttpMethodArgs.builder()
                            .operator("EQUALS_ANY_OF")
                            .values(                            
                                "POST",
                                "GET")
                            .build())
                        .negate(false)
                        .build())
                    .build())
                .build())
            .enabled(true)
            .managementZones(test.applyValue(getManagementZoneResult -> getManagementZoneResult.id()))
            .metricDefinition(CalculatedServiceMetricMetricDefinitionArgs.builder()
                .metric("REQUEST_ATTRIBUTE")
                .requestAttribute("foo")
                .build())
            .metricKey("calc:service.#name#")
            .unit("MILLI_SECOND_PER_MINUTE")
            .build());

    }
}
import pulumi
import lbrlabs_pulumi_dynatrace as dynatrace
import pulumi_dynatrace as dynatrace

test = dynatrace.get_management_zone(name="Example")
_name_ = dynatrace.CalculatedServiceMetric("#name#",
    conditions=[dynatrace.CalculatedServiceMetricConditionArgs(
        conditions=[dynatrace.CalculatedServiceMetricConditionConditionArgs(
            attribute="HTTP_REQUEST_METHOD",
            comparison=dynatrace.CalculatedServiceMetricConditionConditionComparisonArgs(
                http_method=dynatrace.CalculatedServiceMetricConditionConditionComparisonHttpMethodArgs(
                    operator="EQUALS_ANY_OF",
                    values=[
                        "POST",
                        "GET",
                    ],
                ),
                negate=False,
            ),
        )],
    )],
    enabled=True,
    management_zones=[test.id],
    metric_definition=dynatrace.CalculatedServiceMetricMetricDefinitionArgs(
        metric="REQUEST_ATTRIBUTE",
        request_attribute="foo",
    ),
    metric_key="calc:service.#name#",
    unit="MILLI_SECOND_PER_MINUTE")
import * as pulumi from "@pulumi/pulumi";
import * as dynatrace from "@pulumi/dynatrace";

const test = pulumi.output(dynatrace.getManagementZone({
    name: "Example",
}));
const _name_ = new dynatrace.CalculatedServiceMetric("#name#", {
    conditions: [{
        conditions: [{
            attribute: "HTTP_REQUEST_METHOD",
            comparison: {
                httpMethod: {
                    operator: "EQUALS_ANY_OF",
                    values: [
                        "POST",
                        "GET",
                    ],
                },
                negate: false,
            },
        }],
    }],
    enabled: true,
    managementZones: [test.id],
    metricDefinition: {
        metric: "REQUEST_ATTRIBUTE",
        requestAttribute: "foo",
    },
    metricKey: "calc:service.#name#",
    unit: "MILLI_SECOND_PER_MINUTE",
});
resources:
  '#name#':
    type: dynatrace:CalculatedServiceMetric
    properties:
      conditions:
        - conditions:
            - attribute: HTTP_REQUEST_METHOD
              comparison:
                httpMethod:
                  operator: EQUALS_ANY_OF
                  values:
                    - POST
                    - GET
                negate: false
      enabled: true
      managementZones:
        - ${test.id}
      metricDefinition:
        metric: REQUEST_ATTRIBUTE
        requestAttribute: foo
      metricKey: calc:service.#name#
      unit: MILLI_SECOND_PER_MINUTE
variables:
  test:
    fn::invoke:
      Function: dynatrace:getManagementZone
      Arguments:
        name: Example

Using getManagementZone

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 getManagementZone(args: GetManagementZoneArgs, opts?: InvokeOptions): Promise<GetManagementZoneResult>
function getManagementZoneOutput(args: GetManagementZoneOutputArgs, opts?: InvokeOptions): Output<GetManagementZoneResult>
def get_management_zone(name: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetManagementZoneResult
def get_management_zone_output(name: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetManagementZoneResult]
func LookupManagementZone(ctx *Context, args *LookupManagementZoneArgs, opts ...InvokeOption) (*LookupManagementZoneResult, error)
func LookupManagementZoneOutput(ctx *Context, args *LookupManagementZoneOutputArgs, opts ...InvokeOption) LookupManagementZoneResultOutput

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

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

The following arguments are supported:

Name string
Name string
name String
name string
name str
name String

getManagementZone Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Name string
Id string

The provider-assigned unique ID for this managed resource.

Name string
id String

The provider-assigned unique ID for this managed resource.

name String
id string

The provider-assigned unique ID for this managed resource.

name string
id str

The provider-assigned unique ID for this managed resource.

name str
id String

The provider-assigned unique ID for this managed resource.

name String

Package Details

Repository
dynatrace lbrlabs/pulumi-dynatrace
License
Apache-2.0
Notes

This Pulumi package is based on the dynatrace Terraform Provider.