github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/glacier/vaultLock.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 glacier
     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  // ### Testing Glacier Vault Lock Policy
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glacier"
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			exampleVault, err := glacier.NewVault(ctx, "example", &glacier.VaultArgs{
    34  //				Name: pulumi.String("example"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			example := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
    40  //				Statements: iam.GetPolicyDocumentStatementArray{
    41  //					&iam.GetPolicyDocumentStatementArgs{
    42  //						Actions: pulumi.StringArray{
    43  //							pulumi.String("glacier:DeleteArchive"),
    44  //						},
    45  //						Effect: pulumi.String("Deny"),
    46  //						Resources: pulumi.StringArray{
    47  //							exampleVault.Arn,
    48  //						},
    49  //						Conditions: iam.GetPolicyDocumentStatementConditionArray{
    50  //							&iam.GetPolicyDocumentStatementConditionArgs{
    51  //								Test:     pulumi.String("NumericLessThanEquals"),
    52  //								Variable: pulumi.String("glacier:ArchiveAgeinDays"),
    53  //								Values: pulumi.StringArray{
    54  //									pulumi.String("365"),
    55  //								},
    56  //							},
    57  //						},
    58  //					},
    59  //				},
    60  //			}, nil)
    61  //			_, err = glacier.NewVaultLock(ctx, "example", &glacier.VaultLockArgs{
    62  //				CompleteLock: pulumi.Bool(false),
    63  //				Policy: example.ApplyT(func(example iam.GetPolicyDocumentResult) (*string, error) {
    64  //					return &example.Json, nil
    65  //				}).(pulumi.StringPtrOutput),
    66  //				VaultName: exampleVault.Name,
    67  //			})
    68  //			if err != nil {
    69  //				return err
    70  //			}
    71  //			return nil
    72  //		})
    73  //	}
    74  //
    75  // ```
    76  // <!--End PulumiCodeChooser -->
    77  //
    78  // ### Permanently Applying Glacier Vault Lock Policy
    79  //
    80  // <!--Start PulumiCodeChooser -->
    81  // ```go
    82  // package main
    83  //
    84  // import (
    85  //
    86  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glacier"
    87  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    88  //
    89  // )
    90  //
    91  //	func main() {
    92  //		pulumi.Run(func(ctx *pulumi.Context) error {
    93  //			_, err := glacier.NewVaultLock(ctx, "example", &glacier.VaultLockArgs{
    94  //				CompleteLock: pulumi.Bool(true),
    95  //				Policy:       pulumi.Any(exampleAwsIamPolicyDocument.Json),
    96  //				VaultName:    pulumi.Any(exampleAwsGlacierVault.Name),
    97  //			})
    98  //			if err != nil {
    99  //				return err
   100  //			}
   101  //			return nil
   102  //		})
   103  //	}
   104  //
   105  // ```
   106  // <!--End PulumiCodeChooser -->
   107  //
   108  // ## Import
   109  //
   110  // Using `pulumi import`, import Glacier Vault Locks using the Glacier Vault name. For example:
   111  //
   112  // ```sh
   113  // $ pulumi import aws:glacier/vaultLock:VaultLock example example-vault
   114  // ```
   115  type VaultLock struct {
   116  	pulumi.CustomResourceState
   117  
   118  	// Boolean whether to permanently apply this Glacier Lock Policy. Once completed, this cannot be undone. If set to `false`, the Glacier Lock Policy remains in a testing mode for 24 hours. After that time, the Glacier Lock Policy is automatically removed by Glacier and the this provider resource will show as needing recreation. Changing this from `false` to `true` will show as resource recreation, which is expected. Changing this from `true` to `false` is not possible unless the Glacier Vault is recreated at the same time.
   119  	CompleteLock pulumi.BoolOutput `pulumi:"completeLock"`
   120  	// Allow this provider to ignore the error returned when attempting to delete the Glacier Lock Policy. This can be used to delete or recreate the Glacier Vault via this provider, for example, if the Glacier Vault Lock policy permits that action. This should only be used in conjunction with `completeLock` being set to `true`.
   121  	IgnoreDeletionError pulumi.BoolPtrOutput `pulumi:"ignoreDeletionError"`
   122  	// JSON string containing the IAM policy to apply as the Glacier Vault Lock policy.
   123  	Policy pulumi.StringOutput `pulumi:"policy"`
   124  	// The name of the Glacier Vault.
   125  	VaultName pulumi.StringOutput `pulumi:"vaultName"`
   126  }
   127  
   128  // NewVaultLock registers a new resource with the given unique name, arguments, and options.
   129  func NewVaultLock(ctx *pulumi.Context,
   130  	name string, args *VaultLockArgs, opts ...pulumi.ResourceOption) (*VaultLock, error) {
   131  	if args == nil {
   132  		return nil, errors.New("missing one or more required arguments")
   133  	}
   134  
   135  	if args.CompleteLock == nil {
   136  		return nil, errors.New("invalid value for required argument 'CompleteLock'")
   137  	}
   138  	if args.Policy == nil {
   139  		return nil, errors.New("invalid value for required argument 'Policy'")
   140  	}
   141  	if args.VaultName == nil {
   142  		return nil, errors.New("invalid value for required argument 'VaultName'")
   143  	}
   144  	opts = internal.PkgResourceDefaultOpts(opts)
   145  	var resource VaultLock
   146  	err := ctx.RegisterResource("aws:glacier/vaultLock:VaultLock", name, args, &resource, opts...)
   147  	if err != nil {
   148  		return nil, err
   149  	}
   150  	return &resource, nil
   151  }
   152  
   153  // GetVaultLock gets an existing VaultLock resource's state with the given name, ID, and optional
   154  // state properties that are used to uniquely qualify the lookup (nil if not required).
   155  func GetVaultLock(ctx *pulumi.Context,
   156  	name string, id pulumi.IDInput, state *VaultLockState, opts ...pulumi.ResourceOption) (*VaultLock, error) {
   157  	var resource VaultLock
   158  	err := ctx.ReadResource("aws:glacier/vaultLock:VaultLock", name, id, state, &resource, opts...)
   159  	if err != nil {
   160  		return nil, err
   161  	}
   162  	return &resource, nil
   163  }
   164  
   165  // Input properties used for looking up and filtering VaultLock resources.
   166  type vaultLockState struct {
   167  	// Boolean whether to permanently apply this Glacier Lock Policy. Once completed, this cannot be undone. If set to `false`, the Glacier Lock Policy remains in a testing mode for 24 hours. After that time, the Glacier Lock Policy is automatically removed by Glacier and the this provider resource will show as needing recreation. Changing this from `false` to `true` will show as resource recreation, which is expected. Changing this from `true` to `false` is not possible unless the Glacier Vault is recreated at the same time.
   168  	CompleteLock *bool `pulumi:"completeLock"`
   169  	// Allow this provider to ignore the error returned when attempting to delete the Glacier Lock Policy. This can be used to delete or recreate the Glacier Vault via this provider, for example, if the Glacier Vault Lock policy permits that action. This should only be used in conjunction with `completeLock` being set to `true`.
   170  	IgnoreDeletionError *bool `pulumi:"ignoreDeletionError"`
   171  	// JSON string containing the IAM policy to apply as the Glacier Vault Lock policy.
   172  	Policy *string `pulumi:"policy"`
   173  	// The name of the Glacier Vault.
   174  	VaultName *string `pulumi:"vaultName"`
   175  }
   176  
   177  type VaultLockState struct {
   178  	// Boolean whether to permanently apply this Glacier Lock Policy. Once completed, this cannot be undone. If set to `false`, the Glacier Lock Policy remains in a testing mode for 24 hours. After that time, the Glacier Lock Policy is automatically removed by Glacier and the this provider resource will show as needing recreation. Changing this from `false` to `true` will show as resource recreation, which is expected. Changing this from `true` to `false` is not possible unless the Glacier Vault is recreated at the same time.
   179  	CompleteLock pulumi.BoolPtrInput
   180  	// Allow this provider to ignore the error returned when attempting to delete the Glacier Lock Policy. This can be used to delete or recreate the Glacier Vault via this provider, for example, if the Glacier Vault Lock policy permits that action. This should only be used in conjunction with `completeLock` being set to `true`.
   181  	IgnoreDeletionError pulumi.BoolPtrInput
   182  	// JSON string containing the IAM policy to apply as the Glacier Vault Lock policy.
   183  	Policy pulumi.StringPtrInput
   184  	// The name of the Glacier Vault.
   185  	VaultName pulumi.StringPtrInput
   186  }
   187  
   188  func (VaultLockState) ElementType() reflect.Type {
   189  	return reflect.TypeOf((*vaultLockState)(nil)).Elem()
   190  }
   191  
   192  type vaultLockArgs struct {
   193  	// Boolean whether to permanently apply this Glacier Lock Policy. Once completed, this cannot be undone. If set to `false`, the Glacier Lock Policy remains in a testing mode for 24 hours. After that time, the Glacier Lock Policy is automatically removed by Glacier and the this provider resource will show as needing recreation. Changing this from `false` to `true` will show as resource recreation, which is expected. Changing this from `true` to `false` is not possible unless the Glacier Vault is recreated at the same time.
   194  	CompleteLock bool `pulumi:"completeLock"`
   195  	// Allow this provider to ignore the error returned when attempting to delete the Glacier Lock Policy. This can be used to delete or recreate the Glacier Vault via this provider, for example, if the Glacier Vault Lock policy permits that action. This should only be used in conjunction with `completeLock` being set to `true`.
   196  	IgnoreDeletionError *bool `pulumi:"ignoreDeletionError"`
   197  	// JSON string containing the IAM policy to apply as the Glacier Vault Lock policy.
   198  	Policy string `pulumi:"policy"`
   199  	// The name of the Glacier Vault.
   200  	VaultName string `pulumi:"vaultName"`
   201  }
   202  
   203  // The set of arguments for constructing a VaultLock resource.
   204  type VaultLockArgs struct {
   205  	// Boolean whether to permanently apply this Glacier Lock Policy. Once completed, this cannot be undone. If set to `false`, the Glacier Lock Policy remains in a testing mode for 24 hours. After that time, the Glacier Lock Policy is automatically removed by Glacier and the this provider resource will show as needing recreation. Changing this from `false` to `true` will show as resource recreation, which is expected. Changing this from `true` to `false` is not possible unless the Glacier Vault is recreated at the same time.
   206  	CompleteLock pulumi.BoolInput
   207  	// Allow this provider to ignore the error returned when attempting to delete the Glacier Lock Policy. This can be used to delete or recreate the Glacier Vault via this provider, for example, if the Glacier Vault Lock policy permits that action. This should only be used in conjunction with `completeLock` being set to `true`.
   208  	IgnoreDeletionError pulumi.BoolPtrInput
   209  	// JSON string containing the IAM policy to apply as the Glacier Vault Lock policy.
   210  	Policy pulumi.StringInput
   211  	// The name of the Glacier Vault.
   212  	VaultName pulumi.StringInput
   213  }
   214  
   215  func (VaultLockArgs) ElementType() reflect.Type {
   216  	return reflect.TypeOf((*vaultLockArgs)(nil)).Elem()
   217  }
   218  
   219  type VaultLockInput interface {
   220  	pulumi.Input
   221  
   222  	ToVaultLockOutput() VaultLockOutput
   223  	ToVaultLockOutputWithContext(ctx context.Context) VaultLockOutput
   224  }
   225  
   226  func (*VaultLock) ElementType() reflect.Type {
   227  	return reflect.TypeOf((**VaultLock)(nil)).Elem()
   228  }
   229  
   230  func (i *VaultLock) ToVaultLockOutput() VaultLockOutput {
   231  	return i.ToVaultLockOutputWithContext(context.Background())
   232  }
   233  
   234  func (i *VaultLock) ToVaultLockOutputWithContext(ctx context.Context) VaultLockOutput {
   235  	return pulumi.ToOutputWithContext(ctx, i).(VaultLockOutput)
   236  }
   237  
   238  // VaultLockArrayInput is an input type that accepts VaultLockArray and VaultLockArrayOutput values.
   239  // You can construct a concrete instance of `VaultLockArrayInput` via:
   240  //
   241  //	VaultLockArray{ VaultLockArgs{...} }
   242  type VaultLockArrayInput interface {
   243  	pulumi.Input
   244  
   245  	ToVaultLockArrayOutput() VaultLockArrayOutput
   246  	ToVaultLockArrayOutputWithContext(context.Context) VaultLockArrayOutput
   247  }
   248  
   249  type VaultLockArray []VaultLockInput
   250  
   251  func (VaultLockArray) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*[]*VaultLock)(nil)).Elem()
   253  }
   254  
   255  func (i VaultLockArray) ToVaultLockArrayOutput() VaultLockArrayOutput {
   256  	return i.ToVaultLockArrayOutputWithContext(context.Background())
   257  }
   258  
   259  func (i VaultLockArray) ToVaultLockArrayOutputWithContext(ctx context.Context) VaultLockArrayOutput {
   260  	return pulumi.ToOutputWithContext(ctx, i).(VaultLockArrayOutput)
   261  }
   262  
   263  // VaultLockMapInput is an input type that accepts VaultLockMap and VaultLockMapOutput values.
   264  // You can construct a concrete instance of `VaultLockMapInput` via:
   265  //
   266  //	VaultLockMap{ "key": VaultLockArgs{...} }
   267  type VaultLockMapInput interface {
   268  	pulumi.Input
   269  
   270  	ToVaultLockMapOutput() VaultLockMapOutput
   271  	ToVaultLockMapOutputWithContext(context.Context) VaultLockMapOutput
   272  }
   273  
   274  type VaultLockMap map[string]VaultLockInput
   275  
   276  func (VaultLockMap) ElementType() reflect.Type {
   277  	return reflect.TypeOf((*map[string]*VaultLock)(nil)).Elem()
   278  }
   279  
   280  func (i VaultLockMap) ToVaultLockMapOutput() VaultLockMapOutput {
   281  	return i.ToVaultLockMapOutputWithContext(context.Background())
   282  }
   283  
   284  func (i VaultLockMap) ToVaultLockMapOutputWithContext(ctx context.Context) VaultLockMapOutput {
   285  	return pulumi.ToOutputWithContext(ctx, i).(VaultLockMapOutput)
   286  }
   287  
   288  type VaultLockOutput struct{ *pulumi.OutputState }
   289  
   290  func (VaultLockOutput) ElementType() reflect.Type {
   291  	return reflect.TypeOf((**VaultLock)(nil)).Elem()
   292  }
   293  
   294  func (o VaultLockOutput) ToVaultLockOutput() VaultLockOutput {
   295  	return o
   296  }
   297  
   298  func (o VaultLockOutput) ToVaultLockOutputWithContext(ctx context.Context) VaultLockOutput {
   299  	return o
   300  }
   301  
   302  // Boolean whether to permanently apply this Glacier Lock Policy. Once completed, this cannot be undone. If set to `false`, the Glacier Lock Policy remains in a testing mode for 24 hours. After that time, the Glacier Lock Policy is automatically removed by Glacier and the this provider resource will show as needing recreation. Changing this from `false` to `true` will show as resource recreation, which is expected. Changing this from `true` to `false` is not possible unless the Glacier Vault is recreated at the same time.
   303  func (o VaultLockOutput) CompleteLock() pulumi.BoolOutput {
   304  	return o.ApplyT(func(v *VaultLock) pulumi.BoolOutput { return v.CompleteLock }).(pulumi.BoolOutput)
   305  }
   306  
   307  // Allow this provider to ignore the error returned when attempting to delete the Glacier Lock Policy. This can be used to delete or recreate the Glacier Vault via this provider, for example, if the Glacier Vault Lock policy permits that action. This should only be used in conjunction with `completeLock` being set to `true`.
   308  func (o VaultLockOutput) IgnoreDeletionError() pulumi.BoolPtrOutput {
   309  	return o.ApplyT(func(v *VaultLock) pulumi.BoolPtrOutput { return v.IgnoreDeletionError }).(pulumi.BoolPtrOutput)
   310  }
   311  
   312  // JSON string containing the IAM policy to apply as the Glacier Vault Lock policy.
   313  func (o VaultLockOutput) Policy() pulumi.StringOutput {
   314  	return o.ApplyT(func(v *VaultLock) pulumi.StringOutput { return v.Policy }).(pulumi.StringOutput)
   315  }
   316  
   317  // The name of the Glacier Vault.
   318  func (o VaultLockOutput) VaultName() pulumi.StringOutput {
   319  	return o.ApplyT(func(v *VaultLock) pulumi.StringOutput { return v.VaultName }).(pulumi.StringOutput)
   320  }
   321  
   322  type VaultLockArrayOutput struct{ *pulumi.OutputState }
   323  
   324  func (VaultLockArrayOutput) ElementType() reflect.Type {
   325  	return reflect.TypeOf((*[]*VaultLock)(nil)).Elem()
   326  }
   327  
   328  func (o VaultLockArrayOutput) ToVaultLockArrayOutput() VaultLockArrayOutput {
   329  	return o
   330  }
   331  
   332  func (o VaultLockArrayOutput) ToVaultLockArrayOutputWithContext(ctx context.Context) VaultLockArrayOutput {
   333  	return o
   334  }
   335  
   336  func (o VaultLockArrayOutput) Index(i pulumi.IntInput) VaultLockOutput {
   337  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VaultLock {
   338  		return vs[0].([]*VaultLock)[vs[1].(int)]
   339  	}).(VaultLockOutput)
   340  }
   341  
   342  type VaultLockMapOutput struct{ *pulumi.OutputState }
   343  
   344  func (VaultLockMapOutput) ElementType() reflect.Type {
   345  	return reflect.TypeOf((*map[string]*VaultLock)(nil)).Elem()
   346  }
   347  
   348  func (o VaultLockMapOutput) ToVaultLockMapOutput() VaultLockMapOutput {
   349  	return o
   350  }
   351  
   352  func (o VaultLockMapOutput) ToVaultLockMapOutputWithContext(ctx context.Context) VaultLockMapOutput {
   353  	return o
   354  }
   355  
   356  func (o VaultLockMapOutput) MapIndex(k pulumi.StringInput) VaultLockOutput {
   357  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VaultLock {
   358  		return vs[0].(map[string]*VaultLock)[vs[1].(string)]
   359  	}).(VaultLockOutput)
   360  }
   361  
   362  func init() {
   363  	pulumi.RegisterInputType(reflect.TypeOf((*VaultLockInput)(nil)).Elem(), &VaultLock{})
   364  	pulumi.RegisterInputType(reflect.TypeOf((*VaultLockArrayInput)(nil)).Elem(), VaultLockArray{})
   365  	pulumi.RegisterInputType(reflect.TypeOf((*VaultLockMapInput)(nil)).Elem(), VaultLockMap{})
   366  	pulumi.RegisterOutputType(VaultLockOutput{})
   367  	pulumi.RegisterOutputType(VaultLockArrayOutput{})
   368  	pulumi.RegisterOutputType(VaultLockMapOutput{})
   369  }