github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/glacier/vault.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Provides a Glacier Vault Resource. You can refer to the [Glacier Developer Guide](https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-vaults.html) for a full explanation of the Glacier Vault functionality
    15  //
    16  // > **NOTE:** When removing a Glacier Vault, the Vault must be empty.
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glacier"
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			awsSnsTopic, err := sns.NewTopic(ctx, "aws_sns_topic", &sns.TopicArgs{
    36  //				Name: pulumi.String("glacier-sns-topic"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			myArchive, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    42  //				Statements: []iam.GetPolicyDocumentStatement{
    43  //					{
    44  //						Sid:    pulumi.StringRef("add-read-only-perm"),
    45  //						Effect: pulumi.StringRef("Allow"),
    46  //						Principals: []iam.GetPolicyDocumentStatementPrincipal{
    47  //							{
    48  //								Type: "*",
    49  //								Identifiers: []string{
    50  //									"*",
    51  //								},
    52  //							},
    53  //						},
    54  //						Actions: []string{
    55  //							"glacier:InitiateJob",
    56  //							"glacier:GetJobOutput",
    57  //						},
    58  //						Resources: []string{
    59  //							"arn:aws:glacier:eu-west-1:432981146916:vaults/MyArchive",
    60  //						},
    61  //					},
    62  //				},
    63  //			}, nil)
    64  //			if err != nil {
    65  //				return err
    66  //			}
    67  //			_, err = glacier.NewVault(ctx, "my_archive", &glacier.VaultArgs{
    68  //				Name: pulumi.String("MyArchive"),
    69  //				Notification: &glacier.VaultNotificationArgs{
    70  //					SnsTopic: awsSnsTopic.Arn,
    71  //					Events: pulumi.StringArray{
    72  //						pulumi.String("ArchiveRetrievalCompleted"),
    73  //						pulumi.String("InventoryRetrievalCompleted"),
    74  //					},
    75  //				},
    76  //				AccessPolicy: pulumi.String(myArchive.Json),
    77  //				Tags: pulumi.StringMap{
    78  //					"Test": pulumi.String("MyArchive"),
    79  //				},
    80  //			})
    81  //			if err != nil {
    82  //				return err
    83  //			}
    84  //			return nil
    85  //		})
    86  //	}
    87  //
    88  // ```
    89  // <!--End PulumiCodeChooser -->
    90  //
    91  // ## Import
    92  //
    93  // Using `pulumi import`, import Glacier Vaults using the `name`. For example:
    94  //
    95  // ```sh
    96  // $ pulumi import aws:glacier/vault:Vault archive my_archive
    97  // ```
    98  type Vault struct {
    99  	pulumi.CustomResourceState
   100  
   101  	// The policy document. This is a JSON formatted string.
   102  	// The heredoc syntax or `file` function is helpful here. Use the [Glacier Developer Guide](https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html) for more information on Glacier Vault Policy
   103  	AccessPolicy pulumi.StringPtrOutput `pulumi:"accessPolicy"`
   104  	// The ARN of the vault.
   105  	Arn pulumi.StringOutput `pulumi:"arn"`
   106  	// The URI of the vault that was created.
   107  	Location pulumi.StringOutput `pulumi:"location"`
   108  	// The name of the Vault. Names can be between 1 and 255 characters long and the valid characters are a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), and '.' (period).
   109  	Name pulumi.StringOutput `pulumi:"name"`
   110  	// The notifications for the Vault. Fields documented below.
   111  	Notification VaultNotificationPtrOutput `pulumi:"notification"`
   112  	// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   113  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   114  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   115  	//
   116  	// Deprecated: Please use `tags` instead.
   117  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   118  }
   119  
   120  // NewVault registers a new resource with the given unique name, arguments, and options.
   121  func NewVault(ctx *pulumi.Context,
   122  	name string, args *VaultArgs, opts ...pulumi.ResourceOption) (*Vault, error) {
   123  	if args == nil {
   124  		args = &VaultArgs{}
   125  	}
   126  
   127  	opts = internal.PkgResourceDefaultOpts(opts)
   128  	var resource Vault
   129  	err := ctx.RegisterResource("aws:glacier/vault:Vault", name, args, &resource, opts...)
   130  	if err != nil {
   131  		return nil, err
   132  	}
   133  	return &resource, nil
   134  }
   135  
   136  // GetVault gets an existing Vault resource's state with the given name, ID, and optional
   137  // state properties that are used to uniquely qualify the lookup (nil if not required).
   138  func GetVault(ctx *pulumi.Context,
   139  	name string, id pulumi.IDInput, state *VaultState, opts ...pulumi.ResourceOption) (*Vault, error) {
   140  	var resource Vault
   141  	err := ctx.ReadResource("aws:glacier/vault:Vault", name, id, state, &resource, opts...)
   142  	if err != nil {
   143  		return nil, err
   144  	}
   145  	return &resource, nil
   146  }
   147  
   148  // Input properties used for looking up and filtering Vault resources.
   149  type vaultState struct {
   150  	// The policy document. This is a JSON formatted string.
   151  	// The heredoc syntax or `file` function is helpful here. Use the [Glacier Developer Guide](https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html) for more information on Glacier Vault Policy
   152  	AccessPolicy *string `pulumi:"accessPolicy"`
   153  	// The ARN of the vault.
   154  	Arn *string `pulumi:"arn"`
   155  	// The URI of the vault that was created.
   156  	Location *string `pulumi:"location"`
   157  	// The name of the Vault. Names can be between 1 and 255 characters long and the valid characters are a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), and '.' (period).
   158  	Name *string `pulumi:"name"`
   159  	// The notifications for the Vault. Fields documented below.
   160  	Notification *VaultNotification `pulumi:"notification"`
   161  	// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   162  	Tags map[string]string `pulumi:"tags"`
   163  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   164  	//
   165  	// Deprecated: Please use `tags` instead.
   166  	TagsAll map[string]string `pulumi:"tagsAll"`
   167  }
   168  
   169  type VaultState struct {
   170  	// The policy document. This is a JSON formatted string.
   171  	// The heredoc syntax or `file` function is helpful here. Use the [Glacier Developer Guide](https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html) for more information on Glacier Vault Policy
   172  	AccessPolicy pulumi.StringPtrInput
   173  	// The ARN of the vault.
   174  	Arn pulumi.StringPtrInput
   175  	// The URI of the vault that was created.
   176  	Location pulumi.StringPtrInput
   177  	// The name of the Vault. Names can be between 1 and 255 characters long and the valid characters are a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), and '.' (period).
   178  	Name pulumi.StringPtrInput
   179  	// The notifications for the Vault. Fields documented below.
   180  	Notification VaultNotificationPtrInput
   181  	// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   182  	Tags pulumi.StringMapInput
   183  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   184  	//
   185  	// Deprecated: Please use `tags` instead.
   186  	TagsAll pulumi.StringMapInput
   187  }
   188  
   189  func (VaultState) ElementType() reflect.Type {
   190  	return reflect.TypeOf((*vaultState)(nil)).Elem()
   191  }
   192  
   193  type vaultArgs struct {
   194  	// The policy document. This is a JSON formatted string.
   195  	// The heredoc syntax or `file` function is helpful here. Use the [Glacier Developer Guide](https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html) for more information on Glacier Vault Policy
   196  	AccessPolicy *string `pulumi:"accessPolicy"`
   197  	// The name of the Vault. Names can be between 1 and 255 characters long and the valid characters are a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), and '.' (period).
   198  	Name *string `pulumi:"name"`
   199  	// The notifications for the Vault. Fields documented below.
   200  	Notification *VaultNotification `pulumi:"notification"`
   201  	// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   202  	Tags map[string]string `pulumi:"tags"`
   203  }
   204  
   205  // The set of arguments for constructing a Vault resource.
   206  type VaultArgs struct {
   207  	// The policy document. This is a JSON formatted string.
   208  	// The heredoc syntax or `file` function is helpful here. Use the [Glacier Developer Guide](https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html) for more information on Glacier Vault Policy
   209  	AccessPolicy pulumi.StringPtrInput
   210  	// The name of the Vault. Names can be between 1 and 255 characters long and the valid characters are a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), and '.' (period).
   211  	Name pulumi.StringPtrInput
   212  	// The notifications for the Vault. Fields documented below.
   213  	Notification VaultNotificationPtrInput
   214  	// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   215  	Tags pulumi.StringMapInput
   216  }
   217  
   218  func (VaultArgs) ElementType() reflect.Type {
   219  	return reflect.TypeOf((*vaultArgs)(nil)).Elem()
   220  }
   221  
   222  type VaultInput interface {
   223  	pulumi.Input
   224  
   225  	ToVaultOutput() VaultOutput
   226  	ToVaultOutputWithContext(ctx context.Context) VaultOutput
   227  }
   228  
   229  func (*Vault) ElementType() reflect.Type {
   230  	return reflect.TypeOf((**Vault)(nil)).Elem()
   231  }
   232  
   233  func (i *Vault) ToVaultOutput() VaultOutput {
   234  	return i.ToVaultOutputWithContext(context.Background())
   235  }
   236  
   237  func (i *Vault) ToVaultOutputWithContext(ctx context.Context) VaultOutput {
   238  	return pulumi.ToOutputWithContext(ctx, i).(VaultOutput)
   239  }
   240  
   241  // VaultArrayInput is an input type that accepts VaultArray and VaultArrayOutput values.
   242  // You can construct a concrete instance of `VaultArrayInput` via:
   243  //
   244  //	VaultArray{ VaultArgs{...} }
   245  type VaultArrayInput interface {
   246  	pulumi.Input
   247  
   248  	ToVaultArrayOutput() VaultArrayOutput
   249  	ToVaultArrayOutputWithContext(context.Context) VaultArrayOutput
   250  }
   251  
   252  type VaultArray []VaultInput
   253  
   254  func (VaultArray) ElementType() reflect.Type {
   255  	return reflect.TypeOf((*[]*Vault)(nil)).Elem()
   256  }
   257  
   258  func (i VaultArray) ToVaultArrayOutput() VaultArrayOutput {
   259  	return i.ToVaultArrayOutputWithContext(context.Background())
   260  }
   261  
   262  func (i VaultArray) ToVaultArrayOutputWithContext(ctx context.Context) VaultArrayOutput {
   263  	return pulumi.ToOutputWithContext(ctx, i).(VaultArrayOutput)
   264  }
   265  
   266  // VaultMapInput is an input type that accepts VaultMap and VaultMapOutput values.
   267  // You can construct a concrete instance of `VaultMapInput` via:
   268  //
   269  //	VaultMap{ "key": VaultArgs{...} }
   270  type VaultMapInput interface {
   271  	pulumi.Input
   272  
   273  	ToVaultMapOutput() VaultMapOutput
   274  	ToVaultMapOutputWithContext(context.Context) VaultMapOutput
   275  }
   276  
   277  type VaultMap map[string]VaultInput
   278  
   279  func (VaultMap) ElementType() reflect.Type {
   280  	return reflect.TypeOf((*map[string]*Vault)(nil)).Elem()
   281  }
   282  
   283  func (i VaultMap) ToVaultMapOutput() VaultMapOutput {
   284  	return i.ToVaultMapOutputWithContext(context.Background())
   285  }
   286  
   287  func (i VaultMap) ToVaultMapOutputWithContext(ctx context.Context) VaultMapOutput {
   288  	return pulumi.ToOutputWithContext(ctx, i).(VaultMapOutput)
   289  }
   290  
   291  type VaultOutput struct{ *pulumi.OutputState }
   292  
   293  func (VaultOutput) ElementType() reflect.Type {
   294  	return reflect.TypeOf((**Vault)(nil)).Elem()
   295  }
   296  
   297  func (o VaultOutput) ToVaultOutput() VaultOutput {
   298  	return o
   299  }
   300  
   301  func (o VaultOutput) ToVaultOutputWithContext(ctx context.Context) VaultOutput {
   302  	return o
   303  }
   304  
   305  // The policy document. This is a JSON formatted string.
   306  // The heredoc syntax or `file` function is helpful here. Use the [Glacier Developer Guide](https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html) for more information on Glacier Vault Policy
   307  func (o VaultOutput) AccessPolicy() pulumi.StringPtrOutput {
   308  	return o.ApplyT(func(v *Vault) pulumi.StringPtrOutput { return v.AccessPolicy }).(pulumi.StringPtrOutput)
   309  }
   310  
   311  // The ARN of the vault.
   312  func (o VaultOutput) Arn() pulumi.StringOutput {
   313  	return o.ApplyT(func(v *Vault) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   314  }
   315  
   316  // The URI of the vault that was created.
   317  func (o VaultOutput) Location() pulumi.StringOutput {
   318  	return o.ApplyT(func(v *Vault) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
   319  }
   320  
   321  // The name of the Vault. Names can be between 1 and 255 characters long and the valid characters are a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), and '.' (period).
   322  func (o VaultOutput) Name() pulumi.StringOutput {
   323  	return o.ApplyT(func(v *Vault) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   324  }
   325  
   326  // The notifications for the Vault. Fields documented below.
   327  func (o VaultOutput) Notification() VaultNotificationPtrOutput {
   328  	return o.ApplyT(func(v *Vault) VaultNotificationPtrOutput { return v.Notification }).(VaultNotificationPtrOutput)
   329  }
   330  
   331  // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   332  func (o VaultOutput) Tags() pulumi.StringMapOutput {
   333  	return o.ApplyT(func(v *Vault) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   334  }
   335  
   336  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   337  //
   338  // Deprecated: Please use `tags` instead.
   339  func (o VaultOutput) TagsAll() pulumi.StringMapOutput {
   340  	return o.ApplyT(func(v *Vault) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   341  }
   342  
   343  type VaultArrayOutput struct{ *pulumi.OutputState }
   344  
   345  func (VaultArrayOutput) ElementType() reflect.Type {
   346  	return reflect.TypeOf((*[]*Vault)(nil)).Elem()
   347  }
   348  
   349  func (o VaultArrayOutput) ToVaultArrayOutput() VaultArrayOutput {
   350  	return o
   351  }
   352  
   353  func (o VaultArrayOutput) ToVaultArrayOutputWithContext(ctx context.Context) VaultArrayOutput {
   354  	return o
   355  }
   356  
   357  func (o VaultArrayOutput) Index(i pulumi.IntInput) VaultOutput {
   358  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Vault {
   359  		return vs[0].([]*Vault)[vs[1].(int)]
   360  	}).(VaultOutput)
   361  }
   362  
   363  type VaultMapOutput struct{ *pulumi.OutputState }
   364  
   365  func (VaultMapOutput) ElementType() reflect.Type {
   366  	return reflect.TypeOf((*map[string]*Vault)(nil)).Elem()
   367  }
   368  
   369  func (o VaultMapOutput) ToVaultMapOutput() VaultMapOutput {
   370  	return o
   371  }
   372  
   373  func (o VaultMapOutput) ToVaultMapOutputWithContext(ctx context.Context) VaultMapOutput {
   374  	return o
   375  }
   376  
   377  func (o VaultMapOutput) MapIndex(k pulumi.StringInput) VaultOutput {
   378  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Vault {
   379  		return vs[0].(map[string]*Vault)[vs[1].(string)]
   380  	}).(VaultOutput)
   381  }
   382  
   383  func init() {
   384  	pulumi.RegisterInputType(reflect.TypeOf((*VaultInput)(nil)).Elem(), &Vault{})
   385  	pulumi.RegisterInputType(reflect.TypeOf((*VaultArrayInput)(nil)).Elem(), VaultArray{})
   386  	pulumi.RegisterInputType(reflect.TypeOf((*VaultMapInput)(nil)).Elem(), VaultMap{})
   387  	pulumi.RegisterOutputType(VaultOutput{})
   388  	pulumi.RegisterOutputType(VaultArrayOutput{})
   389  	pulumi.RegisterOutputType(VaultMapOutput{})
   390  }