github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/servicediscovery/privateDnsNamespace.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 servicediscovery
     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 a Service Discovery Private DNS Namespace 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/ec2"
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/servicediscovery"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			example, err := ec2.NewVpc(ctx, "example", &ec2.VpcArgs{
    34  //				CidrBlock: pulumi.String("10.0.0.0/16"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			_, err = servicediscovery.NewPrivateDnsNamespace(ctx, "example", &servicediscovery.PrivateDnsNamespaceArgs{
    40  //				Name:        pulumi.String("hoge.example.local"),
    41  //				Description: pulumi.String("example"),
    42  //				Vpc:         example.ID(),
    43  //			})
    44  //			if err != nil {
    45  //				return err
    46  //			}
    47  //			return nil
    48  //		})
    49  //	}
    50  //
    51  // ```
    52  // <!--End PulumiCodeChooser -->
    53  //
    54  // ## Import
    55  //
    56  // Using `pulumi import`, import Service Discovery Private DNS Namespace using the namespace ID and VPC ID. For example:
    57  //
    58  // ```sh
    59  // $ pulumi import aws:servicediscovery/privateDnsNamespace:PrivateDnsNamespace example 0123456789:vpc-123345
    60  // ```
    61  type PrivateDnsNamespace struct {
    62  	pulumi.CustomResourceState
    63  
    64  	// The ARN that Amazon Route 53 assigns to the namespace when you create it.
    65  	Arn pulumi.StringOutput `pulumi:"arn"`
    66  	// The description that you specify for the namespace when you create it.
    67  	Description pulumi.StringPtrOutput `pulumi:"description"`
    68  	// The ID for the hosted zone that Amazon Route 53 creates when you create a namespace.
    69  	HostedZone pulumi.StringOutput `pulumi:"hostedZone"`
    70  	// The name of the namespace.
    71  	Name pulumi.StringOutput `pulumi:"name"`
    72  	// A map of tags to assign to the namespace. 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  	// The ID of VPC that you want to associate the namespace with.
    79  	Vpc pulumi.StringOutput `pulumi:"vpc"`
    80  }
    81  
    82  // NewPrivateDnsNamespace registers a new resource with the given unique name, arguments, and options.
    83  func NewPrivateDnsNamespace(ctx *pulumi.Context,
    84  	name string, args *PrivateDnsNamespaceArgs, opts ...pulumi.ResourceOption) (*PrivateDnsNamespace, error) {
    85  	if args == nil {
    86  		return nil, errors.New("missing one or more required arguments")
    87  	}
    88  
    89  	if args.Vpc == nil {
    90  		return nil, errors.New("invalid value for required argument 'Vpc'")
    91  	}
    92  	opts = internal.PkgResourceDefaultOpts(opts)
    93  	var resource PrivateDnsNamespace
    94  	err := ctx.RegisterResource("aws:servicediscovery/privateDnsNamespace:PrivateDnsNamespace", name, args, &resource, opts...)
    95  	if err != nil {
    96  		return nil, err
    97  	}
    98  	return &resource, nil
    99  }
   100  
   101  // GetPrivateDnsNamespace gets an existing PrivateDnsNamespace resource's state with the given name, ID, and optional
   102  // state properties that are used to uniquely qualify the lookup (nil if not required).
   103  func GetPrivateDnsNamespace(ctx *pulumi.Context,
   104  	name string, id pulumi.IDInput, state *PrivateDnsNamespaceState, opts ...pulumi.ResourceOption) (*PrivateDnsNamespace, error) {
   105  	var resource PrivateDnsNamespace
   106  	err := ctx.ReadResource("aws:servicediscovery/privateDnsNamespace:PrivateDnsNamespace", name, id, state, &resource, opts...)
   107  	if err != nil {
   108  		return nil, err
   109  	}
   110  	return &resource, nil
   111  }
   112  
   113  // Input properties used for looking up and filtering PrivateDnsNamespace resources.
   114  type privateDnsNamespaceState struct {
   115  	// The ARN that Amazon Route 53 assigns to the namespace when you create it.
   116  	Arn *string `pulumi:"arn"`
   117  	// The description that you specify for the namespace when you create it.
   118  	Description *string `pulumi:"description"`
   119  	// The ID for the hosted zone that Amazon Route 53 creates when you create a namespace.
   120  	HostedZone *string `pulumi:"hostedZone"`
   121  	// The name of the namespace.
   122  	Name *string `pulumi:"name"`
   123  	// A map of tags to assign to the namespace. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   124  	Tags map[string]string `pulumi:"tags"`
   125  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   126  	//
   127  	// Deprecated: Please use `tags` instead.
   128  	TagsAll map[string]string `pulumi:"tagsAll"`
   129  	// The ID of VPC that you want to associate the namespace with.
   130  	Vpc *string `pulumi:"vpc"`
   131  }
   132  
   133  type PrivateDnsNamespaceState struct {
   134  	// The ARN that Amazon Route 53 assigns to the namespace when you create it.
   135  	Arn pulumi.StringPtrInput
   136  	// The description that you specify for the namespace when you create it.
   137  	Description pulumi.StringPtrInput
   138  	// The ID for the hosted zone that Amazon Route 53 creates when you create a namespace.
   139  	HostedZone pulumi.StringPtrInput
   140  	// The name of the namespace.
   141  	Name pulumi.StringPtrInput
   142  	// A map of tags to assign to the namespace. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   143  	Tags pulumi.StringMapInput
   144  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   145  	//
   146  	// Deprecated: Please use `tags` instead.
   147  	TagsAll pulumi.StringMapInput
   148  	// The ID of VPC that you want to associate the namespace with.
   149  	Vpc pulumi.StringPtrInput
   150  }
   151  
   152  func (PrivateDnsNamespaceState) ElementType() reflect.Type {
   153  	return reflect.TypeOf((*privateDnsNamespaceState)(nil)).Elem()
   154  }
   155  
   156  type privateDnsNamespaceArgs struct {
   157  	// The description that you specify for the namespace when you create it.
   158  	Description *string `pulumi:"description"`
   159  	// The name of the namespace.
   160  	Name *string `pulumi:"name"`
   161  	// A map of tags to assign to the namespace. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   162  	Tags map[string]string `pulumi:"tags"`
   163  	// The ID of VPC that you want to associate the namespace with.
   164  	Vpc string `pulumi:"vpc"`
   165  }
   166  
   167  // The set of arguments for constructing a PrivateDnsNamespace resource.
   168  type PrivateDnsNamespaceArgs struct {
   169  	// The description that you specify for the namespace when you create it.
   170  	Description pulumi.StringPtrInput
   171  	// The name of the namespace.
   172  	Name pulumi.StringPtrInput
   173  	// A map of tags to assign to the namespace. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   174  	Tags pulumi.StringMapInput
   175  	// The ID of VPC that you want to associate the namespace with.
   176  	Vpc pulumi.StringInput
   177  }
   178  
   179  func (PrivateDnsNamespaceArgs) ElementType() reflect.Type {
   180  	return reflect.TypeOf((*privateDnsNamespaceArgs)(nil)).Elem()
   181  }
   182  
   183  type PrivateDnsNamespaceInput interface {
   184  	pulumi.Input
   185  
   186  	ToPrivateDnsNamespaceOutput() PrivateDnsNamespaceOutput
   187  	ToPrivateDnsNamespaceOutputWithContext(ctx context.Context) PrivateDnsNamespaceOutput
   188  }
   189  
   190  func (*PrivateDnsNamespace) ElementType() reflect.Type {
   191  	return reflect.TypeOf((**PrivateDnsNamespace)(nil)).Elem()
   192  }
   193  
   194  func (i *PrivateDnsNamespace) ToPrivateDnsNamespaceOutput() PrivateDnsNamespaceOutput {
   195  	return i.ToPrivateDnsNamespaceOutputWithContext(context.Background())
   196  }
   197  
   198  func (i *PrivateDnsNamespace) ToPrivateDnsNamespaceOutputWithContext(ctx context.Context) PrivateDnsNamespaceOutput {
   199  	return pulumi.ToOutputWithContext(ctx, i).(PrivateDnsNamespaceOutput)
   200  }
   201  
   202  // PrivateDnsNamespaceArrayInput is an input type that accepts PrivateDnsNamespaceArray and PrivateDnsNamespaceArrayOutput values.
   203  // You can construct a concrete instance of `PrivateDnsNamespaceArrayInput` via:
   204  //
   205  //	PrivateDnsNamespaceArray{ PrivateDnsNamespaceArgs{...} }
   206  type PrivateDnsNamespaceArrayInput interface {
   207  	pulumi.Input
   208  
   209  	ToPrivateDnsNamespaceArrayOutput() PrivateDnsNamespaceArrayOutput
   210  	ToPrivateDnsNamespaceArrayOutputWithContext(context.Context) PrivateDnsNamespaceArrayOutput
   211  }
   212  
   213  type PrivateDnsNamespaceArray []PrivateDnsNamespaceInput
   214  
   215  func (PrivateDnsNamespaceArray) ElementType() reflect.Type {
   216  	return reflect.TypeOf((*[]*PrivateDnsNamespace)(nil)).Elem()
   217  }
   218  
   219  func (i PrivateDnsNamespaceArray) ToPrivateDnsNamespaceArrayOutput() PrivateDnsNamespaceArrayOutput {
   220  	return i.ToPrivateDnsNamespaceArrayOutputWithContext(context.Background())
   221  }
   222  
   223  func (i PrivateDnsNamespaceArray) ToPrivateDnsNamespaceArrayOutputWithContext(ctx context.Context) PrivateDnsNamespaceArrayOutput {
   224  	return pulumi.ToOutputWithContext(ctx, i).(PrivateDnsNamespaceArrayOutput)
   225  }
   226  
   227  // PrivateDnsNamespaceMapInput is an input type that accepts PrivateDnsNamespaceMap and PrivateDnsNamespaceMapOutput values.
   228  // You can construct a concrete instance of `PrivateDnsNamespaceMapInput` via:
   229  //
   230  //	PrivateDnsNamespaceMap{ "key": PrivateDnsNamespaceArgs{...} }
   231  type PrivateDnsNamespaceMapInput interface {
   232  	pulumi.Input
   233  
   234  	ToPrivateDnsNamespaceMapOutput() PrivateDnsNamespaceMapOutput
   235  	ToPrivateDnsNamespaceMapOutputWithContext(context.Context) PrivateDnsNamespaceMapOutput
   236  }
   237  
   238  type PrivateDnsNamespaceMap map[string]PrivateDnsNamespaceInput
   239  
   240  func (PrivateDnsNamespaceMap) ElementType() reflect.Type {
   241  	return reflect.TypeOf((*map[string]*PrivateDnsNamespace)(nil)).Elem()
   242  }
   243  
   244  func (i PrivateDnsNamespaceMap) ToPrivateDnsNamespaceMapOutput() PrivateDnsNamespaceMapOutput {
   245  	return i.ToPrivateDnsNamespaceMapOutputWithContext(context.Background())
   246  }
   247  
   248  func (i PrivateDnsNamespaceMap) ToPrivateDnsNamespaceMapOutputWithContext(ctx context.Context) PrivateDnsNamespaceMapOutput {
   249  	return pulumi.ToOutputWithContext(ctx, i).(PrivateDnsNamespaceMapOutput)
   250  }
   251  
   252  type PrivateDnsNamespaceOutput struct{ *pulumi.OutputState }
   253  
   254  func (PrivateDnsNamespaceOutput) ElementType() reflect.Type {
   255  	return reflect.TypeOf((**PrivateDnsNamespace)(nil)).Elem()
   256  }
   257  
   258  func (o PrivateDnsNamespaceOutput) ToPrivateDnsNamespaceOutput() PrivateDnsNamespaceOutput {
   259  	return o
   260  }
   261  
   262  func (o PrivateDnsNamespaceOutput) ToPrivateDnsNamespaceOutputWithContext(ctx context.Context) PrivateDnsNamespaceOutput {
   263  	return o
   264  }
   265  
   266  // The ARN that Amazon Route 53 assigns to the namespace when you create it.
   267  func (o PrivateDnsNamespaceOutput) Arn() pulumi.StringOutput {
   268  	return o.ApplyT(func(v *PrivateDnsNamespace) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   269  }
   270  
   271  // The description that you specify for the namespace when you create it.
   272  func (o PrivateDnsNamespaceOutput) Description() pulumi.StringPtrOutput {
   273  	return o.ApplyT(func(v *PrivateDnsNamespace) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   274  }
   275  
   276  // The ID for the hosted zone that Amazon Route 53 creates when you create a namespace.
   277  func (o PrivateDnsNamespaceOutput) HostedZone() pulumi.StringOutput {
   278  	return o.ApplyT(func(v *PrivateDnsNamespace) pulumi.StringOutput { return v.HostedZone }).(pulumi.StringOutput)
   279  }
   280  
   281  // The name of the namespace.
   282  func (o PrivateDnsNamespaceOutput) Name() pulumi.StringOutput {
   283  	return o.ApplyT(func(v *PrivateDnsNamespace) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   284  }
   285  
   286  // A map of tags to assign to the namespace. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   287  func (o PrivateDnsNamespaceOutput) Tags() pulumi.StringMapOutput {
   288  	return o.ApplyT(func(v *PrivateDnsNamespace) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   289  }
   290  
   291  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   292  //
   293  // Deprecated: Please use `tags` instead.
   294  func (o PrivateDnsNamespaceOutput) TagsAll() pulumi.StringMapOutput {
   295  	return o.ApplyT(func(v *PrivateDnsNamespace) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   296  }
   297  
   298  // The ID of VPC that you want to associate the namespace with.
   299  func (o PrivateDnsNamespaceOutput) Vpc() pulumi.StringOutput {
   300  	return o.ApplyT(func(v *PrivateDnsNamespace) pulumi.StringOutput { return v.Vpc }).(pulumi.StringOutput)
   301  }
   302  
   303  type PrivateDnsNamespaceArrayOutput struct{ *pulumi.OutputState }
   304  
   305  func (PrivateDnsNamespaceArrayOutput) ElementType() reflect.Type {
   306  	return reflect.TypeOf((*[]*PrivateDnsNamespace)(nil)).Elem()
   307  }
   308  
   309  func (o PrivateDnsNamespaceArrayOutput) ToPrivateDnsNamespaceArrayOutput() PrivateDnsNamespaceArrayOutput {
   310  	return o
   311  }
   312  
   313  func (o PrivateDnsNamespaceArrayOutput) ToPrivateDnsNamespaceArrayOutputWithContext(ctx context.Context) PrivateDnsNamespaceArrayOutput {
   314  	return o
   315  }
   316  
   317  func (o PrivateDnsNamespaceArrayOutput) Index(i pulumi.IntInput) PrivateDnsNamespaceOutput {
   318  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PrivateDnsNamespace {
   319  		return vs[0].([]*PrivateDnsNamespace)[vs[1].(int)]
   320  	}).(PrivateDnsNamespaceOutput)
   321  }
   322  
   323  type PrivateDnsNamespaceMapOutput struct{ *pulumi.OutputState }
   324  
   325  func (PrivateDnsNamespaceMapOutput) ElementType() reflect.Type {
   326  	return reflect.TypeOf((*map[string]*PrivateDnsNamespace)(nil)).Elem()
   327  }
   328  
   329  func (o PrivateDnsNamespaceMapOutput) ToPrivateDnsNamespaceMapOutput() PrivateDnsNamespaceMapOutput {
   330  	return o
   331  }
   332  
   333  func (o PrivateDnsNamespaceMapOutput) ToPrivateDnsNamespaceMapOutputWithContext(ctx context.Context) PrivateDnsNamespaceMapOutput {
   334  	return o
   335  }
   336  
   337  func (o PrivateDnsNamespaceMapOutput) MapIndex(k pulumi.StringInput) PrivateDnsNamespaceOutput {
   338  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PrivateDnsNamespace {
   339  		return vs[0].(map[string]*PrivateDnsNamespace)[vs[1].(string)]
   340  	}).(PrivateDnsNamespaceOutput)
   341  }
   342  
   343  func init() {
   344  	pulumi.RegisterInputType(reflect.TypeOf((*PrivateDnsNamespaceInput)(nil)).Elem(), &PrivateDnsNamespace{})
   345  	pulumi.RegisterInputType(reflect.TypeOf((*PrivateDnsNamespaceArrayInput)(nil)).Elem(), PrivateDnsNamespaceArray{})
   346  	pulumi.RegisterInputType(reflect.TypeOf((*PrivateDnsNamespaceMapInput)(nil)).Elem(), PrivateDnsNamespaceMap{})
   347  	pulumi.RegisterOutputType(PrivateDnsNamespaceOutput{})
   348  	pulumi.RegisterOutputType(PrivateDnsNamespaceArrayOutput{})
   349  	pulumi.RegisterOutputType(PrivateDnsNamespaceMapOutput{})
   350  }