github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/opensearch/packageAssociation.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 opensearch
     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 AWS Opensearch Package Association.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/opensearch"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			myDomain, err := opensearch.NewDomain(ctx, "my_domain", &opensearch.DomainArgs{
    35  //				DomainName:    pulumi.String("my-opensearch-domain"),
    36  //				EngineVersion: pulumi.String("Elasticsearch_7.10"),
    37  //				ClusterConfig: &opensearch.DomainClusterConfigArgs{
    38  //					InstanceType: pulumi.String("r4.large.search"),
    39  //				},
    40  //			})
    41  //			if err != nil {
    42  //				return err
    43  //			}
    44  //			example, err := opensearch.NewPackage(ctx, "example", &opensearch.PackageArgs{
    45  //				PackageName: pulumi.String("example-txt"),
    46  //				PackageSource: &opensearch.PackagePackageSourceArgs{
    47  //					S3BucketName: pulumi.Any(myOpensearchPackages.Bucket),
    48  //					S3Key:        pulumi.Any(exampleAwsS3Object.Key),
    49  //				},
    50  //				PackageType: pulumi.String("TXT-DICTIONARY"),
    51  //			})
    52  //			if err != nil {
    53  //				return err
    54  //			}
    55  //			_, err = opensearch.NewPackageAssociation(ctx, "example", &opensearch.PackageAssociationArgs{
    56  //				PackageId:  example.ID(),
    57  //				DomainName: myDomain.DomainName,
    58  //			})
    59  //			if err != nil {
    60  //				return err
    61  //			}
    62  //			return nil
    63  //		})
    64  //	}
    65  //
    66  // ```
    67  // <!--End PulumiCodeChooser -->
    68  type PackageAssociation struct {
    69  	pulumi.CustomResourceState
    70  
    71  	// Name of the domain to associate the package with.
    72  	DomainName pulumi.StringOutput `pulumi:"domainName"`
    73  	// Internal ID of the package to associate with a domain.
    74  	PackageId     pulumi.StringOutput `pulumi:"packageId"`
    75  	ReferencePath pulumi.StringOutput `pulumi:"referencePath"`
    76  }
    77  
    78  // NewPackageAssociation registers a new resource with the given unique name, arguments, and options.
    79  func NewPackageAssociation(ctx *pulumi.Context,
    80  	name string, args *PackageAssociationArgs, opts ...pulumi.ResourceOption) (*PackageAssociation, 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.PackageId == nil {
    89  		return nil, errors.New("invalid value for required argument 'PackageId'")
    90  	}
    91  	opts = internal.PkgResourceDefaultOpts(opts)
    92  	var resource PackageAssociation
    93  	err := ctx.RegisterResource("aws:opensearch/packageAssociation:PackageAssociation", name, args, &resource, opts...)
    94  	if err != nil {
    95  		return nil, err
    96  	}
    97  	return &resource, nil
    98  }
    99  
   100  // GetPackageAssociation gets an existing PackageAssociation resource's state with the given name, ID, and optional
   101  // state properties that are used to uniquely qualify the lookup (nil if not required).
   102  func GetPackageAssociation(ctx *pulumi.Context,
   103  	name string, id pulumi.IDInput, state *PackageAssociationState, opts ...pulumi.ResourceOption) (*PackageAssociation, error) {
   104  	var resource PackageAssociation
   105  	err := ctx.ReadResource("aws:opensearch/packageAssociation:PackageAssociation", name, id, state, &resource, opts...)
   106  	if err != nil {
   107  		return nil, err
   108  	}
   109  	return &resource, nil
   110  }
   111  
   112  // Input properties used for looking up and filtering PackageAssociation resources.
   113  type packageAssociationState struct {
   114  	// Name of the domain to associate the package with.
   115  	DomainName *string `pulumi:"domainName"`
   116  	// Internal ID of the package to associate with a domain.
   117  	PackageId     *string `pulumi:"packageId"`
   118  	ReferencePath *string `pulumi:"referencePath"`
   119  }
   120  
   121  type PackageAssociationState struct {
   122  	// Name of the domain to associate the package with.
   123  	DomainName pulumi.StringPtrInput
   124  	// Internal ID of the package to associate with a domain.
   125  	PackageId     pulumi.StringPtrInput
   126  	ReferencePath pulumi.StringPtrInput
   127  }
   128  
   129  func (PackageAssociationState) ElementType() reflect.Type {
   130  	return reflect.TypeOf((*packageAssociationState)(nil)).Elem()
   131  }
   132  
   133  type packageAssociationArgs struct {
   134  	// Name of the domain to associate the package with.
   135  	DomainName string `pulumi:"domainName"`
   136  	// Internal ID of the package to associate with a domain.
   137  	PackageId string `pulumi:"packageId"`
   138  }
   139  
   140  // The set of arguments for constructing a PackageAssociation resource.
   141  type PackageAssociationArgs struct {
   142  	// Name of the domain to associate the package with.
   143  	DomainName pulumi.StringInput
   144  	// Internal ID of the package to associate with a domain.
   145  	PackageId pulumi.StringInput
   146  }
   147  
   148  func (PackageAssociationArgs) ElementType() reflect.Type {
   149  	return reflect.TypeOf((*packageAssociationArgs)(nil)).Elem()
   150  }
   151  
   152  type PackageAssociationInput interface {
   153  	pulumi.Input
   154  
   155  	ToPackageAssociationOutput() PackageAssociationOutput
   156  	ToPackageAssociationOutputWithContext(ctx context.Context) PackageAssociationOutput
   157  }
   158  
   159  func (*PackageAssociation) ElementType() reflect.Type {
   160  	return reflect.TypeOf((**PackageAssociation)(nil)).Elem()
   161  }
   162  
   163  func (i *PackageAssociation) ToPackageAssociationOutput() PackageAssociationOutput {
   164  	return i.ToPackageAssociationOutputWithContext(context.Background())
   165  }
   166  
   167  func (i *PackageAssociation) ToPackageAssociationOutputWithContext(ctx context.Context) PackageAssociationOutput {
   168  	return pulumi.ToOutputWithContext(ctx, i).(PackageAssociationOutput)
   169  }
   170  
   171  // PackageAssociationArrayInput is an input type that accepts PackageAssociationArray and PackageAssociationArrayOutput values.
   172  // You can construct a concrete instance of `PackageAssociationArrayInput` via:
   173  //
   174  //	PackageAssociationArray{ PackageAssociationArgs{...} }
   175  type PackageAssociationArrayInput interface {
   176  	pulumi.Input
   177  
   178  	ToPackageAssociationArrayOutput() PackageAssociationArrayOutput
   179  	ToPackageAssociationArrayOutputWithContext(context.Context) PackageAssociationArrayOutput
   180  }
   181  
   182  type PackageAssociationArray []PackageAssociationInput
   183  
   184  func (PackageAssociationArray) ElementType() reflect.Type {
   185  	return reflect.TypeOf((*[]*PackageAssociation)(nil)).Elem()
   186  }
   187  
   188  func (i PackageAssociationArray) ToPackageAssociationArrayOutput() PackageAssociationArrayOutput {
   189  	return i.ToPackageAssociationArrayOutputWithContext(context.Background())
   190  }
   191  
   192  func (i PackageAssociationArray) ToPackageAssociationArrayOutputWithContext(ctx context.Context) PackageAssociationArrayOutput {
   193  	return pulumi.ToOutputWithContext(ctx, i).(PackageAssociationArrayOutput)
   194  }
   195  
   196  // PackageAssociationMapInput is an input type that accepts PackageAssociationMap and PackageAssociationMapOutput values.
   197  // You can construct a concrete instance of `PackageAssociationMapInput` via:
   198  //
   199  //	PackageAssociationMap{ "key": PackageAssociationArgs{...} }
   200  type PackageAssociationMapInput interface {
   201  	pulumi.Input
   202  
   203  	ToPackageAssociationMapOutput() PackageAssociationMapOutput
   204  	ToPackageAssociationMapOutputWithContext(context.Context) PackageAssociationMapOutput
   205  }
   206  
   207  type PackageAssociationMap map[string]PackageAssociationInput
   208  
   209  func (PackageAssociationMap) ElementType() reflect.Type {
   210  	return reflect.TypeOf((*map[string]*PackageAssociation)(nil)).Elem()
   211  }
   212  
   213  func (i PackageAssociationMap) ToPackageAssociationMapOutput() PackageAssociationMapOutput {
   214  	return i.ToPackageAssociationMapOutputWithContext(context.Background())
   215  }
   216  
   217  func (i PackageAssociationMap) ToPackageAssociationMapOutputWithContext(ctx context.Context) PackageAssociationMapOutput {
   218  	return pulumi.ToOutputWithContext(ctx, i).(PackageAssociationMapOutput)
   219  }
   220  
   221  type PackageAssociationOutput struct{ *pulumi.OutputState }
   222  
   223  func (PackageAssociationOutput) ElementType() reflect.Type {
   224  	return reflect.TypeOf((**PackageAssociation)(nil)).Elem()
   225  }
   226  
   227  func (o PackageAssociationOutput) ToPackageAssociationOutput() PackageAssociationOutput {
   228  	return o
   229  }
   230  
   231  func (o PackageAssociationOutput) ToPackageAssociationOutputWithContext(ctx context.Context) PackageAssociationOutput {
   232  	return o
   233  }
   234  
   235  // Name of the domain to associate the package with.
   236  func (o PackageAssociationOutput) DomainName() pulumi.StringOutput {
   237  	return o.ApplyT(func(v *PackageAssociation) pulumi.StringOutput { return v.DomainName }).(pulumi.StringOutput)
   238  }
   239  
   240  // Internal ID of the package to associate with a domain.
   241  func (o PackageAssociationOutput) PackageId() pulumi.StringOutput {
   242  	return o.ApplyT(func(v *PackageAssociation) pulumi.StringOutput { return v.PackageId }).(pulumi.StringOutput)
   243  }
   244  
   245  func (o PackageAssociationOutput) ReferencePath() pulumi.StringOutput {
   246  	return o.ApplyT(func(v *PackageAssociation) pulumi.StringOutput { return v.ReferencePath }).(pulumi.StringOutput)
   247  }
   248  
   249  type PackageAssociationArrayOutput struct{ *pulumi.OutputState }
   250  
   251  func (PackageAssociationArrayOutput) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*[]*PackageAssociation)(nil)).Elem()
   253  }
   254  
   255  func (o PackageAssociationArrayOutput) ToPackageAssociationArrayOutput() PackageAssociationArrayOutput {
   256  	return o
   257  }
   258  
   259  func (o PackageAssociationArrayOutput) ToPackageAssociationArrayOutputWithContext(ctx context.Context) PackageAssociationArrayOutput {
   260  	return o
   261  }
   262  
   263  func (o PackageAssociationArrayOutput) Index(i pulumi.IntInput) PackageAssociationOutput {
   264  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PackageAssociation {
   265  		return vs[0].([]*PackageAssociation)[vs[1].(int)]
   266  	}).(PackageAssociationOutput)
   267  }
   268  
   269  type PackageAssociationMapOutput struct{ *pulumi.OutputState }
   270  
   271  func (PackageAssociationMapOutput) ElementType() reflect.Type {
   272  	return reflect.TypeOf((*map[string]*PackageAssociation)(nil)).Elem()
   273  }
   274  
   275  func (o PackageAssociationMapOutput) ToPackageAssociationMapOutput() PackageAssociationMapOutput {
   276  	return o
   277  }
   278  
   279  func (o PackageAssociationMapOutput) ToPackageAssociationMapOutputWithContext(ctx context.Context) PackageAssociationMapOutput {
   280  	return o
   281  }
   282  
   283  func (o PackageAssociationMapOutput) MapIndex(k pulumi.StringInput) PackageAssociationOutput {
   284  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PackageAssociation {
   285  		return vs[0].(map[string]*PackageAssociation)[vs[1].(string)]
   286  	}).(PackageAssociationOutput)
   287  }
   288  
   289  func init() {
   290  	pulumi.RegisterInputType(reflect.TypeOf((*PackageAssociationInput)(nil)).Elem(), &PackageAssociation{})
   291  	pulumi.RegisterInputType(reflect.TypeOf((*PackageAssociationArrayInput)(nil)).Elem(), PackageAssociationArray{})
   292  	pulumi.RegisterInputType(reflect.TypeOf((*PackageAssociationMapInput)(nil)).Elem(), PackageAssociationMap{})
   293  	pulumi.RegisterOutputType(PackageAssociationOutput{})
   294  	pulumi.RegisterOutputType(PackageAssociationArrayOutput{})
   295  	pulumi.RegisterOutputType(PackageAssociationMapOutput{})
   296  }