github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/datasync/nfsLocation.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 datasync
     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 an NFS Location within AWS DataSync.
    16  //
    17  // > **NOTE:** The DataSync Agents must be available before creating this resource.
    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/datasync"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := datasync.NewNfsLocation(ctx, "example", &datasync.NfsLocationArgs{
    35  //				ServerHostname: pulumi.String("nfs.example.com"),
    36  //				Subdirectory:   pulumi.String("/exported/path"),
    37  //				OnPremConfig: &datasync.NfsLocationOnPremConfigArgs{
    38  //					AgentArns: pulumi.StringArray{
    39  //						exampleAwsDatasyncAgent.Arn,
    40  //					},
    41  //				},
    42  //			})
    43  //			if err != nil {
    44  //				return err
    45  //			}
    46  //			return nil
    47  //		})
    48  //	}
    49  //
    50  // ```
    51  // <!--End PulumiCodeChooser -->
    52  //
    53  // ## Import
    54  //
    55  // Using `pulumi import`, import `aws_datasync_location_nfs` using the DataSync Task Amazon Resource Name (ARN). For example:
    56  //
    57  // ```sh
    58  // $ pulumi import aws:datasync/nfsLocation:NfsLocation example arn:aws:datasync:us-east-1:123456789012:location/loc-12345678901234567
    59  // ```
    60  type NfsLocation struct {
    61  	pulumi.CustomResourceState
    62  
    63  	// Amazon Resource Name (ARN) of the DataSync Location.
    64  	Arn pulumi.StringOutput `pulumi:"arn"`
    65  	// Configuration block containing mount options used by DataSync to access the NFS Server.
    66  	MountOptions NfsLocationMountOptionsPtrOutput `pulumi:"mountOptions"`
    67  	// Configuration block containing information for connecting to the NFS File System.
    68  	OnPremConfig NfsLocationOnPremConfigOutput `pulumi:"onPremConfig"`
    69  	// Specifies the IP address or DNS name of the NFS server. The DataSync Agent(s) use this to mount the NFS server.
    70  	ServerHostname pulumi.StringOutput `pulumi:"serverHostname"`
    71  	// Subdirectory to perform actions as source or destination. Should be exported by the NFS server.
    72  	Subdirectory pulumi.StringOutput `pulumi:"subdirectory"`
    73  	// Key-value pairs of resource tags to assign to the DataSync Location. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    74  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    75  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    76  	//
    77  	// Deprecated: Please use `tags` instead.
    78  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    79  	Uri     pulumi.StringOutput    `pulumi:"uri"`
    80  }
    81  
    82  // NewNfsLocation registers a new resource with the given unique name, arguments, and options.
    83  func NewNfsLocation(ctx *pulumi.Context,
    84  	name string, args *NfsLocationArgs, opts ...pulumi.ResourceOption) (*NfsLocation, error) {
    85  	if args == nil {
    86  		return nil, errors.New("missing one or more required arguments")
    87  	}
    88  
    89  	if args.OnPremConfig == nil {
    90  		return nil, errors.New("invalid value for required argument 'OnPremConfig'")
    91  	}
    92  	if args.ServerHostname == nil {
    93  		return nil, errors.New("invalid value for required argument 'ServerHostname'")
    94  	}
    95  	if args.Subdirectory == nil {
    96  		return nil, errors.New("invalid value for required argument 'Subdirectory'")
    97  	}
    98  	opts = internal.PkgResourceDefaultOpts(opts)
    99  	var resource NfsLocation
   100  	err := ctx.RegisterResource("aws:datasync/nfsLocation:NfsLocation", name, args, &resource, opts...)
   101  	if err != nil {
   102  		return nil, err
   103  	}
   104  	return &resource, nil
   105  }
   106  
   107  // GetNfsLocation gets an existing NfsLocation resource's state with the given name, ID, and optional
   108  // state properties that are used to uniquely qualify the lookup (nil if not required).
   109  func GetNfsLocation(ctx *pulumi.Context,
   110  	name string, id pulumi.IDInput, state *NfsLocationState, opts ...pulumi.ResourceOption) (*NfsLocation, error) {
   111  	var resource NfsLocation
   112  	err := ctx.ReadResource("aws:datasync/nfsLocation:NfsLocation", name, id, state, &resource, opts...)
   113  	if err != nil {
   114  		return nil, err
   115  	}
   116  	return &resource, nil
   117  }
   118  
   119  // Input properties used for looking up and filtering NfsLocation resources.
   120  type nfsLocationState struct {
   121  	// Amazon Resource Name (ARN) of the DataSync Location.
   122  	Arn *string `pulumi:"arn"`
   123  	// Configuration block containing mount options used by DataSync to access the NFS Server.
   124  	MountOptions *NfsLocationMountOptions `pulumi:"mountOptions"`
   125  	// Configuration block containing information for connecting to the NFS File System.
   126  	OnPremConfig *NfsLocationOnPremConfig `pulumi:"onPremConfig"`
   127  	// Specifies the IP address or DNS name of the NFS server. The DataSync Agent(s) use this to mount the NFS server.
   128  	ServerHostname *string `pulumi:"serverHostname"`
   129  	// Subdirectory to perform actions as source or destination. Should be exported by the NFS server.
   130  	Subdirectory *string `pulumi:"subdirectory"`
   131  	// Key-value pairs of resource tags to assign to the DataSync Location. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   132  	Tags map[string]string `pulumi:"tags"`
   133  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   134  	//
   135  	// Deprecated: Please use `tags` instead.
   136  	TagsAll map[string]string `pulumi:"tagsAll"`
   137  	Uri     *string           `pulumi:"uri"`
   138  }
   139  
   140  type NfsLocationState struct {
   141  	// Amazon Resource Name (ARN) of the DataSync Location.
   142  	Arn pulumi.StringPtrInput
   143  	// Configuration block containing mount options used by DataSync to access the NFS Server.
   144  	MountOptions NfsLocationMountOptionsPtrInput
   145  	// Configuration block containing information for connecting to the NFS File System.
   146  	OnPremConfig NfsLocationOnPremConfigPtrInput
   147  	// Specifies the IP address or DNS name of the NFS server. The DataSync Agent(s) use this to mount the NFS server.
   148  	ServerHostname pulumi.StringPtrInput
   149  	// Subdirectory to perform actions as source or destination. Should be exported by the NFS server.
   150  	Subdirectory pulumi.StringPtrInput
   151  	// Key-value pairs of resource tags to assign to the DataSync Location. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   152  	Tags pulumi.StringMapInput
   153  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   154  	//
   155  	// Deprecated: Please use `tags` instead.
   156  	TagsAll pulumi.StringMapInput
   157  	Uri     pulumi.StringPtrInput
   158  }
   159  
   160  func (NfsLocationState) ElementType() reflect.Type {
   161  	return reflect.TypeOf((*nfsLocationState)(nil)).Elem()
   162  }
   163  
   164  type nfsLocationArgs struct {
   165  	// Configuration block containing mount options used by DataSync to access the NFS Server.
   166  	MountOptions *NfsLocationMountOptions `pulumi:"mountOptions"`
   167  	// Configuration block containing information for connecting to the NFS File System.
   168  	OnPremConfig NfsLocationOnPremConfig `pulumi:"onPremConfig"`
   169  	// Specifies the IP address or DNS name of the NFS server. The DataSync Agent(s) use this to mount the NFS server.
   170  	ServerHostname string `pulumi:"serverHostname"`
   171  	// Subdirectory to perform actions as source or destination. Should be exported by the NFS server.
   172  	Subdirectory string `pulumi:"subdirectory"`
   173  	// Key-value pairs of resource tags to assign to the DataSync Location. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   174  	Tags map[string]string `pulumi:"tags"`
   175  }
   176  
   177  // The set of arguments for constructing a NfsLocation resource.
   178  type NfsLocationArgs struct {
   179  	// Configuration block containing mount options used by DataSync to access the NFS Server.
   180  	MountOptions NfsLocationMountOptionsPtrInput
   181  	// Configuration block containing information for connecting to the NFS File System.
   182  	OnPremConfig NfsLocationOnPremConfigInput
   183  	// Specifies the IP address or DNS name of the NFS server. The DataSync Agent(s) use this to mount the NFS server.
   184  	ServerHostname pulumi.StringInput
   185  	// Subdirectory to perform actions as source or destination. Should be exported by the NFS server.
   186  	Subdirectory pulumi.StringInput
   187  	// Key-value pairs of resource tags to assign to the DataSync Location. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   188  	Tags pulumi.StringMapInput
   189  }
   190  
   191  func (NfsLocationArgs) ElementType() reflect.Type {
   192  	return reflect.TypeOf((*nfsLocationArgs)(nil)).Elem()
   193  }
   194  
   195  type NfsLocationInput interface {
   196  	pulumi.Input
   197  
   198  	ToNfsLocationOutput() NfsLocationOutput
   199  	ToNfsLocationOutputWithContext(ctx context.Context) NfsLocationOutput
   200  }
   201  
   202  func (*NfsLocation) ElementType() reflect.Type {
   203  	return reflect.TypeOf((**NfsLocation)(nil)).Elem()
   204  }
   205  
   206  func (i *NfsLocation) ToNfsLocationOutput() NfsLocationOutput {
   207  	return i.ToNfsLocationOutputWithContext(context.Background())
   208  }
   209  
   210  func (i *NfsLocation) ToNfsLocationOutputWithContext(ctx context.Context) NfsLocationOutput {
   211  	return pulumi.ToOutputWithContext(ctx, i).(NfsLocationOutput)
   212  }
   213  
   214  // NfsLocationArrayInput is an input type that accepts NfsLocationArray and NfsLocationArrayOutput values.
   215  // You can construct a concrete instance of `NfsLocationArrayInput` via:
   216  //
   217  //	NfsLocationArray{ NfsLocationArgs{...} }
   218  type NfsLocationArrayInput interface {
   219  	pulumi.Input
   220  
   221  	ToNfsLocationArrayOutput() NfsLocationArrayOutput
   222  	ToNfsLocationArrayOutputWithContext(context.Context) NfsLocationArrayOutput
   223  }
   224  
   225  type NfsLocationArray []NfsLocationInput
   226  
   227  func (NfsLocationArray) ElementType() reflect.Type {
   228  	return reflect.TypeOf((*[]*NfsLocation)(nil)).Elem()
   229  }
   230  
   231  func (i NfsLocationArray) ToNfsLocationArrayOutput() NfsLocationArrayOutput {
   232  	return i.ToNfsLocationArrayOutputWithContext(context.Background())
   233  }
   234  
   235  func (i NfsLocationArray) ToNfsLocationArrayOutputWithContext(ctx context.Context) NfsLocationArrayOutput {
   236  	return pulumi.ToOutputWithContext(ctx, i).(NfsLocationArrayOutput)
   237  }
   238  
   239  // NfsLocationMapInput is an input type that accepts NfsLocationMap and NfsLocationMapOutput values.
   240  // You can construct a concrete instance of `NfsLocationMapInput` via:
   241  //
   242  //	NfsLocationMap{ "key": NfsLocationArgs{...} }
   243  type NfsLocationMapInput interface {
   244  	pulumi.Input
   245  
   246  	ToNfsLocationMapOutput() NfsLocationMapOutput
   247  	ToNfsLocationMapOutputWithContext(context.Context) NfsLocationMapOutput
   248  }
   249  
   250  type NfsLocationMap map[string]NfsLocationInput
   251  
   252  func (NfsLocationMap) ElementType() reflect.Type {
   253  	return reflect.TypeOf((*map[string]*NfsLocation)(nil)).Elem()
   254  }
   255  
   256  func (i NfsLocationMap) ToNfsLocationMapOutput() NfsLocationMapOutput {
   257  	return i.ToNfsLocationMapOutputWithContext(context.Background())
   258  }
   259  
   260  func (i NfsLocationMap) ToNfsLocationMapOutputWithContext(ctx context.Context) NfsLocationMapOutput {
   261  	return pulumi.ToOutputWithContext(ctx, i).(NfsLocationMapOutput)
   262  }
   263  
   264  type NfsLocationOutput struct{ *pulumi.OutputState }
   265  
   266  func (NfsLocationOutput) ElementType() reflect.Type {
   267  	return reflect.TypeOf((**NfsLocation)(nil)).Elem()
   268  }
   269  
   270  func (o NfsLocationOutput) ToNfsLocationOutput() NfsLocationOutput {
   271  	return o
   272  }
   273  
   274  func (o NfsLocationOutput) ToNfsLocationOutputWithContext(ctx context.Context) NfsLocationOutput {
   275  	return o
   276  }
   277  
   278  // Amazon Resource Name (ARN) of the DataSync Location.
   279  func (o NfsLocationOutput) Arn() pulumi.StringOutput {
   280  	return o.ApplyT(func(v *NfsLocation) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   281  }
   282  
   283  // Configuration block containing mount options used by DataSync to access the NFS Server.
   284  func (o NfsLocationOutput) MountOptions() NfsLocationMountOptionsPtrOutput {
   285  	return o.ApplyT(func(v *NfsLocation) NfsLocationMountOptionsPtrOutput { return v.MountOptions }).(NfsLocationMountOptionsPtrOutput)
   286  }
   287  
   288  // Configuration block containing information for connecting to the NFS File System.
   289  func (o NfsLocationOutput) OnPremConfig() NfsLocationOnPremConfigOutput {
   290  	return o.ApplyT(func(v *NfsLocation) NfsLocationOnPremConfigOutput { return v.OnPremConfig }).(NfsLocationOnPremConfigOutput)
   291  }
   292  
   293  // Specifies the IP address or DNS name of the NFS server. The DataSync Agent(s) use this to mount the NFS server.
   294  func (o NfsLocationOutput) ServerHostname() pulumi.StringOutput {
   295  	return o.ApplyT(func(v *NfsLocation) pulumi.StringOutput { return v.ServerHostname }).(pulumi.StringOutput)
   296  }
   297  
   298  // Subdirectory to perform actions as source or destination. Should be exported by the NFS server.
   299  func (o NfsLocationOutput) Subdirectory() pulumi.StringOutput {
   300  	return o.ApplyT(func(v *NfsLocation) pulumi.StringOutput { return v.Subdirectory }).(pulumi.StringOutput)
   301  }
   302  
   303  // Key-value pairs of resource tags to assign to the DataSync Location. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   304  func (o NfsLocationOutput) Tags() pulumi.StringMapOutput {
   305  	return o.ApplyT(func(v *NfsLocation) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   306  }
   307  
   308  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   309  //
   310  // Deprecated: Please use `tags` instead.
   311  func (o NfsLocationOutput) TagsAll() pulumi.StringMapOutput {
   312  	return o.ApplyT(func(v *NfsLocation) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   313  }
   314  
   315  func (o NfsLocationOutput) Uri() pulumi.StringOutput {
   316  	return o.ApplyT(func(v *NfsLocation) pulumi.StringOutput { return v.Uri }).(pulumi.StringOutput)
   317  }
   318  
   319  type NfsLocationArrayOutput struct{ *pulumi.OutputState }
   320  
   321  func (NfsLocationArrayOutput) ElementType() reflect.Type {
   322  	return reflect.TypeOf((*[]*NfsLocation)(nil)).Elem()
   323  }
   324  
   325  func (o NfsLocationArrayOutput) ToNfsLocationArrayOutput() NfsLocationArrayOutput {
   326  	return o
   327  }
   328  
   329  func (o NfsLocationArrayOutput) ToNfsLocationArrayOutputWithContext(ctx context.Context) NfsLocationArrayOutput {
   330  	return o
   331  }
   332  
   333  func (o NfsLocationArrayOutput) Index(i pulumi.IntInput) NfsLocationOutput {
   334  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *NfsLocation {
   335  		return vs[0].([]*NfsLocation)[vs[1].(int)]
   336  	}).(NfsLocationOutput)
   337  }
   338  
   339  type NfsLocationMapOutput struct{ *pulumi.OutputState }
   340  
   341  func (NfsLocationMapOutput) ElementType() reflect.Type {
   342  	return reflect.TypeOf((*map[string]*NfsLocation)(nil)).Elem()
   343  }
   344  
   345  func (o NfsLocationMapOutput) ToNfsLocationMapOutput() NfsLocationMapOutput {
   346  	return o
   347  }
   348  
   349  func (o NfsLocationMapOutput) ToNfsLocationMapOutputWithContext(ctx context.Context) NfsLocationMapOutput {
   350  	return o
   351  }
   352  
   353  func (o NfsLocationMapOutput) MapIndex(k pulumi.StringInput) NfsLocationOutput {
   354  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *NfsLocation {
   355  		return vs[0].(map[string]*NfsLocation)[vs[1].(string)]
   356  	}).(NfsLocationOutput)
   357  }
   358  
   359  func init() {
   360  	pulumi.RegisterInputType(reflect.TypeOf((*NfsLocationInput)(nil)).Elem(), &NfsLocation{})
   361  	pulumi.RegisterInputType(reflect.TypeOf((*NfsLocationArrayInput)(nil)).Elem(), NfsLocationArray{})
   362  	pulumi.RegisterInputType(reflect.TypeOf((*NfsLocationMapInput)(nil)).Elem(), NfsLocationMap{})
   363  	pulumi.RegisterOutputType(NfsLocationOutput{})
   364  	pulumi.RegisterOutputType(NfsLocationArrayOutput{})
   365  	pulumi.RegisterOutputType(NfsLocationMapOutput{})
   366  }