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

dynatrace.getManagementZone

Explore with Pulumi AI

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

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

    This data source requires the API token scope Read configuration (ReadConfig)

    !> This data source is utilizing an older API endpoint, please use dynatrace.ManagementZoneV2 instead.

    • name queries for all management zones with the specified name

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as dynatrace from "@pulumi/dynatrace";
    import * as dynatrace from "@pulumiverse/dynatrace";
    
    const test = 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.then(test => test.id)],
        metricDefinition: {
            metric: "REQUEST_ATTRIBUTE",
            requestAttribute: "foo",
        },
        metricKey: "calc:service.#name#",
        unit: "MILLI_SECOND_PER_MINUTE",
    });
    
    import pulumi
    import pulumi_dynatrace as dynatrace
    import pulumiverse_dynatrace as dynatrace
    
    test = dynatrace.get_management_zone(name="Example")
    _name_ = dynatrace.CalculatedServiceMetric("#name#",
        conditions=[{
            "conditions": [{
                "attribute": "HTTP_REQUEST_METHOD",
                "comparison": {
                    "http_method": {
                        "operator": "EQUALS_ANY_OF",
                        "values": [
                            "POST",
                            "GET",
                        ],
                    },
                    "negate": False,
                },
            }],
        }],
        enabled=True,
        management_zones=[test.id],
        metric_definition={
            "metric": "REQUEST_ATTRIBUTE",
            "request_attribute": "foo",
        },
        metric_key="calc:service.#name#",
        unit="MILLI_SECOND_PER_MINUTE")
    
    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.LookupManagementZone(ctx, &dynatrace.LookupManagementZoneArgs{
    			Name: "Example",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = dynatrace.NewCalculatedServiceMetric(ctx, "#name#", &dynatrace.CalculatedServiceMetricArgs{
    			Conditions: dynatrace.CalculatedServiceMetricConditionArray{
    				&dynatrace.CalculatedServiceMetricConditionArgs{
    					Conditions: dynatrace.CalculatedServiceMetricConditionConditionArray{
    						&dynatrace.CalculatedServiceMetricConditionConditionArgs{
    							Attribute: pulumi.String("HTTP_REQUEST_METHOD"),
    							Comparison: &dynatrace.CalculatedServiceMetricConditionConditionComparisonArgs{
    								HttpMethod: &dynatrace.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: &dynatrace.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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Dynatrace = Pulumi.Dynatrace;
    using Dynatrace = Pulumiverse.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 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());
    
        }
    }
    
    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.
    LegacyId string
    Name string
    Settings20Id string
    Id string
    The provider-assigned unique ID for this managed resource.
    LegacyId string
    Name string
    Settings20Id string
    id String
    The provider-assigned unique ID for this managed resource.
    legacyId String
    name String
    settings20Id String
    id string
    The provider-assigned unique ID for this managed resource.
    legacyId string
    name string
    settings20Id string
    id str
    The provider-assigned unique ID for this managed resource.
    legacy_id str
    name str
    settings20_id str
    id String
    The provider-assigned unique ID for this managed resource.
    legacyId String
    name String
    settings20Id String

    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