github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/securityhub/member.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  // Provides a Security Hub member resource.
    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/securityhub"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			example, err := securityhub.NewAccount(ctx, "example", nil)
    33  //			if err != nil {
    34  //				return err
    35  //			}
    36  //			_, err = securityhub.NewMember(ctx, "example", &securityhub.MemberArgs{
    37  //				AccountId: pulumi.String("123456789012"),
    38  //				Email:     pulumi.String("example@example.com"),
    39  //				Invite:    pulumi.Bool(true),
    40  //			}, pulumi.DependsOn([]pulumi.Resource{
    41  //				example,
    42  //			}))
    43  //			if err != nil {
    44  //				return err
    45  //			}
    46  //			return nil
    47  //		})
    48  //	}
    49  //
    50  // ```
    51  // <!--End PulumiCodeChooser -->
    52  //
    53  // ## Import
    54  //
    55  // Using `pulumi import`, import Security Hub members using their account ID. For example:
    56  //
    57  // ```sh
    58  // $ pulumi import aws:securityhub/member:Member example 123456789012
    59  // ```
    60  type Member struct {
    61  	pulumi.CustomResourceState
    62  
    63  	// The ID of the member AWS account.
    64  	AccountId pulumi.StringOutput `pulumi:"accountId"`
    65  	// The email of the member AWS account.
    66  	Email pulumi.StringPtrOutput `pulumi:"email"`
    67  	// Boolean whether to invite the account to Security Hub as a member. Defaults to `false`.
    68  	Invite pulumi.BoolPtrOutput `pulumi:"invite"`
    69  	// The ID of the master Security Hub AWS account.
    70  	MasterId pulumi.StringOutput `pulumi:"masterId"`
    71  	// The status of the member account relationship.
    72  	MemberStatus pulumi.StringOutput `pulumi:"memberStatus"`
    73  }
    74  
    75  // NewMember registers a new resource with the given unique name, arguments, and options.
    76  func NewMember(ctx *pulumi.Context,
    77  	name string, args *MemberArgs, opts ...pulumi.ResourceOption) (*Member, error) {
    78  	if args == nil {
    79  		return nil, errors.New("missing one or more required arguments")
    80  	}
    81  
    82  	if args.AccountId == nil {
    83  		return nil, errors.New("invalid value for required argument 'AccountId'")
    84  	}
    85  	opts = internal.PkgResourceDefaultOpts(opts)
    86  	var resource Member
    87  	err := ctx.RegisterResource("aws:securityhub/member:Member", name, args, &resource, opts...)
    88  	if err != nil {
    89  		return nil, err
    90  	}
    91  	return &resource, nil
    92  }
    93  
    94  // GetMember gets an existing Member resource's state with the given name, ID, and optional
    95  // state properties that are used to uniquely qualify the lookup (nil if not required).
    96  func GetMember(ctx *pulumi.Context,
    97  	name string, id pulumi.IDInput, state *MemberState, opts ...pulumi.ResourceOption) (*Member, error) {
    98  	var resource Member
    99  	err := ctx.ReadResource("aws:securityhub/member:Member", name, id, state, &resource, opts...)
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	return &resource, nil
   104  }
   105  
   106  // Input properties used for looking up and filtering Member resources.
   107  type memberState struct {
   108  	// The ID of the member AWS account.
   109  	AccountId *string `pulumi:"accountId"`
   110  	// The email of the member AWS account.
   111  	Email *string `pulumi:"email"`
   112  	// Boolean whether to invite the account to Security Hub as a member. Defaults to `false`.
   113  	Invite *bool `pulumi:"invite"`
   114  	// The ID of the master Security Hub AWS account.
   115  	MasterId *string `pulumi:"masterId"`
   116  	// The status of the member account relationship.
   117  	MemberStatus *string `pulumi:"memberStatus"`
   118  }
   119  
   120  type MemberState struct {
   121  	// The ID of the member AWS account.
   122  	AccountId pulumi.StringPtrInput
   123  	// The email of the member AWS account.
   124  	Email pulumi.StringPtrInput
   125  	// Boolean whether to invite the account to Security Hub as a member. Defaults to `false`.
   126  	Invite pulumi.BoolPtrInput
   127  	// The ID of the master Security Hub AWS account.
   128  	MasterId pulumi.StringPtrInput
   129  	// The status of the member account relationship.
   130  	MemberStatus pulumi.StringPtrInput
   131  }
   132  
   133  func (MemberState) ElementType() reflect.Type {
   134  	return reflect.TypeOf((*memberState)(nil)).Elem()
   135  }
   136  
   137  type memberArgs struct {
   138  	// The ID of the member AWS account.
   139  	AccountId string `pulumi:"accountId"`
   140  	// The email of the member AWS account.
   141  	Email *string `pulumi:"email"`
   142  	// Boolean whether to invite the account to Security Hub as a member. Defaults to `false`.
   143  	Invite *bool `pulumi:"invite"`
   144  }
   145  
   146  // The set of arguments for constructing a Member resource.
   147  type MemberArgs struct {
   148  	// The ID of the member AWS account.
   149  	AccountId pulumi.StringInput
   150  	// The email of the member AWS account.
   151  	Email pulumi.StringPtrInput
   152  	// Boolean whether to invite the account to Security Hub as a member. Defaults to `false`.
   153  	Invite pulumi.BoolPtrInput
   154  }
   155  
   156  func (MemberArgs) ElementType() reflect.Type {
   157  	return reflect.TypeOf((*memberArgs)(nil)).Elem()
   158  }
   159  
   160  type MemberInput interface {
   161  	pulumi.Input
   162  
   163  	ToMemberOutput() MemberOutput
   164  	ToMemberOutputWithContext(ctx context.Context) MemberOutput
   165  }
   166  
   167  func (*Member) ElementType() reflect.Type {
   168  	return reflect.TypeOf((**Member)(nil)).Elem()
   169  }
   170  
   171  func (i *Member) ToMemberOutput() MemberOutput {
   172  	return i.ToMemberOutputWithContext(context.Background())
   173  }
   174  
   175  func (i *Member) ToMemberOutputWithContext(ctx context.Context) MemberOutput {
   176  	return pulumi.ToOutputWithContext(ctx, i).(MemberOutput)
   177  }
   178  
   179  // MemberArrayInput is an input type that accepts MemberArray and MemberArrayOutput values.
   180  // You can construct a concrete instance of `MemberArrayInput` via:
   181  //
   182  //	MemberArray{ MemberArgs{...} }
   183  type MemberArrayInput interface {
   184  	pulumi.Input
   185  
   186  	ToMemberArrayOutput() MemberArrayOutput
   187  	ToMemberArrayOutputWithContext(context.Context) MemberArrayOutput
   188  }
   189  
   190  type MemberArray []MemberInput
   191  
   192  func (MemberArray) ElementType() reflect.Type {
   193  	return reflect.TypeOf((*[]*Member)(nil)).Elem()
   194  }
   195  
   196  func (i MemberArray) ToMemberArrayOutput() MemberArrayOutput {
   197  	return i.ToMemberArrayOutputWithContext(context.Background())
   198  }
   199  
   200  func (i MemberArray) ToMemberArrayOutputWithContext(ctx context.Context) MemberArrayOutput {
   201  	return pulumi.ToOutputWithContext(ctx, i).(MemberArrayOutput)
   202  }
   203  
   204  // MemberMapInput is an input type that accepts MemberMap and MemberMapOutput values.
   205  // You can construct a concrete instance of `MemberMapInput` via:
   206  //
   207  //	MemberMap{ "key": MemberArgs{...} }
   208  type MemberMapInput interface {
   209  	pulumi.Input
   210  
   211  	ToMemberMapOutput() MemberMapOutput
   212  	ToMemberMapOutputWithContext(context.Context) MemberMapOutput
   213  }
   214  
   215  type MemberMap map[string]MemberInput
   216  
   217  func (MemberMap) ElementType() reflect.Type {
   218  	return reflect.TypeOf((*map[string]*Member)(nil)).Elem()
   219  }
   220  
   221  func (i MemberMap) ToMemberMapOutput() MemberMapOutput {
   222  	return i.ToMemberMapOutputWithContext(context.Background())
   223  }
   224  
   225  func (i MemberMap) ToMemberMapOutputWithContext(ctx context.Context) MemberMapOutput {
   226  	return pulumi.ToOutputWithContext(ctx, i).(MemberMapOutput)
   227  }
   228  
   229  type MemberOutput struct{ *pulumi.OutputState }
   230  
   231  func (MemberOutput) ElementType() reflect.Type {
   232  	return reflect.TypeOf((**Member)(nil)).Elem()
   233  }
   234  
   235  func (o MemberOutput) ToMemberOutput() MemberOutput {
   236  	return o
   237  }
   238  
   239  func (o MemberOutput) ToMemberOutputWithContext(ctx context.Context) MemberOutput {
   240  	return o
   241  }
   242  
   243  // The ID of the member AWS account.
   244  func (o MemberOutput) AccountId() pulumi.StringOutput {
   245  	return o.ApplyT(func(v *Member) pulumi.StringOutput { return v.AccountId }).(pulumi.StringOutput)
   246  }
   247  
   248  // The email of the member AWS account.
   249  func (o MemberOutput) Email() pulumi.StringPtrOutput {
   250  	return o.ApplyT(func(v *Member) pulumi.StringPtrOutput { return v.Email }).(pulumi.StringPtrOutput)
   251  }
   252  
   253  // Boolean whether to invite the account to Security Hub as a member. Defaults to `false`.
   254  func (o MemberOutput) Invite() pulumi.BoolPtrOutput {
   255  	return o.ApplyT(func(v *Member) pulumi.BoolPtrOutput { return v.Invite }).(pulumi.BoolPtrOutput)
   256  }
   257  
   258  // The ID of the master Security Hub AWS account.
   259  func (o MemberOutput) MasterId() pulumi.StringOutput {
   260  	return o.ApplyT(func(v *Member) pulumi.StringOutput { return v.MasterId }).(pulumi.StringOutput)
   261  }
   262  
   263  // The status of the member account relationship.
   264  func (o MemberOutput) MemberStatus() pulumi.StringOutput {
   265  	return o.ApplyT(func(v *Member) pulumi.StringOutput { return v.MemberStatus }).(pulumi.StringOutput)
   266  }
   267  
   268  type MemberArrayOutput struct{ *pulumi.OutputState }
   269  
   270  func (MemberArrayOutput) ElementType() reflect.Type {
   271  	return reflect.TypeOf((*[]*Member)(nil)).Elem()
   272  }
   273  
   274  func (o MemberArrayOutput) ToMemberArrayOutput() MemberArrayOutput {
   275  	return o
   276  }
   277  
   278  func (o MemberArrayOutput) ToMemberArrayOutputWithContext(ctx context.Context) MemberArrayOutput {
   279  	return o
   280  }
   281  
   282  func (o MemberArrayOutput) Index(i pulumi.IntInput) MemberOutput {
   283  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Member {
   284  		return vs[0].([]*Member)[vs[1].(int)]
   285  	}).(MemberOutput)
   286  }
   287  
   288  type MemberMapOutput struct{ *pulumi.OutputState }
   289  
   290  func (MemberMapOutput) ElementType() reflect.Type {
   291  	return reflect.TypeOf((*map[string]*Member)(nil)).Elem()
   292  }
   293  
   294  func (o MemberMapOutput) ToMemberMapOutput() MemberMapOutput {
   295  	return o
   296  }
   297  
   298  func (o MemberMapOutput) ToMemberMapOutputWithContext(ctx context.Context) MemberMapOutput {
   299  	return o
   300  }
   301  
   302  func (o MemberMapOutput) MapIndex(k pulumi.StringInput) MemberOutput {
   303  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Member {
   304  		return vs[0].(map[string]*Member)[vs[1].(string)]
   305  	}).(MemberOutput)
   306  }
   307  
   308  func init() {
   309  	pulumi.RegisterInputType(reflect.TypeOf((*MemberInput)(nil)).Elem(), &Member{})
   310  	pulumi.RegisterInputType(reflect.TypeOf((*MemberArrayInput)(nil)).Elem(), MemberArray{})
   311  	pulumi.RegisterInputType(reflect.TypeOf((*MemberMapInput)(nil)).Elem(), MemberMap{})
   312  	pulumi.RegisterOutputType(MemberOutput{})
   313  	pulumi.RegisterOutputType(MemberArrayOutput{})
   314  	pulumi.RegisterOutputType(MemberMapOutput{})
   315  }