github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/account/region.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 account 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 // Enable (Opt-In) or Disable (Opt-Out) a particular Region for an AWS account. 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/account" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // _, err := account.NewRegion(ctx, "example", &account.RegionArgs{ 33 // RegionName: pulumi.String("ap-southeast-3"), 34 // Enabled: pulumi.Bool(true), 35 // }) 36 // if err != nil { 37 // return err 38 // } 39 // return nil 40 // }) 41 // } 42 // 43 // ``` 44 // <!--End PulumiCodeChooser --> 45 // 46 // ## Import 47 // 48 // Using `pulumi import`. For example: 49 // 50 // ```sh 51 // $ pulumi import aws:account/region:Region example ap-southeast-3 52 // ``` 53 type Region struct { 54 pulumi.CustomResourceState 55 56 // The ID of the target account when managing member accounts. Will manage current user's account by default if omitted. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must also be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. 57 AccountId pulumi.StringPtrOutput `pulumi:"accountId"` 58 // Whether the region is enabled. 59 Enabled pulumi.BoolOutput `pulumi:"enabled"` 60 // The region opt status. 61 OptStatus pulumi.StringOutput `pulumi:"optStatus"` 62 // The region name to manage. 63 RegionName pulumi.StringOutput `pulumi:"regionName"` 64 } 65 66 // NewRegion registers a new resource with the given unique name, arguments, and options. 67 func NewRegion(ctx *pulumi.Context, 68 name string, args *RegionArgs, opts ...pulumi.ResourceOption) (*Region, error) { 69 if args == nil { 70 return nil, errors.New("missing one or more required arguments") 71 } 72 73 if args.Enabled == nil { 74 return nil, errors.New("invalid value for required argument 'Enabled'") 75 } 76 if args.RegionName == nil { 77 return nil, errors.New("invalid value for required argument 'RegionName'") 78 } 79 opts = internal.PkgResourceDefaultOpts(opts) 80 var resource Region 81 err := ctx.RegisterResource("aws:account/region:Region", name, args, &resource, opts...) 82 if err != nil { 83 return nil, err 84 } 85 return &resource, nil 86 } 87 88 // GetRegion gets an existing Region resource's state with the given name, ID, and optional 89 // state properties that are used to uniquely qualify the lookup (nil if not required). 90 func GetRegion(ctx *pulumi.Context, 91 name string, id pulumi.IDInput, state *RegionState, opts ...pulumi.ResourceOption) (*Region, error) { 92 var resource Region 93 err := ctx.ReadResource("aws:account/region:Region", name, id, state, &resource, opts...) 94 if err != nil { 95 return nil, err 96 } 97 return &resource, nil 98 } 99 100 // Input properties used for looking up and filtering Region resources. 101 type regionState struct { 102 // The ID of the target account when managing member accounts. Will manage current user's account by default if omitted. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must also be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. 103 AccountId *string `pulumi:"accountId"` 104 // Whether the region is enabled. 105 Enabled *bool `pulumi:"enabled"` 106 // The region opt status. 107 OptStatus *string `pulumi:"optStatus"` 108 // The region name to manage. 109 RegionName *string `pulumi:"regionName"` 110 } 111 112 type RegionState struct { 113 // The ID of the target account when managing member accounts. Will manage current user's account by default if omitted. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must also be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. 114 AccountId pulumi.StringPtrInput 115 // Whether the region is enabled. 116 Enabled pulumi.BoolPtrInput 117 // The region opt status. 118 OptStatus pulumi.StringPtrInput 119 // The region name to manage. 120 RegionName pulumi.StringPtrInput 121 } 122 123 func (RegionState) ElementType() reflect.Type { 124 return reflect.TypeOf((*regionState)(nil)).Elem() 125 } 126 127 type regionArgs struct { 128 // The ID of the target account when managing member accounts. Will manage current user's account by default if omitted. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must also be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. 129 AccountId *string `pulumi:"accountId"` 130 // Whether the region is enabled. 131 Enabled bool `pulumi:"enabled"` 132 // The region name to manage. 133 RegionName string `pulumi:"regionName"` 134 } 135 136 // The set of arguments for constructing a Region resource. 137 type RegionArgs struct { 138 // The ID of the target account when managing member accounts. Will manage current user's account by default if omitted. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must also be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. 139 AccountId pulumi.StringPtrInput 140 // Whether the region is enabled. 141 Enabled pulumi.BoolInput 142 // The region name to manage. 143 RegionName pulumi.StringInput 144 } 145 146 func (RegionArgs) ElementType() reflect.Type { 147 return reflect.TypeOf((*regionArgs)(nil)).Elem() 148 } 149 150 type RegionInput interface { 151 pulumi.Input 152 153 ToRegionOutput() RegionOutput 154 ToRegionOutputWithContext(ctx context.Context) RegionOutput 155 } 156 157 func (*Region) ElementType() reflect.Type { 158 return reflect.TypeOf((**Region)(nil)).Elem() 159 } 160 161 func (i *Region) ToRegionOutput() RegionOutput { 162 return i.ToRegionOutputWithContext(context.Background()) 163 } 164 165 func (i *Region) ToRegionOutputWithContext(ctx context.Context) RegionOutput { 166 return pulumi.ToOutputWithContext(ctx, i).(RegionOutput) 167 } 168 169 // RegionArrayInput is an input type that accepts RegionArray and RegionArrayOutput values. 170 // You can construct a concrete instance of `RegionArrayInput` via: 171 // 172 // RegionArray{ RegionArgs{...} } 173 type RegionArrayInput interface { 174 pulumi.Input 175 176 ToRegionArrayOutput() RegionArrayOutput 177 ToRegionArrayOutputWithContext(context.Context) RegionArrayOutput 178 } 179 180 type RegionArray []RegionInput 181 182 func (RegionArray) ElementType() reflect.Type { 183 return reflect.TypeOf((*[]*Region)(nil)).Elem() 184 } 185 186 func (i RegionArray) ToRegionArrayOutput() RegionArrayOutput { 187 return i.ToRegionArrayOutputWithContext(context.Background()) 188 } 189 190 func (i RegionArray) ToRegionArrayOutputWithContext(ctx context.Context) RegionArrayOutput { 191 return pulumi.ToOutputWithContext(ctx, i).(RegionArrayOutput) 192 } 193 194 // RegionMapInput is an input type that accepts RegionMap and RegionMapOutput values. 195 // You can construct a concrete instance of `RegionMapInput` via: 196 // 197 // RegionMap{ "key": RegionArgs{...} } 198 type RegionMapInput interface { 199 pulumi.Input 200 201 ToRegionMapOutput() RegionMapOutput 202 ToRegionMapOutputWithContext(context.Context) RegionMapOutput 203 } 204 205 type RegionMap map[string]RegionInput 206 207 func (RegionMap) ElementType() reflect.Type { 208 return reflect.TypeOf((*map[string]*Region)(nil)).Elem() 209 } 210 211 func (i RegionMap) ToRegionMapOutput() RegionMapOutput { 212 return i.ToRegionMapOutputWithContext(context.Background()) 213 } 214 215 func (i RegionMap) ToRegionMapOutputWithContext(ctx context.Context) RegionMapOutput { 216 return pulumi.ToOutputWithContext(ctx, i).(RegionMapOutput) 217 } 218 219 type RegionOutput struct{ *pulumi.OutputState } 220 221 func (RegionOutput) ElementType() reflect.Type { 222 return reflect.TypeOf((**Region)(nil)).Elem() 223 } 224 225 func (o RegionOutput) ToRegionOutput() RegionOutput { 226 return o 227 } 228 229 func (o RegionOutput) ToRegionOutputWithContext(ctx context.Context) RegionOutput { 230 return o 231 } 232 233 // The ID of the target account when managing member accounts. Will manage current user's account by default if omitted. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must also be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. 234 func (o RegionOutput) AccountId() pulumi.StringPtrOutput { 235 return o.ApplyT(func(v *Region) pulumi.StringPtrOutput { return v.AccountId }).(pulumi.StringPtrOutput) 236 } 237 238 // Whether the region is enabled. 239 func (o RegionOutput) Enabled() pulumi.BoolOutput { 240 return o.ApplyT(func(v *Region) pulumi.BoolOutput { return v.Enabled }).(pulumi.BoolOutput) 241 } 242 243 // The region opt status. 244 func (o RegionOutput) OptStatus() pulumi.StringOutput { 245 return o.ApplyT(func(v *Region) pulumi.StringOutput { return v.OptStatus }).(pulumi.StringOutput) 246 } 247 248 // The region name to manage. 249 func (o RegionOutput) RegionName() pulumi.StringOutput { 250 return o.ApplyT(func(v *Region) pulumi.StringOutput { return v.RegionName }).(pulumi.StringOutput) 251 } 252 253 type RegionArrayOutput struct{ *pulumi.OutputState } 254 255 func (RegionArrayOutput) ElementType() reflect.Type { 256 return reflect.TypeOf((*[]*Region)(nil)).Elem() 257 } 258 259 func (o RegionArrayOutput) ToRegionArrayOutput() RegionArrayOutput { 260 return o 261 } 262 263 func (o RegionArrayOutput) ToRegionArrayOutputWithContext(ctx context.Context) RegionArrayOutput { 264 return o 265 } 266 267 func (o RegionArrayOutput) Index(i pulumi.IntInput) RegionOutput { 268 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Region { 269 return vs[0].([]*Region)[vs[1].(int)] 270 }).(RegionOutput) 271 } 272 273 type RegionMapOutput struct{ *pulumi.OutputState } 274 275 func (RegionMapOutput) ElementType() reflect.Type { 276 return reflect.TypeOf((*map[string]*Region)(nil)).Elem() 277 } 278 279 func (o RegionMapOutput) ToRegionMapOutput() RegionMapOutput { 280 return o 281 } 282 283 func (o RegionMapOutput) ToRegionMapOutputWithContext(ctx context.Context) RegionMapOutput { 284 return o 285 } 286 287 func (o RegionMapOutput) MapIndex(k pulumi.StringInput) RegionOutput { 288 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Region { 289 return vs[0].(map[string]*Region)[vs[1].(string)] 290 }).(RegionOutput) 291 } 292 293 func init() { 294 pulumi.RegisterInputType(reflect.TypeOf((*RegionInput)(nil)).Elem(), &Region{}) 295 pulumi.RegisterInputType(reflect.TypeOf((*RegionArrayInput)(nil)).Elem(), RegionArray{}) 296 pulumi.RegisterInputType(reflect.TypeOf((*RegionMapInput)(nil)).Elem(), RegionMap{}) 297 pulumi.RegisterOutputType(RegionOutput{}) 298 pulumi.RegisterOutputType(RegionArrayOutput{}) 299 pulumi.RegisterOutputType(RegionMapOutput{}) 300 }