1. Packages
  2. Dynatrace
  3. API Docs
  4. getPlatformSloTemplate
Dynatrace v0.28.0 published on Sunday, May 11, 2025 by Pulumiverse

dynatrace.getPlatformSloTemplate

Explore with Pulumi AI

dynatrace logo
Dynatrace v0.28.0 published on Sunday, May 11, 2025 by Pulumiverse

    To utilize this data source, please define the environment variables DT_CLIENT_ID, DT_CLIENT_SECRET, DT_ACCOUNT_ID with an OAuth client including the following permissions: View SLOs (slo:slos:read) and View SLO objective templates (slo:objective-templates:read).

    The SLO objective template data source allows the ID to be retrieved by its name.

    • name (String) Name of the SLO objective template

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as dynatrace from "@pulumi/dynatrace";
    import * as dynatrace from "@pulumiverse/dynatrace";
    
    const hostCPU = dynatrace.getPlatformSloTemplate({
        name: "Host CPU usage utilization",
    });
    const _name_ = new dynatrace.PlatformSlo("#name#", {
        description: "Measures the CPU usage of selected hosts over time.",
        criteria: {
            criteriaDetails: [{
                target: 95,
                timeframeFrom: "now-7d",
                timeframeTo: "now",
            }],
        },
        sliReference: {
            templateId: hostCPU.then(hostCPU => hostCPU.id),
            variables: {
                sliReferenceVariables: [{
                    name: "hosts",
                    value: "\"HOST-1234567890000000\"",
                }],
            },
        },
    });
    
    import pulumi
    import pulumi_dynatrace as dynatrace
    import pulumiverse_dynatrace as dynatrace
    
    host_cpu = dynatrace.get_platform_slo_template(name="Host CPU usage utilization")
    _name_ = dynatrace.PlatformSlo("#name#",
        description="Measures the CPU usage of selected hosts over time.",
        criteria={
            "criteria_details": [{
                "target": 95,
                "timeframe_from": "now-7d",
                "timeframe_to": "now",
            }],
        },
        sli_reference={
            "template_id": host_cpu.id,
            "variables": {
                "sli_reference_variables": [{
                    "name": "hosts",
                    "value": "\"HOST-1234567890000000\"",
                }],
            },
        })
    
    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 {
    		hostCPU, err := dynatrace.GetPlatformSloTemplate(ctx, &dynatrace.GetPlatformSloTemplateArgs{
    			Name: "Host CPU usage utilization",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = dynatrace.NewPlatformSlo(ctx, "#name#", &dynatrace.PlatformSloArgs{
    			Description: pulumi.String("Measures the CPU usage of selected hosts over time."),
    			Criteria: &dynatrace.PlatformSloCriteriaArgs{
    				CriteriaDetails: dynatrace.PlatformSloCriteriaCriteriaDetailArray{
    					&dynatrace.PlatformSloCriteriaCriteriaDetailArgs{
    						Target:        pulumi.Float64(95),
    						TimeframeFrom: pulumi.String("now-7d"),
    						TimeframeTo:   pulumi.String("now"),
    					},
    				},
    			},
    			SliReference: &dynatrace.PlatformSloSliReferenceArgs{
    				TemplateId: pulumi.String(hostCPU.Id),
    				Variables: &dynatrace.PlatformSloSliReferenceVariablesArgs{
    					SliReferenceVariables: dynatrace.PlatformSloSliReferenceVariablesSliReferenceVariableArray{
    						&dynatrace.PlatformSloSliReferenceVariablesSliReferenceVariableArgs{
    							Name:  pulumi.String("hosts"),
    							Value: pulumi.String("\"HOST-1234567890000000\""),
    						},
    					},
    				},
    			},
    		})
    		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 hostCPU = Dynatrace.GetPlatformSloTemplate.Invoke(new()
        {
            Name = "Host CPU usage utilization",
        });
    
        var _name_ = new Dynatrace.PlatformSlo("#name#", new()
        {
            Description = "Measures the CPU usage of selected hosts over time.",
            Criteria = new Dynatrace.Inputs.PlatformSloCriteriaArgs
            {
                CriteriaDetails = new[]
                {
                    new Dynatrace.Inputs.PlatformSloCriteriaCriteriaDetailArgs
                    {
                        Target = 95,
                        TimeframeFrom = "now-7d",
                        TimeframeTo = "now",
                    },
                },
            },
            SliReference = new Dynatrace.Inputs.PlatformSloSliReferenceArgs
            {
                TemplateId = hostCPU.Apply(getPlatformSloTemplateResult => getPlatformSloTemplateResult.Id),
                Variables = new Dynatrace.Inputs.PlatformSloSliReferenceVariablesArgs
                {
                    SliReferenceVariables = new[]
                    {
                        new Dynatrace.Inputs.PlatformSloSliReferenceVariablesSliReferenceVariableArgs
                        {
                            Name = "hosts",
                            Value = "\"HOST-1234567890000000\"",
                        },
                    },
                },
            },
        });
    
    });
    
    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.GetPlatformSloTemplateArgs;
    import com.pulumi.dynatrace.PlatformSlo;
    import com.pulumi.dynatrace.PlatformSloArgs;
    import com.pulumi.dynatrace.inputs.PlatformSloCriteriaArgs;
    import com.pulumi.dynatrace.inputs.PlatformSloSliReferenceArgs;
    import com.pulumi.dynatrace.inputs.PlatformSloSliReferenceVariablesArgs;
    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 hostCPU = DynatraceFunctions.getPlatformSloTemplate(GetPlatformSloTemplateArgs.builder()
                .name("Host CPU usage utilization")
                .build());
    
            var _name_ = new PlatformSlo("#name#", PlatformSloArgs.builder()
                .description("Measures the CPU usage of selected hosts over time.")
                .criteria(PlatformSloCriteriaArgs.builder()
                    .criteriaDetails(PlatformSloCriteriaCriteriaDetailArgs.builder()
                        .target(95.0)
                        .timeframeFrom("now-7d")
                        .timeframeTo("now")
                        .build())
                    .build())
                .sliReference(PlatformSloSliReferenceArgs.builder()
                    .templateId(hostCPU.id())
                    .variables(PlatformSloSliReferenceVariablesArgs.builder()
                        .sliReferenceVariables(PlatformSloSliReferenceVariablesSliReferenceVariableArgs.builder()
                            .name("hosts")
                            .value("\"HOST-1234567890000000\"")
                            .build())
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      '#name#':
        type: dynatrace:PlatformSlo
        properties:
          description: Measures the CPU usage of selected hosts over time.
          criteria:
            criteriaDetails:
              - target: 95
                timeframeFrom: now-7d
                timeframeTo: now
          sliReference:
            templateId: ${hostCPU.id}
            variables:
              sliReferenceVariables:
                - name: hosts
                  value: '"HOST-1234567890000000"'
    variables:
      hostCPU:
        fn::invoke:
          function: dynatrace:getPlatformSloTemplate
          arguments:
            name: Host CPU usage utilization
    

    Using getPlatformSloTemplate

    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 getPlatformSloTemplate(args: GetPlatformSloTemplateArgs, opts?: InvokeOptions): Promise<GetPlatformSloTemplateResult>
    function getPlatformSloTemplateOutput(args: GetPlatformSloTemplateOutputArgs, opts?: InvokeOptions): Output<GetPlatformSloTemplateResult>
    def get_platform_slo_template(name: Optional[str] = None,
                                  opts: Optional[InvokeOptions] = None) -> GetPlatformSloTemplateResult
    def get_platform_slo_template_output(name: Optional[pulumi.Input[str]] = None,
                                  opts: Optional[InvokeOptions] = None) -> Output[GetPlatformSloTemplateResult]
    func GetPlatformSloTemplate(ctx *Context, args *GetPlatformSloTemplateArgs, opts ...InvokeOption) (*GetPlatformSloTemplateResult, error)
    func GetPlatformSloTemplateOutput(ctx *Context, args *GetPlatformSloTemplateOutputArgs, opts ...InvokeOption) GetPlatformSloTemplateResultOutput

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

    public static class GetPlatformSloTemplate 
    {
        public static Task<GetPlatformSloTemplateResult> InvokeAsync(GetPlatformSloTemplateArgs args, InvokeOptions? opts = null)
        public static Output<GetPlatformSloTemplateResult> Invoke(GetPlatformSloTemplateInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPlatformSloTemplateResult> getPlatformSloTemplate(GetPlatformSloTemplateArgs args, InvokeOptions options)
    public static Output<GetPlatformSloTemplateResult> getPlatformSloTemplate(GetPlatformSloTemplateArgs args, InvokeOptions options)
    
    fn::invoke:
      function: dynatrace:index/getPlatformSloTemplate:getPlatformSloTemplate
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of the SLO objective template
    Name string
    Name of the SLO objective template
    name String
    Name of the SLO objective template
    name string
    Name of the SLO objective template
    name str
    Name of the SLO objective template
    name String
    Name of the SLO objective template

    getPlatformSloTemplate Result

    The following output properties are available:

    Id string
    ID of the SLO objective template
    Name string
    Name of the SLO objective template
    Id string
    ID of the SLO objective template
    Name string
    Name of the SLO objective template
    id String
    ID of the SLO objective template
    name String
    Name of the SLO objective template
    id string
    ID of the SLO objective template
    name string
    Name of the SLO objective template
    id str
    ID of the SLO objective template
    name str
    Name of the SLO objective template
    id String
    ID of the SLO objective template
    name String
    Name of the SLO objective template

    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.28.0 published on Sunday, May 11, 2025 by Pulumiverse