1. Packages
  2. New Relic
  3. API Docs
  4. ServiceLevel
New Relic v5.23.1 published on Friday, Apr 26, 2024 by Pulumi

newrelic.ServiceLevel

Explore with Pulumi AI

newrelic logo
New Relic v5.23.1 published on Friday, Apr 26, 2024 by Pulumi

    Use this resource to create, update, and delete New Relic Service Level Indicators and Objectives.

    A New Relic User API key is required to provision this resource. Set the api_key attribute in the provider block or the NEW_RELIC_API_KEY environment variable with your User API key.

    Important:

    • Only roles that provide permissions to create events to metric rules can create SLI/SLOs.
    • Only Full users can view SLI/SLOs.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const foo = new newrelic.ServiceLevel("foo", {
        guid: "MXxBUE18QVBQTElDQVRJT058MQ",
        name: "Latency",
        description: "Proportion of requests that are served faster than a threshold.",
        events: {
            accountId: 12345678,
            validEvents: {
                from: "Transaction",
                where: "appName = 'Example application' AND (transactionType='Web')",
            },
            goodEvents: {
                from: "Transaction",
                where: "appName = 'Example application' AND (transactionType= 'Web') AND duration < 0.1",
            },
        },
        objective: {
            target: 99,
            timeWindow: {
                rolling: {
                    count: 7,
                    unit: "DAY",
                },
            },
        },
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    foo = newrelic.ServiceLevel("foo",
        guid="MXxBUE18QVBQTElDQVRJT058MQ",
        name="Latency",
        description="Proportion of requests that are served faster than a threshold.",
        events=newrelic.ServiceLevelEventsArgs(
            account_id=12345678,
            valid_events=newrelic.ServiceLevelEventsValidEventsArgs(
                from_="Transaction",
                where="appName = 'Example application' AND (transactionType='Web')",
            ),
            good_events=newrelic.ServiceLevelEventsGoodEventsArgs(
                from_="Transaction",
                where="appName = 'Example application' AND (transactionType= 'Web') AND duration < 0.1",
            ),
        ),
        objective=newrelic.ServiceLevelObjectiveArgs(
            target=99,
            time_window=newrelic.ServiceLevelObjectiveTimeWindowArgs(
                rolling=newrelic.ServiceLevelObjectiveTimeWindowRollingArgs(
                    count=7,
                    unit="DAY",
                ),
            ),
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := newrelic.NewServiceLevel(ctx, "foo", &newrelic.ServiceLevelArgs{
    			Guid:        pulumi.String("MXxBUE18QVBQTElDQVRJT058MQ"),
    			Name:        pulumi.String("Latency"),
    			Description: pulumi.String("Proportion of requests that are served faster than a threshold."),
    			Events: &newrelic.ServiceLevelEventsArgs{
    				AccountId: pulumi.Int(12345678),
    				ValidEvents: &newrelic.ServiceLevelEventsValidEventsArgs{
    					From:  pulumi.String("Transaction"),
    					Where: pulumi.String("appName = 'Example application' AND (transactionType='Web')"),
    				},
    				GoodEvents: &newrelic.ServiceLevelEventsGoodEventsArgs{
    					From:  pulumi.String("Transaction"),
    					Where: pulumi.String("appName = 'Example application' AND (transactionType= 'Web') AND duration < 0.1"),
    				},
    			},
    			Objective: &newrelic.ServiceLevelObjectiveArgs{
    				Target: pulumi.Float64(99),
    				TimeWindow: &newrelic.ServiceLevelObjectiveTimeWindowArgs{
    					Rolling: &newrelic.ServiceLevelObjectiveTimeWindowRollingArgs{
    						Count: pulumi.Int(7),
    						Unit:  pulumi.String("DAY"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = new NewRelic.ServiceLevel("foo", new()
        {
            Guid = "MXxBUE18QVBQTElDQVRJT058MQ",
            Name = "Latency",
            Description = "Proportion of requests that are served faster than a threshold.",
            Events = new NewRelic.Inputs.ServiceLevelEventsArgs
            {
                AccountId = 12345678,
                ValidEvents = new NewRelic.Inputs.ServiceLevelEventsValidEventsArgs
                {
                    From = "Transaction",
                    Where = "appName = 'Example application' AND (transactionType='Web')",
                },
                GoodEvents = new NewRelic.Inputs.ServiceLevelEventsGoodEventsArgs
                {
                    From = "Transaction",
                    Where = "appName = 'Example application' AND (transactionType= 'Web') AND duration < 0.1",
                },
            },
            Objective = new NewRelic.Inputs.ServiceLevelObjectiveArgs
            {
                Target = 99,
                TimeWindow = new NewRelic.Inputs.ServiceLevelObjectiveTimeWindowArgs
                {
                    Rolling = new NewRelic.Inputs.ServiceLevelObjectiveTimeWindowRollingArgs
                    {
                        Count = 7,
                        Unit = "DAY",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.ServiceLevel;
    import com.pulumi.newrelic.ServiceLevelArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelEventsArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelEventsValidEventsArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelEventsGoodEventsArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelObjectiveArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelObjectiveTimeWindowArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelObjectiveTimeWindowRollingArgs;
    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) {
            var foo = new ServiceLevel("foo", ServiceLevelArgs.builder()        
                .guid("MXxBUE18QVBQTElDQVRJT058MQ")
                .name("Latency")
                .description("Proportion of requests that are served faster than a threshold.")
                .events(ServiceLevelEventsArgs.builder()
                    .accountId(12345678)
                    .validEvents(ServiceLevelEventsValidEventsArgs.builder()
                        .from("Transaction")
                        .where("appName = 'Example application' AND (transactionType='Web')")
                        .build())
                    .goodEvents(ServiceLevelEventsGoodEventsArgs.builder()
                        .from("Transaction")
                        .where("appName = 'Example application' AND (transactionType= 'Web') AND duration < 0.1")
                        .build())
                    .build())
                .objective(ServiceLevelObjectiveArgs.builder()
                    .target(99)
                    .timeWindow(ServiceLevelObjectiveTimeWindowArgs.builder()
                        .rolling(ServiceLevelObjectiveTimeWindowRollingArgs.builder()
                            .count(7)
                            .unit("DAY")
                            .build())
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      foo:
        type: newrelic:ServiceLevel
        properties:
          guid: MXxBUE18QVBQTElDQVRJT058MQ
          name: Latency
          description: Proportion of requests that are served faster than a threshold.
          events:
            accountId: 1.2345678e+07
            validEvents:
              from: Transaction
              where: appName = 'Example application' AND (transactionType='Web')
            goodEvents:
              from: Transaction
              where: appName = 'Example application' AND (transactionType= 'Web') AND duration < 0.1
          objective:
            target: 99
            timeWindow:
              rolling:
                count: 7
                unit: DAY
    

    Additional Example

    Service level with tags:

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const mySyntheticMonitorServiceLevel = new newrelic.ServiceLevel("my_synthetic_monitor_service_level", {
        guid: "MXxBUE18QVBQTElDQVRJT058MQ",
        name: "My synthethic monitor - Success",
        description: "Proportion of successful synthetic checks.",
        events: {
            accountId: 12345678,
            validEvents: {
                from: "SyntheticCheck",
                where: "entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ'",
            },
            goodEvents: {
                from: "SyntheticCheck",
                where: "entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ' AND result='SUCCESS'",
            },
        },
        objective: {
            target: 99,
            timeWindow: {
                rolling: {
                    count: 7,
                    unit: "DAY",
                },
            },
        },
    });
    const mySyntheticMonitorServiceLevelTags = new newrelic.EntityTags("my_synthetic_monitor_service_level_tags", {
        guid: mySyntheticMonitorServiceLevel.sliGuid,
        tags: [
            {
                key: "user_journey",
                values: [
                    "authentication",
                    "sso",
                ],
            },
            {
                key: "owner",
                values: ["identityTeam"],
            },
        ],
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    my_synthetic_monitor_service_level = newrelic.ServiceLevel("my_synthetic_monitor_service_level",
        guid="MXxBUE18QVBQTElDQVRJT058MQ",
        name="My synthethic monitor - Success",
        description="Proportion of successful synthetic checks.",
        events=newrelic.ServiceLevelEventsArgs(
            account_id=12345678,
            valid_events=newrelic.ServiceLevelEventsValidEventsArgs(
                from_="SyntheticCheck",
                where="entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ'",
            ),
            good_events=newrelic.ServiceLevelEventsGoodEventsArgs(
                from_="SyntheticCheck",
                where="entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ' AND result='SUCCESS'",
            ),
        ),
        objective=newrelic.ServiceLevelObjectiveArgs(
            target=99,
            time_window=newrelic.ServiceLevelObjectiveTimeWindowArgs(
                rolling=newrelic.ServiceLevelObjectiveTimeWindowRollingArgs(
                    count=7,
                    unit="DAY",
                ),
            ),
        ))
    my_synthetic_monitor_service_level_tags = newrelic.EntityTags("my_synthetic_monitor_service_level_tags",
        guid=my_synthetic_monitor_service_level.sli_guid,
        tags=[
            newrelic.EntityTagsTagArgs(
                key="user_journey",
                values=[
                    "authentication",
                    "sso",
                ],
            ),
            newrelic.EntityTagsTagArgs(
                key="owner",
                values=["identityTeam"],
            ),
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		mySyntheticMonitorServiceLevel, err := newrelic.NewServiceLevel(ctx, "my_synthetic_monitor_service_level", &newrelic.ServiceLevelArgs{
    			Guid:        pulumi.String("MXxBUE18QVBQTElDQVRJT058MQ"),
    			Name:        pulumi.String("My synthethic monitor - Success"),
    			Description: pulumi.String("Proportion of successful synthetic checks."),
    			Events: &newrelic.ServiceLevelEventsArgs{
    				AccountId: pulumi.Int(12345678),
    				ValidEvents: &newrelic.ServiceLevelEventsValidEventsArgs{
    					From:  pulumi.String("SyntheticCheck"),
    					Where: pulumi.String("entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ'"),
    				},
    				GoodEvents: &newrelic.ServiceLevelEventsGoodEventsArgs{
    					From:  pulumi.String("SyntheticCheck"),
    					Where: pulumi.String("entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ' AND result='SUCCESS'"),
    				},
    			},
    			Objective: &newrelic.ServiceLevelObjectiveArgs{
    				Target: pulumi.Float64(99),
    				TimeWindow: &newrelic.ServiceLevelObjectiveTimeWindowArgs{
    					Rolling: &newrelic.ServiceLevelObjectiveTimeWindowRollingArgs{
    						Count: pulumi.Int(7),
    						Unit:  pulumi.String("DAY"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.NewEntityTags(ctx, "my_synthetic_monitor_service_level_tags", &newrelic.EntityTagsArgs{
    			Guid: mySyntheticMonitorServiceLevel.SliGuid,
    			Tags: newrelic.EntityTagsTagArray{
    				&newrelic.EntityTagsTagArgs{
    					Key: pulumi.String("user_journey"),
    					Values: pulumi.StringArray{
    						pulumi.String("authentication"),
    						pulumi.String("sso"),
    					},
    				},
    				&newrelic.EntityTagsTagArgs{
    					Key: pulumi.String("owner"),
    					Values: pulumi.StringArray{
    						pulumi.String("identityTeam"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var mySyntheticMonitorServiceLevel = new NewRelic.ServiceLevel("my_synthetic_monitor_service_level", new()
        {
            Guid = "MXxBUE18QVBQTElDQVRJT058MQ",
            Name = "My synthethic monitor - Success",
            Description = "Proportion of successful synthetic checks.",
            Events = new NewRelic.Inputs.ServiceLevelEventsArgs
            {
                AccountId = 12345678,
                ValidEvents = new NewRelic.Inputs.ServiceLevelEventsValidEventsArgs
                {
                    From = "SyntheticCheck",
                    Where = "entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ'",
                },
                GoodEvents = new NewRelic.Inputs.ServiceLevelEventsGoodEventsArgs
                {
                    From = "SyntheticCheck",
                    Where = "entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ' AND result='SUCCESS'",
                },
            },
            Objective = new NewRelic.Inputs.ServiceLevelObjectiveArgs
            {
                Target = 99,
                TimeWindow = new NewRelic.Inputs.ServiceLevelObjectiveTimeWindowArgs
                {
                    Rolling = new NewRelic.Inputs.ServiceLevelObjectiveTimeWindowRollingArgs
                    {
                        Count = 7,
                        Unit = "DAY",
                    },
                },
            },
        });
    
        var mySyntheticMonitorServiceLevelTags = new NewRelic.EntityTags("my_synthetic_monitor_service_level_tags", new()
        {
            Guid = mySyntheticMonitorServiceLevel.SliGuid,
            Tags = new[]
            {
                new NewRelic.Inputs.EntityTagsTagArgs
                {
                    Key = "user_journey",
                    Values = new[]
                    {
                        "authentication",
                        "sso",
                    },
                },
                new NewRelic.Inputs.EntityTagsTagArgs
                {
                    Key = "owner",
                    Values = new[]
                    {
                        "identityTeam",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.ServiceLevel;
    import com.pulumi.newrelic.ServiceLevelArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelEventsArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelEventsValidEventsArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelEventsGoodEventsArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelObjectiveArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelObjectiveTimeWindowArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelObjectiveTimeWindowRollingArgs;
    import com.pulumi.newrelic.EntityTags;
    import com.pulumi.newrelic.EntityTagsArgs;
    import com.pulumi.newrelic.inputs.EntityTagsTagArgs;
    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) {
            var mySyntheticMonitorServiceLevel = new ServiceLevel("mySyntheticMonitorServiceLevel", ServiceLevelArgs.builder()        
                .guid("MXxBUE18QVBQTElDQVRJT058MQ")
                .name("My synthethic monitor - Success")
                .description("Proportion of successful synthetic checks.")
                .events(ServiceLevelEventsArgs.builder()
                    .accountId(12345678)
                    .validEvents(ServiceLevelEventsValidEventsArgs.builder()
                        .from("SyntheticCheck")
                        .where("entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ'")
                        .build())
                    .goodEvents(ServiceLevelEventsGoodEventsArgs.builder()
                        .from("SyntheticCheck")
                        .where("entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ' AND result='SUCCESS'")
                        .build())
                    .build())
                .objective(ServiceLevelObjectiveArgs.builder()
                    .target(99)
                    .timeWindow(ServiceLevelObjectiveTimeWindowArgs.builder()
                        .rolling(ServiceLevelObjectiveTimeWindowRollingArgs.builder()
                            .count(7)
                            .unit("DAY")
                            .build())
                        .build())
                    .build())
                .build());
    
            var mySyntheticMonitorServiceLevelTags = new EntityTags("mySyntheticMonitorServiceLevelTags", EntityTagsArgs.builder()        
                .guid(mySyntheticMonitorServiceLevel.sliGuid())
                .tags(            
                    EntityTagsTagArgs.builder()
                        .key("user_journey")
                        .values(                    
                            "authentication",
                            "sso")
                        .build(),
                    EntityTagsTagArgs.builder()
                        .key("owner")
                        .values("identityTeam")
                        .build())
                .build());
    
        }
    }
    
    resources:
      mySyntheticMonitorServiceLevel:
        type: newrelic:ServiceLevel
        name: my_synthetic_monitor_service_level
        properties:
          guid: MXxBUE18QVBQTElDQVRJT058MQ
          name: My synthethic monitor - Success
          description: Proportion of successful synthetic checks.
          events:
            accountId: 1.2345678e+07
            validEvents:
              from: SyntheticCheck
              where: entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ'
            goodEvents:
              from: SyntheticCheck
              where: entityGuid = 'MXxBUE18QVBQTElDQVRJT058MQ' AND result='SUCCESS'
          objective:
            target: 99
            timeWindow:
              rolling:
                count: 7
                unit: DAY
      mySyntheticMonitorServiceLevelTags:
        type: newrelic:EntityTags
        name: my_synthetic_monitor_service_level_tags
        properties:
          guid: ${mySyntheticMonitorServiceLevel.sliGuid}
          tags:
            - key: user_journey
              values:
                - authentication
                - sso
            - key: owner
              values:
                - identityTeam
    

    Using select for events

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const mySyntheticMonitorDurationServiceLevel = new newrelic.ServiceLevel("my_synthetic_monitor_duration_service_level", {
        guid: "MXxBUE18QVBQTElDQVRJT058MQ",
        name: "Duration distribution is under 7",
        description: "Monitor created to test concurrent request from terraform",
        events: {
            accountId: 313870,
            validEvents: {
                from: "Metric",
                select: {
                    attribute: "`query.wallClockTime.negative.distribution`",
                    "function": "GET_FIELD",
                },
                where: "metricName = 'query.wallClockTime.negative.distribution'",
            },
            goodEvents: {
                from: "Metric",
                select: {
                    attribute: "`query.wallClockTime.negative.distribution`",
                    "function": "GET_CDF_COUNT",
                    threshold: 7,
                },
                where: "metricName = 'query.wallClockTime.negative.distribution'",
            },
        },
        objective: {
            target: 49,
            timeWindow: {
                rolling: {
                    count: 7,
                    unit: "DAY",
                },
            },
        },
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    my_synthetic_monitor_duration_service_level = newrelic.ServiceLevel("my_synthetic_monitor_duration_service_level",
        guid="MXxBUE18QVBQTElDQVRJT058MQ",
        name="Duration distribution is under 7",
        description="Monitor created to test concurrent request from terraform",
        events=newrelic.ServiceLevelEventsArgs(
            account_id=313870,
            valid_events=newrelic.ServiceLevelEventsValidEventsArgs(
                from_="Metric",
                select=newrelic.ServiceLevelEventsValidEventsSelectArgs(
                    attribute="`query.wallClockTime.negative.distribution`",
                    function="GET_FIELD",
                ),
                where="metricName = 'query.wallClockTime.negative.distribution'",
            ),
            good_events=newrelic.ServiceLevelEventsGoodEventsArgs(
                from_="Metric",
                select=newrelic.ServiceLevelEventsGoodEventsSelectArgs(
                    attribute="`query.wallClockTime.negative.distribution`",
                    function="GET_CDF_COUNT",
                    threshold=7,
                ),
                where="metricName = 'query.wallClockTime.negative.distribution'",
            ),
        ),
        objective=newrelic.ServiceLevelObjectiveArgs(
            target=49,
            time_window=newrelic.ServiceLevelObjectiveTimeWindowArgs(
                rolling=newrelic.ServiceLevelObjectiveTimeWindowRollingArgs(
                    count=7,
                    unit="DAY",
                ),
            ),
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := newrelic.NewServiceLevel(ctx, "my_synthetic_monitor_duration_service_level", &newrelic.ServiceLevelArgs{
    			Guid:        pulumi.String("MXxBUE18QVBQTElDQVRJT058MQ"),
    			Name:        pulumi.String("Duration distribution is under 7"),
    			Description: pulumi.String("Monitor created to test concurrent request from terraform"),
    			Events: &newrelic.ServiceLevelEventsArgs{
    				AccountId: pulumi.Int(313870),
    				ValidEvents: &newrelic.ServiceLevelEventsValidEventsArgs{
    					From: pulumi.String("Metric"),
    					Select: &newrelic.ServiceLevelEventsValidEventsSelectArgs{
    						Attribute: pulumi.String("`query.wallClockTime.negative.distribution`"),
    						Function:  pulumi.String("GET_FIELD"),
    					},
    					Where: pulumi.String("metricName = 'query.wallClockTime.negative.distribution'"),
    				},
    				GoodEvents: &newrelic.ServiceLevelEventsGoodEventsArgs{
    					From: pulumi.String("Metric"),
    					Select: &newrelic.ServiceLevelEventsGoodEventsSelectArgs{
    						Attribute: pulumi.String("`query.wallClockTime.negative.distribution`"),
    						Function:  pulumi.String("GET_CDF_COUNT"),
    						Threshold: pulumi.Float64(7),
    					},
    					Where: pulumi.String("metricName = 'query.wallClockTime.negative.distribution'"),
    				},
    			},
    			Objective: &newrelic.ServiceLevelObjectiveArgs{
    				Target: pulumi.Float64(49),
    				TimeWindow: &newrelic.ServiceLevelObjectiveTimeWindowArgs{
    					Rolling: &newrelic.ServiceLevelObjectiveTimeWindowRollingArgs{
    						Count: pulumi.Int(7),
    						Unit:  pulumi.String("DAY"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var mySyntheticMonitorDurationServiceLevel = new NewRelic.ServiceLevel("my_synthetic_monitor_duration_service_level", new()
        {
            Guid = "MXxBUE18QVBQTElDQVRJT058MQ",
            Name = "Duration distribution is under 7",
            Description = "Monitor created to test concurrent request from terraform",
            Events = new NewRelic.Inputs.ServiceLevelEventsArgs
            {
                AccountId = 313870,
                ValidEvents = new NewRelic.Inputs.ServiceLevelEventsValidEventsArgs
                {
                    From = "Metric",
                    Select = new NewRelic.Inputs.ServiceLevelEventsValidEventsSelectArgs
                    {
                        Attribute = "`query.wallClockTime.negative.distribution`",
                        Function = "GET_FIELD",
                    },
                    Where = "metricName = 'query.wallClockTime.negative.distribution'",
                },
                GoodEvents = new NewRelic.Inputs.ServiceLevelEventsGoodEventsArgs
                {
                    From = "Metric",
                    Select = new NewRelic.Inputs.ServiceLevelEventsGoodEventsSelectArgs
                    {
                        Attribute = "`query.wallClockTime.negative.distribution`",
                        Function = "GET_CDF_COUNT",
                        Threshold = 7,
                    },
                    Where = "metricName = 'query.wallClockTime.negative.distribution'",
                },
            },
            Objective = new NewRelic.Inputs.ServiceLevelObjectiveArgs
            {
                Target = 49,
                TimeWindow = new NewRelic.Inputs.ServiceLevelObjectiveTimeWindowArgs
                {
                    Rolling = new NewRelic.Inputs.ServiceLevelObjectiveTimeWindowRollingArgs
                    {
                        Count = 7,
                        Unit = "DAY",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.ServiceLevel;
    import com.pulumi.newrelic.ServiceLevelArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelEventsArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelEventsValidEventsArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelEventsValidEventsSelectArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelEventsGoodEventsArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelEventsGoodEventsSelectArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelObjectiveArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelObjectiveTimeWindowArgs;
    import com.pulumi.newrelic.inputs.ServiceLevelObjectiveTimeWindowRollingArgs;
    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) {
            var mySyntheticMonitorDurationServiceLevel = new ServiceLevel("mySyntheticMonitorDurationServiceLevel", ServiceLevelArgs.builder()        
                .guid("MXxBUE18QVBQTElDQVRJT058MQ")
                .name("Duration distribution is under 7")
                .description("Monitor created to test concurrent request from terraform")
                .events(ServiceLevelEventsArgs.builder()
                    .accountId(313870)
                    .validEvents(ServiceLevelEventsValidEventsArgs.builder()
                        .from("Metric")
                        .select(ServiceLevelEventsValidEventsSelectArgs.builder()
                            .attribute("`query.wallClockTime.negative.distribution`")
                            .function("GET_FIELD")
                            .build())
                        .where("metricName = 'query.wallClockTime.negative.distribution'")
                        .build())
                    .goodEvents(ServiceLevelEventsGoodEventsArgs.builder()
                        .from("Metric")
                        .select(ServiceLevelEventsGoodEventsSelectArgs.builder()
                            .attribute("`query.wallClockTime.negative.distribution`")
                            .function("GET_CDF_COUNT")
                            .threshold(7)
                            .build())
                        .where("metricName = 'query.wallClockTime.negative.distribution'")
                        .build())
                    .build())
                .objective(ServiceLevelObjectiveArgs.builder()
                    .target(49)
                    .timeWindow(ServiceLevelObjectiveTimeWindowArgs.builder()
                        .rolling(ServiceLevelObjectiveTimeWindowRollingArgs.builder()
                            .count(7)
                            .unit("DAY")
                            .build())
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      mySyntheticMonitorDurationServiceLevel:
        type: newrelic:ServiceLevel
        name: my_synthetic_monitor_duration_service_level
        properties:
          guid: MXxBUE18QVBQTElDQVRJT058MQ
          name: Duration distribution is under 7
          description: Monitor created to test concurrent request from terraform
          events:
            accountId: 313870
            validEvents:
              from: Metric
              select:
                attribute: '`query.wallClockTime.negative.distribution`'
                function: GET_FIELD
              where: metricName = 'query.wallClockTime.negative.distribution'
            goodEvents:
              from: Metric
              select:
                attribute: '`query.wallClockTime.negative.distribution`'
                function: GET_CDF_COUNT
                threshold: 7
              where: metricName = 'query.wallClockTime.negative.distribution'
          objective:
            target: 49
            timeWindow:
              rolling:
                count: 7
                unit: DAY
    

    For up-to-date documentation about the tagging resource, please check newrelic.EntityTags

    Create ServiceLevel Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ServiceLevel(name: string, args: ServiceLevelArgs, opts?: CustomResourceOptions);
    @overload
    def ServiceLevel(resource_name: str,
                     args: ServiceLevelArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServiceLevel(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     events: Optional[ServiceLevelEventsArgs] = None,
                     guid: Optional[str] = None,
                     objective: Optional[ServiceLevelObjectiveArgs] = None,
                     description: Optional[str] = None,
                     name: Optional[str] = None)
    func NewServiceLevel(ctx *Context, name string, args ServiceLevelArgs, opts ...ResourceOption) (*ServiceLevel, error)
    public ServiceLevel(string name, ServiceLevelArgs args, CustomResourceOptions? opts = null)
    public ServiceLevel(String name, ServiceLevelArgs args)
    public ServiceLevel(String name, ServiceLevelArgs args, CustomResourceOptions options)
    
    type: newrelic:ServiceLevel
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ServiceLevelArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ServiceLevelArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ServiceLevelArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceLevelArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceLevelArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var serviceLevelResource = new NewRelic.ServiceLevel("serviceLevelResource", new()
    {
        Events = new NewRelic.Inputs.ServiceLevelEventsArgs
        {
            AccountId = 0,
            ValidEvents = new NewRelic.Inputs.ServiceLevelEventsValidEventsArgs
            {
                From = "string",
                Select = new NewRelic.Inputs.ServiceLevelEventsValidEventsSelectArgs
                {
                    Function = "string",
                    Attribute = "string",
                    Threshold = 0,
                },
                Where = "string",
            },
            BadEvents = new NewRelic.Inputs.ServiceLevelEventsBadEventsArgs
            {
                From = "string",
                Select = new NewRelic.Inputs.ServiceLevelEventsBadEventsSelectArgs
                {
                    Function = "string",
                    Attribute = "string",
                    Threshold = 0,
                },
                Where = "string",
            },
            GoodEvents = new NewRelic.Inputs.ServiceLevelEventsGoodEventsArgs
            {
                From = "string",
                Select = new NewRelic.Inputs.ServiceLevelEventsGoodEventsSelectArgs
                {
                    Function = "string",
                    Attribute = "string",
                    Threshold = 0,
                },
                Where = "string",
            },
        },
        Guid = "string",
        Objective = new NewRelic.Inputs.ServiceLevelObjectiveArgs
        {
            Target = 0,
            TimeWindow = new NewRelic.Inputs.ServiceLevelObjectiveTimeWindowArgs
            {
                Rolling = new NewRelic.Inputs.ServiceLevelObjectiveTimeWindowRollingArgs
                {
                    Count = 0,
                    Unit = "string",
                },
            },
            Description = "string",
            Name = "string",
        },
        Description = "string",
        Name = "string",
    });
    
    example, err := newrelic.NewServiceLevel(ctx, "serviceLevelResource", &newrelic.ServiceLevelArgs{
    	Events: &newrelic.ServiceLevelEventsArgs{
    		AccountId: pulumi.Int(0),
    		ValidEvents: &newrelic.ServiceLevelEventsValidEventsArgs{
    			From: pulumi.String("string"),
    			Select: &newrelic.ServiceLevelEventsValidEventsSelectArgs{
    				Function:  pulumi.String("string"),
    				Attribute: pulumi.String("string"),
    				Threshold: pulumi.Float64(0),
    			},
    			Where: pulumi.String("string"),
    		},
    		BadEvents: &newrelic.ServiceLevelEventsBadEventsArgs{
    			From: pulumi.String("string"),
    			Select: &newrelic.ServiceLevelEventsBadEventsSelectArgs{
    				Function:  pulumi.String("string"),
    				Attribute: pulumi.String("string"),
    				Threshold: pulumi.Float64(0),
    			},
    			Where: pulumi.String("string"),
    		},
    		GoodEvents: &newrelic.ServiceLevelEventsGoodEventsArgs{
    			From: pulumi.String("string"),
    			Select: &newrelic.ServiceLevelEventsGoodEventsSelectArgs{
    				Function:  pulumi.String("string"),
    				Attribute: pulumi.String("string"),
    				Threshold: pulumi.Float64(0),
    			},
    			Where: pulumi.String("string"),
    		},
    	},
    	Guid: pulumi.String("string"),
    	Objective: &newrelic.ServiceLevelObjectiveArgs{
    		Target: pulumi.Float64(0),
    		TimeWindow: &newrelic.ServiceLevelObjectiveTimeWindowArgs{
    			Rolling: &newrelic.ServiceLevelObjectiveTimeWindowRollingArgs{
    				Count: pulumi.Int(0),
    				Unit:  pulumi.String("string"),
    			},
    		},
    		Description: pulumi.String("string"),
    		Name:        pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    })
    
    var serviceLevelResource = new ServiceLevel("serviceLevelResource", ServiceLevelArgs.builder()        
        .events(ServiceLevelEventsArgs.builder()
            .accountId(0)
            .validEvents(ServiceLevelEventsValidEventsArgs.builder()
                .from("string")
                .select(ServiceLevelEventsValidEventsSelectArgs.builder()
                    .function("string")
                    .attribute("string")
                    .threshold(0)
                    .build())
                .where("string")
                .build())
            .badEvents(ServiceLevelEventsBadEventsArgs.builder()
                .from("string")
                .select(ServiceLevelEventsBadEventsSelectArgs.builder()
                    .function("string")
                    .attribute("string")
                    .threshold(0)
                    .build())
                .where("string")
                .build())
            .goodEvents(ServiceLevelEventsGoodEventsArgs.builder()
                .from("string")
                .select(ServiceLevelEventsGoodEventsSelectArgs.builder()
                    .function("string")
                    .attribute("string")
                    .threshold(0)
                    .build())
                .where("string")
                .build())
            .build())
        .guid("string")
        .objective(ServiceLevelObjectiveArgs.builder()
            .target(0)
            .timeWindow(ServiceLevelObjectiveTimeWindowArgs.builder()
                .rolling(ServiceLevelObjectiveTimeWindowRollingArgs.builder()
                    .count(0)
                    .unit("string")
                    .build())
                .build())
            .description("string")
            .name("string")
            .build())
        .description("string")
        .name("string")
        .build());
    
    service_level_resource = newrelic.ServiceLevel("serviceLevelResource",
        events=newrelic.ServiceLevelEventsArgs(
            account_id=0,
            valid_events=newrelic.ServiceLevelEventsValidEventsArgs(
                from_="string",
                select=newrelic.ServiceLevelEventsValidEventsSelectArgs(
                    function="string",
                    attribute="string",
                    threshold=0,
                ),
                where="string",
            ),
            bad_events=newrelic.ServiceLevelEventsBadEventsArgs(
                from_="string",
                select=newrelic.ServiceLevelEventsBadEventsSelectArgs(
                    function="string",
                    attribute="string",
                    threshold=0,
                ),
                where="string",
            ),
            good_events=newrelic.ServiceLevelEventsGoodEventsArgs(
                from_="string",
                select=newrelic.ServiceLevelEventsGoodEventsSelectArgs(
                    function="string",
                    attribute="string",
                    threshold=0,
                ),
                where="string",
            ),
        ),
        guid="string",
        objective=newrelic.ServiceLevelObjectiveArgs(
            target=0,
            time_window=newrelic.ServiceLevelObjectiveTimeWindowArgs(
                rolling=newrelic.ServiceLevelObjectiveTimeWindowRollingArgs(
                    count=0,
                    unit="string",
                ),
            ),
            description="string",
            name="string",
        ),
        description="string",
        name="string")
    
    const serviceLevelResource = new newrelic.ServiceLevel("serviceLevelResource", {
        events: {
            accountId: 0,
            validEvents: {
                from: "string",
                select: {
                    "function": "string",
                    attribute: "string",
                    threshold: 0,
                },
                where: "string",
            },
            badEvents: {
                from: "string",
                select: {
                    "function": "string",
                    attribute: "string",
                    threshold: 0,
                },
                where: "string",
            },
            goodEvents: {
                from: "string",
                select: {
                    "function": "string",
                    attribute: "string",
                    threshold: 0,
                },
                where: "string",
            },
        },
        guid: "string",
        objective: {
            target: 0,
            timeWindow: {
                rolling: {
                    count: 0,
                    unit: "string",
                },
            },
            description: "string",
            name: "string",
        },
        description: "string",
        name: "string",
    });
    
    type: newrelic:ServiceLevel
    properties:
        description: string
        events:
            accountId: 0
            badEvents:
                from: string
                select:
                    attribute: string
                    function: string
                    threshold: 0
                where: string
            goodEvents:
                from: string
                select:
                    attribute: string
                    function: string
                    threshold: 0
                where: string
            validEvents:
                from: string
                select:
                    attribute: string
                    function: string
                    threshold: 0
                where: string
        guid: string
        name: string
        objective:
            description: string
            name: string
            target: 0
            timeWindow:
                rolling:
                    count: 0
                    unit: string
    

    ServiceLevel Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ServiceLevel resource accepts the following input properties:

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ServiceLevel resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    SliGuid string
    The unique entity identifier of the Service Level Indicator in New Relic.
    SliId string
    The unique entity identifier of the Service Level Indicator.
    Id string
    The provider-assigned unique ID for this managed resource.
    SliGuid string
    The unique entity identifier of the Service Level Indicator in New Relic.
    SliId string
    The unique entity identifier of the Service Level Indicator.
    id String
    The provider-assigned unique ID for this managed resource.
    sliGuid String
    The unique entity identifier of the Service Level Indicator in New Relic.
    sliId String
    The unique entity identifier of the Service Level Indicator.
    id string
    The provider-assigned unique ID for this managed resource.
    sliGuid string
    The unique entity identifier of the Service Level Indicator in New Relic.
    sliId string
    The unique entity identifier of the Service Level Indicator.
    id str
    The provider-assigned unique ID for this managed resource.
    sli_guid str
    The unique entity identifier of the Service Level Indicator in New Relic.
    sli_id str
    The unique entity identifier of the Service Level Indicator.
    id String
    The provider-assigned unique ID for this managed resource.
    sliGuid String
    The unique entity identifier of the Service Level Indicator in New Relic.
    sliId String
    The unique entity identifier of the Service Level Indicator.

    Look up Existing ServiceLevel Resource

    Get an existing ServiceLevel resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ServiceLevelState, opts?: CustomResourceOptions): ServiceLevel
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            events: Optional[ServiceLevelEventsArgs] = None,
            guid: Optional[str] = None,
            name: Optional[str] = None,
            objective: Optional[ServiceLevelObjectiveArgs] = None,
            sli_guid: Optional[str] = None,
            sli_id: Optional[str] = None) -> ServiceLevel
    func GetServiceLevel(ctx *Context, name string, id IDInput, state *ServiceLevelState, opts ...ResourceOption) (*ServiceLevel, error)
    public static ServiceLevel Get(string name, Input<string> id, ServiceLevelState? state, CustomResourceOptions? opts = null)
    public static ServiceLevel get(String name, Output<String> id, ServiceLevelState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Description string
    Events Pulumi.NewRelic.Inputs.ServiceLevelEvents
    Guid string
    Name string
    Objective Pulumi.NewRelic.Inputs.ServiceLevelObjective
    SliGuid string
    The unique entity identifier of the Service Level Indicator in New Relic.
    SliId string
    The unique entity identifier of the Service Level Indicator.
    Description string
    Events ServiceLevelEventsArgs
    Guid string
    Name string
    Objective ServiceLevelObjectiveArgs
    SliGuid string
    The unique entity identifier of the Service Level Indicator in New Relic.
    SliId string
    The unique entity identifier of the Service Level Indicator.
    description String
    events ServiceLevelEvents
    guid String
    name String
    objective ServiceLevelObjective
    sliGuid String
    The unique entity identifier of the Service Level Indicator in New Relic.
    sliId String
    The unique entity identifier of the Service Level Indicator.
    description string
    events ServiceLevelEvents
    guid string
    name string
    objective ServiceLevelObjective
    sliGuid string
    The unique entity identifier of the Service Level Indicator in New Relic.
    sliId string
    The unique entity identifier of the Service Level Indicator.
    description str
    events ServiceLevelEventsArgs
    guid str
    name str
    objective ServiceLevelObjectiveArgs
    sli_guid str
    The unique entity identifier of the Service Level Indicator in New Relic.
    sli_id str
    The unique entity identifier of the Service Level Indicator.
    description String
    events Property Map
    guid String
    name String
    objective Property Map
    sliGuid String
    The unique entity identifier of the Service Level Indicator in New Relic.
    sliId String
    The unique entity identifier of the Service Level Indicator.

    Supporting Types

    ServiceLevelEvents, ServiceLevelEventsArgs

    ServiceLevelEventsBadEvents, ServiceLevelEventsBadEventsArgs

    ServiceLevelEventsBadEventsSelect, ServiceLevelEventsBadEventsSelectArgs

    Function string
    Attribute string
    Threshold double
    The event threshold to use in the SELECT clause
    Function string
    Attribute string
    Threshold float64
    The event threshold to use in the SELECT clause
    function String
    attribute String
    threshold Double
    The event threshold to use in the SELECT clause
    function string
    attribute string
    threshold number
    The event threshold to use in the SELECT clause
    function str
    attribute str
    threshold float
    The event threshold to use in the SELECT clause
    function String
    attribute String
    threshold Number
    The event threshold to use in the SELECT clause

    ServiceLevelEventsGoodEvents, ServiceLevelEventsGoodEventsArgs

    ServiceLevelEventsGoodEventsSelect, ServiceLevelEventsGoodEventsSelectArgs

    Function string
    Attribute string
    Threshold double
    The event threshold to use in the SELECT clause
    Function string
    Attribute string
    Threshold float64
    The event threshold to use in the SELECT clause
    function String
    attribute String
    threshold Double
    The event threshold to use in the SELECT clause
    function string
    attribute string
    threshold number
    The event threshold to use in the SELECT clause
    function str
    attribute str
    threshold float
    The event threshold to use in the SELECT clause
    function String
    attribute String
    threshold Number
    The event threshold to use in the SELECT clause

    ServiceLevelEventsValidEvents, ServiceLevelEventsValidEventsArgs

    ServiceLevelEventsValidEventsSelect, ServiceLevelEventsValidEventsSelectArgs

    Function string
    Attribute string
    Threshold double
    The event threshold to use in the SELECT clause
    Function string
    Attribute string
    Threshold float64
    The event threshold to use in the SELECT clause
    function String
    attribute String
    threshold Double
    The event threshold to use in the SELECT clause
    function string
    attribute string
    threshold number
    The event threshold to use in the SELECT clause
    function str
    attribute str
    threshold float
    The event threshold to use in the SELECT clause
    function String
    attribute String
    threshold Number
    The event threshold to use in the SELECT clause

    ServiceLevelObjective, ServiceLevelObjectiveArgs

    ServiceLevelObjectiveTimeWindow, ServiceLevelObjectiveTimeWindowArgs

    ServiceLevelObjectiveTimeWindowRolling, ServiceLevelObjectiveTimeWindowRollingArgs

    Count int
    Unit string
    Count int
    Unit string
    count Integer
    unit String
    count number
    unit string
    count int
    unit str
    count Number
    unit String

    Import

    New Relic Service Levels can be imported using a concatenated string of the format

    <account_id>:<sli_id>:<guid>, where the guid is the entity the SLI relates to.

    Example:

    bash

    $ pulumi import newrelic:index/serviceLevel:ServiceLevel foo 12345678:4321:MXxBUE18QVBQTElDQVRJT058MQ
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    New Relic pulumi/pulumi-newrelic
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the newrelic Terraform Provider.
    newrelic logo
    New Relic v5.23.1 published on Friday, Apr 26, 2024 by Pulumi