@pulumi/sumologic
Version:
A Pulumi package for creating and managing sumologic cloud resources.
248 lines • 10.1 kB
JavaScript
"use strict";
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Slo = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides the ability to create, read, delete, and update SLOs.
*
* ## Example SLO
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as sumologic from "@pulumi/sumologic";
*
* const sloTfWindowMetricRatio = new sumologic.Slo("slo_tf_window_metric_ratio", {
* name: "login error rate",
* description: "per minute login error rate over rolling 7 days",
* parentId: "0000000000000001",
* signalType: "Error",
* service: "auth",
* application: "login",
* tags: {
* team: "metrics",
* application: "sumologic",
* },
* compliances: [{
* complianceType: "Rolling",
* size: "7d",
* target: 95,
* timezone: "Asia/Kolkata",
* }],
* indicator: {
* windowBasedEvaluation: {
* op: "LessThan",
* queryType: "Metrics",
* size: "1m",
* threshold: 99,
* queries: [
* {
* queryGroupType: "Unsuccessful",
* queryGroups: [{
* rowId: "A",
* query: "service=auth api=login metric=HTTP_5XX_Count",
* useRowCount: false,
* }],
* },
* {
* queryGroupType: "Total",
* queryGroups: [{
* rowId: "A",
* query: "service=auth api=login metric=TotalRequests",
* useRowCount: false,
* }],
* },
* ],
* },
* },
* });
* const sloTfWindowBased = new sumologic.Slo("slo_tf_window_based", {
* name: "slo-tf-window-based",
* description: "example SLO created with terraform",
* parentId: "0000000000000001",
* signalType: "Latency",
* service: "auth",
* application: "login",
* tags: {
* team: "metrics",
* application: "sumologic",
* },
* compliances: [{
* complianceType: "Rolling",
* size: "7d",
* target: 99,
* timezone: "Asia/Kolkata",
* }],
* indicator: {
* windowBasedEvaluation: {
* op: "LessThan",
* queryType: "Metrics",
* aggregation: "Avg",
* size: "1m",
* threshold: 200,
* queries: [{
* queryGroupType: "Threshold",
* queryGroups: [{
* rowId: "A",
* query: "metric=request_time_p90 service=auth api=login",
* useRowCount: false,
* }],
* }],
* },
* },
* });
* const sloTfRequestBased = new sumologic.Slo("slo_tf_request_based", {
* name: "slo-tf-request-based",
* description: "example SLO created with terraform for request based SLI",
* parentId: tfSloFolder.id,
* signalType: "Latency",
* service: "auth",
* application: "login",
* tags: {
* team: "metrics",
* application: "sumologic",
* },
* compliances: [{
* complianceType: "Rolling",
* size: "7d",
* target: 99,
* timezone: "Asia/Kolkata",
* }],
* indicator: {
* requestBasedEvaluation: {
* op: "LessThanOrEqual",
* queryType: "Logs",
* threshold: 1,
* queries: [{
* queryGroupType: "Threshold",
* queryGroups: [{
* rowId: "A",
* query: ` cluster=sedemostaging namespace=warp004*
* | parse "Coffee preparation request time: * ms" as latency nodrop
* | if(isBlank(latency), "false", "true") as hasLatency
* | where hasLatency = "true"
* | if(isBlank(latency), 0.0, latency) as latency
* | latency/ 1000 as latency_sec
* `,
* useRowCount: false,
* field: "latency_sec",
* }],
* }],
* },
* },
* });
* const sloTfMonitorBased = new sumologic.Slo("slo_tf_monitor_based", {
* name: "slo-tf-monitor-based",
* description: "example of monitor based SLO created with terraform",
* parentId: "0000000000000001",
* signalType: "Error",
* service: "auth",
* application: "login",
* tags: {
* team: "metrics",
* application: "sumologic",
* },
* compliances: [{
* complianceType: "Rolling",
* size: "7d",
* target: 99,
* timezone: "Asia/Kolkata",
* }],
* indicator: {
* monitorBasedEvaluation: {
* monitorTriggers: {
* monitorId: "0000000000BCB3A4",
* triggerTypes: "Critical",
* },
* },
* },
* });
* ```
*/
class Slo extends pulumi.CustomResource {
/**
* Get an existing Slo resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Slo(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Slo. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Slo.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["application"] = state ? state.application : undefined;
resourceInputs["compliances"] = state ? state.compliances : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["createdBy"] = state ? state.createdBy : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["indicator"] = state ? state.indicator : undefined;
resourceInputs["isLocked"] = state ? state.isLocked : undefined;
resourceInputs["isMutable"] = state ? state.isMutable : undefined;
resourceInputs["isSystem"] = state ? state.isSystem : undefined;
resourceInputs["modifiedAt"] = state ? state.modifiedAt : undefined;
resourceInputs["modifiedBy"] = state ? state.modifiedBy : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["parentId"] = state ? state.parentId : undefined;
resourceInputs["postRequestMap"] = state ? state.postRequestMap : undefined;
resourceInputs["service"] = state ? state.service : undefined;
resourceInputs["signalType"] = state ? state.signalType : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["version"] = state ? state.version : undefined;
}
else {
const args = argsOrState;
if ((!args || args.compliances === undefined) && !opts.urn) {
throw new Error("Missing required property 'compliances'");
}
if ((!args || args.indicator === undefined) && !opts.urn) {
throw new Error("Missing required property 'indicator'");
}
if ((!args || args.signalType === undefined) && !opts.urn) {
throw new Error("Missing required property 'signalType'");
}
resourceInputs["application"] = args ? args.application : undefined;
resourceInputs["compliances"] = args ? args.compliances : undefined;
resourceInputs["createdAt"] = args ? args.createdAt : undefined;
resourceInputs["createdBy"] = args ? args.createdBy : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["indicator"] = args ? args.indicator : undefined;
resourceInputs["isLocked"] = args ? args.isLocked : undefined;
resourceInputs["isMutable"] = args ? args.isMutable : undefined;
resourceInputs["isSystem"] = args ? args.isSystem : undefined;
resourceInputs["modifiedAt"] = args ? args.modifiedAt : undefined;
resourceInputs["modifiedBy"] = args ? args.modifiedBy : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["parentId"] = args ? args.parentId : undefined;
resourceInputs["postRequestMap"] = args ? args.postRequestMap : undefined;
resourceInputs["service"] = args ? args.service : undefined;
resourceInputs["signalType"] = args ? args.signalType : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["version"] = args ? args.version : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Slo.__pulumiType, name, resourceInputs, opts);
}
}
exports.Slo = Slo;
/** @internal */
Slo.__pulumiType = 'sumologic:index/slo:Slo';
//# sourceMappingURL=slo.js.map