github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lightsail/domainEntry.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 lightsail
     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  // Creates a domain entry resource
    16  //
    17  // > **NOTE on `id`:** In an effort to simplify imports, this resource `id` field has been updated to the standard resource id separator, a comma (`,`). For backward compatibility, the previous separator (underscore `_`) can still be used to read and import existing resources. When state is refreshed, the `id` will be updated to use the new standard separator. The previous separator will be deprecated in a future major release.
    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/lightsail"
    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 := lightsail.NewDomain(ctx, "test", &lightsail.DomainArgs{
    35  //				DomainName: pulumi.String("mydomain.com"),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			_, err = lightsail.NewDomainEntry(ctx, "test", &lightsail.DomainEntryArgs{
    41  //				DomainName: pulumi.Any(domainTest.DomainName),
    42  //				Name:       pulumi.String("www"),
    43  //				Type:       pulumi.String("A"),
    44  //				Target:     pulumi.String("127.0.0.1"),
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			return nil
    50  //		})
    51  //	}
    52  //
    53  // ```
    54  // <!--End PulumiCodeChooser -->
    55  //
    56  // ## Import
    57  //
    58  // Using `pulumi import`, import `aws_lightsail_domain_entry` using the id attribute. For example:
    59  //
    60  // ```sh
    61  // $ pulumi import aws:lightsail/domainEntry:DomainEntry example www,mydomain.com,A,127.0.0.1
    62  // ```
    63  type DomainEntry struct {
    64  	pulumi.CustomResourceState
    65  
    66  	// The name of the Lightsail domain in which to create the entry
    67  	DomainName pulumi.StringOutput `pulumi:"domainName"`
    68  	// If the entry should be an alias Defaults to `false`
    69  	IsAlias pulumi.BoolPtrOutput `pulumi:"isAlias"`
    70  	// Name of the entry record
    71  	Name pulumi.StringOutput `pulumi:"name"`
    72  	// Target of the domain entry
    73  	Target pulumi.StringOutput `pulumi:"target"`
    74  	// Type of record
    75  	Type pulumi.StringOutput `pulumi:"type"`
    76  }
    77  
    78  // NewDomainEntry registers a new resource with the given unique name, arguments, and options.
    79  func NewDomainEntry(ctx *pulumi.Context,
    80  	name string, args *DomainEntryArgs, opts ...pulumi.ResourceOption) (*DomainEntry, error) {
    81  	if args == nil {
    82  		return nil, errors.New("missing one or more required arguments")
    83  	}
    84  
    85  	if args.DomainName == nil {
    86  		return nil, errors.New("invalid value for required argument 'DomainName'")
    87  	}
    88  	if args.Target == nil {
    89  		return nil, errors.New("invalid value for required argument 'Target'")
    90  	}
    91  	if args.Type == nil {
    92  		return nil, errors.New("invalid value for required argument 'Type'")
    93  	}
    94  	opts = internal.PkgResourceDefaultOpts(opts)
    95  	var resource DomainEntry
    96  	err := ctx.RegisterResource("aws:lightsail/domainEntry:DomainEntry", name, args, &resource, opts...)
    97  	if err != nil {
    98  		return nil, err
    99  	}
   100  	return &resource, nil
   101  }
   102  
   103  // GetDomainEntry gets an existing DomainEntry resource's state with the given name, ID, and optional
   104  // state properties that are used to uniquely qualify the lookup (nil if not required).
   105  func GetDomainEntry(ctx *pulumi.Context,
   106  	name string, id pulumi.IDInput, state *DomainEntryState, opts ...pulumi.ResourceOption) (*DomainEntry, error) {
   107  	var resource DomainEntry
   108  	err := ctx.ReadResource("aws:lightsail/domainEntry:DomainEntry", name, id, state, &resource, opts...)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	return &resource, nil
   113  }
   114  
   115  // Input properties used for looking up and filtering DomainEntry resources.
   116  type domainEntryState struct {
   117  	// The name of the Lightsail domain in which to create the entry
   118  	DomainName *string `pulumi:"domainName"`
   119  	// If the entry should be an alias Defaults to `false`
   120  	IsAlias *bool `pulumi:"isAlias"`
   121  	// Name of the entry record
   122  	Name *string `pulumi:"name"`
   123  	// Target of the domain entry
   124  	Target *string `pulumi:"target"`
   125  	// Type of record
   126  	Type *string `pulumi:"type"`
   127  }
   128  
   129  type DomainEntryState struct {
   130  	// The name of the Lightsail domain in which to create the entry
   131  	DomainName pulumi.StringPtrInput
   132  	// If the entry should be an alias Defaults to `false`
   133  	IsAlias pulumi.BoolPtrInput
   134  	// Name of the entry record
   135  	Name pulumi.StringPtrInput
   136  	// Target of the domain entry
   137  	Target pulumi.StringPtrInput
   138  	// Type of record
   139  	Type pulumi.StringPtrInput
   140  }
   141  
   142  func (DomainEntryState) ElementType() reflect.Type {
   143  	return reflect.TypeOf((*domainEntryState)(nil)).Elem()
   144  }
   145  
   146  type domainEntryArgs struct {
   147  	// The name of the Lightsail domain in which to create the entry
   148  	DomainName string `pulumi:"domainName"`
   149  	// If the entry should be an alias Defaults to `false`
   150  	IsAlias *bool `pulumi:"isAlias"`
   151  	// Name of the entry record
   152  	Name *string `pulumi:"name"`
   153  	// Target of the domain entry
   154  	Target string `pulumi:"target"`
   155  	// Type of record
   156  	Type string `pulumi:"type"`
   157  }
   158  
   159  // The set of arguments for constructing a DomainEntry resource.
   160  type DomainEntryArgs struct {
   161  	// The name of the Lightsail domain in which to create the entry
   162  	DomainName pulumi.StringInput
   163  	// If the entry should be an alias Defaults to `false`
   164  	IsAlias pulumi.BoolPtrInput
   165  	// Name of the entry record
   166  	Name pulumi.StringPtrInput
   167  	// Target of the domain entry
   168  	Target pulumi.StringInput
   169  	// Type of record
   170  	Type pulumi.StringInput
   171  }
   172  
   173  func (DomainEntryArgs) ElementType() reflect.Type {
   174  	return reflect.TypeOf((*domainEntryArgs)(nil)).Elem()
   175  }
   176  
   177  type DomainEntryInput interface {
   178  	pulumi.Input
   179  
   180  	ToDomainEntryOutput() DomainEntryOutput
   181  	ToDomainEntryOutputWithContext(ctx context.Context) DomainEntryOutput
   182  }
   183  
   184  func (*DomainEntry) ElementType() reflect.Type {
   185  	return reflect.TypeOf((**DomainEntry)(nil)).Elem()
   186  }
   187  
   188  func (i *DomainEntry) ToDomainEntryOutput() DomainEntryOutput {
   189  	return i.ToDomainEntryOutputWithContext(context.Background())
   190  }
   191  
   192  func (i *DomainEntry) ToDomainEntryOutputWithContext(ctx context.Context) DomainEntryOutput {
   193  	return pulumi.ToOutputWithContext(ctx, i).(DomainEntryOutput)
   194  }
   195  
   196  // DomainEntryArrayInput is an input type that accepts DomainEntryArray and DomainEntryArrayOutput values.
   197  // You can construct a concrete instance of `DomainEntryArrayInput` via:
   198  //
   199  //	DomainEntryArray{ DomainEntryArgs{...} }
   200  type DomainEntryArrayInput interface {
   201  	pulumi.Input
   202  
   203  	ToDomainEntryArrayOutput() DomainEntryArrayOutput
   204  	ToDomainEntryArrayOutputWithContext(context.Context) DomainEntryArrayOutput
   205  }
   206  
   207  type DomainEntryArray []DomainEntryInput
   208  
   209  func (DomainEntryArray) ElementType() reflect.Type {
   210  	return reflect.TypeOf((*[]*DomainEntry)(nil)).Elem()
   211  }
   212  
   213  func (i DomainEntryArray) ToDomainEntryArrayOutput() DomainEntryArrayOutput {
   214  	return i.ToDomainEntryArrayOutputWithContext(context.Background())
   215  }
   216  
   217  func (i DomainEntryArray) ToDomainEntryArrayOutputWithContext(ctx context.Context) DomainEntryArrayOutput {
   218  	return pulumi.ToOutputWithContext(ctx, i).(DomainEntryArrayOutput)
   219  }
   220  
   221  // DomainEntryMapInput is an input type that accepts DomainEntryMap and DomainEntryMapOutput values.
   222  // You can construct a concrete instance of `DomainEntryMapInput` via:
   223  //
   224  //	DomainEntryMap{ "key": DomainEntryArgs{...} }
   225  type DomainEntryMapInput interface {
   226  	pulumi.Input
   227  
   228  	ToDomainEntryMapOutput() DomainEntryMapOutput
   229  	ToDomainEntryMapOutputWithContext(context.Context) DomainEntryMapOutput
   230  }
   231  
   232  type DomainEntryMap map[string]DomainEntryInput
   233  
   234  func (DomainEntryMap) ElementType() reflect.Type {
   235  	return reflect.TypeOf((*map[string]*DomainEntry)(nil)).Elem()
   236  }
   237  
   238  func (i DomainEntryMap) ToDomainEntryMapOutput() DomainEntryMapOutput {
   239  	return i.ToDomainEntryMapOutputWithContext(context.Background())
   240  }
   241  
   242  func (i DomainEntryMap) ToDomainEntryMapOutputWithContext(ctx context.Context) DomainEntryMapOutput {
   243  	return pulumi.ToOutputWithContext(ctx, i).(DomainEntryMapOutput)
   244  }
   245  
   246  type DomainEntryOutput struct{ *pulumi.OutputState }
   247  
   248  func (DomainEntryOutput) ElementType() reflect.Type {
   249  	return reflect.TypeOf((**DomainEntry)(nil)).Elem()
   250  }
   251  
   252  func (o DomainEntryOutput) ToDomainEntryOutput() DomainEntryOutput {
   253  	return o
   254  }
   255  
   256  func (o DomainEntryOutput) ToDomainEntryOutputWithContext(ctx context.Context) DomainEntryOutput {
   257  	return o
   258  }
   259  
   260  // The name of the Lightsail domain in which to create the entry
   261  func (o DomainEntryOutput) DomainName() pulumi.StringOutput {
   262  	return o.ApplyT(func(v *DomainEntry) pulumi.StringOutput { return v.DomainName }).(pulumi.StringOutput)
   263  }
   264  
   265  // If the entry should be an alias Defaults to `false`
   266  func (o DomainEntryOutput) IsAlias() pulumi.BoolPtrOutput {
   267  	return o.ApplyT(func(v *DomainEntry) pulumi.BoolPtrOutput { return v.IsAlias }).(pulumi.BoolPtrOutput)
   268  }
   269  
   270  // Name of the entry record
   271  func (o DomainEntryOutput) Name() pulumi.StringOutput {
   272  	return o.ApplyT(func(v *DomainEntry) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   273  }
   274  
   275  // Target of the domain entry
   276  func (o DomainEntryOutput) Target() pulumi.StringOutput {
   277  	return o.ApplyT(func(v *DomainEntry) pulumi.StringOutput { return v.Target }).(pulumi.StringOutput)
   278  }
   279  
   280  // Type of record
   281  func (o DomainEntryOutput) Type() pulumi.StringOutput {
   282  	return o.ApplyT(func(v *DomainEntry) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
   283  }
   284  
   285  type DomainEntryArrayOutput struct{ *pulumi.OutputState }
   286  
   287  func (DomainEntryArrayOutput) ElementType() reflect.Type {
   288  	return reflect.TypeOf((*[]*DomainEntry)(nil)).Elem()
   289  }
   290  
   291  func (o DomainEntryArrayOutput) ToDomainEntryArrayOutput() DomainEntryArrayOutput {
   292  	return o
   293  }
   294  
   295  func (o DomainEntryArrayOutput) ToDomainEntryArrayOutputWithContext(ctx context.Context) DomainEntryArrayOutput {
   296  	return o
   297  }
   298  
   299  func (o DomainEntryArrayOutput) Index(i pulumi.IntInput) DomainEntryOutput {
   300  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DomainEntry {
   301  		return vs[0].([]*DomainEntry)[vs[1].(int)]
   302  	}).(DomainEntryOutput)
   303  }
   304  
   305  type DomainEntryMapOutput struct{ *pulumi.OutputState }
   306  
   307  func (DomainEntryMapOutput) ElementType() reflect.Type {
   308  	return reflect.TypeOf((*map[string]*DomainEntry)(nil)).Elem()
   309  }
   310  
   311  func (o DomainEntryMapOutput) ToDomainEntryMapOutput() DomainEntryMapOutput {
   312  	return o
   313  }
   314  
   315  func (o DomainEntryMapOutput) ToDomainEntryMapOutputWithContext(ctx context.Context) DomainEntryMapOutput {
   316  	return o
   317  }
   318  
   319  func (o DomainEntryMapOutput) MapIndex(k pulumi.StringInput) DomainEntryOutput {
   320  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DomainEntry {
   321  		return vs[0].(map[string]*DomainEntry)[vs[1].(string)]
   322  	}).(DomainEntryOutput)
   323  }
   324  
   325  func init() {
   326  	pulumi.RegisterInputType(reflect.TypeOf((*DomainEntryInput)(nil)).Elem(), &DomainEntry{})
   327  	pulumi.RegisterInputType(reflect.TypeOf((*DomainEntryArrayInput)(nil)).Elem(), DomainEntryArray{})
   328  	pulumi.RegisterInputType(reflect.TypeOf((*DomainEntryMapInput)(nil)).Elem(), DomainEntryMap{})
   329  	pulumi.RegisterOutputType(DomainEntryOutput{})
   330  	pulumi.RegisterOutputType(DomainEntryArrayOutput{})
   331  	pulumi.RegisterOutputType(DomainEntryMapOutput{})
   332  }