github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/guardduty/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 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 manage a GuardDuty member. To accept invitations in member accounts, see the `guardduty.InviteAccepter` 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/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", &guardduty.DetectorArgs{ 33 // Enable: pulumi.Bool(true), 34 // }) 35 // if err != nil { 36 // return err 37 // } 38 // member, err := guardduty.NewDetector(ctx, "member", &guardduty.DetectorArgs{ 39 // Enable: pulumi.Bool(true), 40 // }) 41 // if err != nil { 42 // return err 43 // } 44 // _, err = guardduty.NewMember(ctx, "member", &guardduty.MemberArgs{ 45 // AccountId: member.AccountId, 46 // DetectorId: primary.ID(), 47 // Email: pulumi.String("required@example.com"), 48 // Invite: pulumi.Bool(true), 49 // InvitationMessage: pulumi.String("please accept guardduty invitation"), 50 // }) 51 // if err != nil { 52 // return err 53 // } 54 // return nil 55 // }) 56 // } 57 // 58 // ``` 59 // <!--End PulumiCodeChooser --> 60 // 61 // ## Import 62 // 63 // Using `pulumi import`, import GuardDuty members using the primary GuardDuty detector ID and member AWS account ID. For example: 64 // 65 // ```sh 66 // $ pulumi import aws:guardduty/member:Member MyMember 00b00fd5aecc0ab60a708659477e9617:123456789012 67 // ``` 68 type Member struct { 69 pulumi.CustomResourceState 70 71 // AWS account ID for member account. 72 AccountId pulumi.StringOutput `pulumi:"accountId"` 73 // The detector ID of the GuardDuty account where you want to create member accounts. 74 DetectorId pulumi.StringOutput `pulumi:"detectorId"` 75 // Boolean whether an email notification is sent to the accounts. Defaults to `false`. 76 DisableEmailNotification pulumi.BoolPtrOutput `pulumi:"disableEmailNotification"` 77 // Email address for member account. 78 Email pulumi.StringOutput `pulumi:"email"` 79 // Message for invitation. 80 InvitationMessage pulumi.StringPtrOutput `pulumi:"invitationMessage"` 81 // Boolean whether to invite the account to GuardDuty as a member. Defaults to `false`. To detect if an invitation needs to be (re-)sent, the this provider state value is `true` based on a `relationshipStatus` of `Disabled`, `Enabled`, `Invited`, or `EmailVerificationInProgress`. 82 Invite pulumi.BoolPtrOutput `pulumi:"invite"` 83 // The status of the relationship between the member account and its primary account. More information can be found in [Amazon GuardDuty API Reference](https://docs.aws.amazon.com/guardduty/latest/ug/get-members.html). 84 RelationshipStatus pulumi.StringOutput `pulumi:"relationshipStatus"` 85 } 86 87 // NewMember registers a new resource with the given unique name, arguments, and options. 88 func NewMember(ctx *pulumi.Context, 89 name string, args *MemberArgs, opts ...pulumi.ResourceOption) (*Member, error) { 90 if args == nil { 91 return nil, errors.New("missing one or more required arguments") 92 } 93 94 if args.AccountId == nil { 95 return nil, errors.New("invalid value for required argument 'AccountId'") 96 } 97 if args.DetectorId == nil { 98 return nil, errors.New("invalid value for required argument 'DetectorId'") 99 } 100 if args.Email == nil { 101 return nil, errors.New("invalid value for required argument 'Email'") 102 } 103 opts = internal.PkgResourceDefaultOpts(opts) 104 var resource Member 105 err := ctx.RegisterResource("aws:guardduty/member:Member", name, args, &resource, opts...) 106 if err != nil { 107 return nil, err 108 } 109 return &resource, nil 110 } 111 112 // GetMember gets an existing Member resource's state with the given name, ID, and optional 113 // state properties that are used to uniquely qualify the lookup (nil if not required). 114 func GetMember(ctx *pulumi.Context, 115 name string, id pulumi.IDInput, state *MemberState, opts ...pulumi.ResourceOption) (*Member, error) { 116 var resource Member 117 err := ctx.ReadResource("aws:guardduty/member:Member", name, id, state, &resource, opts...) 118 if err != nil { 119 return nil, err 120 } 121 return &resource, nil 122 } 123 124 // Input properties used for looking up and filtering Member resources. 125 type memberState struct { 126 // AWS account ID for member account. 127 AccountId *string `pulumi:"accountId"` 128 // The detector ID of the GuardDuty account where you want to create member accounts. 129 DetectorId *string `pulumi:"detectorId"` 130 // Boolean whether an email notification is sent to the accounts. Defaults to `false`. 131 DisableEmailNotification *bool `pulumi:"disableEmailNotification"` 132 // Email address for member account. 133 Email *string `pulumi:"email"` 134 // Message for invitation. 135 InvitationMessage *string `pulumi:"invitationMessage"` 136 // Boolean whether to invite the account to GuardDuty as a member. Defaults to `false`. To detect if an invitation needs to be (re-)sent, the this provider state value is `true` based on a `relationshipStatus` of `Disabled`, `Enabled`, `Invited`, or `EmailVerificationInProgress`. 137 Invite *bool `pulumi:"invite"` 138 // The status of the relationship between the member account and its primary account. More information can be found in [Amazon GuardDuty API Reference](https://docs.aws.amazon.com/guardduty/latest/ug/get-members.html). 139 RelationshipStatus *string `pulumi:"relationshipStatus"` 140 } 141 142 type MemberState struct { 143 // AWS account ID for member account. 144 AccountId pulumi.StringPtrInput 145 // The detector ID of the GuardDuty account where you want to create member accounts. 146 DetectorId pulumi.StringPtrInput 147 // Boolean whether an email notification is sent to the accounts. Defaults to `false`. 148 DisableEmailNotification pulumi.BoolPtrInput 149 // Email address for member account. 150 Email pulumi.StringPtrInput 151 // Message for invitation. 152 InvitationMessage pulumi.StringPtrInput 153 // Boolean whether to invite the account to GuardDuty as a member. Defaults to `false`. To detect if an invitation needs to be (re-)sent, the this provider state value is `true` based on a `relationshipStatus` of `Disabled`, `Enabled`, `Invited`, or `EmailVerificationInProgress`. 154 Invite pulumi.BoolPtrInput 155 // The status of the relationship between the member account and its primary account. More information can be found in [Amazon GuardDuty API Reference](https://docs.aws.amazon.com/guardduty/latest/ug/get-members.html). 156 RelationshipStatus pulumi.StringPtrInput 157 } 158 159 func (MemberState) ElementType() reflect.Type { 160 return reflect.TypeOf((*memberState)(nil)).Elem() 161 } 162 163 type memberArgs struct { 164 // AWS account ID for member account. 165 AccountId string `pulumi:"accountId"` 166 // The detector ID of the GuardDuty account where you want to create member accounts. 167 DetectorId string `pulumi:"detectorId"` 168 // Boolean whether an email notification is sent to the accounts. Defaults to `false`. 169 DisableEmailNotification *bool `pulumi:"disableEmailNotification"` 170 // Email address for member account. 171 Email string `pulumi:"email"` 172 // Message for invitation. 173 InvitationMessage *string `pulumi:"invitationMessage"` 174 // Boolean whether to invite the account to GuardDuty as a member. Defaults to `false`. To detect if an invitation needs to be (re-)sent, the this provider state value is `true` based on a `relationshipStatus` of `Disabled`, `Enabled`, `Invited`, or `EmailVerificationInProgress`. 175 Invite *bool `pulumi:"invite"` 176 } 177 178 // The set of arguments for constructing a Member resource. 179 type MemberArgs struct { 180 // AWS account ID for member account. 181 AccountId pulumi.StringInput 182 // The detector ID of the GuardDuty account where you want to create member accounts. 183 DetectorId pulumi.StringInput 184 // Boolean whether an email notification is sent to the accounts. Defaults to `false`. 185 DisableEmailNotification pulumi.BoolPtrInput 186 // Email address for member account. 187 Email pulumi.StringInput 188 // Message for invitation. 189 InvitationMessage pulumi.StringPtrInput 190 // Boolean whether to invite the account to GuardDuty as a member. Defaults to `false`. To detect if an invitation needs to be (re-)sent, the this provider state value is `true` based on a `relationshipStatus` of `Disabled`, `Enabled`, `Invited`, or `EmailVerificationInProgress`. 191 Invite pulumi.BoolPtrInput 192 } 193 194 func (MemberArgs) ElementType() reflect.Type { 195 return reflect.TypeOf((*memberArgs)(nil)).Elem() 196 } 197 198 type MemberInput interface { 199 pulumi.Input 200 201 ToMemberOutput() MemberOutput 202 ToMemberOutputWithContext(ctx context.Context) MemberOutput 203 } 204 205 func (*Member) ElementType() reflect.Type { 206 return reflect.TypeOf((**Member)(nil)).Elem() 207 } 208 209 func (i *Member) ToMemberOutput() MemberOutput { 210 return i.ToMemberOutputWithContext(context.Background()) 211 } 212 213 func (i *Member) ToMemberOutputWithContext(ctx context.Context) MemberOutput { 214 return pulumi.ToOutputWithContext(ctx, i).(MemberOutput) 215 } 216 217 // MemberArrayInput is an input type that accepts MemberArray and MemberArrayOutput values. 218 // You can construct a concrete instance of `MemberArrayInput` via: 219 // 220 // MemberArray{ MemberArgs{...} } 221 type MemberArrayInput interface { 222 pulumi.Input 223 224 ToMemberArrayOutput() MemberArrayOutput 225 ToMemberArrayOutputWithContext(context.Context) MemberArrayOutput 226 } 227 228 type MemberArray []MemberInput 229 230 func (MemberArray) ElementType() reflect.Type { 231 return reflect.TypeOf((*[]*Member)(nil)).Elem() 232 } 233 234 func (i MemberArray) ToMemberArrayOutput() MemberArrayOutput { 235 return i.ToMemberArrayOutputWithContext(context.Background()) 236 } 237 238 func (i MemberArray) ToMemberArrayOutputWithContext(ctx context.Context) MemberArrayOutput { 239 return pulumi.ToOutputWithContext(ctx, i).(MemberArrayOutput) 240 } 241 242 // MemberMapInput is an input type that accepts MemberMap and MemberMapOutput values. 243 // You can construct a concrete instance of `MemberMapInput` via: 244 // 245 // MemberMap{ "key": MemberArgs{...} } 246 type MemberMapInput interface { 247 pulumi.Input 248 249 ToMemberMapOutput() MemberMapOutput 250 ToMemberMapOutputWithContext(context.Context) MemberMapOutput 251 } 252 253 type MemberMap map[string]MemberInput 254 255 func (MemberMap) ElementType() reflect.Type { 256 return reflect.TypeOf((*map[string]*Member)(nil)).Elem() 257 } 258 259 func (i MemberMap) ToMemberMapOutput() MemberMapOutput { 260 return i.ToMemberMapOutputWithContext(context.Background()) 261 } 262 263 func (i MemberMap) ToMemberMapOutputWithContext(ctx context.Context) MemberMapOutput { 264 return pulumi.ToOutputWithContext(ctx, i).(MemberMapOutput) 265 } 266 267 type MemberOutput struct{ *pulumi.OutputState } 268 269 func (MemberOutput) ElementType() reflect.Type { 270 return reflect.TypeOf((**Member)(nil)).Elem() 271 } 272 273 func (o MemberOutput) ToMemberOutput() MemberOutput { 274 return o 275 } 276 277 func (o MemberOutput) ToMemberOutputWithContext(ctx context.Context) MemberOutput { 278 return o 279 } 280 281 // AWS account ID for member account. 282 func (o MemberOutput) AccountId() pulumi.StringOutput { 283 return o.ApplyT(func(v *Member) pulumi.StringOutput { return v.AccountId }).(pulumi.StringOutput) 284 } 285 286 // The detector ID of the GuardDuty account where you want to create member accounts. 287 func (o MemberOutput) DetectorId() pulumi.StringOutput { 288 return o.ApplyT(func(v *Member) pulumi.StringOutput { return v.DetectorId }).(pulumi.StringOutput) 289 } 290 291 // Boolean whether an email notification is sent to the accounts. Defaults to `false`. 292 func (o MemberOutput) DisableEmailNotification() pulumi.BoolPtrOutput { 293 return o.ApplyT(func(v *Member) pulumi.BoolPtrOutput { return v.DisableEmailNotification }).(pulumi.BoolPtrOutput) 294 } 295 296 // Email address for member account. 297 func (o MemberOutput) Email() pulumi.StringOutput { 298 return o.ApplyT(func(v *Member) pulumi.StringOutput { return v.Email }).(pulumi.StringOutput) 299 } 300 301 // Message for invitation. 302 func (o MemberOutput) InvitationMessage() pulumi.StringPtrOutput { 303 return o.ApplyT(func(v *Member) pulumi.StringPtrOutput { return v.InvitationMessage }).(pulumi.StringPtrOutput) 304 } 305 306 // Boolean whether to invite the account to GuardDuty as a member. Defaults to `false`. To detect if an invitation needs to be (re-)sent, the this provider state value is `true` based on a `relationshipStatus` of `Disabled`, `Enabled`, `Invited`, or `EmailVerificationInProgress`. 307 func (o MemberOutput) Invite() pulumi.BoolPtrOutput { 308 return o.ApplyT(func(v *Member) pulumi.BoolPtrOutput { return v.Invite }).(pulumi.BoolPtrOutput) 309 } 310 311 // The status of the relationship between the member account and its primary account. More information can be found in [Amazon GuardDuty API Reference](https://docs.aws.amazon.com/guardduty/latest/ug/get-members.html). 312 func (o MemberOutput) RelationshipStatus() pulumi.StringOutput { 313 return o.ApplyT(func(v *Member) pulumi.StringOutput { return v.RelationshipStatus }).(pulumi.StringOutput) 314 } 315 316 type MemberArrayOutput struct{ *pulumi.OutputState } 317 318 func (MemberArrayOutput) ElementType() reflect.Type { 319 return reflect.TypeOf((*[]*Member)(nil)).Elem() 320 } 321 322 func (o MemberArrayOutput) ToMemberArrayOutput() MemberArrayOutput { 323 return o 324 } 325 326 func (o MemberArrayOutput) ToMemberArrayOutputWithContext(ctx context.Context) MemberArrayOutput { 327 return o 328 } 329 330 func (o MemberArrayOutput) Index(i pulumi.IntInput) MemberOutput { 331 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Member { 332 return vs[0].([]*Member)[vs[1].(int)] 333 }).(MemberOutput) 334 } 335 336 type MemberMapOutput struct{ *pulumi.OutputState } 337 338 func (MemberMapOutput) ElementType() reflect.Type { 339 return reflect.TypeOf((*map[string]*Member)(nil)).Elem() 340 } 341 342 func (o MemberMapOutput) ToMemberMapOutput() MemberMapOutput { 343 return o 344 } 345 346 func (o MemberMapOutput) ToMemberMapOutputWithContext(ctx context.Context) MemberMapOutput { 347 return o 348 } 349 350 func (o MemberMapOutput) MapIndex(k pulumi.StringInput) MemberOutput { 351 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Member { 352 return vs[0].(map[string]*Member)[vs[1].(string)] 353 }).(MemberOutput) 354 } 355 356 func init() { 357 pulumi.RegisterInputType(reflect.TypeOf((*MemberInput)(nil)).Elem(), &Member{}) 358 pulumi.RegisterInputType(reflect.TypeOf((*MemberArrayInput)(nil)).Elem(), MemberArray{}) 359 pulumi.RegisterInputType(reflect.TypeOf((*MemberMapInput)(nil)).Elem(), MemberMap{}) 360 pulumi.RegisterOutputType(MemberOutput{}) 361 pulumi.RegisterOutputType(MemberArrayOutput{}) 362 pulumi.RegisterOutputType(MemberMapOutput{}) 363 }