github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/accessanalyzer/archiveRule.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 accessanalyzer
     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  // Resource for managing an AWS AccessAnalyzer Archive Rule.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/accessanalyzer"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := accessanalyzer.NewArchiveRule(ctx, "example", &accessanalyzer.ArchiveRuleArgs{
    35  //				AnalyzerName: pulumi.String("example-analyzer"),
    36  //				RuleName:     pulumi.String("example-rule"),
    37  //				Filters: accessanalyzer.ArchiveRuleFilterArray{
    38  //					&accessanalyzer.ArchiveRuleFilterArgs{
    39  //						Criteria: pulumi.String("condition.aws:UserId"),
    40  //						Eqs: pulumi.StringArray{
    41  //							pulumi.String("userid"),
    42  //						},
    43  //					},
    44  //					&accessanalyzer.ArchiveRuleFilterArgs{
    45  //						Criteria: pulumi.String("error"),
    46  //						Exists:   pulumi.String("true"),
    47  //					},
    48  //					&accessanalyzer.ArchiveRuleFilterArgs{
    49  //						Criteria: pulumi.String("isPublic"),
    50  //						Eqs: pulumi.StringArray{
    51  //							pulumi.String("false"),
    52  //						},
    53  //					},
    54  //				},
    55  //			})
    56  //			if err != nil {
    57  //				return err
    58  //			}
    59  //			return nil
    60  //		})
    61  //	}
    62  //
    63  // ```
    64  // <!--End PulumiCodeChooser -->
    65  //
    66  // ## Import
    67  //
    68  // Using `pulumi import`, import AccessAnalyzer ArchiveRule using the `analyzer_name/rule_name`. For example:
    69  //
    70  // ```sh
    71  // $ pulumi import aws:accessanalyzer/archiveRule:ArchiveRule example example-analyzer/example-rule
    72  // ```
    73  type ArchiveRule struct {
    74  	pulumi.CustomResourceState
    75  
    76  	// Analyzer name.
    77  	AnalyzerName pulumi.StringOutput `pulumi:"analyzerName"`
    78  	// Filter criteria for the archive rule. See Filter for more details.
    79  	Filters ArchiveRuleFilterArrayOutput `pulumi:"filters"`
    80  	// Rule name.
    81  	RuleName pulumi.StringOutput `pulumi:"ruleName"`
    82  }
    83  
    84  // NewArchiveRule registers a new resource with the given unique name, arguments, and options.
    85  func NewArchiveRule(ctx *pulumi.Context,
    86  	name string, args *ArchiveRuleArgs, opts ...pulumi.ResourceOption) (*ArchiveRule, error) {
    87  	if args == nil {
    88  		return nil, errors.New("missing one or more required arguments")
    89  	}
    90  
    91  	if args.AnalyzerName == nil {
    92  		return nil, errors.New("invalid value for required argument 'AnalyzerName'")
    93  	}
    94  	if args.Filters == nil {
    95  		return nil, errors.New("invalid value for required argument 'Filters'")
    96  	}
    97  	if args.RuleName == nil {
    98  		return nil, errors.New("invalid value for required argument 'RuleName'")
    99  	}
   100  	opts = internal.PkgResourceDefaultOpts(opts)
   101  	var resource ArchiveRule
   102  	err := ctx.RegisterResource("aws:accessanalyzer/archiveRule:ArchiveRule", name, args, &resource, opts...)
   103  	if err != nil {
   104  		return nil, err
   105  	}
   106  	return &resource, nil
   107  }
   108  
   109  // GetArchiveRule gets an existing ArchiveRule resource's state with the given name, ID, and optional
   110  // state properties that are used to uniquely qualify the lookup (nil if not required).
   111  func GetArchiveRule(ctx *pulumi.Context,
   112  	name string, id pulumi.IDInput, state *ArchiveRuleState, opts ...pulumi.ResourceOption) (*ArchiveRule, error) {
   113  	var resource ArchiveRule
   114  	err := ctx.ReadResource("aws:accessanalyzer/archiveRule:ArchiveRule", name, id, state, &resource, opts...)
   115  	if err != nil {
   116  		return nil, err
   117  	}
   118  	return &resource, nil
   119  }
   120  
   121  // Input properties used for looking up and filtering ArchiveRule resources.
   122  type archiveRuleState struct {
   123  	// Analyzer name.
   124  	AnalyzerName *string `pulumi:"analyzerName"`
   125  	// Filter criteria for the archive rule. See Filter for more details.
   126  	Filters []ArchiveRuleFilter `pulumi:"filters"`
   127  	// Rule name.
   128  	RuleName *string `pulumi:"ruleName"`
   129  }
   130  
   131  type ArchiveRuleState struct {
   132  	// Analyzer name.
   133  	AnalyzerName pulumi.StringPtrInput
   134  	// Filter criteria for the archive rule. See Filter for more details.
   135  	Filters ArchiveRuleFilterArrayInput
   136  	// Rule name.
   137  	RuleName pulumi.StringPtrInput
   138  }
   139  
   140  func (ArchiveRuleState) ElementType() reflect.Type {
   141  	return reflect.TypeOf((*archiveRuleState)(nil)).Elem()
   142  }
   143  
   144  type archiveRuleArgs struct {
   145  	// Analyzer name.
   146  	AnalyzerName string `pulumi:"analyzerName"`
   147  	// Filter criteria for the archive rule. See Filter for more details.
   148  	Filters []ArchiveRuleFilter `pulumi:"filters"`
   149  	// Rule name.
   150  	RuleName string `pulumi:"ruleName"`
   151  }
   152  
   153  // The set of arguments for constructing a ArchiveRule resource.
   154  type ArchiveRuleArgs struct {
   155  	// Analyzer name.
   156  	AnalyzerName pulumi.StringInput
   157  	// Filter criteria for the archive rule. See Filter for more details.
   158  	Filters ArchiveRuleFilterArrayInput
   159  	// Rule name.
   160  	RuleName pulumi.StringInput
   161  }
   162  
   163  func (ArchiveRuleArgs) ElementType() reflect.Type {
   164  	return reflect.TypeOf((*archiveRuleArgs)(nil)).Elem()
   165  }
   166  
   167  type ArchiveRuleInput interface {
   168  	pulumi.Input
   169  
   170  	ToArchiveRuleOutput() ArchiveRuleOutput
   171  	ToArchiveRuleOutputWithContext(ctx context.Context) ArchiveRuleOutput
   172  }
   173  
   174  func (*ArchiveRule) ElementType() reflect.Type {
   175  	return reflect.TypeOf((**ArchiveRule)(nil)).Elem()
   176  }
   177  
   178  func (i *ArchiveRule) ToArchiveRuleOutput() ArchiveRuleOutput {
   179  	return i.ToArchiveRuleOutputWithContext(context.Background())
   180  }
   181  
   182  func (i *ArchiveRule) ToArchiveRuleOutputWithContext(ctx context.Context) ArchiveRuleOutput {
   183  	return pulumi.ToOutputWithContext(ctx, i).(ArchiveRuleOutput)
   184  }
   185  
   186  // ArchiveRuleArrayInput is an input type that accepts ArchiveRuleArray and ArchiveRuleArrayOutput values.
   187  // You can construct a concrete instance of `ArchiveRuleArrayInput` via:
   188  //
   189  //	ArchiveRuleArray{ ArchiveRuleArgs{...} }
   190  type ArchiveRuleArrayInput interface {
   191  	pulumi.Input
   192  
   193  	ToArchiveRuleArrayOutput() ArchiveRuleArrayOutput
   194  	ToArchiveRuleArrayOutputWithContext(context.Context) ArchiveRuleArrayOutput
   195  }
   196  
   197  type ArchiveRuleArray []ArchiveRuleInput
   198  
   199  func (ArchiveRuleArray) ElementType() reflect.Type {
   200  	return reflect.TypeOf((*[]*ArchiveRule)(nil)).Elem()
   201  }
   202  
   203  func (i ArchiveRuleArray) ToArchiveRuleArrayOutput() ArchiveRuleArrayOutput {
   204  	return i.ToArchiveRuleArrayOutputWithContext(context.Background())
   205  }
   206  
   207  func (i ArchiveRuleArray) ToArchiveRuleArrayOutputWithContext(ctx context.Context) ArchiveRuleArrayOutput {
   208  	return pulumi.ToOutputWithContext(ctx, i).(ArchiveRuleArrayOutput)
   209  }
   210  
   211  // ArchiveRuleMapInput is an input type that accepts ArchiveRuleMap and ArchiveRuleMapOutput values.
   212  // You can construct a concrete instance of `ArchiveRuleMapInput` via:
   213  //
   214  //	ArchiveRuleMap{ "key": ArchiveRuleArgs{...} }
   215  type ArchiveRuleMapInput interface {
   216  	pulumi.Input
   217  
   218  	ToArchiveRuleMapOutput() ArchiveRuleMapOutput
   219  	ToArchiveRuleMapOutputWithContext(context.Context) ArchiveRuleMapOutput
   220  }
   221  
   222  type ArchiveRuleMap map[string]ArchiveRuleInput
   223  
   224  func (ArchiveRuleMap) ElementType() reflect.Type {
   225  	return reflect.TypeOf((*map[string]*ArchiveRule)(nil)).Elem()
   226  }
   227  
   228  func (i ArchiveRuleMap) ToArchiveRuleMapOutput() ArchiveRuleMapOutput {
   229  	return i.ToArchiveRuleMapOutputWithContext(context.Background())
   230  }
   231  
   232  func (i ArchiveRuleMap) ToArchiveRuleMapOutputWithContext(ctx context.Context) ArchiveRuleMapOutput {
   233  	return pulumi.ToOutputWithContext(ctx, i).(ArchiveRuleMapOutput)
   234  }
   235  
   236  type ArchiveRuleOutput struct{ *pulumi.OutputState }
   237  
   238  func (ArchiveRuleOutput) ElementType() reflect.Type {
   239  	return reflect.TypeOf((**ArchiveRule)(nil)).Elem()
   240  }
   241  
   242  func (o ArchiveRuleOutput) ToArchiveRuleOutput() ArchiveRuleOutput {
   243  	return o
   244  }
   245  
   246  func (o ArchiveRuleOutput) ToArchiveRuleOutputWithContext(ctx context.Context) ArchiveRuleOutput {
   247  	return o
   248  }
   249  
   250  // Analyzer name.
   251  func (o ArchiveRuleOutput) AnalyzerName() pulumi.StringOutput {
   252  	return o.ApplyT(func(v *ArchiveRule) pulumi.StringOutput { return v.AnalyzerName }).(pulumi.StringOutput)
   253  }
   254  
   255  // Filter criteria for the archive rule. See Filter for more details.
   256  func (o ArchiveRuleOutput) Filters() ArchiveRuleFilterArrayOutput {
   257  	return o.ApplyT(func(v *ArchiveRule) ArchiveRuleFilterArrayOutput { return v.Filters }).(ArchiveRuleFilterArrayOutput)
   258  }
   259  
   260  // Rule name.
   261  func (o ArchiveRuleOutput) RuleName() pulumi.StringOutput {
   262  	return o.ApplyT(func(v *ArchiveRule) pulumi.StringOutput { return v.RuleName }).(pulumi.StringOutput)
   263  }
   264  
   265  type ArchiveRuleArrayOutput struct{ *pulumi.OutputState }
   266  
   267  func (ArchiveRuleArrayOutput) ElementType() reflect.Type {
   268  	return reflect.TypeOf((*[]*ArchiveRule)(nil)).Elem()
   269  }
   270  
   271  func (o ArchiveRuleArrayOutput) ToArchiveRuleArrayOutput() ArchiveRuleArrayOutput {
   272  	return o
   273  }
   274  
   275  func (o ArchiveRuleArrayOutput) ToArchiveRuleArrayOutputWithContext(ctx context.Context) ArchiveRuleArrayOutput {
   276  	return o
   277  }
   278  
   279  func (o ArchiveRuleArrayOutput) Index(i pulumi.IntInput) ArchiveRuleOutput {
   280  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ArchiveRule {
   281  		return vs[0].([]*ArchiveRule)[vs[1].(int)]
   282  	}).(ArchiveRuleOutput)
   283  }
   284  
   285  type ArchiveRuleMapOutput struct{ *pulumi.OutputState }
   286  
   287  func (ArchiveRuleMapOutput) ElementType() reflect.Type {
   288  	return reflect.TypeOf((*map[string]*ArchiveRule)(nil)).Elem()
   289  }
   290  
   291  func (o ArchiveRuleMapOutput) ToArchiveRuleMapOutput() ArchiveRuleMapOutput {
   292  	return o
   293  }
   294  
   295  func (o ArchiveRuleMapOutput) ToArchiveRuleMapOutputWithContext(ctx context.Context) ArchiveRuleMapOutput {
   296  	return o
   297  }
   298  
   299  func (o ArchiveRuleMapOutput) MapIndex(k pulumi.StringInput) ArchiveRuleOutput {
   300  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ArchiveRule {
   301  		return vs[0].(map[string]*ArchiveRule)[vs[1].(string)]
   302  	}).(ArchiveRuleOutput)
   303  }
   304  
   305  func init() {
   306  	pulumi.RegisterInputType(reflect.TypeOf((*ArchiveRuleInput)(nil)).Elem(), &ArchiveRule{})
   307  	pulumi.RegisterInputType(reflect.TypeOf((*ArchiveRuleArrayInput)(nil)).Elem(), ArchiveRuleArray{})
   308  	pulumi.RegisterInputType(reflect.TypeOf((*ArchiveRuleMapInput)(nil)).Elem(), ArchiveRuleMap{})
   309  	pulumi.RegisterOutputType(ArchiveRuleOutput{})
   310  	pulumi.RegisterOutputType(ArchiveRuleArrayOutput{})
   311  	pulumi.RegisterOutputType(ArchiveRuleMapOutput{})
   312  }