github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/rolesanywhere/profile.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 rolesanywhere
     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 a Roles Anywhere Profile.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"encoding/json"
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rolesanywhere"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    36  //				"Version": "2012-10-17",
    37  //				"Statement": []map[string]interface{}{
    38  //					map[string]interface{}{
    39  //						"Action": []string{
    40  //							"sts:AssumeRole",
    41  //							"sts:TagSession",
    42  //							"sts:SetSourceIdentity",
    43  //						},
    44  //						"Principal": map[string]interface{}{
    45  //							"Service": "rolesanywhere.amazonaws.com",
    46  //						},
    47  //						"Effect": "Allow",
    48  //						"Sid":    "",
    49  //					},
    50  //				},
    51  //			})
    52  //			if err != nil {
    53  //				return err
    54  //			}
    55  //			json0 := string(tmpJSON0)
    56  //			test, err := iam.NewRole(ctx, "test", &iam.RoleArgs{
    57  //				Name:             pulumi.String("test"),
    58  //				Path:             pulumi.String("/"),
    59  //				AssumeRolePolicy: pulumi.String(json0),
    60  //			})
    61  //			if err != nil {
    62  //				return err
    63  //			}
    64  //			_, err = rolesanywhere.NewProfile(ctx, "test", &rolesanywhere.ProfileArgs{
    65  //				Name: pulumi.String("example"),
    66  //				RoleArns: pulumi.StringArray{
    67  //					test.Arn,
    68  //				},
    69  //			})
    70  //			if err != nil {
    71  //				return err
    72  //			}
    73  //			return nil
    74  //		})
    75  //	}
    76  //
    77  // ```
    78  // <!--End PulumiCodeChooser -->
    79  //
    80  // ## Import
    81  //
    82  // Using `pulumi import`, import `aws_rolesanywhere_profile` using its `id`. For example:
    83  //
    84  // ```sh
    85  // $ pulumi import aws:rolesanywhere/profile:Profile example db138a85-8925-4f9f-a409-08231233cacf
    86  // ```
    87  type Profile struct {
    88  	pulumi.CustomResourceState
    89  
    90  	// Amazon Resource Name (ARN) of the Profile
    91  	Arn pulumi.StringOutput `pulumi:"arn"`
    92  	// The number of seconds the vended session credentials are valid for. Defaults to 3600.
    93  	DurationSeconds pulumi.IntOutput `pulumi:"durationSeconds"`
    94  	// Whether or not the Profile is enabled.
    95  	Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
    96  	// A list of managed policy ARNs that apply to the vended session credentials.
    97  	ManagedPolicyArns pulumi.StringArrayOutput `pulumi:"managedPolicyArns"`
    98  	// The name of the Profile.
    99  	Name pulumi.StringOutput `pulumi:"name"`
   100  	// Specifies whether instance properties are required in [CreateSession](https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) requests with this profile.
   101  	RequireInstanceProperties pulumi.BoolPtrOutput `pulumi:"requireInstanceProperties"`
   102  	// A list of IAM roles that this profile can assume
   103  	RoleArns pulumi.StringArrayOutput `pulumi:"roleArns"`
   104  	// A session policy that applies to the trust boundary of the vended session credentials.
   105  	SessionPolicy pulumi.StringPtrOutput `pulumi:"sessionPolicy"`
   106  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   107  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   108  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   109  	//
   110  	// Deprecated: Please use `tags` instead.
   111  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   112  }
   113  
   114  // NewProfile registers a new resource with the given unique name, arguments, and options.
   115  func NewProfile(ctx *pulumi.Context,
   116  	name string, args *ProfileArgs, opts ...pulumi.ResourceOption) (*Profile, error) {
   117  	if args == nil {
   118  		return nil, errors.New("missing one or more required arguments")
   119  	}
   120  
   121  	if args.RoleArns == nil {
   122  		return nil, errors.New("invalid value for required argument 'RoleArns'")
   123  	}
   124  	opts = internal.PkgResourceDefaultOpts(opts)
   125  	var resource Profile
   126  	err := ctx.RegisterResource("aws:rolesanywhere/profile:Profile", name, args, &resource, opts...)
   127  	if err != nil {
   128  		return nil, err
   129  	}
   130  	return &resource, nil
   131  }
   132  
   133  // GetProfile gets an existing Profile resource's state with the given name, ID, and optional
   134  // state properties that are used to uniquely qualify the lookup (nil if not required).
   135  func GetProfile(ctx *pulumi.Context,
   136  	name string, id pulumi.IDInput, state *ProfileState, opts ...pulumi.ResourceOption) (*Profile, error) {
   137  	var resource Profile
   138  	err := ctx.ReadResource("aws:rolesanywhere/profile:Profile", name, id, state, &resource, opts...)
   139  	if err != nil {
   140  		return nil, err
   141  	}
   142  	return &resource, nil
   143  }
   144  
   145  // Input properties used for looking up and filtering Profile resources.
   146  type profileState struct {
   147  	// Amazon Resource Name (ARN) of the Profile
   148  	Arn *string `pulumi:"arn"`
   149  	// The number of seconds the vended session credentials are valid for. Defaults to 3600.
   150  	DurationSeconds *int `pulumi:"durationSeconds"`
   151  	// Whether or not the Profile is enabled.
   152  	Enabled *bool `pulumi:"enabled"`
   153  	// A list of managed policy ARNs that apply to the vended session credentials.
   154  	ManagedPolicyArns []string `pulumi:"managedPolicyArns"`
   155  	// The name of the Profile.
   156  	Name *string `pulumi:"name"`
   157  	// Specifies whether instance properties are required in [CreateSession](https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) requests with this profile.
   158  	RequireInstanceProperties *bool `pulumi:"requireInstanceProperties"`
   159  	// A list of IAM roles that this profile can assume
   160  	RoleArns []string `pulumi:"roleArns"`
   161  	// A session policy that applies to the trust boundary of the vended session credentials.
   162  	SessionPolicy *string `pulumi:"sessionPolicy"`
   163  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   164  	Tags map[string]string `pulumi:"tags"`
   165  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   166  	//
   167  	// Deprecated: Please use `tags` instead.
   168  	TagsAll map[string]string `pulumi:"tagsAll"`
   169  }
   170  
   171  type ProfileState struct {
   172  	// Amazon Resource Name (ARN) of the Profile
   173  	Arn pulumi.StringPtrInput
   174  	// The number of seconds the vended session credentials are valid for. Defaults to 3600.
   175  	DurationSeconds pulumi.IntPtrInput
   176  	// Whether or not the Profile is enabled.
   177  	Enabled pulumi.BoolPtrInput
   178  	// A list of managed policy ARNs that apply to the vended session credentials.
   179  	ManagedPolicyArns pulumi.StringArrayInput
   180  	// The name of the Profile.
   181  	Name pulumi.StringPtrInput
   182  	// Specifies whether instance properties are required in [CreateSession](https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) requests with this profile.
   183  	RequireInstanceProperties pulumi.BoolPtrInput
   184  	// A list of IAM roles that this profile can assume
   185  	RoleArns pulumi.StringArrayInput
   186  	// A session policy that applies to the trust boundary of the vended session credentials.
   187  	SessionPolicy pulumi.StringPtrInput
   188  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   189  	Tags pulumi.StringMapInput
   190  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   191  	//
   192  	// Deprecated: Please use `tags` instead.
   193  	TagsAll pulumi.StringMapInput
   194  }
   195  
   196  func (ProfileState) ElementType() reflect.Type {
   197  	return reflect.TypeOf((*profileState)(nil)).Elem()
   198  }
   199  
   200  type profileArgs struct {
   201  	// The number of seconds the vended session credentials are valid for. Defaults to 3600.
   202  	DurationSeconds *int `pulumi:"durationSeconds"`
   203  	// Whether or not the Profile is enabled.
   204  	Enabled *bool `pulumi:"enabled"`
   205  	// A list of managed policy ARNs that apply to the vended session credentials.
   206  	ManagedPolicyArns []string `pulumi:"managedPolicyArns"`
   207  	// The name of the Profile.
   208  	Name *string `pulumi:"name"`
   209  	// Specifies whether instance properties are required in [CreateSession](https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) requests with this profile.
   210  	RequireInstanceProperties *bool `pulumi:"requireInstanceProperties"`
   211  	// A list of IAM roles that this profile can assume
   212  	RoleArns []string `pulumi:"roleArns"`
   213  	// A session policy that applies to the trust boundary of the vended session credentials.
   214  	SessionPolicy *string `pulumi:"sessionPolicy"`
   215  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   216  	Tags map[string]string `pulumi:"tags"`
   217  }
   218  
   219  // The set of arguments for constructing a Profile resource.
   220  type ProfileArgs struct {
   221  	// The number of seconds the vended session credentials are valid for. Defaults to 3600.
   222  	DurationSeconds pulumi.IntPtrInput
   223  	// Whether or not the Profile is enabled.
   224  	Enabled pulumi.BoolPtrInput
   225  	// A list of managed policy ARNs that apply to the vended session credentials.
   226  	ManagedPolicyArns pulumi.StringArrayInput
   227  	// The name of the Profile.
   228  	Name pulumi.StringPtrInput
   229  	// Specifies whether instance properties are required in [CreateSession](https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) requests with this profile.
   230  	RequireInstanceProperties pulumi.BoolPtrInput
   231  	// A list of IAM roles that this profile can assume
   232  	RoleArns pulumi.StringArrayInput
   233  	// A session policy that applies to the trust boundary of the vended session credentials.
   234  	SessionPolicy pulumi.StringPtrInput
   235  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   236  	Tags pulumi.StringMapInput
   237  }
   238  
   239  func (ProfileArgs) ElementType() reflect.Type {
   240  	return reflect.TypeOf((*profileArgs)(nil)).Elem()
   241  }
   242  
   243  type ProfileInput interface {
   244  	pulumi.Input
   245  
   246  	ToProfileOutput() ProfileOutput
   247  	ToProfileOutputWithContext(ctx context.Context) ProfileOutput
   248  }
   249  
   250  func (*Profile) ElementType() reflect.Type {
   251  	return reflect.TypeOf((**Profile)(nil)).Elem()
   252  }
   253  
   254  func (i *Profile) ToProfileOutput() ProfileOutput {
   255  	return i.ToProfileOutputWithContext(context.Background())
   256  }
   257  
   258  func (i *Profile) ToProfileOutputWithContext(ctx context.Context) ProfileOutput {
   259  	return pulumi.ToOutputWithContext(ctx, i).(ProfileOutput)
   260  }
   261  
   262  // ProfileArrayInput is an input type that accepts ProfileArray and ProfileArrayOutput values.
   263  // You can construct a concrete instance of `ProfileArrayInput` via:
   264  //
   265  //	ProfileArray{ ProfileArgs{...} }
   266  type ProfileArrayInput interface {
   267  	pulumi.Input
   268  
   269  	ToProfileArrayOutput() ProfileArrayOutput
   270  	ToProfileArrayOutputWithContext(context.Context) ProfileArrayOutput
   271  }
   272  
   273  type ProfileArray []ProfileInput
   274  
   275  func (ProfileArray) ElementType() reflect.Type {
   276  	return reflect.TypeOf((*[]*Profile)(nil)).Elem()
   277  }
   278  
   279  func (i ProfileArray) ToProfileArrayOutput() ProfileArrayOutput {
   280  	return i.ToProfileArrayOutputWithContext(context.Background())
   281  }
   282  
   283  func (i ProfileArray) ToProfileArrayOutputWithContext(ctx context.Context) ProfileArrayOutput {
   284  	return pulumi.ToOutputWithContext(ctx, i).(ProfileArrayOutput)
   285  }
   286  
   287  // ProfileMapInput is an input type that accepts ProfileMap and ProfileMapOutput values.
   288  // You can construct a concrete instance of `ProfileMapInput` via:
   289  //
   290  //	ProfileMap{ "key": ProfileArgs{...} }
   291  type ProfileMapInput interface {
   292  	pulumi.Input
   293  
   294  	ToProfileMapOutput() ProfileMapOutput
   295  	ToProfileMapOutputWithContext(context.Context) ProfileMapOutput
   296  }
   297  
   298  type ProfileMap map[string]ProfileInput
   299  
   300  func (ProfileMap) ElementType() reflect.Type {
   301  	return reflect.TypeOf((*map[string]*Profile)(nil)).Elem()
   302  }
   303  
   304  func (i ProfileMap) ToProfileMapOutput() ProfileMapOutput {
   305  	return i.ToProfileMapOutputWithContext(context.Background())
   306  }
   307  
   308  func (i ProfileMap) ToProfileMapOutputWithContext(ctx context.Context) ProfileMapOutput {
   309  	return pulumi.ToOutputWithContext(ctx, i).(ProfileMapOutput)
   310  }
   311  
   312  type ProfileOutput struct{ *pulumi.OutputState }
   313  
   314  func (ProfileOutput) ElementType() reflect.Type {
   315  	return reflect.TypeOf((**Profile)(nil)).Elem()
   316  }
   317  
   318  func (o ProfileOutput) ToProfileOutput() ProfileOutput {
   319  	return o
   320  }
   321  
   322  func (o ProfileOutput) ToProfileOutputWithContext(ctx context.Context) ProfileOutput {
   323  	return o
   324  }
   325  
   326  // Amazon Resource Name (ARN) of the Profile
   327  func (o ProfileOutput) Arn() pulumi.StringOutput {
   328  	return o.ApplyT(func(v *Profile) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   329  }
   330  
   331  // The number of seconds the vended session credentials are valid for. Defaults to 3600.
   332  func (o ProfileOutput) DurationSeconds() pulumi.IntOutput {
   333  	return o.ApplyT(func(v *Profile) pulumi.IntOutput { return v.DurationSeconds }).(pulumi.IntOutput)
   334  }
   335  
   336  // Whether or not the Profile is enabled.
   337  func (o ProfileOutput) Enabled() pulumi.BoolPtrOutput {
   338  	return o.ApplyT(func(v *Profile) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
   339  }
   340  
   341  // A list of managed policy ARNs that apply to the vended session credentials.
   342  func (o ProfileOutput) ManagedPolicyArns() pulumi.StringArrayOutput {
   343  	return o.ApplyT(func(v *Profile) pulumi.StringArrayOutput { return v.ManagedPolicyArns }).(pulumi.StringArrayOutput)
   344  }
   345  
   346  // The name of the Profile.
   347  func (o ProfileOutput) Name() pulumi.StringOutput {
   348  	return o.ApplyT(func(v *Profile) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   349  }
   350  
   351  // Specifies whether instance properties are required in [CreateSession](https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) requests with this profile.
   352  func (o ProfileOutput) RequireInstanceProperties() pulumi.BoolPtrOutput {
   353  	return o.ApplyT(func(v *Profile) pulumi.BoolPtrOutput { return v.RequireInstanceProperties }).(pulumi.BoolPtrOutput)
   354  }
   355  
   356  // A list of IAM roles that this profile can assume
   357  func (o ProfileOutput) RoleArns() pulumi.StringArrayOutput {
   358  	return o.ApplyT(func(v *Profile) pulumi.StringArrayOutput { return v.RoleArns }).(pulumi.StringArrayOutput)
   359  }
   360  
   361  // A session policy that applies to the trust boundary of the vended session credentials.
   362  func (o ProfileOutput) SessionPolicy() pulumi.StringPtrOutput {
   363  	return o.ApplyT(func(v *Profile) pulumi.StringPtrOutput { return v.SessionPolicy }).(pulumi.StringPtrOutput)
   364  }
   365  
   366  // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   367  func (o ProfileOutput) Tags() pulumi.StringMapOutput {
   368  	return o.ApplyT(func(v *Profile) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   369  }
   370  
   371  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   372  //
   373  // Deprecated: Please use `tags` instead.
   374  func (o ProfileOutput) TagsAll() pulumi.StringMapOutput {
   375  	return o.ApplyT(func(v *Profile) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   376  }
   377  
   378  type ProfileArrayOutput struct{ *pulumi.OutputState }
   379  
   380  func (ProfileArrayOutput) ElementType() reflect.Type {
   381  	return reflect.TypeOf((*[]*Profile)(nil)).Elem()
   382  }
   383  
   384  func (o ProfileArrayOutput) ToProfileArrayOutput() ProfileArrayOutput {
   385  	return o
   386  }
   387  
   388  func (o ProfileArrayOutput) ToProfileArrayOutputWithContext(ctx context.Context) ProfileArrayOutput {
   389  	return o
   390  }
   391  
   392  func (o ProfileArrayOutput) Index(i pulumi.IntInput) ProfileOutput {
   393  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Profile {
   394  		return vs[0].([]*Profile)[vs[1].(int)]
   395  	}).(ProfileOutput)
   396  }
   397  
   398  type ProfileMapOutput struct{ *pulumi.OutputState }
   399  
   400  func (ProfileMapOutput) ElementType() reflect.Type {
   401  	return reflect.TypeOf((*map[string]*Profile)(nil)).Elem()
   402  }
   403  
   404  func (o ProfileMapOutput) ToProfileMapOutput() ProfileMapOutput {
   405  	return o
   406  }
   407  
   408  func (o ProfileMapOutput) ToProfileMapOutputWithContext(ctx context.Context) ProfileMapOutput {
   409  	return o
   410  }
   411  
   412  func (o ProfileMapOutput) MapIndex(k pulumi.StringInput) ProfileOutput {
   413  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Profile {
   414  		return vs[0].(map[string]*Profile)[vs[1].(string)]
   415  	}).(ProfileOutput)
   416  }
   417  
   418  func init() {
   419  	pulumi.RegisterInputType(reflect.TypeOf((*ProfileInput)(nil)).Elem(), &Profile{})
   420  	pulumi.RegisterInputType(reflect.TypeOf((*ProfileArrayInput)(nil)).Elem(), ProfileArray{})
   421  	pulumi.RegisterInputType(reflect.TypeOf((*ProfileMapInput)(nil)).Elem(), ProfileMap{})
   422  	pulumi.RegisterOutputType(ProfileOutput{})
   423  	pulumi.RegisterOutputType(ProfileArrayOutput{})
   424  	pulumi.RegisterOutputType(ProfileMapOutput{})
   425  }