github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/directoryservice/sharedDirectoryAccepter.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 directoryservice
     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  // Accepts a shared directory in a consumer account.
    16  //
    17  // > **NOTE:** Destroying this resource removes the shared directory from the consumer account only.
    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/directoryservice"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			example, err := directoryservice.NewSharedDirectory(ctx, "example", &directoryservice.SharedDirectoryArgs{
    35  //				DirectoryId: pulumi.Any(exampleAwsDirectoryServiceDirectory.Id),
    36  //				Notes:       pulumi.String("example"),
    37  //				Target: &directoryservice.SharedDirectoryTargetArgs{
    38  //					Id: pulumi.Any(receiver.AccountId),
    39  //				},
    40  //			})
    41  //			if err != nil {
    42  //				return err
    43  //			}
    44  //			_, err = directoryservice.NewSharedDirectoryAccepter(ctx, "example", &directoryservice.SharedDirectoryAccepterArgs{
    45  //				SharedDirectoryId: example.SharedDirectoryId,
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  //
    57  // ## Import
    58  //
    59  // Using `pulumi import`, import Directory Service Shared Directories using the shared directory ID. For example:
    60  //
    61  // ```sh
    62  // $ pulumi import aws:directoryservice/sharedDirectoryAccepter:SharedDirectoryAccepter example d-9267633ece
    63  // ```
    64  type SharedDirectoryAccepter struct {
    65  	pulumi.CustomResourceState
    66  
    67  	// Method used when sharing a directory (i.e., `ORGANIZATIONS` or `HANDSHAKE`).
    68  	Method pulumi.StringOutput `pulumi:"method"`
    69  	// Message sent by the directory owner to the directory consumer to help the directory consumer administrator determine whether to approve or reject the share invitation.
    70  	Notes pulumi.StringOutput `pulumi:"notes"`
    71  	// Account identifier of the directory owner.
    72  	OwnerAccountId pulumi.StringOutput `pulumi:"ownerAccountId"`
    73  	// Identifier of the Managed Microsoft AD directory from the perspective of the directory owner.
    74  	OwnerDirectoryId pulumi.StringOutput `pulumi:"ownerDirectoryId"`
    75  	// Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    76  	SharedDirectoryId pulumi.StringOutput `pulumi:"sharedDirectoryId"`
    77  }
    78  
    79  // NewSharedDirectoryAccepter registers a new resource with the given unique name, arguments, and options.
    80  func NewSharedDirectoryAccepter(ctx *pulumi.Context,
    81  	name string, args *SharedDirectoryAccepterArgs, opts ...pulumi.ResourceOption) (*SharedDirectoryAccepter, error) {
    82  	if args == nil {
    83  		return nil, errors.New("missing one or more required arguments")
    84  	}
    85  
    86  	if args.SharedDirectoryId == nil {
    87  		return nil, errors.New("invalid value for required argument 'SharedDirectoryId'")
    88  	}
    89  	opts = internal.PkgResourceDefaultOpts(opts)
    90  	var resource SharedDirectoryAccepter
    91  	err := ctx.RegisterResource("aws:directoryservice/sharedDirectoryAccepter:SharedDirectoryAccepter", name, args, &resource, opts...)
    92  	if err != nil {
    93  		return nil, err
    94  	}
    95  	return &resource, nil
    96  }
    97  
    98  // GetSharedDirectoryAccepter gets an existing SharedDirectoryAccepter 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 GetSharedDirectoryAccepter(ctx *pulumi.Context,
   101  	name string, id pulumi.IDInput, state *SharedDirectoryAccepterState, opts ...pulumi.ResourceOption) (*SharedDirectoryAccepter, error) {
   102  	var resource SharedDirectoryAccepter
   103  	err := ctx.ReadResource("aws:directoryservice/sharedDirectoryAccepter:SharedDirectoryAccepter", 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 SharedDirectoryAccepter resources.
   111  type sharedDirectoryAccepterState struct {
   112  	// Method used when sharing a directory (i.e., `ORGANIZATIONS` or `HANDSHAKE`).
   113  	Method *string `pulumi:"method"`
   114  	// Message sent by the directory owner to the directory consumer to help the directory consumer administrator determine whether to approve or reject the share invitation.
   115  	Notes *string `pulumi:"notes"`
   116  	// Account identifier of the directory owner.
   117  	OwnerAccountId *string `pulumi:"ownerAccountId"`
   118  	// Identifier of the Managed Microsoft AD directory from the perspective of the directory owner.
   119  	OwnerDirectoryId *string `pulumi:"ownerDirectoryId"`
   120  	// Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
   121  	SharedDirectoryId *string `pulumi:"sharedDirectoryId"`
   122  }
   123  
   124  type SharedDirectoryAccepterState struct {
   125  	// Method used when sharing a directory (i.e., `ORGANIZATIONS` or `HANDSHAKE`).
   126  	Method pulumi.StringPtrInput
   127  	// Message sent by the directory owner to the directory consumer to help the directory consumer administrator determine whether to approve or reject the share invitation.
   128  	Notes pulumi.StringPtrInput
   129  	// Account identifier of the directory owner.
   130  	OwnerAccountId pulumi.StringPtrInput
   131  	// Identifier of the Managed Microsoft AD directory from the perspective of the directory owner.
   132  	OwnerDirectoryId pulumi.StringPtrInput
   133  	// Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
   134  	SharedDirectoryId pulumi.StringPtrInput
   135  }
   136  
   137  func (SharedDirectoryAccepterState) ElementType() reflect.Type {
   138  	return reflect.TypeOf((*sharedDirectoryAccepterState)(nil)).Elem()
   139  }
   140  
   141  type sharedDirectoryAccepterArgs struct {
   142  	// Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
   143  	SharedDirectoryId string `pulumi:"sharedDirectoryId"`
   144  }
   145  
   146  // The set of arguments for constructing a SharedDirectoryAccepter resource.
   147  type SharedDirectoryAccepterArgs struct {
   148  	// Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
   149  	SharedDirectoryId pulumi.StringInput
   150  }
   151  
   152  func (SharedDirectoryAccepterArgs) ElementType() reflect.Type {
   153  	return reflect.TypeOf((*sharedDirectoryAccepterArgs)(nil)).Elem()
   154  }
   155  
   156  type SharedDirectoryAccepterInput interface {
   157  	pulumi.Input
   158  
   159  	ToSharedDirectoryAccepterOutput() SharedDirectoryAccepterOutput
   160  	ToSharedDirectoryAccepterOutputWithContext(ctx context.Context) SharedDirectoryAccepterOutput
   161  }
   162  
   163  func (*SharedDirectoryAccepter) ElementType() reflect.Type {
   164  	return reflect.TypeOf((**SharedDirectoryAccepter)(nil)).Elem()
   165  }
   166  
   167  func (i *SharedDirectoryAccepter) ToSharedDirectoryAccepterOutput() SharedDirectoryAccepterOutput {
   168  	return i.ToSharedDirectoryAccepterOutputWithContext(context.Background())
   169  }
   170  
   171  func (i *SharedDirectoryAccepter) ToSharedDirectoryAccepterOutputWithContext(ctx context.Context) SharedDirectoryAccepterOutput {
   172  	return pulumi.ToOutputWithContext(ctx, i).(SharedDirectoryAccepterOutput)
   173  }
   174  
   175  // SharedDirectoryAccepterArrayInput is an input type that accepts SharedDirectoryAccepterArray and SharedDirectoryAccepterArrayOutput values.
   176  // You can construct a concrete instance of `SharedDirectoryAccepterArrayInput` via:
   177  //
   178  //	SharedDirectoryAccepterArray{ SharedDirectoryAccepterArgs{...} }
   179  type SharedDirectoryAccepterArrayInput interface {
   180  	pulumi.Input
   181  
   182  	ToSharedDirectoryAccepterArrayOutput() SharedDirectoryAccepterArrayOutput
   183  	ToSharedDirectoryAccepterArrayOutputWithContext(context.Context) SharedDirectoryAccepterArrayOutput
   184  }
   185  
   186  type SharedDirectoryAccepterArray []SharedDirectoryAccepterInput
   187  
   188  func (SharedDirectoryAccepterArray) ElementType() reflect.Type {
   189  	return reflect.TypeOf((*[]*SharedDirectoryAccepter)(nil)).Elem()
   190  }
   191  
   192  func (i SharedDirectoryAccepterArray) ToSharedDirectoryAccepterArrayOutput() SharedDirectoryAccepterArrayOutput {
   193  	return i.ToSharedDirectoryAccepterArrayOutputWithContext(context.Background())
   194  }
   195  
   196  func (i SharedDirectoryAccepterArray) ToSharedDirectoryAccepterArrayOutputWithContext(ctx context.Context) SharedDirectoryAccepterArrayOutput {
   197  	return pulumi.ToOutputWithContext(ctx, i).(SharedDirectoryAccepterArrayOutput)
   198  }
   199  
   200  // SharedDirectoryAccepterMapInput is an input type that accepts SharedDirectoryAccepterMap and SharedDirectoryAccepterMapOutput values.
   201  // You can construct a concrete instance of `SharedDirectoryAccepterMapInput` via:
   202  //
   203  //	SharedDirectoryAccepterMap{ "key": SharedDirectoryAccepterArgs{...} }
   204  type SharedDirectoryAccepterMapInput interface {
   205  	pulumi.Input
   206  
   207  	ToSharedDirectoryAccepterMapOutput() SharedDirectoryAccepterMapOutput
   208  	ToSharedDirectoryAccepterMapOutputWithContext(context.Context) SharedDirectoryAccepterMapOutput
   209  }
   210  
   211  type SharedDirectoryAccepterMap map[string]SharedDirectoryAccepterInput
   212  
   213  func (SharedDirectoryAccepterMap) ElementType() reflect.Type {
   214  	return reflect.TypeOf((*map[string]*SharedDirectoryAccepter)(nil)).Elem()
   215  }
   216  
   217  func (i SharedDirectoryAccepterMap) ToSharedDirectoryAccepterMapOutput() SharedDirectoryAccepterMapOutput {
   218  	return i.ToSharedDirectoryAccepterMapOutputWithContext(context.Background())
   219  }
   220  
   221  func (i SharedDirectoryAccepterMap) ToSharedDirectoryAccepterMapOutputWithContext(ctx context.Context) SharedDirectoryAccepterMapOutput {
   222  	return pulumi.ToOutputWithContext(ctx, i).(SharedDirectoryAccepterMapOutput)
   223  }
   224  
   225  type SharedDirectoryAccepterOutput struct{ *pulumi.OutputState }
   226  
   227  func (SharedDirectoryAccepterOutput) ElementType() reflect.Type {
   228  	return reflect.TypeOf((**SharedDirectoryAccepter)(nil)).Elem()
   229  }
   230  
   231  func (o SharedDirectoryAccepterOutput) ToSharedDirectoryAccepterOutput() SharedDirectoryAccepterOutput {
   232  	return o
   233  }
   234  
   235  func (o SharedDirectoryAccepterOutput) ToSharedDirectoryAccepterOutputWithContext(ctx context.Context) SharedDirectoryAccepterOutput {
   236  	return o
   237  }
   238  
   239  // Method used when sharing a directory (i.e., `ORGANIZATIONS` or `HANDSHAKE`).
   240  func (o SharedDirectoryAccepterOutput) Method() pulumi.StringOutput {
   241  	return o.ApplyT(func(v *SharedDirectoryAccepter) pulumi.StringOutput { return v.Method }).(pulumi.StringOutput)
   242  }
   243  
   244  // Message sent by the directory owner to the directory consumer to help the directory consumer administrator determine whether to approve or reject the share invitation.
   245  func (o SharedDirectoryAccepterOutput) Notes() pulumi.StringOutput {
   246  	return o.ApplyT(func(v *SharedDirectoryAccepter) pulumi.StringOutput { return v.Notes }).(pulumi.StringOutput)
   247  }
   248  
   249  // Account identifier of the directory owner.
   250  func (o SharedDirectoryAccepterOutput) OwnerAccountId() pulumi.StringOutput {
   251  	return o.ApplyT(func(v *SharedDirectoryAccepter) pulumi.StringOutput { return v.OwnerAccountId }).(pulumi.StringOutput)
   252  }
   253  
   254  // Identifier of the Managed Microsoft AD directory from the perspective of the directory owner.
   255  func (o SharedDirectoryAccepterOutput) OwnerDirectoryId() pulumi.StringOutput {
   256  	return o.ApplyT(func(v *SharedDirectoryAccepter) pulumi.StringOutput { return v.OwnerDirectoryId }).(pulumi.StringOutput)
   257  }
   258  
   259  // Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
   260  func (o SharedDirectoryAccepterOutput) SharedDirectoryId() pulumi.StringOutput {
   261  	return o.ApplyT(func(v *SharedDirectoryAccepter) pulumi.StringOutput { return v.SharedDirectoryId }).(pulumi.StringOutput)
   262  }
   263  
   264  type SharedDirectoryAccepterArrayOutput struct{ *pulumi.OutputState }
   265  
   266  func (SharedDirectoryAccepterArrayOutput) ElementType() reflect.Type {
   267  	return reflect.TypeOf((*[]*SharedDirectoryAccepter)(nil)).Elem()
   268  }
   269  
   270  func (o SharedDirectoryAccepterArrayOutput) ToSharedDirectoryAccepterArrayOutput() SharedDirectoryAccepterArrayOutput {
   271  	return o
   272  }
   273  
   274  func (o SharedDirectoryAccepterArrayOutput) ToSharedDirectoryAccepterArrayOutputWithContext(ctx context.Context) SharedDirectoryAccepterArrayOutput {
   275  	return o
   276  }
   277  
   278  func (o SharedDirectoryAccepterArrayOutput) Index(i pulumi.IntInput) SharedDirectoryAccepterOutput {
   279  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SharedDirectoryAccepter {
   280  		return vs[0].([]*SharedDirectoryAccepter)[vs[1].(int)]
   281  	}).(SharedDirectoryAccepterOutput)
   282  }
   283  
   284  type SharedDirectoryAccepterMapOutput struct{ *pulumi.OutputState }
   285  
   286  func (SharedDirectoryAccepterMapOutput) ElementType() reflect.Type {
   287  	return reflect.TypeOf((*map[string]*SharedDirectoryAccepter)(nil)).Elem()
   288  }
   289  
   290  func (o SharedDirectoryAccepterMapOutput) ToSharedDirectoryAccepterMapOutput() SharedDirectoryAccepterMapOutput {
   291  	return o
   292  }
   293  
   294  func (o SharedDirectoryAccepterMapOutput) ToSharedDirectoryAccepterMapOutputWithContext(ctx context.Context) SharedDirectoryAccepterMapOutput {
   295  	return o
   296  }
   297  
   298  func (o SharedDirectoryAccepterMapOutput) MapIndex(k pulumi.StringInput) SharedDirectoryAccepterOutput {
   299  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SharedDirectoryAccepter {
   300  		return vs[0].(map[string]*SharedDirectoryAccepter)[vs[1].(string)]
   301  	}).(SharedDirectoryAccepterOutput)
   302  }
   303  
   304  func init() {
   305  	pulumi.RegisterInputType(reflect.TypeOf((*SharedDirectoryAccepterInput)(nil)).Elem(), &SharedDirectoryAccepter{})
   306  	pulumi.RegisterInputType(reflect.TypeOf((*SharedDirectoryAccepterArrayInput)(nil)).Elem(), SharedDirectoryAccepterArray{})
   307  	pulumi.RegisterInputType(reflect.TypeOf((*SharedDirectoryAccepterMapInput)(nil)).Elem(), SharedDirectoryAccepterMap{})
   308  	pulumi.RegisterOutputType(SharedDirectoryAccepterOutput{})
   309  	pulumi.RegisterOutputType(SharedDirectoryAccepterArrayOutput{})
   310  	pulumi.RegisterOutputType(SharedDirectoryAccepterMapOutput{})
   311  }