github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/resourcegroups/group.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 resourcegroups 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Provides a Resource Group. 15 // 16 // ## Example Usage 17 // 18 // <!--Start PulumiCodeChooser --> 19 // ```go 20 // package main 21 // 22 // import ( 23 // 24 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/resourcegroups" 25 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 26 // 27 // ) 28 // 29 // func main() { 30 // pulumi.Run(func(ctx *pulumi.Context) error { 31 // _, err := resourcegroups.NewGroup(ctx, "test", &resourcegroups.GroupArgs{ 32 // Name: pulumi.String("test-group"), 33 // ResourceQuery: &resourcegroups.GroupResourceQueryArgs{ 34 // Query: pulumi.String(`{ 35 // "ResourceTypeFilters": [ 36 // "AWS::EC2::Instance" 37 // ], 38 // "TagFilters": [ 39 // { 40 // "Key": "Stage", 41 // "Values": ["Test"] 42 // } 43 // ] 44 // } 45 // 46 // `), 47 // 48 // }, 49 // }) 50 // if err != nil { 51 // return err 52 // } 53 // return nil 54 // }) 55 // } 56 // 57 // ``` 58 // <!--End PulumiCodeChooser --> 59 // 60 // ## Import 61 // 62 // Using `pulumi import`, import resource groups using the `name`. For example: 63 // 64 // ```sh 65 // $ pulumi import aws:resourcegroups/group:Group foo resource-group-name 66 // ``` 67 type Group struct { 68 pulumi.CustomResourceState 69 70 // The ARN assigned by AWS for this resource group. 71 Arn pulumi.StringOutput `pulumi:"arn"` 72 // A configuration associates the resource group with an AWS service and specifies how the service can interact with the resources in the group. See below for details. 73 Configurations GroupConfigurationArrayOutput `pulumi:"configurations"` 74 // A description of the resource group. 75 Description pulumi.StringPtrOutput `pulumi:"description"` 76 // The resource group's name. A resource group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. 77 Name pulumi.StringOutput `pulumi:"name"` 78 // A `resourceQuery` block. Resource queries are documented below. 79 ResourceQuery GroupResourceQueryPtrOutput `pulumi:"resourceQuery"` 80 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 81 Tags pulumi.StringMapOutput `pulumi:"tags"` 82 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 83 // 84 // Deprecated: Please use `tags` instead. 85 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 86 } 87 88 // NewGroup registers a new resource with the given unique name, arguments, and options. 89 func NewGroup(ctx *pulumi.Context, 90 name string, args *GroupArgs, opts ...pulumi.ResourceOption) (*Group, error) { 91 if args == nil { 92 args = &GroupArgs{} 93 } 94 95 opts = internal.PkgResourceDefaultOpts(opts) 96 var resource Group 97 err := ctx.RegisterResource("aws:resourcegroups/group:Group", name, args, &resource, opts...) 98 if err != nil { 99 return nil, err 100 } 101 return &resource, nil 102 } 103 104 // GetGroup gets an existing Group resource's state with the given name, ID, and optional 105 // state properties that are used to uniquely qualify the lookup (nil if not required). 106 func GetGroup(ctx *pulumi.Context, 107 name string, id pulumi.IDInput, state *GroupState, opts ...pulumi.ResourceOption) (*Group, error) { 108 var resource Group 109 err := ctx.ReadResource("aws:resourcegroups/group:Group", name, id, state, &resource, opts...) 110 if err != nil { 111 return nil, err 112 } 113 return &resource, nil 114 } 115 116 // Input properties used for looking up and filtering Group resources. 117 type groupState struct { 118 // The ARN assigned by AWS for this resource group. 119 Arn *string `pulumi:"arn"` 120 // A configuration associates the resource group with an AWS service and specifies how the service can interact with the resources in the group. See below for details. 121 Configurations []GroupConfiguration `pulumi:"configurations"` 122 // A description of the resource group. 123 Description *string `pulumi:"description"` 124 // The resource group's name. A resource group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. 125 Name *string `pulumi:"name"` 126 // A `resourceQuery` block. Resource queries are documented below. 127 ResourceQuery *GroupResourceQuery `pulumi:"resourceQuery"` 128 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 129 Tags map[string]string `pulumi:"tags"` 130 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 131 // 132 // Deprecated: Please use `tags` instead. 133 TagsAll map[string]string `pulumi:"tagsAll"` 134 } 135 136 type GroupState struct { 137 // The ARN assigned by AWS for this resource group. 138 Arn pulumi.StringPtrInput 139 // A configuration associates the resource group with an AWS service and specifies how the service can interact with the resources in the group. See below for details. 140 Configurations GroupConfigurationArrayInput 141 // A description of the resource group. 142 Description pulumi.StringPtrInput 143 // The resource group's name. A resource group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. 144 Name pulumi.StringPtrInput 145 // A `resourceQuery` block. Resource queries are documented below. 146 ResourceQuery GroupResourceQueryPtrInput 147 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 148 Tags pulumi.StringMapInput 149 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 150 // 151 // Deprecated: Please use `tags` instead. 152 TagsAll pulumi.StringMapInput 153 } 154 155 func (GroupState) ElementType() reflect.Type { 156 return reflect.TypeOf((*groupState)(nil)).Elem() 157 } 158 159 type groupArgs struct { 160 // A configuration associates the resource group with an AWS service and specifies how the service can interact with the resources in the group. See below for details. 161 Configurations []GroupConfiguration `pulumi:"configurations"` 162 // A description of the resource group. 163 Description *string `pulumi:"description"` 164 // The resource group's name. A resource group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. 165 Name *string `pulumi:"name"` 166 // A `resourceQuery` block. Resource queries are documented below. 167 ResourceQuery *GroupResourceQuery `pulumi:"resourceQuery"` 168 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 169 Tags map[string]string `pulumi:"tags"` 170 } 171 172 // The set of arguments for constructing a Group resource. 173 type GroupArgs struct { 174 // A configuration associates the resource group with an AWS service and specifies how the service can interact with the resources in the group. See below for details. 175 Configurations GroupConfigurationArrayInput 176 // A description of the resource group. 177 Description pulumi.StringPtrInput 178 // The resource group's name. A resource group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. 179 Name pulumi.StringPtrInput 180 // A `resourceQuery` block. Resource queries are documented below. 181 ResourceQuery GroupResourceQueryPtrInput 182 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 183 Tags pulumi.StringMapInput 184 } 185 186 func (GroupArgs) ElementType() reflect.Type { 187 return reflect.TypeOf((*groupArgs)(nil)).Elem() 188 } 189 190 type GroupInput interface { 191 pulumi.Input 192 193 ToGroupOutput() GroupOutput 194 ToGroupOutputWithContext(ctx context.Context) GroupOutput 195 } 196 197 func (*Group) ElementType() reflect.Type { 198 return reflect.TypeOf((**Group)(nil)).Elem() 199 } 200 201 func (i *Group) ToGroupOutput() GroupOutput { 202 return i.ToGroupOutputWithContext(context.Background()) 203 } 204 205 func (i *Group) ToGroupOutputWithContext(ctx context.Context) GroupOutput { 206 return pulumi.ToOutputWithContext(ctx, i).(GroupOutput) 207 } 208 209 // GroupArrayInput is an input type that accepts GroupArray and GroupArrayOutput values. 210 // You can construct a concrete instance of `GroupArrayInput` via: 211 // 212 // GroupArray{ GroupArgs{...} } 213 type GroupArrayInput interface { 214 pulumi.Input 215 216 ToGroupArrayOutput() GroupArrayOutput 217 ToGroupArrayOutputWithContext(context.Context) GroupArrayOutput 218 } 219 220 type GroupArray []GroupInput 221 222 func (GroupArray) ElementType() reflect.Type { 223 return reflect.TypeOf((*[]*Group)(nil)).Elem() 224 } 225 226 func (i GroupArray) ToGroupArrayOutput() GroupArrayOutput { 227 return i.ToGroupArrayOutputWithContext(context.Background()) 228 } 229 230 func (i GroupArray) ToGroupArrayOutputWithContext(ctx context.Context) GroupArrayOutput { 231 return pulumi.ToOutputWithContext(ctx, i).(GroupArrayOutput) 232 } 233 234 // GroupMapInput is an input type that accepts GroupMap and GroupMapOutput values. 235 // You can construct a concrete instance of `GroupMapInput` via: 236 // 237 // GroupMap{ "key": GroupArgs{...} } 238 type GroupMapInput interface { 239 pulumi.Input 240 241 ToGroupMapOutput() GroupMapOutput 242 ToGroupMapOutputWithContext(context.Context) GroupMapOutput 243 } 244 245 type GroupMap map[string]GroupInput 246 247 func (GroupMap) ElementType() reflect.Type { 248 return reflect.TypeOf((*map[string]*Group)(nil)).Elem() 249 } 250 251 func (i GroupMap) ToGroupMapOutput() GroupMapOutput { 252 return i.ToGroupMapOutputWithContext(context.Background()) 253 } 254 255 func (i GroupMap) ToGroupMapOutputWithContext(ctx context.Context) GroupMapOutput { 256 return pulumi.ToOutputWithContext(ctx, i).(GroupMapOutput) 257 } 258 259 type GroupOutput struct{ *pulumi.OutputState } 260 261 func (GroupOutput) ElementType() reflect.Type { 262 return reflect.TypeOf((**Group)(nil)).Elem() 263 } 264 265 func (o GroupOutput) ToGroupOutput() GroupOutput { 266 return o 267 } 268 269 func (o GroupOutput) ToGroupOutputWithContext(ctx context.Context) GroupOutput { 270 return o 271 } 272 273 // The ARN assigned by AWS for this resource group. 274 func (o GroupOutput) Arn() pulumi.StringOutput { 275 return o.ApplyT(func(v *Group) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 276 } 277 278 // A configuration associates the resource group with an AWS service and specifies how the service can interact with the resources in the group. See below for details. 279 func (o GroupOutput) Configurations() GroupConfigurationArrayOutput { 280 return o.ApplyT(func(v *Group) GroupConfigurationArrayOutput { return v.Configurations }).(GroupConfigurationArrayOutput) 281 } 282 283 // A description of the resource group. 284 func (o GroupOutput) Description() pulumi.StringPtrOutput { 285 return o.ApplyT(func(v *Group) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 286 } 287 288 // The resource group's name. A resource group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. 289 func (o GroupOutput) Name() pulumi.StringOutput { 290 return o.ApplyT(func(v *Group) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 291 } 292 293 // A `resourceQuery` block. Resource queries are documented below. 294 func (o GroupOutput) ResourceQuery() GroupResourceQueryPtrOutput { 295 return o.ApplyT(func(v *Group) GroupResourceQueryPtrOutput { return v.ResourceQuery }).(GroupResourceQueryPtrOutput) 296 } 297 298 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 299 func (o GroupOutput) Tags() pulumi.StringMapOutput { 300 return o.ApplyT(func(v *Group) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 301 } 302 303 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 304 // 305 // Deprecated: Please use `tags` instead. 306 func (o GroupOutput) TagsAll() pulumi.StringMapOutput { 307 return o.ApplyT(func(v *Group) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 308 } 309 310 type GroupArrayOutput struct{ *pulumi.OutputState } 311 312 func (GroupArrayOutput) ElementType() reflect.Type { 313 return reflect.TypeOf((*[]*Group)(nil)).Elem() 314 } 315 316 func (o GroupArrayOutput) ToGroupArrayOutput() GroupArrayOutput { 317 return o 318 } 319 320 func (o GroupArrayOutput) ToGroupArrayOutputWithContext(ctx context.Context) GroupArrayOutput { 321 return o 322 } 323 324 func (o GroupArrayOutput) Index(i pulumi.IntInput) GroupOutput { 325 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Group { 326 return vs[0].([]*Group)[vs[1].(int)] 327 }).(GroupOutput) 328 } 329 330 type GroupMapOutput struct{ *pulumi.OutputState } 331 332 func (GroupMapOutput) ElementType() reflect.Type { 333 return reflect.TypeOf((*map[string]*Group)(nil)).Elem() 334 } 335 336 func (o GroupMapOutput) ToGroupMapOutput() GroupMapOutput { 337 return o 338 } 339 340 func (o GroupMapOutput) ToGroupMapOutputWithContext(ctx context.Context) GroupMapOutput { 341 return o 342 } 343 344 func (o GroupMapOutput) MapIndex(k pulumi.StringInput) GroupOutput { 345 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Group { 346 return vs[0].(map[string]*Group)[vs[1].(string)] 347 }).(GroupOutput) 348 } 349 350 func init() { 351 pulumi.RegisterInputType(reflect.TypeOf((*GroupInput)(nil)).Elem(), &Group{}) 352 pulumi.RegisterInputType(reflect.TypeOf((*GroupArrayInput)(nil)).Elem(), GroupArray{}) 353 pulumi.RegisterInputType(reflect.TypeOf((*GroupMapInput)(nil)).Elem(), GroupMap{}) 354 pulumi.RegisterOutputType(GroupOutput{}) 355 pulumi.RegisterOutputType(GroupArrayOutput{}) 356 pulumi.RegisterOutputType(GroupMapOutput{}) 357 }