github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/serviceSpecificCredential.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  	"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 an IAM Service Specific Credential.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			example, err := iam.NewUser(ctx, "example", &iam.UserArgs{
    33  //				Name: pulumi.String("example"),
    34  //			})
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			_, err = iam.NewServiceSpecificCredential(ctx, "example", &iam.ServiceSpecificCredentialArgs{
    39  //				ServiceName: pulumi.String("codecommit.amazonaws.com"),
    40  //				UserName:    example.Name,
    41  //			})
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			return nil
    46  //		})
    47  //	}
    48  //
    49  // ```
    50  // <!--End PulumiCodeChooser -->
    51  //
    52  // ## Import
    53  //
    54  // Using `pulumi import`, import IAM Service Specific Credentials using the `service_name:user_name:service_specific_credential_id`. For example:
    55  //
    56  // ```sh
    57  // $ pulumi import aws:iam/serviceSpecificCredential:ServiceSpecificCredential default `codecommit.amazonaws.com:example:some-id`
    58  // ```
    59  type ServiceSpecificCredential struct {
    60  	pulumi.CustomResourceState
    61  
    62  	// The name of the AWS service that is to be associated with the credentials. The service you specify here is the only service that can be accessed using these credentials.
    63  	ServiceName pulumi.StringOutput `pulumi:"serviceName"`
    64  	// The generated password for the service-specific credential.
    65  	ServicePassword pulumi.StringOutput `pulumi:"servicePassword"`
    66  	// The unique identifier for the service-specific credential.
    67  	ServiceSpecificCredentialId pulumi.StringOutput `pulumi:"serviceSpecificCredentialId"`
    68  	// The generated user name for the service-specific credential. This value is generated by combining the IAM user's name combined with the ID number of the AWS account, as in `jane-at-123456789012`, for example.
    69  	ServiceUserName pulumi.StringOutput `pulumi:"serviceUserName"`
    70  	// The status to be assigned to the service-specific credential. Valid values are `Active` and `Inactive`. Default value is `Active`.
    71  	Status pulumi.StringPtrOutput `pulumi:"status"`
    72  	// The name of the IAM user that is to be associated with the credentials. The new service-specific credentials have the same permissions as the associated user except that they can be used only to access the specified service.
    73  	UserName pulumi.StringOutput `pulumi:"userName"`
    74  }
    75  
    76  // NewServiceSpecificCredential registers a new resource with the given unique name, arguments, and options.
    77  func NewServiceSpecificCredential(ctx *pulumi.Context,
    78  	name string, args *ServiceSpecificCredentialArgs, opts ...pulumi.ResourceOption) (*ServiceSpecificCredential, error) {
    79  	if args == nil {
    80  		return nil, errors.New("missing one or more required arguments")
    81  	}
    82  
    83  	if args.ServiceName == nil {
    84  		return nil, errors.New("invalid value for required argument 'ServiceName'")
    85  	}
    86  	if args.UserName == nil {
    87  		return nil, errors.New("invalid value for required argument 'UserName'")
    88  	}
    89  	secrets := pulumi.AdditionalSecretOutputs([]string{
    90  		"servicePassword",
    91  	})
    92  	opts = append(opts, secrets)
    93  	opts = internal.PkgResourceDefaultOpts(opts)
    94  	var resource ServiceSpecificCredential
    95  	err := ctx.RegisterResource("aws:iam/serviceSpecificCredential:ServiceSpecificCredential", name, args, &resource, opts...)
    96  	if err != nil {
    97  		return nil, err
    98  	}
    99  	return &resource, nil
   100  }
   101  
   102  // GetServiceSpecificCredential gets an existing ServiceSpecificCredential resource's state with the given name, ID, and optional
   103  // state properties that are used to uniquely qualify the lookup (nil if not required).
   104  func GetServiceSpecificCredential(ctx *pulumi.Context,
   105  	name string, id pulumi.IDInput, state *ServiceSpecificCredentialState, opts ...pulumi.ResourceOption) (*ServiceSpecificCredential, error) {
   106  	var resource ServiceSpecificCredential
   107  	err := ctx.ReadResource("aws:iam/serviceSpecificCredential:ServiceSpecificCredential", name, id, state, &resource, opts...)
   108  	if err != nil {
   109  		return nil, err
   110  	}
   111  	return &resource, nil
   112  }
   113  
   114  // Input properties used for looking up and filtering ServiceSpecificCredential resources.
   115  type serviceSpecificCredentialState struct {
   116  	// The name of the AWS service that is to be associated with the credentials. The service you specify here is the only service that can be accessed using these credentials.
   117  	ServiceName *string `pulumi:"serviceName"`
   118  	// The generated password for the service-specific credential.
   119  	ServicePassword *string `pulumi:"servicePassword"`
   120  	// The unique identifier for the service-specific credential.
   121  	ServiceSpecificCredentialId *string `pulumi:"serviceSpecificCredentialId"`
   122  	// The generated user name for the service-specific credential. This value is generated by combining the IAM user's name combined with the ID number of the AWS account, as in `jane-at-123456789012`, for example.
   123  	ServiceUserName *string `pulumi:"serviceUserName"`
   124  	// The status to be assigned to the service-specific credential. Valid values are `Active` and `Inactive`. Default value is `Active`.
   125  	Status *string `pulumi:"status"`
   126  	// The name of the IAM user that is to be associated with the credentials. The new service-specific credentials have the same permissions as the associated user except that they can be used only to access the specified service.
   127  	UserName *string `pulumi:"userName"`
   128  }
   129  
   130  type ServiceSpecificCredentialState struct {
   131  	// The name of the AWS service that is to be associated with the credentials. The service you specify here is the only service that can be accessed using these credentials.
   132  	ServiceName pulumi.StringPtrInput
   133  	// The generated password for the service-specific credential.
   134  	ServicePassword pulumi.StringPtrInput
   135  	// The unique identifier for the service-specific credential.
   136  	ServiceSpecificCredentialId pulumi.StringPtrInput
   137  	// The generated user name for the service-specific credential. This value is generated by combining the IAM user's name combined with the ID number of the AWS account, as in `jane-at-123456789012`, for example.
   138  	ServiceUserName pulumi.StringPtrInput
   139  	// The status to be assigned to the service-specific credential. Valid values are `Active` and `Inactive`. Default value is `Active`.
   140  	Status pulumi.StringPtrInput
   141  	// The name of the IAM user that is to be associated with the credentials. The new service-specific credentials have the same permissions as the associated user except that they can be used only to access the specified service.
   142  	UserName pulumi.StringPtrInput
   143  }
   144  
   145  func (ServiceSpecificCredentialState) ElementType() reflect.Type {
   146  	return reflect.TypeOf((*serviceSpecificCredentialState)(nil)).Elem()
   147  }
   148  
   149  type serviceSpecificCredentialArgs struct {
   150  	// The name of the AWS service that is to be associated with the credentials. The service you specify here is the only service that can be accessed using these credentials.
   151  	ServiceName string `pulumi:"serviceName"`
   152  	// The status to be assigned to the service-specific credential. Valid values are `Active` and `Inactive`. Default value is `Active`.
   153  	Status *string `pulumi:"status"`
   154  	// The name of the IAM user that is to be associated with the credentials. The new service-specific credentials have the same permissions as the associated user except that they can be used only to access the specified service.
   155  	UserName string `pulumi:"userName"`
   156  }
   157  
   158  // The set of arguments for constructing a ServiceSpecificCredential resource.
   159  type ServiceSpecificCredentialArgs struct {
   160  	// The name of the AWS service that is to be associated with the credentials. The service you specify here is the only service that can be accessed using these credentials.
   161  	ServiceName pulumi.StringInput
   162  	// The status to be assigned to the service-specific credential. Valid values are `Active` and `Inactive`. Default value is `Active`.
   163  	Status pulumi.StringPtrInput
   164  	// The name of the IAM user that is to be associated with the credentials. The new service-specific credentials have the same permissions as the associated user except that they can be used only to access the specified service.
   165  	UserName pulumi.StringInput
   166  }
   167  
   168  func (ServiceSpecificCredentialArgs) ElementType() reflect.Type {
   169  	return reflect.TypeOf((*serviceSpecificCredentialArgs)(nil)).Elem()
   170  }
   171  
   172  type ServiceSpecificCredentialInput interface {
   173  	pulumi.Input
   174  
   175  	ToServiceSpecificCredentialOutput() ServiceSpecificCredentialOutput
   176  	ToServiceSpecificCredentialOutputWithContext(ctx context.Context) ServiceSpecificCredentialOutput
   177  }
   178  
   179  func (*ServiceSpecificCredential) ElementType() reflect.Type {
   180  	return reflect.TypeOf((**ServiceSpecificCredential)(nil)).Elem()
   181  }
   182  
   183  func (i *ServiceSpecificCredential) ToServiceSpecificCredentialOutput() ServiceSpecificCredentialOutput {
   184  	return i.ToServiceSpecificCredentialOutputWithContext(context.Background())
   185  }
   186  
   187  func (i *ServiceSpecificCredential) ToServiceSpecificCredentialOutputWithContext(ctx context.Context) ServiceSpecificCredentialOutput {
   188  	return pulumi.ToOutputWithContext(ctx, i).(ServiceSpecificCredentialOutput)
   189  }
   190  
   191  // ServiceSpecificCredentialArrayInput is an input type that accepts ServiceSpecificCredentialArray and ServiceSpecificCredentialArrayOutput values.
   192  // You can construct a concrete instance of `ServiceSpecificCredentialArrayInput` via:
   193  //
   194  //	ServiceSpecificCredentialArray{ ServiceSpecificCredentialArgs{...} }
   195  type ServiceSpecificCredentialArrayInput interface {
   196  	pulumi.Input
   197  
   198  	ToServiceSpecificCredentialArrayOutput() ServiceSpecificCredentialArrayOutput
   199  	ToServiceSpecificCredentialArrayOutputWithContext(context.Context) ServiceSpecificCredentialArrayOutput
   200  }
   201  
   202  type ServiceSpecificCredentialArray []ServiceSpecificCredentialInput
   203  
   204  func (ServiceSpecificCredentialArray) ElementType() reflect.Type {
   205  	return reflect.TypeOf((*[]*ServiceSpecificCredential)(nil)).Elem()
   206  }
   207  
   208  func (i ServiceSpecificCredentialArray) ToServiceSpecificCredentialArrayOutput() ServiceSpecificCredentialArrayOutput {
   209  	return i.ToServiceSpecificCredentialArrayOutputWithContext(context.Background())
   210  }
   211  
   212  func (i ServiceSpecificCredentialArray) ToServiceSpecificCredentialArrayOutputWithContext(ctx context.Context) ServiceSpecificCredentialArrayOutput {
   213  	return pulumi.ToOutputWithContext(ctx, i).(ServiceSpecificCredentialArrayOutput)
   214  }
   215  
   216  // ServiceSpecificCredentialMapInput is an input type that accepts ServiceSpecificCredentialMap and ServiceSpecificCredentialMapOutput values.
   217  // You can construct a concrete instance of `ServiceSpecificCredentialMapInput` via:
   218  //
   219  //	ServiceSpecificCredentialMap{ "key": ServiceSpecificCredentialArgs{...} }
   220  type ServiceSpecificCredentialMapInput interface {
   221  	pulumi.Input
   222  
   223  	ToServiceSpecificCredentialMapOutput() ServiceSpecificCredentialMapOutput
   224  	ToServiceSpecificCredentialMapOutputWithContext(context.Context) ServiceSpecificCredentialMapOutput
   225  }
   226  
   227  type ServiceSpecificCredentialMap map[string]ServiceSpecificCredentialInput
   228  
   229  func (ServiceSpecificCredentialMap) ElementType() reflect.Type {
   230  	return reflect.TypeOf((*map[string]*ServiceSpecificCredential)(nil)).Elem()
   231  }
   232  
   233  func (i ServiceSpecificCredentialMap) ToServiceSpecificCredentialMapOutput() ServiceSpecificCredentialMapOutput {
   234  	return i.ToServiceSpecificCredentialMapOutputWithContext(context.Background())
   235  }
   236  
   237  func (i ServiceSpecificCredentialMap) ToServiceSpecificCredentialMapOutputWithContext(ctx context.Context) ServiceSpecificCredentialMapOutput {
   238  	return pulumi.ToOutputWithContext(ctx, i).(ServiceSpecificCredentialMapOutput)
   239  }
   240  
   241  type ServiceSpecificCredentialOutput struct{ *pulumi.OutputState }
   242  
   243  func (ServiceSpecificCredentialOutput) ElementType() reflect.Type {
   244  	return reflect.TypeOf((**ServiceSpecificCredential)(nil)).Elem()
   245  }
   246  
   247  func (o ServiceSpecificCredentialOutput) ToServiceSpecificCredentialOutput() ServiceSpecificCredentialOutput {
   248  	return o
   249  }
   250  
   251  func (o ServiceSpecificCredentialOutput) ToServiceSpecificCredentialOutputWithContext(ctx context.Context) ServiceSpecificCredentialOutput {
   252  	return o
   253  }
   254  
   255  // The name of the AWS service that is to be associated with the credentials. The service you specify here is the only service that can be accessed using these credentials.
   256  func (o ServiceSpecificCredentialOutput) ServiceName() pulumi.StringOutput {
   257  	return o.ApplyT(func(v *ServiceSpecificCredential) pulumi.StringOutput { return v.ServiceName }).(pulumi.StringOutput)
   258  }
   259  
   260  // The generated password for the service-specific credential.
   261  func (o ServiceSpecificCredentialOutput) ServicePassword() pulumi.StringOutput {
   262  	return o.ApplyT(func(v *ServiceSpecificCredential) pulumi.StringOutput { return v.ServicePassword }).(pulumi.StringOutput)
   263  }
   264  
   265  // The unique identifier for the service-specific credential.
   266  func (o ServiceSpecificCredentialOutput) ServiceSpecificCredentialId() pulumi.StringOutput {
   267  	return o.ApplyT(func(v *ServiceSpecificCredential) pulumi.StringOutput { return v.ServiceSpecificCredentialId }).(pulumi.StringOutput)
   268  }
   269  
   270  // The generated user name for the service-specific credential. This value is generated by combining the IAM user's name combined with the ID number of the AWS account, as in `jane-at-123456789012`, for example.
   271  func (o ServiceSpecificCredentialOutput) ServiceUserName() pulumi.StringOutput {
   272  	return o.ApplyT(func(v *ServiceSpecificCredential) pulumi.StringOutput { return v.ServiceUserName }).(pulumi.StringOutput)
   273  }
   274  
   275  // The status to be assigned to the service-specific credential. Valid values are `Active` and `Inactive`. Default value is `Active`.
   276  func (o ServiceSpecificCredentialOutput) Status() pulumi.StringPtrOutput {
   277  	return o.ApplyT(func(v *ServiceSpecificCredential) pulumi.StringPtrOutput { return v.Status }).(pulumi.StringPtrOutput)
   278  }
   279  
   280  // The name of the IAM user that is to be associated with the credentials. The new service-specific credentials have the same permissions as the associated user except that they can be used only to access the specified service.
   281  func (o ServiceSpecificCredentialOutput) UserName() pulumi.StringOutput {
   282  	return o.ApplyT(func(v *ServiceSpecificCredential) pulumi.StringOutput { return v.UserName }).(pulumi.StringOutput)
   283  }
   284  
   285  type ServiceSpecificCredentialArrayOutput struct{ *pulumi.OutputState }
   286  
   287  func (ServiceSpecificCredentialArrayOutput) ElementType() reflect.Type {
   288  	return reflect.TypeOf((*[]*ServiceSpecificCredential)(nil)).Elem()
   289  }
   290  
   291  func (o ServiceSpecificCredentialArrayOutput) ToServiceSpecificCredentialArrayOutput() ServiceSpecificCredentialArrayOutput {
   292  	return o
   293  }
   294  
   295  func (o ServiceSpecificCredentialArrayOutput) ToServiceSpecificCredentialArrayOutputWithContext(ctx context.Context) ServiceSpecificCredentialArrayOutput {
   296  	return o
   297  }
   298  
   299  func (o ServiceSpecificCredentialArrayOutput) Index(i pulumi.IntInput) ServiceSpecificCredentialOutput {
   300  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ServiceSpecificCredential {
   301  		return vs[0].([]*ServiceSpecificCredential)[vs[1].(int)]
   302  	}).(ServiceSpecificCredentialOutput)
   303  }
   304  
   305  type ServiceSpecificCredentialMapOutput struct{ *pulumi.OutputState }
   306  
   307  func (ServiceSpecificCredentialMapOutput) ElementType() reflect.Type {
   308  	return reflect.TypeOf((*map[string]*ServiceSpecificCredential)(nil)).Elem()
   309  }
   310  
   311  func (o ServiceSpecificCredentialMapOutput) ToServiceSpecificCredentialMapOutput() ServiceSpecificCredentialMapOutput {
   312  	return o
   313  }
   314  
   315  func (o ServiceSpecificCredentialMapOutput) ToServiceSpecificCredentialMapOutputWithContext(ctx context.Context) ServiceSpecificCredentialMapOutput {
   316  	return o
   317  }
   318  
   319  func (o ServiceSpecificCredentialMapOutput) MapIndex(k pulumi.StringInput) ServiceSpecificCredentialOutput {
   320  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ServiceSpecificCredential {
   321  		return vs[0].(map[string]*ServiceSpecificCredential)[vs[1].(string)]
   322  	}).(ServiceSpecificCredentialOutput)
   323  }
   324  
   325  func init() {
   326  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceSpecificCredentialInput)(nil)).Elem(), &ServiceSpecificCredential{})
   327  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceSpecificCredentialArrayInput)(nil)).Elem(), ServiceSpecificCredentialArray{})
   328  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceSpecificCredentialMapInput)(nil)).Elem(), ServiceSpecificCredentialMap{})
   329  	pulumi.RegisterOutputType(ServiceSpecificCredentialOutput{})
   330  	pulumi.RegisterOutputType(ServiceSpecificCredentialArrayOutput{})
   331  	pulumi.RegisterOutputType(ServiceSpecificCredentialMapOutput{})
   332  }