UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

139 lines 4.99 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Schedule = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a k6 schedule for automated test execution. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * const scheduleProject = new grafana.k6.Project("schedule_project", {name: "Terraform Schedule Resource Project"}); * const scheduledTest = new grafana.k6.LoadTest("scheduled_test", { * projectId: scheduleProject.id, * name: "Terraform Scheduled Resource Test", * script: `export default function() { * console.log('Hello from scheduled k6 test!'); * } * `, * }, { * dependsOn: [scheduleProject], * }); * const cronMonthly = new grafana.k6.Schedule("cron_monthly", { * loadTestId: scheduledTest.id, * starts: "2024-12-25T10:00:00Z", * cron: { * schedule: "0 10 1 * *", * timezone: "UTC", * }, * }); * const daily = new grafana.k6.Schedule("daily", { * loadTestId: scheduledTest.id, * starts: "2024-12-25T10:00:00Z", * recurrenceRule: { * frequency: "DAILY", * interval: 1, * }, * }); * const weekly = new grafana.k6.Schedule("weekly", { * loadTestId: scheduledTest.id, * starts: "2024-12-25T09:00:00Z", * recurrenceRule: { * frequency: "WEEKLY", * interval: 1, * bydays: [ * "MO", * "WE", * "FR", * ], * }, * }); * // Example with YEARLY frequency and count * const yearly = new grafana.k6.Schedule("yearly", { * loadTestId: scheduledTest.id, * starts: "2024-01-01T12:00:00Z", * recurrenceRule: { * frequency: "YEARLY", * interval: 1, * count: 5, * }, * }); * // One-time schedule without recurrence * const oneTime = new grafana.k6.Schedule("one_time", { * loadTestId: scheduledTest.id, * starts: "2024-12-25T15:00:00Z", * }); * ``` * * ## Import * * ```sh * terraform import grafana_k6_schedule.name "{{ load_test_id }}" * ``` */ class Schedule extends pulumi.CustomResource { /** * Get an existing Schedule 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 Schedule(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Schedule. 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'] === Schedule.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createdBy"] = state?.createdBy; resourceInputs["cron"] = state?.cron; resourceInputs["deactivated"] = state?.deactivated; resourceInputs["loadTestId"] = state?.loadTestId; resourceInputs["nextRun"] = state?.nextRun; resourceInputs["recurrenceRule"] = state?.recurrenceRule; resourceInputs["starts"] = state?.starts; } else { const args = argsOrState; if (args?.loadTestId === undefined && !opts.urn) { throw new Error("Missing required property 'loadTestId'"); } if (args?.starts === undefined && !opts.urn) { throw new Error("Missing required property 'starts'"); } resourceInputs["cron"] = args?.cron; resourceInputs["loadTestId"] = args?.loadTestId; resourceInputs["recurrenceRule"] = args?.recurrenceRule; resourceInputs["starts"] = args?.starts; resourceInputs["createdBy"] = undefined /*out*/; resourceInputs["deactivated"] = undefined /*out*/; resourceInputs["nextRun"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Schedule.__pulumiType, name, resourceInputs, opts); } } exports.Schedule = Schedule; /** @internal */ Schedule.__pulumiType = 'grafana:k6/schedule:Schedule'; //# sourceMappingURL=schedule.js.map