github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/redshift/clusterIamRoles.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 redshift
     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  // Provides a Redshift Cluster IAM Roles resource.
    16  //
    17  // > **NOTE:** A Redshift cluster's default IAM role can be managed both by this resource's `defaultIamRoleArn` argument and the `redshift.Cluster` resource's `defaultIamRoleArn` argument. Do not configure different values for both arguments. Doing so will cause a conflict of default IAM roles.
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshift"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := redshift.NewClusterIamRoles(ctx, "example", &redshift.ClusterIamRolesArgs{
    35  //				ClusterIdentifier: pulumi.Any(exampleAwsRedshiftCluster.ClusterIdentifier),
    36  //				IamRoleArns: pulumi.StringArray{
    37  //					exampleAwsIamRole.Arn,
    38  //				},
    39  //			})
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			return nil
    44  //		})
    45  //	}
    46  //
    47  // ```
    48  // <!--End PulumiCodeChooser -->
    49  //
    50  // ## Import
    51  //
    52  // Using `pulumi import`, import Redshift Cluster IAM Roless using the `cluster_identifier`. For example:
    53  //
    54  // ```sh
    55  // $ pulumi import aws:redshift/clusterIamRoles:ClusterIamRoles examplegroup1 example
    56  // ```
    57  type ClusterIamRoles struct {
    58  	pulumi.CustomResourceState
    59  
    60  	// The name of the Redshift Cluster IAM Roles.
    61  	ClusterIdentifier pulumi.StringOutput `pulumi:"clusterIdentifier"`
    62  	// The Amazon Resource Name (ARN) for the IAM role that was set as default for the cluster when the cluster was created.
    63  	DefaultIamRoleArn pulumi.StringOutput `pulumi:"defaultIamRoleArn"`
    64  	// A list of IAM Role ARNs to associate with the cluster. A Maximum of 10 can be associated to the cluster at any time.
    65  	IamRoleArns pulumi.StringArrayOutput `pulumi:"iamRoleArns"`
    66  }
    67  
    68  // NewClusterIamRoles registers a new resource with the given unique name, arguments, and options.
    69  func NewClusterIamRoles(ctx *pulumi.Context,
    70  	name string, args *ClusterIamRolesArgs, opts ...pulumi.ResourceOption) (*ClusterIamRoles, error) {
    71  	if args == nil {
    72  		return nil, errors.New("missing one or more required arguments")
    73  	}
    74  
    75  	if args.ClusterIdentifier == nil {
    76  		return nil, errors.New("invalid value for required argument 'ClusterIdentifier'")
    77  	}
    78  	opts = internal.PkgResourceDefaultOpts(opts)
    79  	var resource ClusterIamRoles
    80  	err := ctx.RegisterResource("aws:redshift/clusterIamRoles:ClusterIamRoles", name, args, &resource, opts...)
    81  	if err != nil {
    82  		return nil, err
    83  	}
    84  	return &resource, nil
    85  }
    86  
    87  // GetClusterIamRoles gets an existing ClusterIamRoles resource's state with the given name, ID, and optional
    88  // state properties that are used to uniquely qualify the lookup (nil if not required).
    89  func GetClusterIamRoles(ctx *pulumi.Context,
    90  	name string, id pulumi.IDInput, state *ClusterIamRolesState, opts ...pulumi.ResourceOption) (*ClusterIamRoles, error) {
    91  	var resource ClusterIamRoles
    92  	err := ctx.ReadResource("aws:redshift/clusterIamRoles:ClusterIamRoles", name, id, state, &resource, opts...)
    93  	if err != nil {
    94  		return nil, err
    95  	}
    96  	return &resource, nil
    97  }
    98  
    99  // Input properties used for looking up and filtering ClusterIamRoles resources.
   100  type clusterIamRolesState struct {
   101  	// The name of the Redshift Cluster IAM Roles.
   102  	ClusterIdentifier *string `pulumi:"clusterIdentifier"`
   103  	// The Amazon Resource Name (ARN) for the IAM role that was set as default for the cluster when the cluster was created.
   104  	DefaultIamRoleArn *string `pulumi:"defaultIamRoleArn"`
   105  	// A list of IAM Role ARNs to associate with the cluster. A Maximum of 10 can be associated to the cluster at any time.
   106  	IamRoleArns []string `pulumi:"iamRoleArns"`
   107  }
   108  
   109  type ClusterIamRolesState struct {
   110  	// The name of the Redshift Cluster IAM Roles.
   111  	ClusterIdentifier pulumi.StringPtrInput
   112  	// The Amazon Resource Name (ARN) for the IAM role that was set as default for the cluster when the cluster was created.
   113  	DefaultIamRoleArn pulumi.StringPtrInput
   114  	// A list of IAM Role ARNs to associate with the cluster. A Maximum of 10 can be associated to the cluster at any time.
   115  	IamRoleArns pulumi.StringArrayInput
   116  }
   117  
   118  func (ClusterIamRolesState) ElementType() reflect.Type {
   119  	return reflect.TypeOf((*clusterIamRolesState)(nil)).Elem()
   120  }
   121  
   122  type clusterIamRolesArgs struct {
   123  	// The name of the Redshift Cluster IAM Roles.
   124  	ClusterIdentifier string `pulumi:"clusterIdentifier"`
   125  	// The Amazon Resource Name (ARN) for the IAM role that was set as default for the cluster when the cluster was created.
   126  	DefaultIamRoleArn *string `pulumi:"defaultIamRoleArn"`
   127  	// A list of IAM Role ARNs to associate with the cluster. A Maximum of 10 can be associated to the cluster at any time.
   128  	IamRoleArns []string `pulumi:"iamRoleArns"`
   129  }
   130  
   131  // The set of arguments for constructing a ClusterIamRoles resource.
   132  type ClusterIamRolesArgs struct {
   133  	// The name of the Redshift Cluster IAM Roles.
   134  	ClusterIdentifier pulumi.StringInput
   135  	// The Amazon Resource Name (ARN) for the IAM role that was set as default for the cluster when the cluster was created.
   136  	DefaultIamRoleArn pulumi.StringPtrInput
   137  	// A list of IAM Role ARNs to associate with the cluster. A Maximum of 10 can be associated to the cluster at any time.
   138  	IamRoleArns pulumi.StringArrayInput
   139  }
   140  
   141  func (ClusterIamRolesArgs) ElementType() reflect.Type {
   142  	return reflect.TypeOf((*clusterIamRolesArgs)(nil)).Elem()
   143  }
   144  
   145  type ClusterIamRolesInput interface {
   146  	pulumi.Input
   147  
   148  	ToClusterIamRolesOutput() ClusterIamRolesOutput
   149  	ToClusterIamRolesOutputWithContext(ctx context.Context) ClusterIamRolesOutput
   150  }
   151  
   152  func (*ClusterIamRoles) ElementType() reflect.Type {
   153  	return reflect.TypeOf((**ClusterIamRoles)(nil)).Elem()
   154  }
   155  
   156  func (i *ClusterIamRoles) ToClusterIamRolesOutput() ClusterIamRolesOutput {
   157  	return i.ToClusterIamRolesOutputWithContext(context.Background())
   158  }
   159  
   160  func (i *ClusterIamRoles) ToClusterIamRolesOutputWithContext(ctx context.Context) ClusterIamRolesOutput {
   161  	return pulumi.ToOutputWithContext(ctx, i).(ClusterIamRolesOutput)
   162  }
   163  
   164  // ClusterIamRolesArrayInput is an input type that accepts ClusterIamRolesArray and ClusterIamRolesArrayOutput values.
   165  // You can construct a concrete instance of `ClusterIamRolesArrayInput` via:
   166  //
   167  //	ClusterIamRolesArray{ ClusterIamRolesArgs{...} }
   168  type ClusterIamRolesArrayInput interface {
   169  	pulumi.Input
   170  
   171  	ToClusterIamRolesArrayOutput() ClusterIamRolesArrayOutput
   172  	ToClusterIamRolesArrayOutputWithContext(context.Context) ClusterIamRolesArrayOutput
   173  }
   174  
   175  type ClusterIamRolesArray []ClusterIamRolesInput
   176  
   177  func (ClusterIamRolesArray) ElementType() reflect.Type {
   178  	return reflect.TypeOf((*[]*ClusterIamRoles)(nil)).Elem()
   179  }
   180  
   181  func (i ClusterIamRolesArray) ToClusterIamRolesArrayOutput() ClusterIamRolesArrayOutput {
   182  	return i.ToClusterIamRolesArrayOutputWithContext(context.Background())
   183  }
   184  
   185  func (i ClusterIamRolesArray) ToClusterIamRolesArrayOutputWithContext(ctx context.Context) ClusterIamRolesArrayOutput {
   186  	return pulumi.ToOutputWithContext(ctx, i).(ClusterIamRolesArrayOutput)
   187  }
   188  
   189  // ClusterIamRolesMapInput is an input type that accepts ClusterIamRolesMap and ClusterIamRolesMapOutput values.
   190  // You can construct a concrete instance of `ClusterIamRolesMapInput` via:
   191  //
   192  //	ClusterIamRolesMap{ "key": ClusterIamRolesArgs{...} }
   193  type ClusterIamRolesMapInput interface {
   194  	pulumi.Input
   195  
   196  	ToClusterIamRolesMapOutput() ClusterIamRolesMapOutput
   197  	ToClusterIamRolesMapOutputWithContext(context.Context) ClusterIamRolesMapOutput
   198  }
   199  
   200  type ClusterIamRolesMap map[string]ClusterIamRolesInput
   201  
   202  func (ClusterIamRolesMap) ElementType() reflect.Type {
   203  	return reflect.TypeOf((*map[string]*ClusterIamRoles)(nil)).Elem()
   204  }
   205  
   206  func (i ClusterIamRolesMap) ToClusterIamRolesMapOutput() ClusterIamRolesMapOutput {
   207  	return i.ToClusterIamRolesMapOutputWithContext(context.Background())
   208  }
   209  
   210  func (i ClusterIamRolesMap) ToClusterIamRolesMapOutputWithContext(ctx context.Context) ClusterIamRolesMapOutput {
   211  	return pulumi.ToOutputWithContext(ctx, i).(ClusterIamRolesMapOutput)
   212  }
   213  
   214  type ClusterIamRolesOutput struct{ *pulumi.OutputState }
   215  
   216  func (ClusterIamRolesOutput) ElementType() reflect.Type {
   217  	return reflect.TypeOf((**ClusterIamRoles)(nil)).Elem()
   218  }
   219  
   220  func (o ClusterIamRolesOutput) ToClusterIamRolesOutput() ClusterIamRolesOutput {
   221  	return o
   222  }
   223  
   224  func (o ClusterIamRolesOutput) ToClusterIamRolesOutputWithContext(ctx context.Context) ClusterIamRolesOutput {
   225  	return o
   226  }
   227  
   228  // The name of the Redshift Cluster IAM Roles.
   229  func (o ClusterIamRolesOutput) ClusterIdentifier() pulumi.StringOutput {
   230  	return o.ApplyT(func(v *ClusterIamRoles) pulumi.StringOutput { return v.ClusterIdentifier }).(pulumi.StringOutput)
   231  }
   232  
   233  // The Amazon Resource Name (ARN) for the IAM role that was set as default for the cluster when the cluster was created.
   234  func (o ClusterIamRolesOutput) DefaultIamRoleArn() pulumi.StringOutput {
   235  	return o.ApplyT(func(v *ClusterIamRoles) pulumi.StringOutput { return v.DefaultIamRoleArn }).(pulumi.StringOutput)
   236  }
   237  
   238  // A list of IAM Role ARNs to associate with the cluster. A Maximum of 10 can be associated to the cluster at any time.
   239  func (o ClusterIamRolesOutput) IamRoleArns() pulumi.StringArrayOutput {
   240  	return o.ApplyT(func(v *ClusterIamRoles) pulumi.StringArrayOutput { return v.IamRoleArns }).(pulumi.StringArrayOutput)
   241  }
   242  
   243  type ClusterIamRolesArrayOutput struct{ *pulumi.OutputState }
   244  
   245  func (ClusterIamRolesArrayOutput) ElementType() reflect.Type {
   246  	return reflect.TypeOf((*[]*ClusterIamRoles)(nil)).Elem()
   247  }
   248  
   249  func (o ClusterIamRolesArrayOutput) ToClusterIamRolesArrayOutput() ClusterIamRolesArrayOutput {
   250  	return o
   251  }
   252  
   253  func (o ClusterIamRolesArrayOutput) ToClusterIamRolesArrayOutputWithContext(ctx context.Context) ClusterIamRolesArrayOutput {
   254  	return o
   255  }
   256  
   257  func (o ClusterIamRolesArrayOutput) Index(i pulumi.IntInput) ClusterIamRolesOutput {
   258  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ClusterIamRoles {
   259  		return vs[0].([]*ClusterIamRoles)[vs[1].(int)]
   260  	}).(ClusterIamRolesOutput)
   261  }
   262  
   263  type ClusterIamRolesMapOutput struct{ *pulumi.OutputState }
   264  
   265  func (ClusterIamRolesMapOutput) ElementType() reflect.Type {
   266  	return reflect.TypeOf((*map[string]*ClusterIamRoles)(nil)).Elem()
   267  }
   268  
   269  func (o ClusterIamRolesMapOutput) ToClusterIamRolesMapOutput() ClusterIamRolesMapOutput {
   270  	return o
   271  }
   272  
   273  func (o ClusterIamRolesMapOutput) ToClusterIamRolesMapOutputWithContext(ctx context.Context) ClusterIamRolesMapOutput {
   274  	return o
   275  }
   276  
   277  func (o ClusterIamRolesMapOutput) MapIndex(k pulumi.StringInput) ClusterIamRolesOutput {
   278  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ClusterIamRoles {
   279  		return vs[0].(map[string]*ClusterIamRoles)[vs[1].(string)]
   280  	}).(ClusterIamRolesOutput)
   281  }
   282  
   283  func init() {
   284  	pulumi.RegisterInputType(reflect.TypeOf((*ClusterIamRolesInput)(nil)).Elem(), &ClusterIamRoles{})
   285  	pulumi.RegisterInputType(reflect.TypeOf((*ClusterIamRolesArrayInput)(nil)).Elem(), ClusterIamRolesArray{})
   286  	pulumi.RegisterInputType(reflect.TypeOf((*ClusterIamRolesMapInput)(nil)).Elem(), ClusterIamRolesMap{})
   287  	pulumi.RegisterOutputType(ClusterIamRolesOutput{})
   288  	pulumi.RegisterOutputType(ClusterIamRolesArrayOutput{})
   289  	pulumi.RegisterOutputType(ClusterIamRolesMapOutput{})
   290  }