github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/docdb/subnetGroup.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 docdb
     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 an DocumentDB subnet group resource.
    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/docdb"
    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 := docdb.NewSubnetGroup(ctx, "default", &docdb.SubnetGroupArgs{
    33  //				Name: pulumi.String("main"),
    34  //				SubnetIds: pulumi.StringArray{
    35  //					frontend.Id,
    36  //					backend.Id,
    37  //				},
    38  //				Tags: pulumi.StringMap{
    39  //					"Name": pulumi.String("My docdb subnet group"),
    40  //				},
    41  //			})
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			return nil
    46  //		})
    47  //	}
    48  //
    49  // ```
    50  // <!--End PulumiCodeChooser -->
    51  //
    52  // ## Import
    53  //
    54  // Using `pulumi import`, import DocumentDB Subnet groups using the `name`. For example:
    55  //
    56  // ```sh
    57  // $ pulumi import aws:docdb/subnetGroup:SubnetGroup default production-subnet-group
    58  // ```
    59  type SubnetGroup struct {
    60  	pulumi.CustomResourceState
    61  
    62  	// The ARN of the docDB subnet group.
    63  	Arn pulumi.StringOutput `pulumi:"arn"`
    64  	// The description of the docDB subnet group. Defaults to "Managed by Pulumi".
    65  	Description pulumi.StringOutput `pulumi:"description"`
    66  	// The name of the docDB subnet group. If omitted, this provider will assign a random, unique name.
    67  	Name pulumi.StringOutput `pulumi:"name"`
    68  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
    69  	NamePrefix pulumi.StringOutput `pulumi:"namePrefix"`
    70  	// A list of VPC subnet IDs.
    71  	SubnetIds pulumi.StringArrayOutput `pulumi:"subnetIds"`
    72  	// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    73  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    74  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    75  	//
    76  	// Deprecated: Please use `tags` instead.
    77  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    78  }
    79  
    80  // NewSubnetGroup registers a new resource with the given unique name, arguments, and options.
    81  func NewSubnetGroup(ctx *pulumi.Context,
    82  	name string, args *SubnetGroupArgs, opts ...pulumi.ResourceOption) (*SubnetGroup, error) {
    83  	if args == nil {
    84  		return nil, errors.New("missing one or more required arguments")
    85  	}
    86  
    87  	if args.SubnetIds == nil {
    88  		return nil, errors.New("invalid value for required argument 'SubnetIds'")
    89  	}
    90  	if args.Description == nil {
    91  		args.Description = pulumi.StringPtr("Managed by Pulumi")
    92  	}
    93  	opts = internal.PkgResourceDefaultOpts(opts)
    94  	var resource SubnetGroup
    95  	err := ctx.RegisterResource("aws:docdb/subnetGroup:SubnetGroup", name, args, &resource, opts...)
    96  	if err != nil {
    97  		return nil, err
    98  	}
    99  	return &resource, nil
   100  }
   101  
   102  // GetSubnetGroup gets an existing SubnetGroup resource's state with the given name, ID, and optional
   103  // state properties that are used to uniquely qualify the lookup (nil if not required).
   104  func GetSubnetGroup(ctx *pulumi.Context,
   105  	name string, id pulumi.IDInput, state *SubnetGroupState, opts ...pulumi.ResourceOption) (*SubnetGroup, error) {
   106  	var resource SubnetGroup
   107  	err := ctx.ReadResource("aws:docdb/subnetGroup:SubnetGroup", name, id, state, &resource, opts...)
   108  	if err != nil {
   109  		return nil, err
   110  	}
   111  	return &resource, nil
   112  }
   113  
   114  // Input properties used for looking up and filtering SubnetGroup resources.
   115  type subnetGroupState struct {
   116  	// The ARN of the docDB subnet group.
   117  	Arn *string `pulumi:"arn"`
   118  	// The description of the docDB subnet group. Defaults to "Managed by Pulumi".
   119  	Description *string `pulumi:"description"`
   120  	// The name of the docDB subnet group. If omitted, this provider will assign a random, unique name.
   121  	Name *string `pulumi:"name"`
   122  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   123  	NamePrefix *string `pulumi:"namePrefix"`
   124  	// A list of VPC subnet IDs.
   125  	SubnetIds []string `pulumi:"subnetIds"`
   126  	// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   127  	Tags map[string]string `pulumi:"tags"`
   128  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   129  	//
   130  	// Deprecated: Please use `tags` instead.
   131  	TagsAll map[string]string `pulumi:"tagsAll"`
   132  }
   133  
   134  type SubnetGroupState struct {
   135  	// The ARN of the docDB subnet group.
   136  	Arn pulumi.StringPtrInput
   137  	// The description of the docDB subnet group. Defaults to "Managed by Pulumi".
   138  	Description pulumi.StringPtrInput
   139  	// The name of the docDB subnet group. If omitted, this provider will assign a random, unique name.
   140  	Name pulumi.StringPtrInput
   141  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   142  	NamePrefix pulumi.StringPtrInput
   143  	// A list of VPC subnet IDs.
   144  	SubnetIds pulumi.StringArrayInput
   145  	// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   146  	Tags pulumi.StringMapInput
   147  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   148  	//
   149  	// Deprecated: Please use `tags` instead.
   150  	TagsAll pulumi.StringMapInput
   151  }
   152  
   153  func (SubnetGroupState) ElementType() reflect.Type {
   154  	return reflect.TypeOf((*subnetGroupState)(nil)).Elem()
   155  }
   156  
   157  type subnetGroupArgs struct {
   158  	// The description of the docDB subnet group. Defaults to "Managed by Pulumi".
   159  	Description *string `pulumi:"description"`
   160  	// The name of the docDB subnet group. If omitted, this provider will assign a random, unique name.
   161  	Name *string `pulumi:"name"`
   162  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   163  	NamePrefix *string `pulumi:"namePrefix"`
   164  	// A list of VPC subnet IDs.
   165  	SubnetIds []string `pulumi:"subnetIds"`
   166  	// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   167  	Tags map[string]string `pulumi:"tags"`
   168  }
   169  
   170  // The set of arguments for constructing a SubnetGroup resource.
   171  type SubnetGroupArgs struct {
   172  	// The description of the docDB subnet group. Defaults to "Managed by Pulumi".
   173  	Description pulumi.StringPtrInput
   174  	// The name of the docDB subnet group. If omitted, this provider will assign a random, unique name.
   175  	Name pulumi.StringPtrInput
   176  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   177  	NamePrefix pulumi.StringPtrInput
   178  	// A list of VPC subnet IDs.
   179  	SubnetIds pulumi.StringArrayInput
   180  	// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   181  	Tags pulumi.StringMapInput
   182  }
   183  
   184  func (SubnetGroupArgs) ElementType() reflect.Type {
   185  	return reflect.TypeOf((*subnetGroupArgs)(nil)).Elem()
   186  }
   187  
   188  type SubnetGroupInput interface {
   189  	pulumi.Input
   190  
   191  	ToSubnetGroupOutput() SubnetGroupOutput
   192  	ToSubnetGroupOutputWithContext(ctx context.Context) SubnetGroupOutput
   193  }
   194  
   195  func (*SubnetGroup) ElementType() reflect.Type {
   196  	return reflect.TypeOf((**SubnetGroup)(nil)).Elem()
   197  }
   198  
   199  func (i *SubnetGroup) ToSubnetGroupOutput() SubnetGroupOutput {
   200  	return i.ToSubnetGroupOutputWithContext(context.Background())
   201  }
   202  
   203  func (i *SubnetGroup) ToSubnetGroupOutputWithContext(ctx context.Context) SubnetGroupOutput {
   204  	return pulumi.ToOutputWithContext(ctx, i).(SubnetGroupOutput)
   205  }
   206  
   207  // SubnetGroupArrayInput is an input type that accepts SubnetGroupArray and SubnetGroupArrayOutput values.
   208  // You can construct a concrete instance of `SubnetGroupArrayInput` via:
   209  //
   210  //	SubnetGroupArray{ SubnetGroupArgs{...} }
   211  type SubnetGroupArrayInput interface {
   212  	pulumi.Input
   213  
   214  	ToSubnetGroupArrayOutput() SubnetGroupArrayOutput
   215  	ToSubnetGroupArrayOutputWithContext(context.Context) SubnetGroupArrayOutput
   216  }
   217  
   218  type SubnetGroupArray []SubnetGroupInput
   219  
   220  func (SubnetGroupArray) ElementType() reflect.Type {
   221  	return reflect.TypeOf((*[]*SubnetGroup)(nil)).Elem()
   222  }
   223  
   224  func (i SubnetGroupArray) ToSubnetGroupArrayOutput() SubnetGroupArrayOutput {
   225  	return i.ToSubnetGroupArrayOutputWithContext(context.Background())
   226  }
   227  
   228  func (i SubnetGroupArray) ToSubnetGroupArrayOutputWithContext(ctx context.Context) SubnetGroupArrayOutput {
   229  	return pulumi.ToOutputWithContext(ctx, i).(SubnetGroupArrayOutput)
   230  }
   231  
   232  // SubnetGroupMapInput is an input type that accepts SubnetGroupMap and SubnetGroupMapOutput values.
   233  // You can construct a concrete instance of `SubnetGroupMapInput` via:
   234  //
   235  //	SubnetGroupMap{ "key": SubnetGroupArgs{...} }
   236  type SubnetGroupMapInput interface {
   237  	pulumi.Input
   238  
   239  	ToSubnetGroupMapOutput() SubnetGroupMapOutput
   240  	ToSubnetGroupMapOutputWithContext(context.Context) SubnetGroupMapOutput
   241  }
   242  
   243  type SubnetGroupMap map[string]SubnetGroupInput
   244  
   245  func (SubnetGroupMap) ElementType() reflect.Type {
   246  	return reflect.TypeOf((*map[string]*SubnetGroup)(nil)).Elem()
   247  }
   248  
   249  func (i SubnetGroupMap) ToSubnetGroupMapOutput() SubnetGroupMapOutput {
   250  	return i.ToSubnetGroupMapOutputWithContext(context.Background())
   251  }
   252  
   253  func (i SubnetGroupMap) ToSubnetGroupMapOutputWithContext(ctx context.Context) SubnetGroupMapOutput {
   254  	return pulumi.ToOutputWithContext(ctx, i).(SubnetGroupMapOutput)
   255  }
   256  
   257  type SubnetGroupOutput struct{ *pulumi.OutputState }
   258  
   259  func (SubnetGroupOutput) ElementType() reflect.Type {
   260  	return reflect.TypeOf((**SubnetGroup)(nil)).Elem()
   261  }
   262  
   263  func (o SubnetGroupOutput) ToSubnetGroupOutput() SubnetGroupOutput {
   264  	return o
   265  }
   266  
   267  func (o SubnetGroupOutput) ToSubnetGroupOutputWithContext(ctx context.Context) SubnetGroupOutput {
   268  	return o
   269  }
   270  
   271  // The ARN of the docDB subnet group.
   272  func (o SubnetGroupOutput) Arn() pulumi.StringOutput {
   273  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   274  }
   275  
   276  // The description of the docDB subnet group. Defaults to "Managed by Pulumi".
   277  func (o SubnetGroupOutput) Description() pulumi.StringOutput {
   278  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
   279  }
   280  
   281  // The name of the docDB subnet group. If omitted, this provider will assign a random, unique name.
   282  func (o SubnetGroupOutput) Name() pulumi.StringOutput {
   283  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   284  }
   285  
   286  // Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   287  func (o SubnetGroupOutput) NamePrefix() pulumi.StringOutput {
   288  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringOutput { return v.NamePrefix }).(pulumi.StringOutput)
   289  }
   290  
   291  // A list of VPC subnet IDs.
   292  func (o SubnetGroupOutput) SubnetIds() pulumi.StringArrayOutput {
   293  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringArrayOutput { return v.SubnetIds }).(pulumi.StringArrayOutput)
   294  }
   295  
   296  // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   297  func (o SubnetGroupOutput) Tags() pulumi.StringMapOutput {
   298  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   299  }
   300  
   301  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   302  //
   303  // Deprecated: Please use `tags` instead.
   304  func (o SubnetGroupOutput) TagsAll() pulumi.StringMapOutput {
   305  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   306  }
   307  
   308  type SubnetGroupArrayOutput struct{ *pulumi.OutputState }
   309  
   310  func (SubnetGroupArrayOutput) ElementType() reflect.Type {
   311  	return reflect.TypeOf((*[]*SubnetGroup)(nil)).Elem()
   312  }
   313  
   314  func (o SubnetGroupArrayOutput) ToSubnetGroupArrayOutput() SubnetGroupArrayOutput {
   315  	return o
   316  }
   317  
   318  func (o SubnetGroupArrayOutput) ToSubnetGroupArrayOutputWithContext(ctx context.Context) SubnetGroupArrayOutput {
   319  	return o
   320  }
   321  
   322  func (o SubnetGroupArrayOutput) Index(i pulumi.IntInput) SubnetGroupOutput {
   323  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SubnetGroup {
   324  		return vs[0].([]*SubnetGroup)[vs[1].(int)]
   325  	}).(SubnetGroupOutput)
   326  }
   327  
   328  type SubnetGroupMapOutput struct{ *pulumi.OutputState }
   329  
   330  func (SubnetGroupMapOutput) ElementType() reflect.Type {
   331  	return reflect.TypeOf((*map[string]*SubnetGroup)(nil)).Elem()
   332  }
   333  
   334  func (o SubnetGroupMapOutput) ToSubnetGroupMapOutput() SubnetGroupMapOutput {
   335  	return o
   336  }
   337  
   338  func (o SubnetGroupMapOutput) ToSubnetGroupMapOutputWithContext(ctx context.Context) SubnetGroupMapOutput {
   339  	return o
   340  }
   341  
   342  func (o SubnetGroupMapOutput) MapIndex(k pulumi.StringInput) SubnetGroupOutput {
   343  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SubnetGroup {
   344  		return vs[0].(map[string]*SubnetGroup)[vs[1].(string)]
   345  	}).(SubnetGroupOutput)
   346  }
   347  
   348  func init() {
   349  	pulumi.RegisterInputType(reflect.TypeOf((*SubnetGroupInput)(nil)).Elem(), &SubnetGroup{})
   350  	pulumi.RegisterInputType(reflect.TypeOf((*SubnetGroupArrayInput)(nil)).Elem(), SubnetGroupArray{})
   351  	pulumi.RegisterInputType(reflect.TypeOf((*SubnetGroupMapInput)(nil)).Elem(), SubnetGroupMap{})
   352  	pulumi.RegisterOutputType(SubnetGroupOutput{})
   353  	pulumi.RegisterOutputType(SubnetGroupArrayOutput{})
   354  	pulumi.RegisterOutputType(SubnetGroupMapOutput{})
   355  }