github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/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 iam
     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 an IAM group.
    15  //
    16  // > **NOTE on user management:** Using `iam.GroupMembership` or `iam.UserGroupMembership` resources in addition to manually managing user/group membership using the console may lead to configuration drift or conflicts. For this reason, it's recommended to either manage membership entirely with the provider or entirely within the AWS console.
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := iam.NewGroup(ctx, "developers", &iam.GroupArgs{
    34  //				Name: pulumi.String("developers"),
    35  //				Path: pulumi.String("/users/"),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			return nil
    41  //		})
    42  //	}
    43  //
    44  // ```
    45  // <!--End PulumiCodeChooser -->
    46  //
    47  // ## Import
    48  //
    49  // Using `pulumi import`, import IAM Groups using the `name`. For example:
    50  //
    51  // ```sh
    52  // $ pulumi import aws:iam/group:Group developers developers
    53  // ```
    54  type Group struct {
    55  	pulumi.CustomResourceState
    56  
    57  	// The ARN assigned by AWS for this group.
    58  	Arn pulumi.StringOutput `pulumi:"arn"`
    59  	// The group's name. The name must consist of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: `=,.@-_.`. Group names are not distinguished by case. For example, you cannot create groups named both "ADMINS" and "admins".
    60  	Name pulumi.StringOutput `pulumi:"name"`
    61  	// Path in which to create the group.
    62  	Path pulumi.StringPtrOutput `pulumi:"path"`
    63  	// The [unique ID][1] assigned by AWS.
    64  	UniqueId pulumi.StringOutput `pulumi:"uniqueId"`
    65  }
    66  
    67  // NewGroup registers a new resource with the given unique name, arguments, and options.
    68  func NewGroup(ctx *pulumi.Context,
    69  	name string, args *GroupArgs, opts ...pulumi.ResourceOption) (*Group, error) {
    70  	if args == nil {
    71  		args = &GroupArgs{}
    72  	}
    73  
    74  	opts = internal.PkgResourceDefaultOpts(opts)
    75  	var resource Group
    76  	err := ctx.RegisterResource("aws:iam/group:Group", name, args, &resource, opts...)
    77  	if err != nil {
    78  		return nil, err
    79  	}
    80  	return &resource, nil
    81  }
    82  
    83  // GetGroup gets an existing Group resource's state with the given name, ID, and optional
    84  // state properties that are used to uniquely qualify the lookup (nil if not required).
    85  func GetGroup(ctx *pulumi.Context,
    86  	name string, id pulumi.IDInput, state *GroupState, opts ...pulumi.ResourceOption) (*Group, error) {
    87  	var resource Group
    88  	err := ctx.ReadResource("aws:iam/group:Group", name, id, state, &resource, opts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return &resource, nil
    93  }
    94  
    95  // Input properties used for looking up and filtering Group resources.
    96  type groupState struct {
    97  	// The ARN assigned by AWS for this group.
    98  	Arn *string `pulumi:"arn"`
    99  	// The group's name. The name must consist of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: `=,.@-_.`. Group names are not distinguished by case. For example, you cannot create groups named both "ADMINS" and "admins".
   100  	Name *string `pulumi:"name"`
   101  	// Path in which to create the group.
   102  	Path *string `pulumi:"path"`
   103  	// The [unique ID][1] assigned by AWS.
   104  	UniqueId *string `pulumi:"uniqueId"`
   105  }
   106  
   107  type GroupState struct {
   108  	// The ARN assigned by AWS for this group.
   109  	Arn pulumi.StringPtrInput
   110  	// The group's name. The name must consist of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: `=,.@-_.`. Group names are not distinguished by case. For example, you cannot create groups named both "ADMINS" and "admins".
   111  	Name pulumi.StringPtrInput
   112  	// Path in which to create the group.
   113  	Path pulumi.StringPtrInput
   114  	// The [unique ID][1] assigned by AWS.
   115  	UniqueId pulumi.StringPtrInput
   116  }
   117  
   118  func (GroupState) ElementType() reflect.Type {
   119  	return reflect.TypeOf((*groupState)(nil)).Elem()
   120  }
   121  
   122  type groupArgs struct {
   123  	// The group's name. The name must consist of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: `=,.@-_.`. Group names are not distinguished by case. For example, you cannot create groups named both "ADMINS" and "admins".
   124  	Name *string `pulumi:"name"`
   125  	// Path in which to create the group.
   126  	Path *string `pulumi:"path"`
   127  }
   128  
   129  // The set of arguments for constructing a Group resource.
   130  type GroupArgs struct {
   131  	// The group's name. The name must consist of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: `=,.@-_.`. Group names are not distinguished by case. For example, you cannot create groups named both "ADMINS" and "admins".
   132  	Name pulumi.StringPtrInput
   133  	// Path in which to create the group.
   134  	Path pulumi.StringPtrInput
   135  }
   136  
   137  func (GroupArgs) ElementType() reflect.Type {
   138  	return reflect.TypeOf((*groupArgs)(nil)).Elem()
   139  }
   140  
   141  type GroupInput interface {
   142  	pulumi.Input
   143  
   144  	ToGroupOutput() GroupOutput
   145  	ToGroupOutputWithContext(ctx context.Context) GroupOutput
   146  }
   147  
   148  func (*Group) ElementType() reflect.Type {
   149  	return reflect.TypeOf((**Group)(nil)).Elem()
   150  }
   151  
   152  func (i *Group) ToGroupOutput() GroupOutput {
   153  	return i.ToGroupOutputWithContext(context.Background())
   154  }
   155  
   156  func (i *Group) ToGroupOutputWithContext(ctx context.Context) GroupOutput {
   157  	return pulumi.ToOutputWithContext(ctx, i).(GroupOutput)
   158  }
   159  
   160  // GroupArrayInput is an input type that accepts GroupArray and GroupArrayOutput values.
   161  // You can construct a concrete instance of `GroupArrayInput` via:
   162  //
   163  //	GroupArray{ GroupArgs{...} }
   164  type GroupArrayInput interface {
   165  	pulumi.Input
   166  
   167  	ToGroupArrayOutput() GroupArrayOutput
   168  	ToGroupArrayOutputWithContext(context.Context) GroupArrayOutput
   169  }
   170  
   171  type GroupArray []GroupInput
   172  
   173  func (GroupArray) ElementType() reflect.Type {
   174  	return reflect.TypeOf((*[]*Group)(nil)).Elem()
   175  }
   176  
   177  func (i GroupArray) ToGroupArrayOutput() GroupArrayOutput {
   178  	return i.ToGroupArrayOutputWithContext(context.Background())
   179  }
   180  
   181  func (i GroupArray) ToGroupArrayOutputWithContext(ctx context.Context) GroupArrayOutput {
   182  	return pulumi.ToOutputWithContext(ctx, i).(GroupArrayOutput)
   183  }
   184  
   185  // GroupMapInput is an input type that accepts GroupMap and GroupMapOutput values.
   186  // You can construct a concrete instance of `GroupMapInput` via:
   187  //
   188  //	GroupMap{ "key": GroupArgs{...} }
   189  type GroupMapInput interface {
   190  	pulumi.Input
   191  
   192  	ToGroupMapOutput() GroupMapOutput
   193  	ToGroupMapOutputWithContext(context.Context) GroupMapOutput
   194  }
   195  
   196  type GroupMap map[string]GroupInput
   197  
   198  func (GroupMap) ElementType() reflect.Type {
   199  	return reflect.TypeOf((*map[string]*Group)(nil)).Elem()
   200  }
   201  
   202  func (i GroupMap) ToGroupMapOutput() GroupMapOutput {
   203  	return i.ToGroupMapOutputWithContext(context.Background())
   204  }
   205  
   206  func (i GroupMap) ToGroupMapOutputWithContext(ctx context.Context) GroupMapOutput {
   207  	return pulumi.ToOutputWithContext(ctx, i).(GroupMapOutput)
   208  }
   209  
   210  type GroupOutput struct{ *pulumi.OutputState }
   211  
   212  func (GroupOutput) ElementType() reflect.Type {
   213  	return reflect.TypeOf((**Group)(nil)).Elem()
   214  }
   215  
   216  func (o GroupOutput) ToGroupOutput() GroupOutput {
   217  	return o
   218  }
   219  
   220  func (o GroupOutput) ToGroupOutputWithContext(ctx context.Context) GroupOutput {
   221  	return o
   222  }
   223  
   224  // The ARN assigned by AWS for this group.
   225  func (o GroupOutput) Arn() pulumi.StringOutput {
   226  	return o.ApplyT(func(v *Group) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   227  }
   228  
   229  // The group's name. The name must consist of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: `=,.@-_.`. Group names are not distinguished by case. For example, you cannot create groups named both "ADMINS" and "admins".
   230  func (o GroupOutput) Name() pulumi.StringOutput {
   231  	return o.ApplyT(func(v *Group) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   232  }
   233  
   234  // Path in which to create the group.
   235  func (o GroupOutput) Path() pulumi.StringPtrOutput {
   236  	return o.ApplyT(func(v *Group) pulumi.StringPtrOutput { return v.Path }).(pulumi.StringPtrOutput)
   237  }
   238  
   239  // The [unique ID][1] assigned by AWS.
   240  func (o GroupOutput) UniqueId() pulumi.StringOutput {
   241  	return o.ApplyT(func(v *Group) pulumi.StringOutput { return v.UniqueId }).(pulumi.StringOutput)
   242  }
   243  
   244  type GroupArrayOutput struct{ *pulumi.OutputState }
   245  
   246  func (GroupArrayOutput) ElementType() reflect.Type {
   247  	return reflect.TypeOf((*[]*Group)(nil)).Elem()
   248  }
   249  
   250  func (o GroupArrayOutput) ToGroupArrayOutput() GroupArrayOutput {
   251  	return o
   252  }
   253  
   254  func (o GroupArrayOutput) ToGroupArrayOutputWithContext(ctx context.Context) GroupArrayOutput {
   255  	return o
   256  }
   257  
   258  func (o GroupArrayOutput) Index(i pulumi.IntInput) GroupOutput {
   259  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Group {
   260  		return vs[0].([]*Group)[vs[1].(int)]
   261  	}).(GroupOutput)
   262  }
   263  
   264  type GroupMapOutput struct{ *pulumi.OutputState }
   265  
   266  func (GroupMapOutput) ElementType() reflect.Type {
   267  	return reflect.TypeOf((*map[string]*Group)(nil)).Elem()
   268  }
   269  
   270  func (o GroupMapOutput) ToGroupMapOutput() GroupMapOutput {
   271  	return o
   272  }
   273  
   274  func (o GroupMapOutput) ToGroupMapOutputWithContext(ctx context.Context) GroupMapOutput {
   275  	return o
   276  }
   277  
   278  func (o GroupMapOutput) MapIndex(k pulumi.StringInput) GroupOutput {
   279  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Group {
   280  		return vs[0].(map[string]*Group)[vs[1].(string)]
   281  	}).(GroupOutput)
   282  }
   283  
   284  func init() {
   285  	pulumi.RegisterInputType(reflect.TypeOf((*GroupInput)(nil)).Elem(), &Group{})
   286  	pulumi.RegisterInputType(reflect.TypeOf((*GroupArrayInput)(nil)).Elem(), GroupArray{})
   287  	pulumi.RegisterInputType(reflect.TypeOf((*GroupMapInput)(nil)).Elem(), GroupMap{})
   288  	pulumi.RegisterOutputType(GroupOutput{})
   289  	pulumi.RegisterOutputType(GroupArrayOutput{})
   290  	pulumi.RegisterOutputType(GroupMapOutput{})
   291  }