All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.costmanagement.kotlin.ScheduledAction.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.costmanagement.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

/**
 * Builder for [ScheduledAction].
 */
@PulumiTagMarker
public class ScheduledActionResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ScheduledActionArgs = ScheduledActionArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend ScheduledActionArgsBuilder.() -> Unit) {
        val builder = ScheduledActionArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): ScheduledAction {
        val builtJavaResource = com.pulumi.azure.costmanagement.ScheduledAction(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ScheduledAction(builtJavaResource)
    }
}

/**
 * Manages an Azure Cost Management Scheduled Action.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.costmanagement.ScheduledAction("example", {
 *     name: "examplescheduledaction",
 *     displayName: "Report Last 6 Months",
 *     viewId: "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/views/ms:CostByService",
 *     emailAddressSender: "[email protected]",
 *     emailSubject: "Cost Management Report",
 *     emailAddresses: ["example@example.com"],
 *     message: "Hi all, take a look at last 6 months spending!",
 *     frequency: "Daily",
 *     startDate: "2023-01-02T00:00:00Z",
 *     endDate: "2023-02-02T00:00:00Z",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.costmanagement.ScheduledAction("example",
 *     name="examplescheduledaction",
 *     display_name="Report Last 6 Months",
 *     view_id="/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/views/ms:CostByService",
 *     email_address_sender="[email protected]",
 *     email_subject="Cost Management Report",
 *     email_addresses=["example@example.com"],
 *     message="Hi all, take a look at last 6 months spending!",
 *     frequency="Daily",
 *     start_date="2023-01-02T00:00:00Z",
 *     end_date="2023-02-02T00:00:00Z")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.CostManagement.ScheduledAction("example", new()
 *     {
 *         Name = "examplescheduledaction",
 *         DisplayName = "Report Last 6 Months",
 *         ViewId = "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/views/ms:CostByService",
 *         EmailAddressSender = "[email protected]",
 *         EmailSubject = "Cost Management Report",
 *         EmailAddresses = new[]
 *         {
 *             "[email protected]",
 *         },
 *         Message = "Hi all, take a look at last 6 months spending!",
 *         Frequency = "Daily",
 *         StartDate = "2023-01-02T00:00:00Z",
 *         EndDate = "2023-02-02T00:00:00Z",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/costmanagement"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := costmanagement.NewScheduledAction(ctx, "example", &costmanagement.ScheduledActionArgs{
 * 			Name:               pulumi.String("examplescheduledaction"),
 * 			DisplayName:        pulumi.String("Report Last 6 Months"),
 * 			ViewId:             pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/views/ms:CostByService"),
 * 			EmailAddressSender: pulumi.String("[email protected]"),
 * 			EmailSubject:       pulumi.String("Cost Management Report"),
 * 			EmailAddresses: pulumi.StringArray{
 * 				pulumi.String("[email protected]"),
 * 			},
 * 			Message:   pulumi.String("Hi all, take a look at last 6 months spending!"),
 * 			Frequency: pulumi.String("Daily"),
 * 			StartDate: pulumi.String("2023-01-02T00:00:00Z"),
 * 			EndDate:   pulumi.String("2023-02-02T00:00:00Z"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.costmanagement.ScheduledAction;
 * import com.pulumi.azure.costmanagement.ScheduledActionArgs;
 * 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 example = new ScheduledAction("example", ScheduledActionArgs.builder()
 *             .name("examplescheduledaction")
 *             .displayName("Report Last 6 Months")
 *             .viewId("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/views/ms:CostByService")
 *             .emailAddressSender("[email protected]")
 *             .emailSubject("Cost Management Report")
 *             .emailAddresses("[email protected]")
 *             .message("Hi all, take a look at last 6 months spending!")
 *             .frequency("Daily")
 *             .startDate("2023-01-02T00:00:00Z")
 *             .endDate("2023-02-02T00:00:00Z")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:costmanagement:ScheduledAction
 *     properties:
 *       name: examplescheduledaction
 *       displayName: Report Last 6 Months
 *       viewId: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/views/ms:CostByService
 *       emailAddressSender: [email protected]
 *       emailSubject: Cost Management Report
 *       emailAddresses:
 *         - [email protected]
 *       message: Hi all, take a look at last 6 months spending!
 *       frequency: Daily
 *       startDate: 2023-01-02T00:00:00Z
 *       endDate: 2023-02-02T00:00:00Z
 * ```
 * 
 * ## Import
 * Azure Cost Management Scheduled Actions can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:costmanagement/scheduledAction:ScheduledAction example /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/scheduledActions/scheduledaction1
 * ```
 */
public class ScheduledAction internal constructor(
    override val javaResource: com.pulumi.azure.costmanagement.ScheduledAction,
) : KotlinCustomResource(javaResource, ScheduledActionMapper) {
    /**
     * UTC day on which cost analysis data will be emailed. Must be between `1` and `31`. This property is applicable when `frequency` is `Monthly`.
     */
    public val dayOfMonth: Output?
        get() = javaResource.dayOfMonth().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies a list of day names on which cost analysis data will be emailed. This property is applicable when frequency is `Weekly` or `Monthly`. Possible values are `Friday`, `Monday`, `Saturday`, `Sunday`, `Thursday`, `Tuesday` and `Wednesday`.
     */
    public val daysOfWeeks: Output>?
        get() = javaResource.daysOfWeeks().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * User visible input name of the Cost Management Scheduled Action.
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * Email address of the point of contact that should get the unsubscribe requests of Scheduled Action notification emails.
     */
    public val emailAddressSender: Output
        get() = javaResource.emailAddressSender().applyValue({ args0 -> args0 })

    /**
     * Specifies a list of email addresses that will receive the Scheduled Action.
     */
    public val emailAddresses: Output>
        get() = javaResource.emailAddresses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Subject of the email. Length is limited to 70 characters.
     */
    public val emailSubject: Output
        get() = javaResource.emailSubject().applyValue({ args0 -> args0 })

    /**
     * The end date and time of the Scheduled Action (UTC).
     */
    public val endDate: Output
        get() = javaResource.endDate().applyValue({ args0 -> args0 })

    /**
     * Frequency of the schedule. Possible values are `Daily`, `Monthly` and `Weekly`. Value `Monthly` requires either `weeks_of_month` and `days_of_week` or `day_of_month` to be specified. Value `Weekly` requires `days_of_week` to be specified.
     */
    public val frequency: Output
        get() = javaResource.frequency().applyValue({ args0 -> args0 })

    /**
     * UTC time at which cost analysis data will be emailed. Must be between `0` and `23`.
     */
    public val hourOfDay: Output?
        get() = javaResource.hourOfDay().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Message to be added in the email. Length is limited to 250 characters.
     */
    public val message: Output?
        get() = javaResource.message().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name which should be used for this Azure Cost Management Scheduled Action. Changing this forces a new Azure Cost Management Scheduled Action to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The start date and time of the Scheduled Action (UTC).
     */
    public val startDate: Output
        get() = javaResource.startDate().applyValue({ args0 -> args0 })

    /**
     * The ID of the Cost Management View that is used by the Scheduled Action. Changing this forces a new resource to be created.
     */
    public val viewId: Output
        get() = javaResource.viewId().applyValue({ args0 -> args0 })

    /**
     * Specifies a list of weeks in which cost analysis data will be emailed. This property is applicable when `frequency` is `Monthly` and used in combination with `days_of_week`. Possible values are `First`, `Fourth`, `Last`, `Second` and `Third`.
     */
    public val weeksOfMonths: Output>?
        get() = javaResource.weeksOfMonths().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })
}

public object ScheduledActionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.costmanagement.ScheduledAction::class == javaResource::class

    override fun map(javaResource: Resource): ScheduledAction = ScheduledAction(
        javaResource as
            com.pulumi.azure.costmanagement.ScheduledAction,
    )
}

/**
 * @see [ScheduledAction].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [ScheduledAction].
 */
public suspend fun scheduledAction(
    name: String,
    block: suspend ScheduledActionResourceBuilder.() -> Unit,
): ScheduledAction {
    val builder = ScheduledActionResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [ScheduledAction].
 * @param name The _unique_ name of the resulting resource.
 */
public fun scheduledAction(name: String): ScheduledAction {
    val builder = ScheduledActionResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy