github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/spotDatafeedSubscription.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package ec2
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // > **Note:** There is only a single subscription allowed per account.
    16  //
    17  // To help you understand the charges for your Spot instances, Amazon EC2 provides a data feed that describes your Spot instance usage and pricing.
    18  // This data feed is sent to an Amazon S3 bucket that you specify when you subscribe to the data feed.
    19  //
    20  // ## Example Usage
    21  //
    22  // <!--Start PulumiCodeChooser -->
    23  // ```go
    24  // package main
    25  //
    26  // import (
    27  //
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			_, err := s3.NewBucketV2(ctx, "default", &s3.BucketV2Args{
    37  //				Bucket: pulumi.String("tf-spot-datafeed"),
    38  //			})
    39  //			if err != nil {
    40  //				return err
    41  //			}
    42  //			_, err = ec2.NewSpotDatafeedSubscription(ctx, "default", &ec2.SpotDatafeedSubscriptionArgs{
    43  //				Bucket: _default.ID(),
    44  //				Prefix: pulumi.String("my_subdirectory"),
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			return nil
    50  //		})
    51  //	}
    52  //
    53  // ```
    54  // <!--End PulumiCodeChooser -->
    55  //
    56  // ## Import
    57  //
    58  // Using `pulumi import`, import a Spot Datafeed Subscription using the word `spot-datafeed-subscription`. For example:
    59  //
    60  // ```sh
    61  // $ pulumi import aws:ec2/spotDatafeedSubscription:SpotDatafeedSubscription mysubscription spot-datafeed-subscription
    62  // ```
    63  type SpotDatafeedSubscription struct {
    64  	pulumi.CustomResourceState
    65  
    66  	// The Amazon S3 bucket in which to store the Spot instance data feed.
    67  	Bucket pulumi.StringOutput `pulumi:"bucket"`
    68  	// Path of folder inside bucket to place spot pricing data.
    69  	Prefix pulumi.StringPtrOutput `pulumi:"prefix"`
    70  }
    71  
    72  // NewSpotDatafeedSubscription registers a new resource with the given unique name, arguments, and options.
    73  func NewSpotDatafeedSubscription(ctx *pulumi.Context,
    74  	name string, args *SpotDatafeedSubscriptionArgs, opts ...pulumi.ResourceOption) (*SpotDatafeedSubscription, error) {
    75  	if args == nil {
    76  		return nil, errors.New("missing one or more required arguments")
    77  	}
    78  
    79  	if args.Bucket == nil {
    80  		return nil, errors.New("invalid value for required argument 'Bucket'")
    81  	}
    82  	opts = internal.PkgResourceDefaultOpts(opts)
    83  	var resource SpotDatafeedSubscription
    84  	err := ctx.RegisterResource("aws:ec2/spotDatafeedSubscription:SpotDatafeedSubscription", name, args, &resource, opts...)
    85  	if err != nil {
    86  		return nil, err
    87  	}
    88  	return &resource, nil
    89  }
    90  
    91  // GetSpotDatafeedSubscription gets an existing SpotDatafeedSubscription resource's state with the given name, ID, and optional
    92  // state properties that are used to uniquely qualify the lookup (nil if not required).
    93  func GetSpotDatafeedSubscription(ctx *pulumi.Context,
    94  	name string, id pulumi.IDInput, state *SpotDatafeedSubscriptionState, opts ...pulumi.ResourceOption) (*SpotDatafeedSubscription, error) {
    95  	var resource SpotDatafeedSubscription
    96  	err := ctx.ReadResource("aws:ec2/spotDatafeedSubscription:SpotDatafeedSubscription", name, id, state, &resource, opts...)
    97  	if err != nil {
    98  		return nil, err
    99  	}
   100  	return &resource, nil
   101  }
   102  
   103  // Input properties used for looking up and filtering SpotDatafeedSubscription resources.
   104  type spotDatafeedSubscriptionState struct {
   105  	// The Amazon S3 bucket in which to store the Spot instance data feed.
   106  	Bucket *string `pulumi:"bucket"`
   107  	// Path of folder inside bucket to place spot pricing data.
   108  	Prefix *string `pulumi:"prefix"`
   109  }
   110  
   111  type SpotDatafeedSubscriptionState struct {
   112  	// The Amazon S3 bucket in which to store the Spot instance data feed.
   113  	Bucket pulumi.StringPtrInput
   114  	// Path of folder inside bucket to place spot pricing data.
   115  	Prefix pulumi.StringPtrInput
   116  }
   117  
   118  func (SpotDatafeedSubscriptionState) ElementType() reflect.Type {
   119  	return reflect.TypeOf((*spotDatafeedSubscriptionState)(nil)).Elem()
   120  }
   121  
   122  type spotDatafeedSubscriptionArgs struct {
   123  	// The Amazon S3 bucket in which to store the Spot instance data feed.
   124  	Bucket string `pulumi:"bucket"`
   125  	// Path of folder inside bucket to place spot pricing data.
   126  	Prefix *string `pulumi:"prefix"`
   127  }
   128  
   129  // The set of arguments for constructing a SpotDatafeedSubscription resource.
   130  type SpotDatafeedSubscriptionArgs struct {
   131  	// The Amazon S3 bucket in which to store the Spot instance data feed.
   132  	Bucket pulumi.StringInput
   133  	// Path of folder inside bucket to place spot pricing data.
   134  	Prefix pulumi.StringPtrInput
   135  }
   136  
   137  func (SpotDatafeedSubscriptionArgs) ElementType() reflect.Type {
   138  	return reflect.TypeOf((*spotDatafeedSubscriptionArgs)(nil)).Elem()
   139  }
   140  
   141  type SpotDatafeedSubscriptionInput interface {
   142  	pulumi.Input
   143  
   144  	ToSpotDatafeedSubscriptionOutput() SpotDatafeedSubscriptionOutput
   145  	ToSpotDatafeedSubscriptionOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionOutput
   146  }
   147  
   148  func (*SpotDatafeedSubscription) ElementType() reflect.Type {
   149  	return reflect.TypeOf((**SpotDatafeedSubscription)(nil)).Elem()
   150  }
   151  
   152  func (i *SpotDatafeedSubscription) ToSpotDatafeedSubscriptionOutput() SpotDatafeedSubscriptionOutput {
   153  	return i.ToSpotDatafeedSubscriptionOutputWithContext(context.Background())
   154  }
   155  
   156  func (i *SpotDatafeedSubscription) ToSpotDatafeedSubscriptionOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionOutput {
   157  	return pulumi.ToOutputWithContext(ctx, i).(SpotDatafeedSubscriptionOutput)
   158  }
   159  
   160  // SpotDatafeedSubscriptionArrayInput is an input type that accepts SpotDatafeedSubscriptionArray and SpotDatafeedSubscriptionArrayOutput values.
   161  // You can construct a concrete instance of `SpotDatafeedSubscriptionArrayInput` via:
   162  //
   163  //	SpotDatafeedSubscriptionArray{ SpotDatafeedSubscriptionArgs{...} }
   164  type SpotDatafeedSubscriptionArrayInput interface {
   165  	pulumi.Input
   166  
   167  	ToSpotDatafeedSubscriptionArrayOutput() SpotDatafeedSubscriptionArrayOutput
   168  	ToSpotDatafeedSubscriptionArrayOutputWithContext(context.Context) SpotDatafeedSubscriptionArrayOutput
   169  }
   170  
   171  type SpotDatafeedSubscriptionArray []SpotDatafeedSubscriptionInput
   172  
   173  func (SpotDatafeedSubscriptionArray) ElementType() reflect.Type {
   174  	return reflect.TypeOf((*[]*SpotDatafeedSubscription)(nil)).Elem()
   175  }
   176  
   177  func (i SpotDatafeedSubscriptionArray) ToSpotDatafeedSubscriptionArrayOutput() SpotDatafeedSubscriptionArrayOutput {
   178  	return i.ToSpotDatafeedSubscriptionArrayOutputWithContext(context.Background())
   179  }
   180  
   181  func (i SpotDatafeedSubscriptionArray) ToSpotDatafeedSubscriptionArrayOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionArrayOutput {
   182  	return pulumi.ToOutputWithContext(ctx, i).(SpotDatafeedSubscriptionArrayOutput)
   183  }
   184  
   185  // SpotDatafeedSubscriptionMapInput is an input type that accepts SpotDatafeedSubscriptionMap and SpotDatafeedSubscriptionMapOutput values.
   186  // You can construct a concrete instance of `SpotDatafeedSubscriptionMapInput` via:
   187  //
   188  //	SpotDatafeedSubscriptionMap{ "key": SpotDatafeedSubscriptionArgs{...} }
   189  type SpotDatafeedSubscriptionMapInput interface {
   190  	pulumi.Input
   191  
   192  	ToSpotDatafeedSubscriptionMapOutput() SpotDatafeedSubscriptionMapOutput
   193  	ToSpotDatafeedSubscriptionMapOutputWithContext(context.Context) SpotDatafeedSubscriptionMapOutput
   194  }
   195  
   196  type SpotDatafeedSubscriptionMap map[string]SpotDatafeedSubscriptionInput
   197  
   198  func (SpotDatafeedSubscriptionMap) ElementType() reflect.Type {
   199  	return reflect.TypeOf((*map[string]*SpotDatafeedSubscription)(nil)).Elem()
   200  }
   201  
   202  func (i SpotDatafeedSubscriptionMap) ToSpotDatafeedSubscriptionMapOutput() SpotDatafeedSubscriptionMapOutput {
   203  	return i.ToSpotDatafeedSubscriptionMapOutputWithContext(context.Background())
   204  }
   205  
   206  func (i SpotDatafeedSubscriptionMap) ToSpotDatafeedSubscriptionMapOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionMapOutput {
   207  	return pulumi.ToOutputWithContext(ctx, i).(SpotDatafeedSubscriptionMapOutput)
   208  }
   209  
   210  type SpotDatafeedSubscriptionOutput struct{ *pulumi.OutputState }
   211  
   212  func (SpotDatafeedSubscriptionOutput) ElementType() reflect.Type {
   213  	return reflect.TypeOf((**SpotDatafeedSubscription)(nil)).Elem()
   214  }
   215  
   216  func (o SpotDatafeedSubscriptionOutput) ToSpotDatafeedSubscriptionOutput() SpotDatafeedSubscriptionOutput {
   217  	return o
   218  }
   219  
   220  func (o SpotDatafeedSubscriptionOutput) ToSpotDatafeedSubscriptionOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionOutput {
   221  	return o
   222  }
   223  
   224  // The Amazon S3 bucket in which to store the Spot instance data feed.
   225  func (o SpotDatafeedSubscriptionOutput) Bucket() pulumi.StringOutput {
   226  	return o.ApplyT(func(v *SpotDatafeedSubscription) pulumi.StringOutput { return v.Bucket }).(pulumi.StringOutput)
   227  }
   228  
   229  // Path of folder inside bucket to place spot pricing data.
   230  func (o SpotDatafeedSubscriptionOutput) Prefix() pulumi.StringPtrOutput {
   231  	return o.ApplyT(func(v *SpotDatafeedSubscription) pulumi.StringPtrOutput { return v.Prefix }).(pulumi.StringPtrOutput)
   232  }
   233  
   234  type SpotDatafeedSubscriptionArrayOutput struct{ *pulumi.OutputState }
   235  
   236  func (SpotDatafeedSubscriptionArrayOutput) ElementType() reflect.Type {
   237  	return reflect.TypeOf((*[]*SpotDatafeedSubscription)(nil)).Elem()
   238  }
   239  
   240  func (o SpotDatafeedSubscriptionArrayOutput) ToSpotDatafeedSubscriptionArrayOutput() SpotDatafeedSubscriptionArrayOutput {
   241  	return o
   242  }
   243  
   244  func (o SpotDatafeedSubscriptionArrayOutput) ToSpotDatafeedSubscriptionArrayOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionArrayOutput {
   245  	return o
   246  }
   247  
   248  func (o SpotDatafeedSubscriptionArrayOutput) Index(i pulumi.IntInput) SpotDatafeedSubscriptionOutput {
   249  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SpotDatafeedSubscription {
   250  		return vs[0].([]*SpotDatafeedSubscription)[vs[1].(int)]
   251  	}).(SpotDatafeedSubscriptionOutput)
   252  }
   253  
   254  type SpotDatafeedSubscriptionMapOutput struct{ *pulumi.OutputState }
   255  
   256  func (SpotDatafeedSubscriptionMapOutput) ElementType() reflect.Type {
   257  	return reflect.TypeOf((*map[string]*SpotDatafeedSubscription)(nil)).Elem()
   258  }
   259  
   260  func (o SpotDatafeedSubscriptionMapOutput) ToSpotDatafeedSubscriptionMapOutput() SpotDatafeedSubscriptionMapOutput {
   261  	return o
   262  }
   263  
   264  func (o SpotDatafeedSubscriptionMapOutput) ToSpotDatafeedSubscriptionMapOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionMapOutput {
   265  	return o
   266  }
   267  
   268  func (o SpotDatafeedSubscriptionMapOutput) MapIndex(k pulumi.StringInput) SpotDatafeedSubscriptionOutput {
   269  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SpotDatafeedSubscription {
   270  		return vs[0].(map[string]*SpotDatafeedSubscription)[vs[1].(string)]
   271  	}).(SpotDatafeedSubscriptionOutput)
   272  }
   273  
   274  func init() {
   275  	pulumi.RegisterInputType(reflect.TypeOf((*SpotDatafeedSubscriptionInput)(nil)).Elem(), &SpotDatafeedSubscription{})
   276  	pulumi.RegisterInputType(reflect.TypeOf((*SpotDatafeedSubscriptionArrayInput)(nil)).Elem(), SpotDatafeedSubscriptionArray{})
   277  	pulumi.RegisterInputType(reflect.TypeOf((*SpotDatafeedSubscriptionMapInput)(nil)).Elem(), SpotDatafeedSubscriptionMap{})
   278  	pulumi.RegisterOutputType(SpotDatafeedSubscriptionOutput{})
   279  	pulumi.RegisterOutputType(SpotDatafeedSubscriptionArrayOutput{})
   280  	pulumi.RegisterOutputType(SpotDatafeedSubscriptionMapOutput{})
   281  }