github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/backup/plan.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 backup
     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  // Provides an AWS Backup plan resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/backup"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := backup.NewPlan(ctx, "example", &backup.PlanArgs{
    33  //				Name: pulumi.String("my_example_backup_plan"),
    34  //				Rules: backup.PlanRuleArray{
    35  //					&backup.PlanRuleArgs{
    36  //						RuleName:        pulumi.String("my_example_backup_rule"),
    37  //						TargetVaultName: pulumi.Any(test.Name),
    38  //						Schedule:        pulumi.String("cron(0 12 * * ? *)"),
    39  //						Lifecycle: &backup.PlanRuleLifecycleArgs{
    40  //							DeleteAfter: pulumi.Int(14),
    41  //						},
    42  //					},
    43  //				},
    44  //				AdvancedBackupSettings: backup.PlanAdvancedBackupSettingArray{
    45  //					&backup.PlanAdvancedBackupSettingArgs{
    46  //						BackupOptions: pulumi.StringMap{
    47  //							"WindowsVSS": pulumi.String("enabled"),
    48  //						},
    49  //						ResourceType: pulumi.String("EC2"),
    50  //					},
    51  //				},
    52  //			})
    53  //			if err != nil {
    54  //				return err
    55  //			}
    56  //			return nil
    57  //		})
    58  //	}
    59  //
    60  // ```
    61  // <!--End PulumiCodeChooser -->
    62  //
    63  // ## Import
    64  //
    65  // Using `pulumi import`, import Backup Plan using the `id`. For example:
    66  //
    67  // ```sh
    68  // $ pulumi import aws:backup/plan:Plan test <id>
    69  // ```
    70  type Plan struct {
    71  	pulumi.CustomResourceState
    72  
    73  	// An object that specifies backup options for each resource type.
    74  	AdvancedBackupSettings PlanAdvancedBackupSettingArrayOutput `pulumi:"advancedBackupSettings"`
    75  	// The ARN of the backup plan.
    76  	Arn pulumi.StringOutput `pulumi:"arn"`
    77  	// The display name of a backup plan.
    78  	Name pulumi.StringOutput `pulumi:"name"`
    79  	// A rule object that specifies a scheduled task that is used to back up a selection of resources.
    80  	Rules PlanRuleArrayOutput `pulumi:"rules"`
    81  	// Metadata that you can assign to help organize the plans you create. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    82  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    83  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    84  	//
    85  	// Deprecated: Please use `tags` instead.
    86  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    87  	// Unique, randomly generated, Unicode, UTF-8 encoded string that serves as the version ID of the backup plan.
    88  	Version pulumi.StringOutput `pulumi:"version"`
    89  }
    90  
    91  // NewPlan registers a new resource with the given unique name, arguments, and options.
    92  func NewPlan(ctx *pulumi.Context,
    93  	name string, args *PlanArgs, opts ...pulumi.ResourceOption) (*Plan, error) {
    94  	if args == nil {
    95  		return nil, errors.New("missing one or more required arguments")
    96  	}
    97  
    98  	if args.Rules == nil {
    99  		return nil, errors.New("invalid value for required argument 'Rules'")
   100  	}
   101  	opts = internal.PkgResourceDefaultOpts(opts)
   102  	var resource Plan
   103  	err := ctx.RegisterResource("aws:backup/plan:Plan", name, args, &resource, opts...)
   104  	if err != nil {
   105  		return nil, err
   106  	}
   107  	return &resource, nil
   108  }
   109  
   110  // GetPlan gets an existing Plan resource's state with the given name, ID, and optional
   111  // state properties that are used to uniquely qualify the lookup (nil if not required).
   112  func GetPlan(ctx *pulumi.Context,
   113  	name string, id pulumi.IDInput, state *PlanState, opts ...pulumi.ResourceOption) (*Plan, error) {
   114  	var resource Plan
   115  	err := ctx.ReadResource("aws:backup/plan:Plan", name, id, state, &resource, opts...)
   116  	if err != nil {
   117  		return nil, err
   118  	}
   119  	return &resource, nil
   120  }
   121  
   122  // Input properties used for looking up and filtering Plan resources.
   123  type planState struct {
   124  	// An object that specifies backup options for each resource type.
   125  	AdvancedBackupSettings []PlanAdvancedBackupSetting `pulumi:"advancedBackupSettings"`
   126  	// The ARN of the backup plan.
   127  	Arn *string `pulumi:"arn"`
   128  	// The display name of a backup plan.
   129  	Name *string `pulumi:"name"`
   130  	// A rule object that specifies a scheduled task that is used to back up a selection of resources.
   131  	Rules []PlanRule `pulumi:"rules"`
   132  	// Metadata that you can assign to help organize the plans you create. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   133  	Tags map[string]string `pulumi:"tags"`
   134  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   135  	//
   136  	// Deprecated: Please use `tags` instead.
   137  	TagsAll map[string]string `pulumi:"tagsAll"`
   138  	// Unique, randomly generated, Unicode, UTF-8 encoded string that serves as the version ID of the backup plan.
   139  	Version *string `pulumi:"version"`
   140  }
   141  
   142  type PlanState struct {
   143  	// An object that specifies backup options for each resource type.
   144  	AdvancedBackupSettings PlanAdvancedBackupSettingArrayInput
   145  	// The ARN of the backup plan.
   146  	Arn pulumi.StringPtrInput
   147  	// The display name of a backup plan.
   148  	Name pulumi.StringPtrInput
   149  	// A rule object that specifies a scheduled task that is used to back up a selection of resources.
   150  	Rules PlanRuleArrayInput
   151  	// Metadata that you can assign to help organize the plans you create. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   152  	Tags pulumi.StringMapInput
   153  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   154  	//
   155  	// Deprecated: Please use `tags` instead.
   156  	TagsAll pulumi.StringMapInput
   157  	// Unique, randomly generated, Unicode, UTF-8 encoded string that serves as the version ID of the backup plan.
   158  	Version pulumi.StringPtrInput
   159  }
   160  
   161  func (PlanState) ElementType() reflect.Type {
   162  	return reflect.TypeOf((*planState)(nil)).Elem()
   163  }
   164  
   165  type planArgs struct {
   166  	// An object that specifies backup options for each resource type.
   167  	AdvancedBackupSettings []PlanAdvancedBackupSetting `pulumi:"advancedBackupSettings"`
   168  	// The display name of a backup plan.
   169  	Name *string `pulumi:"name"`
   170  	// A rule object that specifies a scheduled task that is used to back up a selection of resources.
   171  	Rules []PlanRule `pulumi:"rules"`
   172  	// Metadata that you can assign to help organize the plans you create. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   173  	Tags map[string]string `pulumi:"tags"`
   174  }
   175  
   176  // The set of arguments for constructing a Plan resource.
   177  type PlanArgs struct {
   178  	// An object that specifies backup options for each resource type.
   179  	AdvancedBackupSettings PlanAdvancedBackupSettingArrayInput
   180  	// The display name of a backup plan.
   181  	Name pulumi.StringPtrInput
   182  	// A rule object that specifies a scheduled task that is used to back up a selection of resources.
   183  	Rules PlanRuleArrayInput
   184  	// Metadata that you can assign to help organize the plans you create. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   185  	Tags pulumi.StringMapInput
   186  }
   187  
   188  func (PlanArgs) ElementType() reflect.Type {
   189  	return reflect.TypeOf((*planArgs)(nil)).Elem()
   190  }
   191  
   192  type PlanInput interface {
   193  	pulumi.Input
   194  
   195  	ToPlanOutput() PlanOutput
   196  	ToPlanOutputWithContext(ctx context.Context) PlanOutput
   197  }
   198  
   199  func (*Plan) ElementType() reflect.Type {
   200  	return reflect.TypeOf((**Plan)(nil)).Elem()
   201  }
   202  
   203  func (i *Plan) ToPlanOutput() PlanOutput {
   204  	return i.ToPlanOutputWithContext(context.Background())
   205  }
   206  
   207  func (i *Plan) ToPlanOutputWithContext(ctx context.Context) PlanOutput {
   208  	return pulumi.ToOutputWithContext(ctx, i).(PlanOutput)
   209  }
   210  
   211  // PlanArrayInput is an input type that accepts PlanArray and PlanArrayOutput values.
   212  // You can construct a concrete instance of `PlanArrayInput` via:
   213  //
   214  //	PlanArray{ PlanArgs{...} }
   215  type PlanArrayInput interface {
   216  	pulumi.Input
   217  
   218  	ToPlanArrayOutput() PlanArrayOutput
   219  	ToPlanArrayOutputWithContext(context.Context) PlanArrayOutput
   220  }
   221  
   222  type PlanArray []PlanInput
   223  
   224  func (PlanArray) ElementType() reflect.Type {
   225  	return reflect.TypeOf((*[]*Plan)(nil)).Elem()
   226  }
   227  
   228  func (i PlanArray) ToPlanArrayOutput() PlanArrayOutput {
   229  	return i.ToPlanArrayOutputWithContext(context.Background())
   230  }
   231  
   232  func (i PlanArray) ToPlanArrayOutputWithContext(ctx context.Context) PlanArrayOutput {
   233  	return pulumi.ToOutputWithContext(ctx, i).(PlanArrayOutput)
   234  }
   235  
   236  // PlanMapInput is an input type that accepts PlanMap and PlanMapOutput values.
   237  // You can construct a concrete instance of `PlanMapInput` via:
   238  //
   239  //	PlanMap{ "key": PlanArgs{...} }
   240  type PlanMapInput interface {
   241  	pulumi.Input
   242  
   243  	ToPlanMapOutput() PlanMapOutput
   244  	ToPlanMapOutputWithContext(context.Context) PlanMapOutput
   245  }
   246  
   247  type PlanMap map[string]PlanInput
   248  
   249  func (PlanMap) ElementType() reflect.Type {
   250  	return reflect.TypeOf((*map[string]*Plan)(nil)).Elem()
   251  }
   252  
   253  func (i PlanMap) ToPlanMapOutput() PlanMapOutput {
   254  	return i.ToPlanMapOutputWithContext(context.Background())
   255  }
   256  
   257  func (i PlanMap) ToPlanMapOutputWithContext(ctx context.Context) PlanMapOutput {
   258  	return pulumi.ToOutputWithContext(ctx, i).(PlanMapOutput)
   259  }
   260  
   261  type PlanOutput struct{ *pulumi.OutputState }
   262  
   263  func (PlanOutput) ElementType() reflect.Type {
   264  	return reflect.TypeOf((**Plan)(nil)).Elem()
   265  }
   266  
   267  func (o PlanOutput) ToPlanOutput() PlanOutput {
   268  	return o
   269  }
   270  
   271  func (o PlanOutput) ToPlanOutputWithContext(ctx context.Context) PlanOutput {
   272  	return o
   273  }
   274  
   275  // An object that specifies backup options for each resource type.
   276  func (o PlanOutput) AdvancedBackupSettings() PlanAdvancedBackupSettingArrayOutput {
   277  	return o.ApplyT(func(v *Plan) PlanAdvancedBackupSettingArrayOutput { return v.AdvancedBackupSettings }).(PlanAdvancedBackupSettingArrayOutput)
   278  }
   279  
   280  // The ARN of the backup plan.
   281  func (o PlanOutput) Arn() pulumi.StringOutput {
   282  	return o.ApplyT(func(v *Plan) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   283  }
   284  
   285  // The display name of a backup plan.
   286  func (o PlanOutput) Name() pulumi.StringOutput {
   287  	return o.ApplyT(func(v *Plan) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   288  }
   289  
   290  // A rule object that specifies a scheduled task that is used to back up a selection of resources.
   291  func (o PlanOutput) Rules() PlanRuleArrayOutput {
   292  	return o.ApplyT(func(v *Plan) PlanRuleArrayOutput { return v.Rules }).(PlanRuleArrayOutput)
   293  }
   294  
   295  // Metadata that you can assign to help organize the plans you create. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   296  func (o PlanOutput) Tags() pulumi.StringMapOutput {
   297  	return o.ApplyT(func(v *Plan) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   298  }
   299  
   300  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   301  //
   302  // Deprecated: Please use `tags` instead.
   303  func (o PlanOutput) TagsAll() pulumi.StringMapOutput {
   304  	return o.ApplyT(func(v *Plan) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   305  }
   306  
   307  // Unique, randomly generated, Unicode, UTF-8 encoded string that serves as the version ID of the backup plan.
   308  func (o PlanOutput) Version() pulumi.StringOutput {
   309  	return o.ApplyT(func(v *Plan) pulumi.StringOutput { return v.Version }).(pulumi.StringOutput)
   310  }
   311  
   312  type PlanArrayOutput struct{ *pulumi.OutputState }
   313  
   314  func (PlanArrayOutput) ElementType() reflect.Type {
   315  	return reflect.TypeOf((*[]*Plan)(nil)).Elem()
   316  }
   317  
   318  func (o PlanArrayOutput) ToPlanArrayOutput() PlanArrayOutput {
   319  	return o
   320  }
   321  
   322  func (o PlanArrayOutput) ToPlanArrayOutputWithContext(ctx context.Context) PlanArrayOutput {
   323  	return o
   324  }
   325  
   326  func (o PlanArrayOutput) Index(i pulumi.IntInput) PlanOutput {
   327  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Plan {
   328  		return vs[0].([]*Plan)[vs[1].(int)]
   329  	}).(PlanOutput)
   330  }
   331  
   332  type PlanMapOutput struct{ *pulumi.OutputState }
   333  
   334  func (PlanMapOutput) ElementType() reflect.Type {
   335  	return reflect.TypeOf((*map[string]*Plan)(nil)).Elem()
   336  }
   337  
   338  func (o PlanMapOutput) ToPlanMapOutput() PlanMapOutput {
   339  	return o
   340  }
   341  
   342  func (o PlanMapOutput) ToPlanMapOutputWithContext(ctx context.Context) PlanMapOutput {
   343  	return o
   344  }
   345  
   346  func (o PlanMapOutput) MapIndex(k pulumi.StringInput) PlanOutput {
   347  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Plan {
   348  		return vs[0].(map[string]*Plan)[vs[1].(string)]
   349  	}).(PlanOutput)
   350  }
   351  
   352  func init() {
   353  	pulumi.RegisterInputType(reflect.TypeOf((*PlanInput)(nil)).Elem(), &Plan{})
   354  	pulumi.RegisterInputType(reflect.TypeOf((*PlanArrayInput)(nil)).Elem(), PlanArray{})
   355  	pulumi.RegisterInputType(reflect.TypeOf((*PlanMapInput)(nil)).Elem(), PlanMap{})
   356  	pulumi.RegisterOutputType(PlanOutput{})
   357  	pulumi.RegisterOutputType(PlanArrayOutput{})
   358  	pulumi.RegisterOutputType(PlanMapOutput{})
   359  }