github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/securityhub/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 securityhub
     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  // > **Note:** AWS accounts can only be associated with a single Security Hub master account. Destroying this resource will disassociate the member account from the master account.
    16  //
    17  // Accepts a Security Hub invitation.
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/securityhub"
    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 := securityhub.NewAccount(ctx, "example", nil)
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			exampleMember, err := securityhub.NewMember(ctx, "example", &securityhub.MemberArgs{
    39  //				AccountId: pulumi.String("123456789012"),
    40  //				Email:     pulumi.String("example@example.com"),
    41  //				Invite:    pulumi.Bool(true),
    42  //			})
    43  //			if err != nil {
    44  //				return err
    45  //			}
    46  //			invitee, err := securityhub.NewAccount(ctx, "invitee", nil)
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			_, err = securityhub.NewInviteAccepter(ctx, "invitee", &securityhub.InviteAccepterArgs{
    51  //				MasterId: exampleMember.MasterId,
    52  //			}, pulumi.DependsOn([]pulumi.Resource{
    53  //				invitee,
    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 Security Hub invite acceptance using the account ID. For example:
    68  //
    69  // ```sh
    70  // $ pulumi import aws:securityhub/inviteAccepter:InviteAccepter example 123456789012
    71  // ```
    72  type InviteAccepter struct {
    73  	pulumi.CustomResourceState
    74  
    75  	// The ID of the invitation.
    76  	InvitationId pulumi.StringOutput `pulumi:"invitationId"`
    77  	// The account ID of the master Security Hub account whose invitation you're accepting.
    78  	MasterId pulumi.StringOutput `pulumi:"masterId"`
    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.MasterId == nil {
    89  		return nil, errors.New("invalid value for required argument 'MasterId'")
    90  	}
    91  	opts = internal.PkgResourceDefaultOpts(opts)
    92  	var resource InviteAccepter
    93  	err := ctx.RegisterResource("aws:securityhub/inviteAccepter:InviteAccepter", name, args, &resource, opts...)
    94  	if err != nil {
    95  		return nil, err
    96  	}
    97  	return &resource, nil
    98  }
    99  
   100  // GetInviteAccepter gets an existing InviteAccepter resource's state with the given name, ID, and optional
   101  // state properties that are used to uniquely qualify the lookup (nil if not required).
   102  func GetInviteAccepter(ctx *pulumi.Context,
   103  	name string, id pulumi.IDInput, state *InviteAccepterState, opts ...pulumi.ResourceOption) (*InviteAccepter, error) {
   104  	var resource InviteAccepter
   105  	err := ctx.ReadResource("aws:securityhub/inviteAccepter:InviteAccepter", name, id, state, &resource, opts...)
   106  	if err != nil {
   107  		return nil, err
   108  	}
   109  	return &resource, nil
   110  }
   111  
   112  // Input properties used for looking up and filtering InviteAccepter resources.
   113  type inviteAccepterState struct {
   114  	// The ID of the invitation.
   115  	InvitationId *string `pulumi:"invitationId"`
   116  	// The account ID of the master Security Hub account whose invitation you're accepting.
   117  	MasterId *string `pulumi:"masterId"`
   118  }
   119  
   120  type InviteAccepterState struct {
   121  	// The ID of the invitation.
   122  	InvitationId pulumi.StringPtrInput
   123  	// The account ID of the master Security Hub account whose invitation you're accepting.
   124  	MasterId pulumi.StringPtrInput
   125  }
   126  
   127  func (InviteAccepterState) ElementType() reflect.Type {
   128  	return reflect.TypeOf((*inviteAccepterState)(nil)).Elem()
   129  }
   130  
   131  type inviteAccepterArgs struct {
   132  	// The account ID of the master Security Hub account whose invitation you're accepting.
   133  	MasterId string `pulumi:"masterId"`
   134  }
   135  
   136  // The set of arguments for constructing a InviteAccepter resource.
   137  type InviteAccepterArgs struct {
   138  	// The account ID of the master Security Hub account whose invitation you're accepting.
   139  	MasterId pulumi.StringInput
   140  }
   141  
   142  func (InviteAccepterArgs) ElementType() reflect.Type {
   143  	return reflect.TypeOf((*inviteAccepterArgs)(nil)).Elem()
   144  }
   145  
   146  type InviteAccepterInput interface {
   147  	pulumi.Input
   148  
   149  	ToInviteAccepterOutput() InviteAccepterOutput
   150  	ToInviteAccepterOutputWithContext(ctx context.Context) InviteAccepterOutput
   151  }
   152  
   153  func (*InviteAccepter) ElementType() reflect.Type {
   154  	return reflect.TypeOf((**InviteAccepter)(nil)).Elem()
   155  }
   156  
   157  func (i *InviteAccepter) ToInviteAccepterOutput() InviteAccepterOutput {
   158  	return i.ToInviteAccepterOutputWithContext(context.Background())
   159  }
   160  
   161  func (i *InviteAccepter) ToInviteAccepterOutputWithContext(ctx context.Context) InviteAccepterOutput {
   162  	return pulumi.ToOutputWithContext(ctx, i).(InviteAccepterOutput)
   163  }
   164  
   165  // InviteAccepterArrayInput is an input type that accepts InviteAccepterArray and InviteAccepterArrayOutput values.
   166  // You can construct a concrete instance of `InviteAccepterArrayInput` via:
   167  //
   168  //	InviteAccepterArray{ InviteAccepterArgs{...} }
   169  type InviteAccepterArrayInput interface {
   170  	pulumi.Input
   171  
   172  	ToInviteAccepterArrayOutput() InviteAccepterArrayOutput
   173  	ToInviteAccepterArrayOutputWithContext(context.Context) InviteAccepterArrayOutput
   174  }
   175  
   176  type InviteAccepterArray []InviteAccepterInput
   177  
   178  func (InviteAccepterArray) ElementType() reflect.Type {
   179  	return reflect.TypeOf((*[]*InviteAccepter)(nil)).Elem()
   180  }
   181  
   182  func (i InviteAccepterArray) ToInviteAccepterArrayOutput() InviteAccepterArrayOutput {
   183  	return i.ToInviteAccepterArrayOutputWithContext(context.Background())
   184  }
   185  
   186  func (i InviteAccepterArray) ToInviteAccepterArrayOutputWithContext(ctx context.Context) InviteAccepterArrayOutput {
   187  	return pulumi.ToOutputWithContext(ctx, i).(InviteAccepterArrayOutput)
   188  }
   189  
   190  // InviteAccepterMapInput is an input type that accepts InviteAccepterMap and InviteAccepterMapOutput values.
   191  // You can construct a concrete instance of `InviteAccepterMapInput` via:
   192  //
   193  //	InviteAccepterMap{ "key": InviteAccepterArgs{...} }
   194  type InviteAccepterMapInput interface {
   195  	pulumi.Input
   196  
   197  	ToInviteAccepterMapOutput() InviteAccepterMapOutput
   198  	ToInviteAccepterMapOutputWithContext(context.Context) InviteAccepterMapOutput
   199  }
   200  
   201  type InviteAccepterMap map[string]InviteAccepterInput
   202  
   203  func (InviteAccepterMap) ElementType() reflect.Type {
   204  	return reflect.TypeOf((*map[string]*InviteAccepter)(nil)).Elem()
   205  }
   206  
   207  func (i InviteAccepterMap) ToInviteAccepterMapOutput() InviteAccepterMapOutput {
   208  	return i.ToInviteAccepterMapOutputWithContext(context.Background())
   209  }
   210  
   211  func (i InviteAccepterMap) ToInviteAccepterMapOutputWithContext(ctx context.Context) InviteAccepterMapOutput {
   212  	return pulumi.ToOutputWithContext(ctx, i).(InviteAccepterMapOutput)
   213  }
   214  
   215  type InviteAccepterOutput struct{ *pulumi.OutputState }
   216  
   217  func (InviteAccepterOutput) ElementType() reflect.Type {
   218  	return reflect.TypeOf((**InviteAccepter)(nil)).Elem()
   219  }
   220  
   221  func (o InviteAccepterOutput) ToInviteAccepterOutput() InviteAccepterOutput {
   222  	return o
   223  }
   224  
   225  func (o InviteAccepterOutput) ToInviteAccepterOutputWithContext(ctx context.Context) InviteAccepterOutput {
   226  	return o
   227  }
   228  
   229  // The ID of the invitation.
   230  func (o InviteAccepterOutput) InvitationId() pulumi.StringOutput {
   231  	return o.ApplyT(func(v *InviteAccepter) pulumi.StringOutput { return v.InvitationId }).(pulumi.StringOutput)
   232  }
   233  
   234  // The account ID of the master Security Hub account whose invitation you're accepting.
   235  func (o InviteAccepterOutput) MasterId() pulumi.StringOutput {
   236  	return o.ApplyT(func(v *InviteAccepter) pulumi.StringOutput { return v.MasterId }).(pulumi.StringOutput)
   237  }
   238  
   239  type InviteAccepterArrayOutput struct{ *pulumi.OutputState }
   240  
   241  func (InviteAccepterArrayOutput) ElementType() reflect.Type {
   242  	return reflect.TypeOf((*[]*InviteAccepter)(nil)).Elem()
   243  }
   244  
   245  func (o InviteAccepterArrayOutput) ToInviteAccepterArrayOutput() InviteAccepterArrayOutput {
   246  	return o
   247  }
   248  
   249  func (o InviteAccepterArrayOutput) ToInviteAccepterArrayOutputWithContext(ctx context.Context) InviteAccepterArrayOutput {
   250  	return o
   251  }
   252  
   253  func (o InviteAccepterArrayOutput) Index(i pulumi.IntInput) InviteAccepterOutput {
   254  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *InviteAccepter {
   255  		return vs[0].([]*InviteAccepter)[vs[1].(int)]
   256  	}).(InviteAccepterOutput)
   257  }
   258  
   259  type InviteAccepterMapOutput struct{ *pulumi.OutputState }
   260  
   261  func (InviteAccepterMapOutput) ElementType() reflect.Type {
   262  	return reflect.TypeOf((*map[string]*InviteAccepter)(nil)).Elem()
   263  }
   264  
   265  func (o InviteAccepterMapOutput) ToInviteAccepterMapOutput() InviteAccepterMapOutput {
   266  	return o
   267  }
   268  
   269  func (o InviteAccepterMapOutput) ToInviteAccepterMapOutputWithContext(ctx context.Context) InviteAccepterMapOutput {
   270  	return o
   271  }
   272  
   273  func (o InviteAccepterMapOutput) MapIndex(k pulumi.StringInput) InviteAccepterOutput {
   274  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *InviteAccepter {
   275  		return vs[0].(map[string]*InviteAccepter)[vs[1].(string)]
   276  	}).(InviteAccepterOutput)
   277  }
   278  
   279  func init() {
   280  	pulumi.RegisterInputType(reflect.TypeOf((*InviteAccepterInput)(nil)).Elem(), &InviteAccepter{})
   281  	pulumi.RegisterInputType(reflect.TypeOf((*InviteAccepterArrayInput)(nil)).Elem(), InviteAccepterArray{})
   282  	pulumi.RegisterInputType(reflect.TypeOf((*InviteAccepterMapInput)(nil)).Elem(), InviteAccepterMap{})
   283  	pulumi.RegisterOutputType(InviteAccepterOutput{})
   284  	pulumi.RegisterOutputType(InviteAccepterArrayOutput{})
   285  	pulumi.RegisterOutputType(InviteAccepterMapOutput{})
   286  }