github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/directoryservice/sharedDirectory.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  // Manages a directory in your account (directory owner) shared with another account (directory consumer).
    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/directoryservice"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  // func main() {
    30  // pulumi.Run(func(ctx *pulumi.Context) error {
    31  // example, err := directoryservice.NewDirectory(ctx, "example", &directoryservice.DirectoryArgs{
    32  // Name: pulumi.String("tf-example"),
    33  // Password: pulumi.String("SuperSecretPassw0rd"),
    34  // Type: pulumi.String("MicrosoftAD"),
    35  // Edition: pulumi.String("Standard"),
    36  // VpcSettings: &directoryservice.DirectoryVpcSettingsArgs{
    37  // VpcId: pulumi.Any(exampleAwsVpc.Id),
    38  // SubnetIds: %!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:7,17-39),
    39  // },
    40  // })
    41  // if err != nil {
    42  // return err
    43  // }
    44  // _, err = directoryservice.NewSharedDirectory(ctx, "example", &directoryservice.SharedDirectoryArgs{
    45  // DirectoryId: example.ID(),
    46  // Notes: pulumi.String("You wanna have a catch?"),
    47  // Target: &directoryservice.SharedDirectoryTargetArgs{
    48  // Id: pulumi.Any(receiver.AccountId),
    49  // },
    50  // })
    51  // if err != nil {
    52  // return err
    53  // }
    54  // return nil
    55  // })
    56  // }
    57  // ```
    58  // <!--End PulumiCodeChooser -->
    59  //
    60  // ## Import
    61  //
    62  // Using `pulumi import`, import Directory Service Shared Directories using the owner directory ID/shared directory ID. For example:
    63  //
    64  // ```sh
    65  // $ pulumi import aws:directoryservice/sharedDirectory:SharedDirectory example d-1234567890/d-9267633ece
    66  // ```
    67  type SharedDirectory struct {
    68  	pulumi.CustomResourceState
    69  
    70  	// Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
    71  	DirectoryId pulumi.StringOutput `pulumi:"directoryId"`
    72  	// Method used when sharing a directory. Valid values are `ORGANIZATIONS` and `HANDSHAKE`. Default is `HANDSHAKE`.
    73  	Method pulumi.StringPtrOutput `pulumi:"method"`
    74  	// 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.
    75  	Notes pulumi.StringPtrOutput `pulumi:"notes"`
    76  	// Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
    77  	SharedDirectoryId pulumi.StringOutput `pulumi:"sharedDirectoryId"`
    78  	// Identifier for the directory consumer account with whom the directory is to be shared. See below.
    79  	//
    80  	// The following arguments are optional:
    81  	Target SharedDirectoryTargetOutput `pulumi:"target"`
    82  }
    83  
    84  // NewSharedDirectory registers a new resource with the given unique name, arguments, and options.
    85  func NewSharedDirectory(ctx *pulumi.Context,
    86  	name string, args *SharedDirectoryArgs, opts ...pulumi.ResourceOption) (*SharedDirectory, error) {
    87  	if args == nil {
    88  		return nil, errors.New("missing one or more required arguments")
    89  	}
    90  
    91  	if args.DirectoryId == nil {
    92  		return nil, errors.New("invalid value for required argument 'DirectoryId'")
    93  	}
    94  	if args.Target == nil {
    95  		return nil, errors.New("invalid value for required argument 'Target'")
    96  	}
    97  	if args.Notes != nil {
    98  		args.Notes = pulumi.ToSecret(args.Notes).(pulumi.StringPtrInput)
    99  	}
   100  	secrets := pulumi.AdditionalSecretOutputs([]string{
   101  		"notes",
   102  	})
   103  	opts = append(opts, secrets)
   104  	opts = internal.PkgResourceDefaultOpts(opts)
   105  	var resource SharedDirectory
   106  	err := ctx.RegisterResource("aws:directoryservice/sharedDirectory:SharedDirectory", name, args, &resource, opts...)
   107  	if err != nil {
   108  		return nil, err
   109  	}
   110  	return &resource, nil
   111  }
   112  
   113  // GetSharedDirectory gets an existing SharedDirectory resource's state with the given name, ID, and optional
   114  // state properties that are used to uniquely qualify the lookup (nil if not required).
   115  func GetSharedDirectory(ctx *pulumi.Context,
   116  	name string, id pulumi.IDInput, state *SharedDirectoryState, opts ...pulumi.ResourceOption) (*SharedDirectory, error) {
   117  	var resource SharedDirectory
   118  	err := ctx.ReadResource("aws:directoryservice/sharedDirectory:SharedDirectory", name, id, state, &resource, opts...)
   119  	if err != nil {
   120  		return nil, err
   121  	}
   122  	return &resource, nil
   123  }
   124  
   125  // Input properties used for looking up and filtering SharedDirectory resources.
   126  type sharedDirectoryState struct {
   127  	// Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
   128  	DirectoryId *string `pulumi:"directoryId"`
   129  	// Method used when sharing a directory. Valid values are `ORGANIZATIONS` and `HANDSHAKE`. Default is `HANDSHAKE`.
   130  	Method *string `pulumi:"method"`
   131  	// 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.
   132  	Notes *string `pulumi:"notes"`
   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 *string `pulumi:"sharedDirectoryId"`
   135  	// Identifier for the directory consumer account with whom the directory is to be shared. See below.
   136  	//
   137  	// The following arguments are optional:
   138  	Target *SharedDirectoryTarget `pulumi:"target"`
   139  }
   140  
   141  type SharedDirectoryState struct {
   142  	// Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
   143  	DirectoryId pulumi.StringPtrInput
   144  	// Method used when sharing a directory. Valid values are `ORGANIZATIONS` and `HANDSHAKE`. Default is `HANDSHAKE`.
   145  	Method pulumi.StringPtrInput
   146  	// 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.
   147  	Notes pulumi.StringPtrInput
   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.StringPtrInput
   150  	// Identifier for the directory consumer account with whom the directory is to be shared. See below.
   151  	//
   152  	// The following arguments are optional:
   153  	Target SharedDirectoryTargetPtrInput
   154  }
   155  
   156  func (SharedDirectoryState) ElementType() reflect.Type {
   157  	return reflect.TypeOf((*sharedDirectoryState)(nil)).Elem()
   158  }
   159  
   160  type sharedDirectoryArgs struct {
   161  	// Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
   162  	DirectoryId string `pulumi:"directoryId"`
   163  	// Method used when sharing a directory. Valid values are `ORGANIZATIONS` and `HANDSHAKE`. Default is `HANDSHAKE`.
   164  	Method *string `pulumi:"method"`
   165  	// 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.
   166  	Notes *string `pulumi:"notes"`
   167  	// Identifier for the directory consumer account with whom the directory is to be shared. See below.
   168  	//
   169  	// The following arguments are optional:
   170  	Target SharedDirectoryTarget `pulumi:"target"`
   171  }
   172  
   173  // The set of arguments for constructing a SharedDirectory resource.
   174  type SharedDirectoryArgs struct {
   175  	// Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
   176  	DirectoryId pulumi.StringInput
   177  	// Method used when sharing a directory. Valid values are `ORGANIZATIONS` and `HANDSHAKE`. Default is `HANDSHAKE`.
   178  	Method pulumi.StringPtrInput
   179  	// 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.
   180  	Notes pulumi.StringPtrInput
   181  	// Identifier for the directory consumer account with whom the directory is to be shared. See below.
   182  	//
   183  	// The following arguments are optional:
   184  	Target SharedDirectoryTargetInput
   185  }
   186  
   187  func (SharedDirectoryArgs) ElementType() reflect.Type {
   188  	return reflect.TypeOf((*sharedDirectoryArgs)(nil)).Elem()
   189  }
   190  
   191  type SharedDirectoryInput interface {
   192  	pulumi.Input
   193  
   194  	ToSharedDirectoryOutput() SharedDirectoryOutput
   195  	ToSharedDirectoryOutputWithContext(ctx context.Context) SharedDirectoryOutput
   196  }
   197  
   198  func (*SharedDirectory) ElementType() reflect.Type {
   199  	return reflect.TypeOf((**SharedDirectory)(nil)).Elem()
   200  }
   201  
   202  func (i *SharedDirectory) ToSharedDirectoryOutput() SharedDirectoryOutput {
   203  	return i.ToSharedDirectoryOutputWithContext(context.Background())
   204  }
   205  
   206  func (i *SharedDirectory) ToSharedDirectoryOutputWithContext(ctx context.Context) SharedDirectoryOutput {
   207  	return pulumi.ToOutputWithContext(ctx, i).(SharedDirectoryOutput)
   208  }
   209  
   210  // SharedDirectoryArrayInput is an input type that accepts SharedDirectoryArray and SharedDirectoryArrayOutput values.
   211  // You can construct a concrete instance of `SharedDirectoryArrayInput` via:
   212  //
   213  //	SharedDirectoryArray{ SharedDirectoryArgs{...} }
   214  type SharedDirectoryArrayInput interface {
   215  	pulumi.Input
   216  
   217  	ToSharedDirectoryArrayOutput() SharedDirectoryArrayOutput
   218  	ToSharedDirectoryArrayOutputWithContext(context.Context) SharedDirectoryArrayOutput
   219  }
   220  
   221  type SharedDirectoryArray []SharedDirectoryInput
   222  
   223  func (SharedDirectoryArray) ElementType() reflect.Type {
   224  	return reflect.TypeOf((*[]*SharedDirectory)(nil)).Elem()
   225  }
   226  
   227  func (i SharedDirectoryArray) ToSharedDirectoryArrayOutput() SharedDirectoryArrayOutput {
   228  	return i.ToSharedDirectoryArrayOutputWithContext(context.Background())
   229  }
   230  
   231  func (i SharedDirectoryArray) ToSharedDirectoryArrayOutputWithContext(ctx context.Context) SharedDirectoryArrayOutput {
   232  	return pulumi.ToOutputWithContext(ctx, i).(SharedDirectoryArrayOutput)
   233  }
   234  
   235  // SharedDirectoryMapInput is an input type that accepts SharedDirectoryMap and SharedDirectoryMapOutput values.
   236  // You can construct a concrete instance of `SharedDirectoryMapInput` via:
   237  //
   238  //	SharedDirectoryMap{ "key": SharedDirectoryArgs{...} }
   239  type SharedDirectoryMapInput interface {
   240  	pulumi.Input
   241  
   242  	ToSharedDirectoryMapOutput() SharedDirectoryMapOutput
   243  	ToSharedDirectoryMapOutputWithContext(context.Context) SharedDirectoryMapOutput
   244  }
   245  
   246  type SharedDirectoryMap map[string]SharedDirectoryInput
   247  
   248  func (SharedDirectoryMap) ElementType() reflect.Type {
   249  	return reflect.TypeOf((*map[string]*SharedDirectory)(nil)).Elem()
   250  }
   251  
   252  func (i SharedDirectoryMap) ToSharedDirectoryMapOutput() SharedDirectoryMapOutput {
   253  	return i.ToSharedDirectoryMapOutputWithContext(context.Background())
   254  }
   255  
   256  func (i SharedDirectoryMap) ToSharedDirectoryMapOutputWithContext(ctx context.Context) SharedDirectoryMapOutput {
   257  	return pulumi.ToOutputWithContext(ctx, i).(SharedDirectoryMapOutput)
   258  }
   259  
   260  type SharedDirectoryOutput struct{ *pulumi.OutputState }
   261  
   262  func (SharedDirectoryOutput) ElementType() reflect.Type {
   263  	return reflect.TypeOf((**SharedDirectory)(nil)).Elem()
   264  }
   265  
   266  func (o SharedDirectoryOutput) ToSharedDirectoryOutput() SharedDirectoryOutput {
   267  	return o
   268  }
   269  
   270  func (o SharedDirectoryOutput) ToSharedDirectoryOutputWithContext(ctx context.Context) SharedDirectoryOutput {
   271  	return o
   272  }
   273  
   274  // Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
   275  func (o SharedDirectoryOutput) DirectoryId() pulumi.StringOutput {
   276  	return o.ApplyT(func(v *SharedDirectory) pulumi.StringOutput { return v.DirectoryId }).(pulumi.StringOutput)
   277  }
   278  
   279  // Method used when sharing a directory. Valid values are `ORGANIZATIONS` and `HANDSHAKE`. Default is `HANDSHAKE`.
   280  func (o SharedDirectoryOutput) Method() pulumi.StringPtrOutput {
   281  	return o.ApplyT(func(v *SharedDirectory) pulumi.StringPtrOutput { return v.Method }).(pulumi.StringPtrOutput)
   282  }
   283  
   284  // 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.
   285  func (o SharedDirectoryOutput) Notes() pulumi.StringPtrOutput {
   286  	return o.ApplyT(func(v *SharedDirectory) pulumi.StringPtrOutput { return v.Notes }).(pulumi.StringPtrOutput)
   287  }
   288  
   289  // Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
   290  func (o SharedDirectoryOutput) SharedDirectoryId() pulumi.StringOutput {
   291  	return o.ApplyT(func(v *SharedDirectory) pulumi.StringOutput { return v.SharedDirectoryId }).(pulumi.StringOutput)
   292  }
   293  
   294  // Identifier for the directory consumer account with whom the directory is to be shared. See below.
   295  //
   296  // The following arguments are optional:
   297  func (o SharedDirectoryOutput) Target() SharedDirectoryTargetOutput {
   298  	return o.ApplyT(func(v *SharedDirectory) SharedDirectoryTargetOutput { return v.Target }).(SharedDirectoryTargetOutput)
   299  }
   300  
   301  type SharedDirectoryArrayOutput struct{ *pulumi.OutputState }
   302  
   303  func (SharedDirectoryArrayOutput) ElementType() reflect.Type {
   304  	return reflect.TypeOf((*[]*SharedDirectory)(nil)).Elem()
   305  }
   306  
   307  func (o SharedDirectoryArrayOutput) ToSharedDirectoryArrayOutput() SharedDirectoryArrayOutput {
   308  	return o
   309  }
   310  
   311  func (o SharedDirectoryArrayOutput) ToSharedDirectoryArrayOutputWithContext(ctx context.Context) SharedDirectoryArrayOutput {
   312  	return o
   313  }
   314  
   315  func (o SharedDirectoryArrayOutput) Index(i pulumi.IntInput) SharedDirectoryOutput {
   316  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SharedDirectory {
   317  		return vs[0].([]*SharedDirectory)[vs[1].(int)]
   318  	}).(SharedDirectoryOutput)
   319  }
   320  
   321  type SharedDirectoryMapOutput struct{ *pulumi.OutputState }
   322  
   323  func (SharedDirectoryMapOutput) ElementType() reflect.Type {
   324  	return reflect.TypeOf((*map[string]*SharedDirectory)(nil)).Elem()
   325  }
   326  
   327  func (o SharedDirectoryMapOutput) ToSharedDirectoryMapOutput() SharedDirectoryMapOutput {
   328  	return o
   329  }
   330  
   331  func (o SharedDirectoryMapOutput) ToSharedDirectoryMapOutputWithContext(ctx context.Context) SharedDirectoryMapOutput {
   332  	return o
   333  }
   334  
   335  func (o SharedDirectoryMapOutput) MapIndex(k pulumi.StringInput) SharedDirectoryOutput {
   336  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SharedDirectory {
   337  		return vs[0].(map[string]*SharedDirectory)[vs[1].(string)]
   338  	}).(SharedDirectoryOutput)
   339  }
   340  
   341  func init() {
   342  	pulumi.RegisterInputType(reflect.TypeOf((*SharedDirectoryInput)(nil)).Elem(), &SharedDirectory{})
   343  	pulumi.RegisterInputType(reflect.TypeOf((*SharedDirectoryArrayInput)(nil)).Elem(), SharedDirectoryArray{})
   344  	pulumi.RegisterInputType(reflect.TypeOf((*SharedDirectoryMapInput)(nil)).Elem(), SharedDirectoryMap{})
   345  	pulumi.RegisterOutputType(SharedDirectoryOutput{})
   346  	pulumi.RegisterOutputType(SharedDirectoryArrayOutput{})
   347  	pulumi.RegisterOutputType(SharedDirectoryMapOutput{})
   348  }