github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/redshift/snapshotScheduleAssociation.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 redshift
     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  // ## Example Usage
    16  //
    17  // <!--Start PulumiCodeChooser -->
    18  // ```go
    19  // package main
    20  //
    21  // import (
    22  //
    23  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshift"
    24  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    25  //
    26  // )
    27  //
    28  //	func main() {
    29  //		pulumi.Run(func(ctx *pulumi.Context) error {
    30  //			_, err := redshift.NewCluster(ctx, "default", &redshift.ClusterArgs{
    31  //				ClusterIdentifier: pulumi.String("tf-redshift-cluster"),
    32  //				DatabaseName:      pulumi.String("mydb"),
    33  //				MasterUsername:    pulumi.String("foo"),
    34  //				MasterPassword:    pulumi.String("Mustbe8characters"),
    35  //				NodeType:          pulumi.String("dc1.large"),
    36  //				ClusterType:       pulumi.String("single-node"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			defaultSnapshotSchedule, err := redshift.NewSnapshotSchedule(ctx, "default", &redshift.SnapshotScheduleArgs{
    42  //				Identifier: pulumi.String("tf-redshift-snapshot-schedule"),
    43  //				Definitions: pulumi.StringArray{
    44  //					pulumi.String("rate(12 hours)"),
    45  //				},
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			_, err = redshift.NewSnapshotScheduleAssociation(ctx, "default", &redshift.SnapshotScheduleAssociationArgs{
    51  //				ClusterIdentifier:  _default.ID(),
    52  //				ScheduleIdentifier: defaultSnapshotSchedule.ID(),
    53  //			})
    54  //			if err != nil {
    55  //				return err
    56  //			}
    57  //			return nil
    58  //		})
    59  //	}
    60  //
    61  // ```
    62  // <!--End PulumiCodeChooser -->
    63  //
    64  // ## Import
    65  //
    66  // Using `pulumi import`, import Redshift Snapshot Schedule Association using the `<cluster-identifier>/<schedule-identifier>`. For example:
    67  //
    68  // ```sh
    69  // $ pulumi import aws:redshift/snapshotScheduleAssociation:SnapshotScheduleAssociation default tf-redshift-cluster/tf-redshift-snapshot-schedule
    70  // ```
    71  type SnapshotScheduleAssociation struct {
    72  	pulumi.CustomResourceState
    73  
    74  	// The cluster identifier.
    75  	ClusterIdentifier pulumi.StringOutput `pulumi:"clusterIdentifier"`
    76  	// The snapshot schedule identifier.
    77  	ScheduleIdentifier pulumi.StringOutput `pulumi:"scheduleIdentifier"`
    78  }
    79  
    80  // NewSnapshotScheduleAssociation registers a new resource with the given unique name, arguments, and options.
    81  func NewSnapshotScheduleAssociation(ctx *pulumi.Context,
    82  	name string, args *SnapshotScheduleAssociationArgs, opts ...pulumi.ResourceOption) (*SnapshotScheduleAssociation, error) {
    83  	if args == nil {
    84  		return nil, errors.New("missing one or more required arguments")
    85  	}
    86  
    87  	if args.ClusterIdentifier == nil {
    88  		return nil, errors.New("invalid value for required argument 'ClusterIdentifier'")
    89  	}
    90  	if args.ScheduleIdentifier == nil {
    91  		return nil, errors.New("invalid value for required argument 'ScheduleIdentifier'")
    92  	}
    93  	opts = internal.PkgResourceDefaultOpts(opts)
    94  	var resource SnapshotScheduleAssociation
    95  	err := ctx.RegisterResource("aws:redshift/snapshotScheduleAssociation:SnapshotScheduleAssociation", name, args, &resource, opts...)
    96  	if err != nil {
    97  		return nil, err
    98  	}
    99  	return &resource, nil
   100  }
   101  
   102  // GetSnapshotScheduleAssociation gets an existing SnapshotScheduleAssociation resource's state with the given name, ID, and optional
   103  // state properties that are used to uniquely qualify the lookup (nil if not required).
   104  func GetSnapshotScheduleAssociation(ctx *pulumi.Context,
   105  	name string, id pulumi.IDInput, state *SnapshotScheduleAssociationState, opts ...pulumi.ResourceOption) (*SnapshotScheduleAssociation, error) {
   106  	var resource SnapshotScheduleAssociation
   107  	err := ctx.ReadResource("aws:redshift/snapshotScheduleAssociation:SnapshotScheduleAssociation", name, id, state, &resource, opts...)
   108  	if err != nil {
   109  		return nil, err
   110  	}
   111  	return &resource, nil
   112  }
   113  
   114  // Input properties used for looking up and filtering SnapshotScheduleAssociation resources.
   115  type snapshotScheduleAssociationState struct {
   116  	// The cluster identifier.
   117  	ClusterIdentifier *string `pulumi:"clusterIdentifier"`
   118  	// The snapshot schedule identifier.
   119  	ScheduleIdentifier *string `pulumi:"scheduleIdentifier"`
   120  }
   121  
   122  type SnapshotScheduleAssociationState struct {
   123  	// The cluster identifier.
   124  	ClusterIdentifier pulumi.StringPtrInput
   125  	// The snapshot schedule identifier.
   126  	ScheduleIdentifier pulumi.StringPtrInput
   127  }
   128  
   129  func (SnapshotScheduleAssociationState) ElementType() reflect.Type {
   130  	return reflect.TypeOf((*snapshotScheduleAssociationState)(nil)).Elem()
   131  }
   132  
   133  type snapshotScheduleAssociationArgs struct {
   134  	// The cluster identifier.
   135  	ClusterIdentifier string `pulumi:"clusterIdentifier"`
   136  	// The snapshot schedule identifier.
   137  	ScheduleIdentifier string `pulumi:"scheduleIdentifier"`
   138  }
   139  
   140  // The set of arguments for constructing a SnapshotScheduleAssociation resource.
   141  type SnapshotScheduleAssociationArgs struct {
   142  	// The cluster identifier.
   143  	ClusterIdentifier pulumi.StringInput
   144  	// The snapshot schedule identifier.
   145  	ScheduleIdentifier pulumi.StringInput
   146  }
   147  
   148  func (SnapshotScheduleAssociationArgs) ElementType() reflect.Type {
   149  	return reflect.TypeOf((*snapshotScheduleAssociationArgs)(nil)).Elem()
   150  }
   151  
   152  type SnapshotScheduleAssociationInput interface {
   153  	pulumi.Input
   154  
   155  	ToSnapshotScheduleAssociationOutput() SnapshotScheduleAssociationOutput
   156  	ToSnapshotScheduleAssociationOutputWithContext(ctx context.Context) SnapshotScheduleAssociationOutput
   157  }
   158  
   159  func (*SnapshotScheduleAssociation) ElementType() reflect.Type {
   160  	return reflect.TypeOf((**SnapshotScheduleAssociation)(nil)).Elem()
   161  }
   162  
   163  func (i *SnapshotScheduleAssociation) ToSnapshotScheduleAssociationOutput() SnapshotScheduleAssociationOutput {
   164  	return i.ToSnapshotScheduleAssociationOutputWithContext(context.Background())
   165  }
   166  
   167  func (i *SnapshotScheduleAssociation) ToSnapshotScheduleAssociationOutputWithContext(ctx context.Context) SnapshotScheduleAssociationOutput {
   168  	return pulumi.ToOutputWithContext(ctx, i).(SnapshotScheduleAssociationOutput)
   169  }
   170  
   171  // SnapshotScheduleAssociationArrayInput is an input type that accepts SnapshotScheduleAssociationArray and SnapshotScheduleAssociationArrayOutput values.
   172  // You can construct a concrete instance of `SnapshotScheduleAssociationArrayInput` via:
   173  //
   174  //	SnapshotScheduleAssociationArray{ SnapshotScheduleAssociationArgs{...} }
   175  type SnapshotScheduleAssociationArrayInput interface {
   176  	pulumi.Input
   177  
   178  	ToSnapshotScheduleAssociationArrayOutput() SnapshotScheduleAssociationArrayOutput
   179  	ToSnapshotScheduleAssociationArrayOutputWithContext(context.Context) SnapshotScheduleAssociationArrayOutput
   180  }
   181  
   182  type SnapshotScheduleAssociationArray []SnapshotScheduleAssociationInput
   183  
   184  func (SnapshotScheduleAssociationArray) ElementType() reflect.Type {
   185  	return reflect.TypeOf((*[]*SnapshotScheduleAssociation)(nil)).Elem()
   186  }
   187  
   188  func (i SnapshotScheduleAssociationArray) ToSnapshotScheduleAssociationArrayOutput() SnapshotScheduleAssociationArrayOutput {
   189  	return i.ToSnapshotScheduleAssociationArrayOutputWithContext(context.Background())
   190  }
   191  
   192  func (i SnapshotScheduleAssociationArray) ToSnapshotScheduleAssociationArrayOutputWithContext(ctx context.Context) SnapshotScheduleAssociationArrayOutput {
   193  	return pulumi.ToOutputWithContext(ctx, i).(SnapshotScheduleAssociationArrayOutput)
   194  }
   195  
   196  // SnapshotScheduleAssociationMapInput is an input type that accepts SnapshotScheduleAssociationMap and SnapshotScheduleAssociationMapOutput values.
   197  // You can construct a concrete instance of `SnapshotScheduleAssociationMapInput` via:
   198  //
   199  //	SnapshotScheduleAssociationMap{ "key": SnapshotScheduleAssociationArgs{...} }
   200  type SnapshotScheduleAssociationMapInput interface {
   201  	pulumi.Input
   202  
   203  	ToSnapshotScheduleAssociationMapOutput() SnapshotScheduleAssociationMapOutput
   204  	ToSnapshotScheduleAssociationMapOutputWithContext(context.Context) SnapshotScheduleAssociationMapOutput
   205  }
   206  
   207  type SnapshotScheduleAssociationMap map[string]SnapshotScheduleAssociationInput
   208  
   209  func (SnapshotScheduleAssociationMap) ElementType() reflect.Type {
   210  	return reflect.TypeOf((*map[string]*SnapshotScheduleAssociation)(nil)).Elem()
   211  }
   212  
   213  func (i SnapshotScheduleAssociationMap) ToSnapshotScheduleAssociationMapOutput() SnapshotScheduleAssociationMapOutput {
   214  	return i.ToSnapshotScheduleAssociationMapOutputWithContext(context.Background())
   215  }
   216  
   217  func (i SnapshotScheduleAssociationMap) ToSnapshotScheduleAssociationMapOutputWithContext(ctx context.Context) SnapshotScheduleAssociationMapOutput {
   218  	return pulumi.ToOutputWithContext(ctx, i).(SnapshotScheduleAssociationMapOutput)
   219  }
   220  
   221  type SnapshotScheduleAssociationOutput struct{ *pulumi.OutputState }
   222  
   223  func (SnapshotScheduleAssociationOutput) ElementType() reflect.Type {
   224  	return reflect.TypeOf((**SnapshotScheduleAssociation)(nil)).Elem()
   225  }
   226  
   227  func (o SnapshotScheduleAssociationOutput) ToSnapshotScheduleAssociationOutput() SnapshotScheduleAssociationOutput {
   228  	return o
   229  }
   230  
   231  func (o SnapshotScheduleAssociationOutput) ToSnapshotScheduleAssociationOutputWithContext(ctx context.Context) SnapshotScheduleAssociationOutput {
   232  	return o
   233  }
   234  
   235  // The cluster identifier.
   236  func (o SnapshotScheduleAssociationOutput) ClusterIdentifier() pulumi.StringOutput {
   237  	return o.ApplyT(func(v *SnapshotScheduleAssociation) pulumi.StringOutput { return v.ClusterIdentifier }).(pulumi.StringOutput)
   238  }
   239  
   240  // The snapshot schedule identifier.
   241  func (o SnapshotScheduleAssociationOutput) ScheduleIdentifier() pulumi.StringOutput {
   242  	return o.ApplyT(func(v *SnapshotScheduleAssociation) pulumi.StringOutput { return v.ScheduleIdentifier }).(pulumi.StringOutput)
   243  }
   244  
   245  type SnapshotScheduleAssociationArrayOutput struct{ *pulumi.OutputState }
   246  
   247  func (SnapshotScheduleAssociationArrayOutput) ElementType() reflect.Type {
   248  	return reflect.TypeOf((*[]*SnapshotScheduleAssociation)(nil)).Elem()
   249  }
   250  
   251  func (o SnapshotScheduleAssociationArrayOutput) ToSnapshotScheduleAssociationArrayOutput() SnapshotScheduleAssociationArrayOutput {
   252  	return o
   253  }
   254  
   255  func (o SnapshotScheduleAssociationArrayOutput) ToSnapshotScheduleAssociationArrayOutputWithContext(ctx context.Context) SnapshotScheduleAssociationArrayOutput {
   256  	return o
   257  }
   258  
   259  func (o SnapshotScheduleAssociationArrayOutput) Index(i pulumi.IntInput) SnapshotScheduleAssociationOutput {
   260  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SnapshotScheduleAssociation {
   261  		return vs[0].([]*SnapshotScheduleAssociation)[vs[1].(int)]
   262  	}).(SnapshotScheduleAssociationOutput)
   263  }
   264  
   265  type SnapshotScheduleAssociationMapOutput struct{ *pulumi.OutputState }
   266  
   267  func (SnapshotScheduleAssociationMapOutput) ElementType() reflect.Type {
   268  	return reflect.TypeOf((*map[string]*SnapshotScheduleAssociation)(nil)).Elem()
   269  }
   270  
   271  func (o SnapshotScheduleAssociationMapOutput) ToSnapshotScheduleAssociationMapOutput() SnapshotScheduleAssociationMapOutput {
   272  	return o
   273  }
   274  
   275  func (o SnapshotScheduleAssociationMapOutput) ToSnapshotScheduleAssociationMapOutputWithContext(ctx context.Context) SnapshotScheduleAssociationMapOutput {
   276  	return o
   277  }
   278  
   279  func (o SnapshotScheduleAssociationMapOutput) MapIndex(k pulumi.StringInput) SnapshotScheduleAssociationOutput {
   280  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SnapshotScheduleAssociation {
   281  		return vs[0].(map[string]*SnapshotScheduleAssociation)[vs[1].(string)]
   282  	}).(SnapshotScheduleAssociationOutput)
   283  }
   284  
   285  func init() {
   286  	pulumi.RegisterInputType(reflect.TypeOf((*SnapshotScheduleAssociationInput)(nil)).Elem(), &SnapshotScheduleAssociation{})
   287  	pulumi.RegisterInputType(reflect.TypeOf((*SnapshotScheduleAssociationArrayInput)(nil)).Elem(), SnapshotScheduleAssociationArray{})
   288  	pulumi.RegisterInputType(reflect.TypeOf((*SnapshotScheduleAssociationMapInput)(nil)).Elem(), SnapshotScheduleAssociationMap{})
   289  	pulumi.RegisterOutputType(SnapshotScheduleAssociationOutput{})
   290  	pulumi.RegisterOutputType(SnapshotScheduleAssociationArrayOutput{})
   291  	pulumi.RegisterOutputType(SnapshotScheduleAssociationMapOutput{})
   292  }