github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/guardduty/inviteAccepter.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 guardduty
     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 a resource to accept a pending GuardDuty invite on creation, ensure the detector has the correct primary account on read, and disassociate with the primary account upon removal.
    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/guardduty"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			primary, err := guardduty.NewDetector(ctx, "primary", nil)
    33  //			if err != nil {
    34  //				return err
    35  //			}
    36  //			memberDetector, err := guardduty.NewDetector(ctx, "member", nil)
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			memberMember, err := guardduty.NewMember(ctx, "member", &guardduty.MemberArgs{
    41  //				AccountId:  memberDetector.AccountId,
    42  //				DetectorId: primary.ID(),
    43  //				Email:      pulumi.String("required@example.com"),
    44  //				Invite:     pulumi.Bool(true),
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			_, err = guardduty.NewInviteAccepter(ctx, "member", &guardduty.InviteAccepterArgs{
    50  //				DetectorId:      memberDetector.ID(),
    51  //				MasterAccountId: primary.AccountId,
    52  //			}, pulumi.DependsOn([]pulumi.Resource{
    53  //				memberMember,
    54  //			}))
    55  //			if err != nil {
    56  //				return err
    57  //			}
    58  //			return nil
    59  //		})
    60  //	}
    61  //
    62  // ```
    63  // <!--End PulumiCodeChooser -->
    64  //
    65  // ## Import
    66  //
    67  // Using `pulumi import`, import `aws_guardduty_invite_accepter` using the member GuardDuty detector ID. For example:
    68  //
    69  // ```sh
    70  // $ pulumi import aws:guardduty/inviteAccepter:InviteAccepter member 00b00fd5aecc0ab60a708659477e9617
    71  // ```
    72  type InviteAccepter struct {
    73  	pulumi.CustomResourceState
    74  
    75  	// The detector ID of the member GuardDuty account.
    76  	DetectorId pulumi.StringOutput `pulumi:"detectorId"`
    77  	// AWS account ID for primary account.
    78  	MasterAccountId pulumi.StringOutput `pulumi:"masterAccountId"`
    79  }
    80  
    81  // NewInviteAccepter registers a new resource with the given unique name, arguments, and options.
    82  func NewInviteAccepter(ctx *pulumi.Context,
    83  	name string, args *InviteAccepterArgs, opts ...pulumi.ResourceOption) (*InviteAccepter, error) {
    84  	if args == nil {
    85  		return nil, errors.New("missing one or more required arguments")
    86  	}
    87  
    88  	if args.DetectorId == nil {
    89  		return nil, errors.New("invalid value for required argument 'DetectorId'")
    90  	}
    91  	if args.MasterAccountId == nil {
    92  		return nil, errors.New("invalid value for required argument 'MasterAccountId'")
    93  	}
    94  	opts = internal.PkgResourceDefaultOpts(opts)
    95  	var resource InviteAccepter
    96  	err := ctx.RegisterResource("aws:guardduty/inviteAccepter:InviteAccepter", name, args, &resource, opts...)
    97  	if err != nil {
    98  		return nil, err
    99  	}
   100  	return &resource, nil
   101  }
   102  
   103  // GetInviteAccepter gets an existing InviteAccepter resource's state with the given name, ID, and optional
   104  // state properties that are used to uniquely qualify the lookup (nil if not required).
   105  func GetInviteAccepter(ctx *pulumi.Context,
   106  	name string, id pulumi.IDInput, state *InviteAccepterState, opts ...pulumi.ResourceOption) (*InviteAccepter, error) {
   107  	var resource InviteAccepter
   108  	err := ctx.ReadResource("aws:guardduty/inviteAccepter:InviteAccepter", name, id, state, &resource, opts...)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	return &resource, nil
   113  }
   114  
   115  // Input properties used for looking up and filtering InviteAccepter resources.
   116  type inviteAccepterState struct {
   117  	// The detector ID of the member GuardDuty account.
   118  	DetectorId *string `pulumi:"detectorId"`
   119  	// AWS account ID for primary account.
   120  	MasterAccountId *string `pulumi:"masterAccountId"`
   121  }
   122  
   123  type InviteAccepterState struct {
   124  	// The detector ID of the member GuardDuty account.
   125  	DetectorId pulumi.StringPtrInput
   126  	// AWS account ID for primary account.
   127  	MasterAccountId pulumi.StringPtrInput
   128  }
   129  
   130  func (InviteAccepterState) ElementType() reflect.Type {
   131  	return reflect.TypeOf((*inviteAccepterState)(nil)).Elem()
   132  }
   133  
   134  type inviteAccepterArgs struct {
   135  	// The detector ID of the member GuardDuty account.
   136  	DetectorId string `pulumi:"detectorId"`
   137  	// AWS account ID for primary account.
   138  	MasterAccountId string `pulumi:"masterAccountId"`
   139  }
   140  
   141  // The set of arguments for constructing a InviteAccepter resource.
   142  type InviteAccepterArgs struct {
   143  	// The detector ID of the member GuardDuty account.
   144  	DetectorId pulumi.StringInput
   145  	// AWS account ID for primary account.
   146  	MasterAccountId pulumi.StringInput
   147  }
   148  
   149  func (InviteAccepterArgs) ElementType() reflect.Type {
   150  	return reflect.TypeOf((*inviteAccepterArgs)(nil)).Elem()
   151  }
   152  
   153  type InviteAccepterInput interface {
   154  	pulumi.Input
   155  
   156  	ToInviteAccepterOutput() InviteAccepterOutput
   157  	ToInviteAccepterOutputWithContext(ctx context.Context) InviteAccepterOutput
   158  }
   159  
   160  func (*InviteAccepter) ElementType() reflect.Type {
   161  	return reflect.TypeOf((**InviteAccepter)(nil)).Elem()
   162  }
   163  
   164  func (i *InviteAccepter) ToInviteAccepterOutput() InviteAccepterOutput {
   165  	return i.ToInviteAccepterOutputWithContext(context.Background())
   166  }
   167  
   168  func (i *InviteAccepter) ToInviteAccepterOutputWithContext(ctx context.Context) InviteAccepterOutput {
   169  	return pulumi.ToOutputWithContext(ctx, i).(InviteAccepterOutput)
   170  }
   171  
   172  // InviteAccepterArrayInput is an input type that accepts InviteAccepterArray and InviteAccepterArrayOutput values.
   173  // You can construct a concrete instance of `InviteAccepterArrayInput` via:
   174  //
   175  //	InviteAccepterArray{ InviteAccepterArgs{...} }
   176  type InviteAccepterArrayInput interface {
   177  	pulumi.Input
   178  
   179  	ToInviteAccepterArrayOutput() InviteAccepterArrayOutput
   180  	ToInviteAccepterArrayOutputWithContext(context.Context) InviteAccepterArrayOutput
   181  }
   182  
   183  type InviteAccepterArray []InviteAccepterInput
   184  
   185  func (InviteAccepterArray) ElementType() reflect.Type {
   186  	return reflect.TypeOf((*[]*InviteAccepter)(nil)).Elem()
   187  }
   188  
   189  func (i InviteAccepterArray) ToInviteAccepterArrayOutput() InviteAccepterArrayOutput {
   190  	return i.ToInviteAccepterArrayOutputWithContext(context.Background())
   191  }
   192  
   193  func (i InviteAccepterArray) ToInviteAccepterArrayOutputWithContext(ctx context.Context) InviteAccepterArrayOutput {
   194  	return pulumi.ToOutputWithContext(ctx, i).(InviteAccepterArrayOutput)
   195  }
   196  
   197  // InviteAccepterMapInput is an input type that accepts InviteAccepterMap and InviteAccepterMapOutput values.
   198  // You can construct a concrete instance of `InviteAccepterMapInput` via:
   199  //
   200  //	InviteAccepterMap{ "key": InviteAccepterArgs{...} }
   201  type InviteAccepterMapInput interface {
   202  	pulumi.Input
   203  
   204  	ToInviteAccepterMapOutput() InviteAccepterMapOutput
   205  	ToInviteAccepterMapOutputWithContext(context.Context) InviteAccepterMapOutput
   206  }
   207  
   208  type InviteAccepterMap map[string]InviteAccepterInput
   209  
   210  func (InviteAccepterMap) ElementType() reflect.Type {
   211  	return reflect.TypeOf((*map[string]*InviteAccepter)(nil)).Elem()
   212  }
   213  
   214  func (i InviteAccepterMap) ToInviteAccepterMapOutput() InviteAccepterMapOutput {
   215  	return i.ToInviteAccepterMapOutputWithContext(context.Background())
   216  }
   217  
   218  func (i InviteAccepterMap) ToInviteAccepterMapOutputWithContext(ctx context.Context) InviteAccepterMapOutput {
   219  	return pulumi.ToOutputWithContext(ctx, i).(InviteAccepterMapOutput)
   220  }
   221  
   222  type InviteAccepterOutput struct{ *pulumi.OutputState }
   223  
   224  func (InviteAccepterOutput) ElementType() reflect.Type {
   225  	return reflect.TypeOf((**InviteAccepter)(nil)).Elem()
   226  }
   227  
   228  func (o InviteAccepterOutput) ToInviteAccepterOutput() InviteAccepterOutput {
   229  	return o
   230  }
   231  
   232  func (o InviteAccepterOutput) ToInviteAccepterOutputWithContext(ctx context.Context) InviteAccepterOutput {
   233  	return o
   234  }
   235  
   236  // The detector ID of the member GuardDuty account.
   237  func (o InviteAccepterOutput) DetectorId() pulumi.StringOutput {
   238  	return o.ApplyT(func(v *InviteAccepter) pulumi.StringOutput { return v.DetectorId }).(pulumi.StringOutput)
   239  }
   240  
   241  // AWS account ID for primary account.
   242  func (o InviteAccepterOutput) MasterAccountId() pulumi.StringOutput {
   243  	return o.ApplyT(func(v *InviteAccepter) pulumi.StringOutput { return v.MasterAccountId }).(pulumi.StringOutput)
   244  }
   245  
   246  type InviteAccepterArrayOutput struct{ *pulumi.OutputState }
   247  
   248  func (InviteAccepterArrayOutput) ElementType() reflect.Type {
   249  	return reflect.TypeOf((*[]*InviteAccepter)(nil)).Elem()
   250  }
   251  
   252  func (o InviteAccepterArrayOutput) ToInviteAccepterArrayOutput() InviteAccepterArrayOutput {
   253  	return o
   254  }
   255  
   256  func (o InviteAccepterArrayOutput) ToInviteAccepterArrayOutputWithContext(ctx context.Context) InviteAccepterArrayOutput {
   257  	return o
   258  }
   259  
   260  func (o InviteAccepterArrayOutput) Index(i pulumi.IntInput) InviteAccepterOutput {
   261  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *InviteAccepter {
   262  		return vs[0].([]*InviteAccepter)[vs[1].(int)]
   263  	}).(InviteAccepterOutput)
   264  }
   265  
   266  type InviteAccepterMapOutput struct{ *pulumi.OutputState }
   267  
   268  func (InviteAccepterMapOutput) ElementType() reflect.Type {
   269  	return reflect.TypeOf((*map[string]*InviteAccepter)(nil)).Elem()
   270  }
   271  
   272  func (o InviteAccepterMapOutput) ToInviteAccepterMapOutput() InviteAccepterMapOutput {
   273  	return o
   274  }
   275  
   276  func (o InviteAccepterMapOutput) ToInviteAccepterMapOutputWithContext(ctx context.Context) InviteAccepterMapOutput {
   277  	return o
   278  }
   279  
   280  func (o InviteAccepterMapOutput) MapIndex(k pulumi.StringInput) InviteAccepterOutput {
   281  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *InviteAccepter {
   282  		return vs[0].(map[string]*InviteAccepter)[vs[1].(string)]
   283  	}).(InviteAccepterOutput)
   284  }
   285  
   286  func init() {
   287  	pulumi.RegisterInputType(reflect.TypeOf((*InviteAccepterInput)(nil)).Elem(), &InviteAccepter{})
   288  	pulumi.RegisterInputType(reflect.TypeOf((*InviteAccepterArrayInput)(nil)).Elem(), InviteAccepterArray{})
   289  	pulumi.RegisterInputType(reflect.TypeOf((*InviteAccepterMapInput)(nil)).Elem(), InviteAccepterMap{})
   290  	pulumi.RegisterOutputType(InviteAccepterOutput{})
   291  	pulumi.RegisterOutputType(InviteAccepterArrayOutput{})
   292  	pulumi.RegisterOutputType(InviteAccepterMapOutput{})
   293  }