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

com.pulumi.aws.ec2.kotlin.SpotDatafeedSubscription.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.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.ec2.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.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: SpotDatafeedSubscriptionArgs = SpotDatafeedSubscriptionArgs()

    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 SpotDatafeedSubscriptionArgsBuilder.() -> Unit) {
        val builder = SpotDatafeedSubscriptionArgsBuilder()
        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(): SpotDatafeedSubscription {
        val builtJavaResource = com.pulumi.aws.ec2.SpotDatafeedSubscription(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return SpotDatafeedSubscription(builtJavaResource)
    }
}

/**
 * > **Note:** There is only a single subscription allowed per account.
 * To help you understand the charges for your Spot instances, Amazon EC2 provides a data feed that describes your Spot instance usage and pricing.
 * This data feed is sent to an Amazon S3 bucket that you specify when you subscribe to the data feed.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const _default = new aws.s3.BucketV2("default", {bucket: "tf-spot-datafeed"});
 * const defaultSpotDatafeedSubscription = new aws.ec2.SpotDatafeedSubscription("default", {
 *     bucket: _default.id,
 *     prefix: "my_subdirectory",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * default = aws.s3.BucketV2("default", bucket="tf-spot-datafeed")
 * default_spot_datafeed_subscription = aws.ec2.SpotDatafeedSubscription("default",
 *     bucket=default.id,
 *     prefix="my_subdirectory")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Aws.S3.BucketV2("default", new()
 *     {
 *         Bucket = "tf-spot-datafeed",
 *     });
 *     var defaultSpotDatafeedSubscription = new Aws.Ec2.SpotDatafeedSubscription("default", new()
 *     {
 *         Bucket = @default.Id,
 *         Prefix = "my_subdirectory",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := s3.NewBucketV2(ctx, "default", &s3.BucketV2Args{
 * 			Bucket: pulumi.String("tf-spot-datafeed"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = ec2.NewSpotDatafeedSubscription(ctx, "default", &ec2.SpotDatafeedSubscriptionArgs{
 * 			Bucket: _default.ID(),
 * 			Prefix: pulumi.String("my_subdirectory"),
 * 		})
 * 		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.aws.s3.BucketV2;
 * import com.pulumi.aws.s3.BucketV2Args;
 * import com.pulumi.aws.ec2.SpotDatafeedSubscription;
 * import com.pulumi.aws.ec2.SpotDatafeedSubscriptionArgs;
 * 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 default_ = new BucketV2("default", BucketV2Args.builder()
 *             .bucket("tf-spot-datafeed")
 *             .build());
 *         var defaultSpotDatafeedSubscription = new SpotDatafeedSubscription("defaultSpotDatafeedSubscription", SpotDatafeedSubscriptionArgs.builder()
 *             .bucket(default_.id())
 *             .prefix("my_subdirectory")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: aws:s3:BucketV2
 *     properties:
 *       bucket: tf-spot-datafeed
 *   defaultSpotDatafeedSubscription:
 *     type: aws:ec2:SpotDatafeedSubscription
 *     name: default
 *     properties:
 *       bucket: ${default.id}
 *       prefix: my_subdirectory
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import a Spot Datafeed Subscription using the word `spot-datafeed-subscription`. For example:
 * ```sh
 * $ pulumi import aws:ec2/spotDatafeedSubscription:SpotDatafeedSubscription mysubscription spot-datafeed-subscription
 * ```
 */
public class SpotDatafeedSubscription internal constructor(
    override val javaResource: com.pulumi.aws.ec2.SpotDatafeedSubscription,
) : KotlinCustomResource(javaResource, SpotDatafeedSubscriptionMapper) {
    /**
     * The Amazon S3 bucket in which to store the Spot instance data feed.
     */
    public val bucket: Output
        get() = javaResource.bucket().applyValue({ args0 -> args0 })

    /**
     * Path of folder inside bucket to place spot pricing data.
     */
    public val prefix: Output?
        get() = javaResource.prefix().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object SpotDatafeedSubscriptionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.ec2.SpotDatafeedSubscription::class == javaResource::class

    override fun map(javaResource: Resource): SpotDatafeedSubscription =
        SpotDatafeedSubscription(javaResource as com.pulumi.aws.ec2.SpotDatafeedSubscription)
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy