github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/organizations/getDelegatedAdministrators.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Get a list of AWS accounts that are designated as delegated administrators in this organization
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			_, err := organizations.GetDelegatedAdministrators(ctx, &organizations.GetDelegatedAdministratorsArgs{
    32  //				ServicePrincipal: pulumi.StringRef("SERVICE PRINCIPAL"),
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  func GetDelegatedAdministrators(ctx *pulumi.Context, args *GetDelegatedAdministratorsArgs, opts ...pulumi.InvokeOption) (*GetDelegatedAdministratorsResult, error) {
    44  	opts = internal.PkgInvokeDefaultOpts(opts)
    45  	var rv GetDelegatedAdministratorsResult
    46  	err := ctx.Invoke("aws:organizations/getDelegatedAdministrators:getDelegatedAdministrators", args, &rv, opts...)
    47  	if err != nil {
    48  		return nil, err
    49  	}
    50  	return &rv, nil
    51  }
    52  
    53  // A collection of arguments for invoking getDelegatedAdministrators.
    54  type GetDelegatedAdministratorsArgs struct {
    55  	// Specifies a service principal name. If specified, then the operation lists the delegated administrators only for the specified service. If you don't specify a service principal, the operation lists all delegated administrators for all services in your organization.
    56  	ServicePrincipal *string `pulumi:"servicePrincipal"`
    57  }
    58  
    59  // A collection of values returned by getDelegatedAdministrators.
    60  type GetDelegatedAdministratorsResult struct {
    61  	// The list of delegated administrators in your organization, which have the following attributes:
    62  	DelegatedAdministrators []GetDelegatedAdministratorsDelegatedAdministrator `pulumi:"delegatedAdministrators"`
    63  	// The provider-assigned unique ID for this managed resource.
    64  	Id               string  `pulumi:"id"`
    65  	ServicePrincipal *string `pulumi:"servicePrincipal"`
    66  }
    67  
    68  func GetDelegatedAdministratorsOutput(ctx *pulumi.Context, args GetDelegatedAdministratorsOutputArgs, opts ...pulumi.InvokeOption) GetDelegatedAdministratorsResultOutput {
    69  	return pulumi.ToOutputWithContext(context.Background(), args).
    70  		ApplyT(func(v interface{}) (GetDelegatedAdministratorsResult, error) {
    71  			args := v.(GetDelegatedAdministratorsArgs)
    72  			r, err := GetDelegatedAdministrators(ctx, &args, opts...)
    73  			var s GetDelegatedAdministratorsResult
    74  			if r != nil {
    75  				s = *r
    76  			}
    77  			return s, err
    78  		}).(GetDelegatedAdministratorsResultOutput)
    79  }
    80  
    81  // A collection of arguments for invoking getDelegatedAdministrators.
    82  type GetDelegatedAdministratorsOutputArgs struct {
    83  	// Specifies a service principal name. If specified, then the operation lists the delegated administrators only for the specified service. If you don't specify a service principal, the operation lists all delegated administrators for all services in your organization.
    84  	ServicePrincipal pulumi.StringPtrInput `pulumi:"servicePrincipal"`
    85  }
    86  
    87  func (GetDelegatedAdministratorsOutputArgs) ElementType() reflect.Type {
    88  	return reflect.TypeOf((*GetDelegatedAdministratorsArgs)(nil)).Elem()
    89  }
    90  
    91  // A collection of values returned by getDelegatedAdministrators.
    92  type GetDelegatedAdministratorsResultOutput struct{ *pulumi.OutputState }
    93  
    94  func (GetDelegatedAdministratorsResultOutput) ElementType() reflect.Type {
    95  	return reflect.TypeOf((*GetDelegatedAdministratorsResult)(nil)).Elem()
    96  }
    97  
    98  func (o GetDelegatedAdministratorsResultOutput) ToGetDelegatedAdministratorsResultOutput() GetDelegatedAdministratorsResultOutput {
    99  	return o
   100  }
   101  
   102  func (o GetDelegatedAdministratorsResultOutput) ToGetDelegatedAdministratorsResultOutputWithContext(ctx context.Context) GetDelegatedAdministratorsResultOutput {
   103  	return o
   104  }
   105  
   106  // The list of delegated administrators in your organization, which have the following attributes:
   107  func (o GetDelegatedAdministratorsResultOutput) DelegatedAdministrators() GetDelegatedAdministratorsDelegatedAdministratorArrayOutput {
   108  	return o.ApplyT(func(v GetDelegatedAdministratorsResult) []GetDelegatedAdministratorsDelegatedAdministrator {
   109  		return v.DelegatedAdministrators
   110  	}).(GetDelegatedAdministratorsDelegatedAdministratorArrayOutput)
   111  }
   112  
   113  // The provider-assigned unique ID for this managed resource.
   114  func (o GetDelegatedAdministratorsResultOutput) Id() pulumi.StringOutput {
   115  	return o.ApplyT(func(v GetDelegatedAdministratorsResult) string { return v.Id }).(pulumi.StringOutput)
   116  }
   117  
   118  func (o GetDelegatedAdministratorsResultOutput) ServicePrincipal() pulumi.StringPtrOutput {
   119  	return o.ApplyT(func(v GetDelegatedAdministratorsResult) *string { return v.ServicePrincipal }).(pulumi.StringPtrOutput)
   120  }
   121  
   122  func init() {
   123  	pulumi.RegisterOutputType(GetDelegatedAdministratorsResultOutput{})
   124  }