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

dynatrace.getManagementZoneV2

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 scopes Read settings (settings.read)

    • 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.getManagementZoneV2({
        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.legacyId)],
        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_v2(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.legacy_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.LookupManagementZoneV2(ctx, &dynatrace.LookupManagementZoneV2Args{
    			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.LegacyId),
    			},
    			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.GetManagementZoneV2.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(getManagementZoneV2Result => getManagementZoneV2Result.LegacyId),
            },
            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.GetManagementZoneV2Args;
    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.getManagementZoneV2(GetManagementZoneV2Args.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(getManagementZoneV2Result -> getManagementZoneV2Result.legacyId()))
                .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.legacyId}
          metricDefinition:
            metric: REQUEST_ATTRIBUTE
            requestAttribute: foo
          metricKey: calc:service.#name#
          unit: MILLI_SECOND_PER_MINUTE
    variables:
      test:
        fn::invoke:
          Function: dynatrace:getManagementZoneV2
          Arguments:
            name: Example
    

    Using getManagementZoneV2

    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 getManagementZoneV2(args: GetManagementZoneV2Args, opts?: InvokeOptions): Promise<GetManagementZoneV2Result>
    function getManagementZoneV2Output(args: GetManagementZoneV2OutputArgs, opts?: InvokeOptions): Output<GetManagementZoneV2Result>
    def get_management_zone_v2(name: Optional[str] = None,
                               opts: Optional[InvokeOptions] = None) -> GetManagementZoneV2Result
    def get_management_zone_v2_output(name: Optional[pulumi.Input[str]] = None,
                               opts: Optional[InvokeOptions] = None) -> Output[GetManagementZoneV2Result]
    func LookupManagementZoneV2(ctx *Context, args *LookupManagementZoneV2Args, opts ...InvokeOption) (*LookupManagementZoneV2Result, error)
    func LookupManagementZoneV2Output(ctx *Context, args *LookupManagementZoneV2OutputArgs, opts ...InvokeOption) LookupManagementZoneV2ResultOutput

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

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

    The following arguments are supported:

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

    getManagementZoneV2 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