github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/organizations/delegatedAdministrator.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 organizations
     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 resource to manage an [AWS Organizations Delegated Administrator](https://docs.aws.amazon.com/organizations/latest/APIReference/API_RegisterDelegatedAdministrator.html).
    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/organizations"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := organizations.NewDelegatedAdministrator(ctx, "example", &organizations.DelegatedAdministratorArgs{
    33  //				AccountId:        pulumi.String("123456789012"),
    34  //				ServicePrincipal: pulumi.String("principal"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  //
    46  // ## Import
    47  //
    48  // Using `pulumi import`, import `aws_organizations_delegated_administrator` using the account ID and its service principal. For example:
    49  //
    50  // ```sh
    51  // $ pulumi import aws:organizations/delegatedAdministrator:DelegatedAdministrator example 123456789012/config.amazonaws.com
    52  // ```
    53  type DelegatedAdministrator struct {
    54  	pulumi.CustomResourceState
    55  
    56  	// The account ID number of the member account in the organization to register as a delegated administrator.
    57  	AccountId pulumi.StringOutput `pulumi:"accountId"`
    58  	// The Amazon Resource Name (ARN) of the delegated administrator's account.
    59  	Arn pulumi.StringOutput `pulumi:"arn"`
    60  	// The date when the account was made a delegated administrator.
    61  	DelegationEnabledDate pulumi.StringOutput `pulumi:"delegationEnabledDate"`
    62  	// The email address that is associated with the delegated administrator's AWS account.
    63  	Email pulumi.StringOutput `pulumi:"email"`
    64  	// The method by which the delegated administrator's account joined the organization.
    65  	JoinedMethod pulumi.StringOutput `pulumi:"joinedMethod"`
    66  	// The date when the delegated administrator's account became a part of the organization.
    67  	JoinedTimestamp pulumi.StringOutput `pulumi:"joinedTimestamp"`
    68  	// The friendly name of the delegated administrator's account.
    69  	Name pulumi.StringOutput `pulumi:"name"`
    70  	// The service principal of the AWS service for which you want to make the member account a delegated administrator.
    71  	ServicePrincipal pulumi.StringOutput `pulumi:"servicePrincipal"`
    72  	// The status of the delegated administrator's account in the organization.
    73  	Status pulumi.StringOutput `pulumi:"status"`
    74  }
    75  
    76  // NewDelegatedAdministrator registers a new resource with the given unique name, arguments, and options.
    77  func NewDelegatedAdministrator(ctx *pulumi.Context,
    78  	name string, args *DelegatedAdministratorArgs, opts ...pulumi.ResourceOption) (*DelegatedAdministrator, error) {
    79  	if args == nil {
    80  		return nil, errors.New("missing one or more required arguments")
    81  	}
    82  
    83  	if args.AccountId == nil {
    84  		return nil, errors.New("invalid value for required argument 'AccountId'")
    85  	}
    86  	if args.ServicePrincipal == nil {
    87  		return nil, errors.New("invalid value for required argument 'ServicePrincipal'")
    88  	}
    89  	opts = internal.PkgResourceDefaultOpts(opts)
    90  	var resource DelegatedAdministrator
    91  	err := ctx.RegisterResource("aws:organizations/delegatedAdministrator:DelegatedAdministrator", name, args, &resource, opts...)
    92  	if err != nil {
    93  		return nil, err
    94  	}
    95  	return &resource, nil
    96  }
    97  
    98  // GetDelegatedAdministrator gets an existing DelegatedAdministrator resource's state with the given name, ID, and optional
    99  // state properties that are used to uniquely qualify the lookup (nil if not required).
   100  func GetDelegatedAdministrator(ctx *pulumi.Context,
   101  	name string, id pulumi.IDInput, state *DelegatedAdministratorState, opts ...pulumi.ResourceOption) (*DelegatedAdministrator, error) {
   102  	var resource DelegatedAdministrator
   103  	err := ctx.ReadResource("aws:organizations/delegatedAdministrator:DelegatedAdministrator", name, id, state, &resource, opts...)
   104  	if err != nil {
   105  		return nil, err
   106  	}
   107  	return &resource, nil
   108  }
   109  
   110  // Input properties used for looking up and filtering DelegatedAdministrator resources.
   111  type delegatedAdministratorState struct {
   112  	// The account ID number of the member account in the organization to register as a delegated administrator.
   113  	AccountId *string `pulumi:"accountId"`
   114  	// The Amazon Resource Name (ARN) of the delegated administrator's account.
   115  	Arn *string `pulumi:"arn"`
   116  	// The date when the account was made a delegated administrator.
   117  	DelegationEnabledDate *string `pulumi:"delegationEnabledDate"`
   118  	// The email address that is associated with the delegated administrator's AWS account.
   119  	Email *string `pulumi:"email"`
   120  	// The method by which the delegated administrator's account joined the organization.
   121  	JoinedMethod *string `pulumi:"joinedMethod"`
   122  	// The date when the delegated administrator's account became a part of the organization.
   123  	JoinedTimestamp *string `pulumi:"joinedTimestamp"`
   124  	// The friendly name of the delegated administrator's account.
   125  	Name *string `pulumi:"name"`
   126  	// The service principal of the AWS service for which you want to make the member account a delegated administrator.
   127  	ServicePrincipal *string `pulumi:"servicePrincipal"`
   128  	// The status of the delegated administrator's account in the organization.
   129  	Status *string `pulumi:"status"`
   130  }
   131  
   132  type DelegatedAdministratorState struct {
   133  	// The account ID number of the member account in the organization to register as a delegated administrator.
   134  	AccountId pulumi.StringPtrInput
   135  	// The Amazon Resource Name (ARN) of the delegated administrator's account.
   136  	Arn pulumi.StringPtrInput
   137  	// The date when the account was made a delegated administrator.
   138  	DelegationEnabledDate pulumi.StringPtrInput
   139  	// The email address that is associated with the delegated administrator's AWS account.
   140  	Email pulumi.StringPtrInput
   141  	// The method by which the delegated administrator's account joined the organization.
   142  	JoinedMethod pulumi.StringPtrInput
   143  	// The date when the delegated administrator's account became a part of the organization.
   144  	JoinedTimestamp pulumi.StringPtrInput
   145  	// The friendly name of the delegated administrator's account.
   146  	Name pulumi.StringPtrInput
   147  	// The service principal of the AWS service for which you want to make the member account a delegated administrator.
   148  	ServicePrincipal pulumi.StringPtrInput
   149  	// The status of the delegated administrator's account in the organization.
   150  	Status pulumi.StringPtrInput
   151  }
   152  
   153  func (DelegatedAdministratorState) ElementType() reflect.Type {
   154  	return reflect.TypeOf((*delegatedAdministratorState)(nil)).Elem()
   155  }
   156  
   157  type delegatedAdministratorArgs struct {
   158  	// The account ID number of the member account in the organization to register as a delegated administrator.
   159  	AccountId string `pulumi:"accountId"`
   160  	// The service principal of the AWS service for which you want to make the member account a delegated administrator.
   161  	ServicePrincipal string `pulumi:"servicePrincipal"`
   162  }
   163  
   164  // The set of arguments for constructing a DelegatedAdministrator resource.
   165  type DelegatedAdministratorArgs struct {
   166  	// The account ID number of the member account in the organization to register as a delegated administrator.
   167  	AccountId pulumi.StringInput
   168  	// The service principal of the AWS service for which you want to make the member account a delegated administrator.
   169  	ServicePrincipal pulumi.StringInput
   170  }
   171  
   172  func (DelegatedAdministratorArgs) ElementType() reflect.Type {
   173  	return reflect.TypeOf((*delegatedAdministratorArgs)(nil)).Elem()
   174  }
   175  
   176  type DelegatedAdministratorInput interface {
   177  	pulumi.Input
   178  
   179  	ToDelegatedAdministratorOutput() DelegatedAdministratorOutput
   180  	ToDelegatedAdministratorOutputWithContext(ctx context.Context) DelegatedAdministratorOutput
   181  }
   182  
   183  func (*DelegatedAdministrator) ElementType() reflect.Type {
   184  	return reflect.TypeOf((**DelegatedAdministrator)(nil)).Elem()
   185  }
   186  
   187  func (i *DelegatedAdministrator) ToDelegatedAdministratorOutput() DelegatedAdministratorOutput {
   188  	return i.ToDelegatedAdministratorOutputWithContext(context.Background())
   189  }
   190  
   191  func (i *DelegatedAdministrator) ToDelegatedAdministratorOutputWithContext(ctx context.Context) DelegatedAdministratorOutput {
   192  	return pulumi.ToOutputWithContext(ctx, i).(DelegatedAdministratorOutput)
   193  }
   194  
   195  // DelegatedAdministratorArrayInput is an input type that accepts DelegatedAdministratorArray and DelegatedAdministratorArrayOutput values.
   196  // You can construct a concrete instance of `DelegatedAdministratorArrayInput` via:
   197  //
   198  //	DelegatedAdministratorArray{ DelegatedAdministratorArgs{...} }
   199  type DelegatedAdministratorArrayInput interface {
   200  	pulumi.Input
   201  
   202  	ToDelegatedAdministratorArrayOutput() DelegatedAdministratorArrayOutput
   203  	ToDelegatedAdministratorArrayOutputWithContext(context.Context) DelegatedAdministratorArrayOutput
   204  }
   205  
   206  type DelegatedAdministratorArray []DelegatedAdministratorInput
   207  
   208  func (DelegatedAdministratorArray) ElementType() reflect.Type {
   209  	return reflect.TypeOf((*[]*DelegatedAdministrator)(nil)).Elem()
   210  }
   211  
   212  func (i DelegatedAdministratorArray) ToDelegatedAdministratorArrayOutput() DelegatedAdministratorArrayOutput {
   213  	return i.ToDelegatedAdministratorArrayOutputWithContext(context.Background())
   214  }
   215  
   216  func (i DelegatedAdministratorArray) ToDelegatedAdministratorArrayOutputWithContext(ctx context.Context) DelegatedAdministratorArrayOutput {
   217  	return pulumi.ToOutputWithContext(ctx, i).(DelegatedAdministratorArrayOutput)
   218  }
   219  
   220  // DelegatedAdministratorMapInput is an input type that accepts DelegatedAdministratorMap and DelegatedAdministratorMapOutput values.
   221  // You can construct a concrete instance of `DelegatedAdministratorMapInput` via:
   222  //
   223  //	DelegatedAdministratorMap{ "key": DelegatedAdministratorArgs{...} }
   224  type DelegatedAdministratorMapInput interface {
   225  	pulumi.Input
   226  
   227  	ToDelegatedAdministratorMapOutput() DelegatedAdministratorMapOutput
   228  	ToDelegatedAdministratorMapOutputWithContext(context.Context) DelegatedAdministratorMapOutput
   229  }
   230  
   231  type DelegatedAdministratorMap map[string]DelegatedAdministratorInput
   232  
   233  func (DelegatedAdministratorMap) ElementType() reflect.Type {
   234  	return reflect.TypeOf((*map[string]*DelegatedAdministrator)(nil)).Elem()
   235  }
   236  
   237  func (i DelegatedAdministratorMap) ToDelegatedAdministratorMapOutput() DelegatedAdministratorMapOutput {
   238  	return i.ToDelegatedAdministratorMapOutputWithContext(context.Background())
   239  }
   240  
   241  func (i DelegatedAdministratorMap) ToDelegatedAdministratorMapOutputWithContext(ctx context.Context) DelegatedAdministratorMapOutput {
   242  	return pulumi.ToOutputWithContext(ctx, i).(DelegatedAdministratorMapOutput)
   243  }
   244  
   245  type DelegatedAdministratorOutput struct{ *pulumi.OutputState }
   246  
   247  func (DelegatedAdministratorOutput) ElementType() reflect.Type {
   248  	return reflect.TypeOf((**DelegatedAdministrator)(nil)).Elem()
   249  }
   250  
   251  func (o DelegatedAdministratorOutput) ToDelegatedAdministratorOutput() DelegatedAdministratorOutput {
   252  	return o
   253  }
   254  
   255  func (o DelegatedAdministratorOutput) ToDelegatedAdministratorOutputWithContext(ctx context.Context) DelegatedAdministratorOutput {
   256  	return o
   257  }
   258  
   259  // The account ID number of the member account in the organization to register as a delegated administrator.
   260  func (o DelegatedAdministratorOutput) AccountId() pulumi.StringOutput {
   261  	return o.ApplyT(func(v *DelegatedAdministrator) pulumi.StringOutput { return v.AccountId }).(pulumi.StringOutput)
   262  }
   263  
   264  // The Amazon Resource Name (ARN) of the delegated administrator's account.
   265  func (o DelegatedAdministratorOutput) Arn() pulumi.StringOutput {
   266  	return o.ApplyT(func(v *DelegatedAdministrator) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   267  }
   268  
   269  // The date when the account was made a delegated administrator.
   270  func (o DelegatedAdministratorOutput) DelegationEnabledDate() pulumi.StringOutput {
   271  	return o.ApplyT(func(v *DelegatedAdministrator) pulumi.StringOutput { return v.DelegationEnabledDate }).(pulumi.StringOutput)
   272  }
   273  
   274  // The email address that is associated with the delegated administrator's AWS account.
   275  func (o DelegatedAdministratorOutput) Email() pulumi.StringOutput {
   276  	return o.ApplyT(func(v *DelegatedAdministrator) pulumi.StringOutput { return v.Email }).(pulumi.StringOutput)
   277  }
   278  
   279  // The method by which the delegated administrator's account joined the organization.
   280  func (o DelegatedAdministratorOutput) JoinedMethod() pulumi.StringOutput {
   281  	return o.ApplyT(func(v *DelegatedAdministrator) pulumi.StringOutput { return v.JoinedMethod }).(pulumi.StringOutput)
   282  }
   283  
   284  // The date when the delegated administrator's account became a part of the organization.
   285  func (o DelegatedAdministratorOutput) JoinedTimestamp() pulumi.StringOutput {
   286  	return o.ApplyT(func(v *DelegatedAdministrator) pulumi.StringOutput { return v.JoinedTimestamp }).(pulumi.StringOutput)
   287  }
   288  
   289  // The friendly name of the delegated administrator's account.
   290  func (o DelegatedAdministratorOutput) Name() pulumi.StringOutput {
   291  	return o.ApplyT(func(v *DelegatedAdministrator) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   292  }
   293  
   294  // The service principal of the AWS service for which you want to make the member account a delegated administrator.
   295  func (o DelegatedAdministratorOutput) ServicePrincipal() pulumi.StringOutput {
   296  	return o.ApplyT(func(v *DelegatedAdministrator) pulumi.StringOutput { return v.ServicePrincipal }).(pulumi.StringOutput)
   297  }
   298  
   299  // The status of the delegated administrator's account in the organization.
   300  func (o DelegatedAdministratorOutput) Status() pulumi.StringOutput {
   301  	return o.ApplyT(func(v *DelegatedAdministrator) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
   302  }
   303  
   304  type DelegatedAdministratorArrayOutput struct{ *pulumi.OutputState }
   305  
   306  func (DelegatedAdministratorArrayOutput) ElementType() reflect.Type {
   307  	return reflect.TypeOf((*[]*DelegatedAdministrator)(nil)).Elem()
   308  }
   309  
   310  func (o DelegatedAdministratorArrayOutput) ToDelegatedAdministratorArrayOutput() DelegatedAdministratorArrayOutput {
   311  	return o
   312  }
   313  
   314  func (o DelegatedAdministratorArrayOutput) ToDelegatedAdministratorArrayOutputWithContext(ctx context.Context) DelegatedAdministratorArrayOutput {
   315  	return o
   316  }
   317  
   318  func (o DelegatedAdministratorArrayOutput) Index(i pulumi.IntInput) DelegatedAdministratorOutput {
   319  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DelegatedAdministrator {
   320  		return vs[0].([]*DelegatedAdministrator)[vs[1].(int)]
   321  	}).(DelegatedAdministratorOutput)
   322  }
   323  
   324  type DelegatedAdministratorMapOutput struct{ *pulumi.OutputState }
   325  
   326  func (DelegatedAdministratorMapOutput) ElementType() reflect.Type {
   327  	return reflect.TypeOf((*map[string]*DelegatedAdministrator)(nil)).Elem()
   328  }
   329  
   330  func (o DelegatedAdministratorMapOutput) ToDelegatedAdministratorMapOutput() DelegatedAdministratorMapOutput {
   331  	return o
   332  }
   333  
   334  func (o DelegatedAdministratorMapOutput) ToDelegatedAdministratorMapOutputWithContext(ctx context.Context) DelegatedAdministratorMapOutput {
   335  	return o
   336  }
   337  
   338  func (o DelegatedAdministratorMapOutput) MapIndex(k pulumi.StringInput) DelegatedAdministratorOutput {
   339  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DelegatedAdministrator {
   340  		return vs[0].(map[string]*DelegatedAdministrator)[vs[1].(string)]
   341  	}).(DelegatedAdministratorOutput)
   342  }
   343  
   344  func init() {
   345  	pulumi.RegisterInputType(reflect.TypeOf((*DelegatedAdministratorInput)(nil)).Elem(), &DelegatedAdministrator{})
   346  	pulumi.RegisterInputType(reflect.TypeOf((*DelegatedAdministratorArrayInput)(nil)).Elem(), DelegatedAdministratorArray{})
   347  	pulumi.RegisterInputType(reflect.TypeOf((*DelegatedAdministratorMapInput)(nil)).Elem(), DelegatedAdministratorMap{})
   348  	pulumi.RegisterOutputType(DelegatedAdministratorOutput{})
   349  	pulumi.RegisterOutputType(DelegatedAdministratorArrayOutput{})
   350  	pulumi.RegisterOutputType(DelegatedAdministratorMapOutput{})
   351  }