github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/finspace/kxUser.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 finspace
     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  // Resource for managing an AWS FinSpace Kx User.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"encoding/json"
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/finspace"
    30  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    31  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
    32  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    33  //
    34  // )
    35  //
    36  //	func main() {
    37  //		pulumi.Run(func(ctx *pulumi.Context) error {
    38  //			example, err := kms.NewKey(ctx, "example", &kms.KeyArgs{
    39  //				Description:          pulumi.String("Example KMS Key"),
    40  //				DeletionWindowInDays: pulumi.Int(7),
    41  //			})
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			exampleKxEnvironment, err := finspace.NewKxEnvironment(ctx, "example", &finspace.KxEnvironmentArgs{
    46  //				Name:     pulumi.String("my-tf-kx-environment"),
    47  //				KmsKeyId: example.Arn,
    48  //			})
    49  //			if err != nil {
    50  //				return err
    51  //			}
    52  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    53  //				"Version": "2012-10-17",
    54  //				"Statement": []map[string]interface{}{
    55  //					map[string]interface{}{
    56  //						"Action": "sts:AssumeRole",
    57  //						"Effect": "Allow",
    58  //						"Sid":    "",
    59  //						"Principal": map[string]interface{}{
    60  //							"Service": "ec2.amazonaws.com",
    61  //						},
    62  //					},
    63  //				},
    64  //			})
    65  //			if err != nil {
    66  //				return err
    67  //			}
    68  //			json0 := string(tmpJSON0)
    69  //			exampleRole, err := iam.NewRole(ctx, "example", &iam.RoleArgs{
    70  //				Name:             pulumi.String("example-role"),
    71  //				AssumeRolePolicy: pulumi.String(json0),
    72  //			})
    73  //			if err != nil {
    74  //				return err
    75  //			}
    76  //			_, err = finspace.NewKxUser(ctx, "example", &finspace.KxUserArgs{
    77  //				Name:          pulumi.String("my-tf-kx-user"),
    78  //				EnvironmentId: exampleKxEnvironment.ID(),
    79  //				IamRole:       exampleRole.Arn,
    80  //			})
    81  //			if err != nil {
    82  //				return err
    83  //			}
    84  //			return nil
    85  //		})
    86  //	}
    87  //
    88  // ```
    89  // <!--End PulumiCodeChooser -->
    90  //
    91  // ## Import
    92  //
    93  // Using `pulumi import`, import an AWS FinSpace Kx User using the `id` (environment ID and user name, comma-delimited). For example:
    94  //
    95  // ```sh
    96  // $ pulumi import aws:finspace/kxUser:KxUser example n3ceo7wqxoxcti5tujqwzs,my-tf-kx-user
    97  // ```
    98  type KxUser struct {
    99  	pulumi.CustomResourceState
   100  
   101  	// Amazon Resource Name (ARN) identifier of the KX user.
   102  	Arn pulumi.StringOutput `pulumi:"arn"`
   103  	// Unique identifier for the KX environment.
   104  	EnvironmentId pulumi.StringOutput `pulumi:"environmentId"`
   105  	// IAM role ARN to be associated with the user.
   106  	//
   107  	// The following arguments are optional:
   108  	IamRole pulumi.StringOutput `pulumi:"iamRole"`
   109  	// A unique identifier for the user.
   110  	Name pulumi.StringOutput `pulumi:"name"`
   111  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   112  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   113  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   114  	//
   115  	// Deprecated: Please use `tags` instead.
   116  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   117  }
   118  
   119  // NewKxUser registers a new resource with the given unique name, arguments, and options.
   120  func NewKxUser(ctx *pulumi.Context,
   121  	name string, args *KxUserArgs, opts ...pulumi.ResourceOption) (*KxUser, error) {
   122  	if args == nil {
   123  		return nil, errors.New("missing one or more required arguments")
   124  	}
   125  
   126  	if args.EnvironmentId == nil {
   127  		return nil, errors.New("invalid value for required argument 'EnvironmentId'")
   128  	}
   129  	if args.IamRole == nil {
   130  		return nil, errors.New("invalid value for required argument 'IamRole'")
   131  	}
   132  	opts = internal.PkgResourceDefaultOpts(opts)
   133  	var resource KxUser
   134  	err := ctx.RegisterResource("aws:finspace/kxUser:KxUser", name, args, &resource, opts...)
   135  	if err != nil {
   136  		return nil, err
   137  	}
   138  	return &resource, nil
   139  }
   140  
   141  // GetKxUser gets an existing KxUser resource's state with the given name, ID, and optional
   142  // state properties that are used to uniquely qualify the lookup (nil if not required).
   143  func GetKxUser(ctx *pulumi.Context,
   144  	name string, id pulumi.IDInput, state *KxUserState, opts ...pulumi.ResourceOption) (*KxUser, error) {
   145  	var resource KxUser
   146  	err := ctx.ReadResource("aws:finspace/kxUser:KxUser", name, id, state, &resource, opts...)
   147  	if err != nil {
   148  		return nil, err
   149  	}
   150  	return &resource, nil
   151  }
   152  
   153  // Input properties used for looking up and filtering KxUser resources.
   154  type kxUserState struct {
   155  	// Amazon Resource Name (ARN) identifier of the KX user.
   156  	Arn *string `pulumi:"arn"`
   157  	// Unique identifier for the KX environment.
   158  	EnvironmentId *string `pulumi:"environmentId"`
   159  	// IAM role ARN to be associated with the user.
   160  	//
   161  	// The following arguments are optional:
   162  	IamRole *string `pulumi:"iamRole"`
   163  	// A unique identifier for the user.
   164  	Name *string `pulumi:"name"`
   165  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   166  	Tags map[string]string `pulumi:"tags"`
   167  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   168  	//
   169  	// Deprecated: Please use `tags` instead.
   170  	TagsAll map[string]string `pulumi:"tagsAll"`
   171  }
   172  
   173  type KxUserState struct {
   174  	// Amazon Resource Name (ARN) identifier of the KX user.
   175  	Arn pulumi.StringPtrInput
   176  	// Unique identifier for the KX environment.
   177  	EnvironmentId pulumi.StringPtrInput
   178  	// IAM role ARN to be associated with the user.
   179  	//
   180  	// The following arguments are optional:
   181  	IamRole pulumi.StringPtrInput
   182  	// A unique identifier for the user.
   183  	Name pulumi.StringPtrInput
   184  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   185  	Tags pulumi.StringMapInput
   186  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   187  	//
   188  	// Deprecated: Please use `tags` instead.
   189  	TagsAll pulumi.StringMapInput
   190  }
   191  
   192  func (KxUserState) ElementType() reflect.Type {
   193  	return reflect.TypeOf((*kxUserState)(nil)).Elem()
   194  }
   195  
   196  type kxUserArgs struct {
   197  	// Unique identifier for the KX environment.
   198  	EnvironmentId string `pulumi:"environmentId"`
   199  	// IAM role ARN to be associated with the user.
   200  	//
   201  	// The following arguments are optional:
   202  	IamRole string `pulumi:"iamRole"`
   203  	// A unique identifier for the user.
   204  	Name *string `pulumi:"name"`
   205  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   206  	Tags map[string]string `pulumi:"tags"`
   207  }
   208  
   209  // The set of arguments for constructing a KxUser resource.
   210  type KxUserArgs struct {
   211  	// Unique identifier for the KX environment.
   212  	EnvironmentId pulumi.StringInput
   213  	// IAM role ARN to be associated with the user.
   214  	//
   215  	// The following arguments are optional:
   216  	IamRole pulumi.StringInput
   217  	// A unique identifier for the user.
   218  	Name pulumi.StringPtrInput
   219  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   220  	Tags pulumi.StringMapInput
   221  }
   222  
   223  func (KxUserArgs) ElementType() reflect.Type {
   224  	return reflect.TypeOf((*kxUserArgs)(nil)).Elem()
   225  }
   226  
   227  type KxUserInput interface {
   228  	pulumi.Input
   229  
   230  	ToKxUserOutput() KxUserOutput
   231  	ToKxUserOutputWithContext(ctx context.Context) KxUserOutput
   232  }
   233  
   234  func (*KxUser) ElementType() reflect.Type {
   235  	return reflect.TypeOf((**KxUser)(nil)).Elem()
   236  }
   237  
   238  func (i *KxUser) ToKxUserOutput() KxUserOutput {
   239  	return i.ToKxUserOutputWithContext(context.Background())
   240  }
   241  
   242  func (i *KxUser) ToKxUserOutputWithContext(ctx context.Context) KxUserOutput {
   243  	return pulumi.ToOutputWithContext(ctx, i).(KxUserOutput)
   244  }
   245  
   246  // KxUserArrayInput is an input type that accepts KxUserArray and KxUserArrayOutput values.
   247  // You can construct a concrete instance of `KxUserArrayInput` via:
   248  //
   249  //	KxUserArray{ KxUserArgs{...} }
   250  type KxUserArrayInput interface {
   251  	pulumi.Input
   252  
   253  	ToKxUserArrayOutput() KxUserArrayOutput
   254  	ToKxUserArrayOutputWithContext(context.Context) KxUserArrayOutput
   255  }
   256  
   257  type KxUserArray []KxUserInput
   258  
   259  func (KxUserArray) ElementType() reflect.Type {
   260  	return reflect.TypeOf((*[]*KxUser)(nil)).Elem()
   261  }
   262  
   263  func (i KxUserArray) ToKxUserArrayOutput() KxUserArrayOutput {
   264  	return i.ToKxUserArrayOutputWithContext(context.Background())
   265  }
   266  
   267  func (i KxUserArray) ToKxUserArrayOutputWithContext(ctx context.Context) KxUserArrayOutput {
   268  	return pulumi.ToOutputWithContext(ctx, i).(KxUserArrayOutput)
   269  }
   270  
   271  // KxUserMapInput is an input type that accepts KxUserMap and KxUserMapOutput values.
   272  // You can construct a concrete instance of `KxUserMapInput` via:
   273  //
   274  //	KxUserMap{ "key": KxUserArgs{...} }
   275  type KxUserMapInput interface {
   276  	pulumi.Input
   277  
   278  	ToKxUserMapOutput() KxUserMapOutput
   279  	ToKxUserMapOutputWithContext(context.Context) KxUserMapOutput
   280  }
   281  
   282  type KxUserMap map[string]KxUserInput
   283  
   284  func (KxUserMap) ElementType() reflect.Type {
   285  	return reflect.TypeOf((*map[string]*KxUser)(nil)).Elem()
   286  }
   287  
   288  func (i KxUserMap) ToKxUserMapOutput() KxUserMapOutput {
   289  	return i.ToKxUserMapOutputWithContext(context.Background())
   290  }
   291  
   292  func (i KxUserMap) ToKxUserMapOutputWithContext(ctx context.Context) KxUserMapOutput {
   293  	return pulumi.ToOutputWithContext(ctx, i).(KxUserMapOutput)
   294  }
   295  
   296  type KxUserOutput struct{ *pulumi.OutputState }
   297  
   298  func (KxUserOutput) ElementType() reflect.Type {
   299  	return reflect.TypeOf((**KxUser)(nil)).Elem()
   300  }
   301  
   302  func (o KxUserOutput) ToKxUserOutput() KxUserOutput {
   303  	return o
   304  }
   305  
   306  func (o KxUserOutput) ToKxUserOutputWithContext(ctx context.Context) KxUserOutput {
   307  	return o
   308  }
   309  
   310  // Amazon Resource Name (ARN) identifier of the KX user.
   311  func (o KxUserOutput) Arn() pulumi.StringOutput {
   312  	return o.ApplyT(func(v *KxUser) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   313  }
   314  
   315  // Unique identifier for the KX environment.
   316  func (o KxUserOutput) EnvironmentId() pulumi.StringOutput {
   317  	return o.ApplyT(func(v *KxUser) pulumi.StringOutput { return v.EnvironmentId }).(pulumi.StringOutput)
   318  }
   319  
   320  // IAM role ARN to be associated with the user.
   321  //
   322  // The following arguments are optional:
   323  func (o KxUserOutput) IamRole() pulumi.StringOutput {
   324  	return o.ApplyT(func(v *KxUser) pulumi.StringOutput { return v.IamRole }).(pulumi.StringOutput)
   325  }
   326  
   327  // A unique identifier for the user.
   328  func (o KxUserOutput) Name() pulumi.StringOutput {
   329  	return o.ApplyT(func(v *KxUser) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   330  }
   331  
   332  // Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   333  func (o KxUserOutput) Tags() pulumi.StringMapOutput {
   334  	return o.ApplyT(func(v *KxUser) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   335  }
   336  
   337  // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   338  //
   339  // Deprecated: Please use `tags` instead.
   340  func (o KxUserOutput) TagsAll() pulumi.StringMapOutput {
   341  	return o.ApplyT(func(v *KxUser) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   342  }
   343  
   344  type KxUserArrayOutput struct{ *pulumi.OutputState }
   345  
   346  func (KxUserArrayOutput) ElementType() reflect.Type {
   347  	return reflect.TypeOf((*[]*KxUser)(nil)).Elem()
   348  }
   349  
   350  func (o KxUserArrayOutput) ToKxUserArrayOutput() KxUserArrayOutput {
   351  	return o
   352  }
   353  
   354  func (o KxUserArrayOutput) ToKxUserArrayOutputWithContext(ctx context.Context) KxUserArrayOutput {
   355  	return o
   356  }
   357  
   358  func (o KxUserArrayOutput) Index(i pulumi.IntInput) KxUserOutput {
   359  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *KxUser {
   360  		return vs[0].([]*KxUser)[vs[1].(int)]
   361  	}).(KxUserOutput)
   362  }
   363  
   364  type KxUserMapOutput struct{ *pulumi.OutputState }
   365  
   366  func (KxUserMapOutput) ElementType() reflect.Type {
   367  	return reflect.TypeOf((*map[string]*KxUser)(nil)).Elem()
   368  }
   369  
   370  func (o KxUserMapOutput) ToKxUserMapOutput() KxUserMapOutput {
   371  	return o
   372  }
   373  
   374  func (o KxUserMapOutput) ToKxUserMapOutputWithContext(ctx context.Context) KxUserMapOutput {
   375  	return o
   376  }
   377  
   378  func (o KxUserMapOutput) MapIndex(k pulumi.StringInput) KxUserOutput {
   379  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *KxUser {
   380  		return vs[0].(map[string]*KxUser)[vs[1].(string)]
   381  	}).(KxUserOutput)
   382  }
   383  
   384  func init() {
   385  	pulumi.RegisterInputType(reflect.TypeOf((*KxUserInput)(nil)).Elem(), &KxUser{})
   386  	pulumi.RegisterInputType(reflect.TypeOf((*KxUserArrayInput)(nil)).Elem(), KxUserArray{})
   387  	pulumi.RegisterInputType(reflect.TypeOf((*KxUserMapInput)(nil)).Elem(), KxUserMap{})
   388  	pulumi.RegisterOutputType(KxUserOutput{})
   389  	pulumi.RegisterOutputType(KxUserArrayOutput{})
   390  	pulumi.RegisterOutputType(KxUserMapOutput{})
   391  }