github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/opensearch/serverlessCollection.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Resource for managing an AWS OpenSearch Serverless Collection.
    15  //
    16  // > **NOTE:** An `opensearch.ServerlessCollection` cannot be created without having an applicable encryption security policy. Use the `dependsOn` meta-argument to define this dependency.
    17  //
    18  // > **NOTE:** An `opensearch.ServerlessCollection` is not accessible without configuring an applicable network security policy. Data cannot be accessed without configuring an applicable data access policy.
    19  //
    20  // ## Example Usage
    21  //
    22  // ### Basic Usage
    23  //
    24  // <!--Start PulumiCodeChooser -->
    25  // ```go
    26  // package main
    27  //
    28  // import (
    29  //
    30  //	"encoding/json"
    31  //
    32  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/opensearch"
    33  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    34  //
    35  // )
    36  //
    37  //	func main() {
    38  //		pulumi.Run(func(ctx *pulumi.Context) error {
    39  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    40  //				"Rules": []map[string]interface{}{
    41  //					map[string]interface{}{
    42  //						"Resource": []string{
    43  //							"collection/example",
    44  //						},
    45  //						"ResourceType": "collection",
    46  //					},
    47  //				},
    48  //				"AWSOwnedKey": true,
    49  //			})
    50  //			if err != nil {
    51  //				return err
    52  //			}
    53  //			json0 := string(tmpJSON0)
    54  //			example, err := opensearch.NewServerlessSecurityPolicy(ctx, "example", &opensearch.ServerlessSecurityPolicyArgs{
    55  //				Name:   pulumi.String("example"),
    56  //				Type:   pulumi.String("encryption"),
    57  //				Policy: pulumi.String(json0),
    58  //			})
    59  //			if err != nil {
    60  //				return err
    61  //			}
    62  //			_, err = opensearch.NewServerlessCollection(ctx, "example", &opensearch.ServerlessCollectionArgs{
    63  //				Name: pulumi.String("example"),
    64  //			}, pulumi.DependsOn([]pulumi.Resource{
    65  //				example,
    66  //			}))
    67  //			if err != nil {
    68  //				return err
    69  //			}
    70  //			return nil
    71  //		})
    72  //	}
    73  //
    74  // ```
    75  // <!--End PulumiCodeChooser -->
    76  //
    77  // ## Import
    78  //
    79  // Using `pulumi import`, import OpenSearchServerless Collection using the `id`. For example:
    80  //
    81  // ```sh
    82  // $ pulumi import aws:opensearch/serverlessCollection:ServerlessCollection example example
    83  // ```
    84  type ServerlessCollection struct {
    85  	pulumi.CustomResourceState
    86  
    87  	// Amazon Resource Name (ARN) of the collection.
    88  	Arn pulumi.StringOutput `pulumi:"arn"`
    89  	// Collection-specific endpoint used to submit index, search, and data upload requests to an OpenSearch Serverless collection.
    90  	CollectionEndpoint pulumi.StringOutput `pulumi:"collectionEndpoint"`
    91  	// Collection-specific endpoint used to access OpenSearch Dashboards.
    92  	DashboardEndpoint pulumi.StringOutput `pulumi:"dashboardEndpoint"`
    93  	// Description of the collection.
    94  	Description pulumi.StringPtrOutput `pulumi:"description"`
    95  	// The ARN of the Amazon Web Services KMS key used to encrypt the collection.
    96  	KmsKeyArn pulumi.StringOutput `pulumi:"kmsKeyArn"`
    97  	// Name of the collection.
    98  	//
    99  	// The following arguments are optional:
   100  	Name pulumi.StringOutput `pulumi:"name"`
   101  	// Indicates whether standby replicas should be used for a collection. One of `ENABLED` or `DISABLED`. Defaults to `ENABLED`.
   102  	StandbyReplicas pulumi.StringOutput `pulumi:"standbyReplicas"`
   103  	// A map of tags to assign to the collection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   104  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   105  	// Deprecated: Please use `tags` instead.
   106  	TagsAll  pulumi.StringMapOutput                `pulumi:"tagsAll"`
   107  	Timeouts ServerlessCollectionTimeoutsPtrOutput `pulumi:"timeouts"`
   108  	// Type of collection. One of `SEARCH`, `TIMESERIES`, or `VECTORSEARCH`. Defaults to `TIMESERIES`.
   109  	Type pulumi.StringOutput `pulumi:"type"`
   110  }
   111  
   112  // NewServerlessCollection registers a new resource with the given unique name, arguments, and options.
   113  func NewServerlessCollection(ctx *pulumi.Context,
   114  	name string, args *ServerlessCollectionArgs, opts ...pulumi.ResourceOption) (*ServerlessCollection, error) {
   115  	if args == nil {
   116  		args = &ServerlessCollectionArgs{}
   117  	}
   118  
   119  	opts = internal.PkgResourceDefaultOpts(opts)
   120  	var resource ServerlessCollection
   121  	err := ctx.RegisterResource("aws:opensearch/serverlessCollection:ServerlessCollection", name, args, &resource, opts...)
   122  	if err != nil {
   123  		return nil, err
   124  	}
   125  	return &resource, nil
   126  }
   127  
   128  // GetServerlessCollection gets an existing ServerlessCollection resource's state with the given name, ID, and optional
   129  // state properties that are used to uniquely qualify the lookup (nil if not required).
   130  func GetServerlessCollection(ctx *pulumi.Context,
   131  	name string, id pulumi.IDInput, state *ServerlessCollectionState, opts ...pulumi.ResourceOption) (*ServerlessCollection, error) {
   132  	var resource ServerlessCollection
   133  	err := ctx.ReadResource("aws:opensearch/serverlessCollection:ServerlessCollection", name, id, state, &resource, opts...)
   134  	if err != nil {
   135  		return nil, err
   136  	}
   137  	return &resource, nil
   138  }
   139  
   140  // Input properties used for looking up and filtering ServerlessCollection resources.
   141  type serverlessCollectionState struct {
   142  	// Amazon Resource Name (ARN) of the collection.
   143  	Arn *string `pulumi:"arn"`
   144  	// Collection-specific endpoint used to submit index, search, and data upload requests to an OpenSearch Serverless collection.
   145  	CollectionEndpoint *string `pulumi:"collectionEndpoint"`
   146  	// Collection-specific endpoint used to access OpenSearch Dashboards.
   147  	DashboardEndpoint *string `pulumi:"dashboardEndpoint"`
   148  	// Description of the collection.
   149  	Description *string `pulumi:"description"`
   150  	// The ARN of the Amazon Web Services KMS key used to encrypt the collection.
   151  	KmsKeyArn *string `pulumi:"kmsKeyArn"`
   152  	// Name of the collection.
   153  	//
   154  	// The following arguments are optional:
   155  	Name *string `pulumi:"name"`
   156  	// Indicates whether standby replicas should be used for a collection. One of `ENABLED` or `DISABLED`. Defaults to `ENABLED`.
   157  	StandbyReplicas *string `pulumi:"standbyReplicas"`
   158  	// A map of tags to assign to the collection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   159  	Tags map[string]string `pulumi:"tags"`
   160  	// Deprecated: Please use `tags` instead.
   161  	TagsAll  map[string]string             `pulumi:"tagsAll"`
   162  	Timeouts *ServerlessCollectionTimeouts `pulumi:"timeouts"`
   163  	// Type of collection. One of `SEARCH`, `TIMESERIES`, or `VECTORSEARCH`. Defaults to `TIMESERIES`.
   164  	Type *string `pulumi:"type"`
   165  }
   166  
   167  type ServerlessCollectionState struct {
   168  	// Amazon Resource Name (ARN) of the collection.
   169  	Arn pulumi.StringPtrInput
   170  	// Collection-specific endpoint used to submit index, search, and data upload requests to an OpenSearch Serverless collection.
   171  	CollectionEndpoint pulumi.StringPtrInput
   172  	// Collection-specific endpoint used to access OpenSearch Dashboards.
   173  	DashboardEndpoint pulumi.StringPtrInput
   174  	// Description of the collection.
   175  	Description pulumi.StringPtrInput
   176  	// The ARN of the Amazon Web Services KMS key used to encrypt the collection.
   177  	KmsKeyArn pulumi.StringPtrInput
   178  	// Name of the collection.
   179  	//
   180  	// The following arguments are optional:
   181  	Name pulumi.StringPtrInput
   182  	// Indicates whether standby replicas should be used for a collection. One of `ENABLED` or `DISABLED`. Defaults to `ENABLED`.
   183  	StandbyReplicas pulumi.StringPtrInput
   184  	// A map of tags to assign to the collection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   185  	Tags pulumi.StringMapInput
   186  	// Deprecated: Please use `tags` instead.
   187  	TagsAll  pulumi.StringMapInput
   188  	Timeouts ServerlessCollectionTimeoutsPtrInput
   189  	// Type of collection. One of `SEARCH`, `TIMESERIES`, or `VECTORSEARCH`. Defaults to `TIMESERIES`.
   190  	Type pulumi.StringPtrInput
   191  }
   192  
   193  func (ServerlessCollectionState) ElementType() reflect.Type {
   194  	return reflect.TypeOf((*serverlessCollectionState)(nil)).Elem()
   195  }
   196  
   197  type serverlessCollectionArgs struct {
   198  	// Description of the collection.
   199  	Description *string `pulumi:"description"`
   200  	// Name of the collection.
   201  	//
   202  	// The following arguments are optional:
   203  	Name *string `pulumi:"name"`
   204  	// Indicates whether standby replicas should be used for a collection. One of `ENABLED` or `DISABLED`. Defaults to `ENABLED`.
   205  	StandbyReplicas *string `pulumi:"standbyReplicas"`
   206  	// A map of tags to assign to the collection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   207  	Tags     map[string]string             `pulumi:"tags"`
   208  	Timeouts *ServerlessCollectionTimeouts `pulumi:"timeouts"`
   209  	// Type of collection. One of `SEARCH`, `TIMESERIES`, or `VECTORSEARCH`. Defaults to `TIMESERIES`.
   210  	Type *string `pulumi:"type"`
   211  }
   212  
   213  // The set of arguments for constructing a ServerlessCollection resource.
   214  type ServerlessCollectionArgs struct {
   215  	// Description of the collection.
   216  	Description pulumi.StringPtrInput
   217  	// Name of the collection.
   218  	//
   219  	// The following arguments are optional:
   220  	Name pulumi.StringPtrInput
   221  	// Indicates whether standby replicas should be used for a collection. One of `ENABLED` or `DISABLED`. Defaults to `ENABLED`.
   222  	StandbyReplicas pulumi.StringPtrInput
   223  	// A map of tags to assign to the collection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   224  	Tags     pulumi.StringMapInput
   225  	Timeouts ServerlessCollectionTimeoutsPtrInput
   226  	// Type of collection. One of `SEARCH`, `TIMESERIES`, or `VECTORSEARCH`. Defaults to `TIMESERIES`.
   227  	Type pulumi.StringPtrInput
   228  }
   229  
   230  func (ServerlessCollectionArgs) ElementType() reflect.Type {
   231  	return reflect.TypeOf((*serverlessCollectionArgs)(nil)).Elem()
   232  }
   233  
   234  type ServerlessCollectionInput interface {
   235  	pulumi.Input
   236  
   237  	ToServerlessCollectionOutput() ServerlessCollectionOutput
   238  	ToServerlessCollectionOutputWithContext(ctx context.Context) ServerlessCollectionOutput
   239  }
   240  
   241  func (*ServerlessCollection) ElementType() reflect.Type {
   242  	return reflect.TypeOf((**ServerlessCollection)(nil)).Elem()
   243  }
   244  
   245  func (i *ServerlessCollection) ToServerlessCollectionOutput() ServerlessCollectionOutput {
   246  	return i.ToServerlessCollectionOutputWithContext(context.Background())
   247  }
   248  
   249  func (i *ServerlessCollection) ToServerlessCollectionOutputWithContext(ctx context.Context) ServerlessCollectionOutput {
   250  	return pulumi.ToOutputWithContext(ctx, i).(ServerlessCollectionOutput)
   251  }
   252  
   253  // ServerlessCollectionArrayInput is an input type that accepts ServerlessCollectionArray and ServerlessCollectionArrayOutput values.
   254  // You can construct a concrete instance of `ServerlessCollectionArrayInput` via:
   255  //
   256  //	ServerlessCollectionArray{ ServerlessCollectionArgs{...} }
   257  type ServerlessCollectionArrayInput interface {
   258  	pulumi.Input
   259  
   260  	ToServerlessCollectionArrayOutput() ServerlessCollectionArrayOutput
   261  	ToServerlessCollectionArrayOutputWithContext(context.Context) ServerlessCollectionArrayOutput
   262  }
   263  
   264  type ServerlessCollectionArray []ServerlessCollectionInput
   265  
   266  func (ServerlessCollectionArray) ElementType() reflect.Type {
   267  	return reflect.TypeOf((*[]*ServerlessCollection)(nil)).Elem()
   268  }
   269  
   270  func (i ServerlessCollectionArray) ToServerlessCollectionArrayOutput() ServerlessCollectionArrayOutput {
   271  	return i.ToServerlessCollectionArrayOutputWithContext(context.Background())
   272  }
   273  
   274  func (i ServerlessCollectionArray) ToServerlessCollectionArrayOutputWithContext(ctx context.Context) ServerlessCollectionArrayOutput {
   275  	return pulumi.ToOutputWithContext(ctx, i).(ServerlessCollectionArrayOutput)
   276  }
   277  
   278  // ServerlessCollectionMapInput is an input type that accepts ServerlessCollectionMap and ServerlessCollectionMapOutput values.
   279  // You can construct a concrete instance of `ServerlessCollectionMapInput` via:
   280  //
   281  //	ServerlessCollectionMap{ "key": ServerlessCollectionArgs{...} }
   282  type ServerlessCollectionMapInput interface {
   283  	pulumi.Input
   284  
   285  	ToServerlessCollectionMapOutput() ServerlessCollectionMapOutput
   286  	ToServerlessCollectionMapOutputWithContext(context.Context) ServerlessCollectionMapOutput
   287  }
   288  
   289  type ServerlessCollectionMap map[string]ServerlessCollectionInput
   290  
   291  func (ServerlessCollectionMap) ElementType() reflect.Type {
   292  	return reflect.TypeOf((*map[string]*ServerlessCollection)(nil)).Elem()
   293  }
   294  
   295  func (i ServerlessCollectionMap) ToServerlessCollectionMapOutput() ServerlessCollectionMapOutput {
   296  	return i.ToServerlessCollectionMapOutputWithContext(context.Background())
   297  }
   298  
   299  func (i ServerlessCollectionMap) ToServerlessCollectionMapOutputWithContext(ctx context.Context) ServerlessCollectionMapOutput {
   300  	return pulumi.ToOutputWithContext(ctx, i).(ServerlessCollectionMapOutput)
   301  }
   302  
   303  type ServerlessCollectionOutput struct{ *pulumi.OutputState }
   304  
   305  func (ServerlessCollectionOutput) ElementType() reflect.Type {
   306  	return reflect.TypeOf((**ServerlessCollection)(nil)).Elem()
   307  }
   308  
   309  func (o ServerlessCollectionOutput) ToServerlessCollectionOutput() ServerlessCollectionOutput {
   310  	return o
   311  }
   312  
   313  func (o ServerlessCollectionOutput) ToServerlessCollectionOutputWithContext(ctx context.Context) ServerlessCollectionOutput {
   314  	return o
   315  }
   316  
   317  // Amazon Resource Name (ARN) of the collection.
   318  func (o ServerlessCollectionOutput) Arn() pulumi.StringOutput {
   319  	return o.ApplyT(func(v *ServerlessCollection) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   320  }
   321  
   322  // Collection-specific endpoint used to submit index, search, and data upload requests to an OpenSearch Serverless collection.
   323  func (o ServerlessCollectionOutput) CollectionEndpoint() pulumi.StringOutput {
   324  	return o.ApplyT(func(v *ServerlessCollection) pulumi.StringOutput { return v.CollectionEndpoint }).(pulumi.StringOutput)
   325  }
   326  
   327  // Collection-specific endpoint used to access OpenSearch Dashboards.
   328  func (o ServerlessCollectionOutput) DashboardEndpoint() pulumi.StringOutput {
   329  	return o.ApplyT(func(v *ServerlessCollection) pulumi.StringOutput { return v.DashboardEndpoint }).(pulumi.StringOutput)
   330  }
   331  
   332  // Description of the collection.
   333  func (o ServerlessCollectionOutput) Description() pulumi.StringPtrOutput {
   334  	return o.ApplyT(func(v *ServerlessCollection) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   335  }
   336  
   337  // The ARN of the Amazon Web Services KMS key used to encrypt the collection.
   338  func (o ServerlessCollectionOutput) KmsKeyArn() pulumi.StringOutput {
   339  	return o.ApplyT(func(v *ServerlessCollection) pulumi.StringOutput { return v.KmsKeyArn }).(pulumi.StringOutput)
   340  }
   341  
   342  // Name of the collection.
   343  //
   344  // The following arguments are optional:
   345  func (o ServerlessCollectionOutput) Name() pulumi.StringOutput {
   346  	return o.ApplyT(func(v *ServerlessCollection) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   347  }
   348  
   349  // Indicates whether standby replicas should be used for a collection. One of `ENABLED` or `DISABLED`. Defaults to `ENABLED`.
   350  func (o ServerlessCollectionOutput) StandbyReplicas() pulumi.StringOutput {
   351  	return o.ApplyT(func(v *ServerlessCollection) pulumi.StringOutput { return v.StandbyReplicas }).(pulumi.StringOutput)
   352  }
   353  
   354  // A map of tags to assign to the collection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   355  func (o ServerlessCollectionOutput) Tags() pulumi.StringMapOutput {
   356  	return o.ApplyT(func(v *ServerlessCollection) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   357  }
   358  
   359  // Deprecated: Please use `tags` instead.
   360  func (o ServerlessCollectionOutput) TagsAll() pulumi.StringMapOutput {
   361  	return o.ApplyT(func(v *ServerlessCollection) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   362  }
   363  
   364  func (o ServerlessCollectionOutput) Timeouts() ServerlessCollectionTimeoutsPtrOutput {
   365  	return o.ApplyT(func(v *ServerlessCollection) ServerlessCollectionTimeoutsPtrOutput { return v.Timeouts }).(ServerlessCollectionTimeoutsPtrOutput)
   366  }
   367  
   368  // Type of collection. One of `SEARCH`, `TIMESERIES`, or `VECTORSEARCH`. Defaults to `TIMESERIES`.
   369  func (o ServerlessCollectionOutput) Type() pulumi.StringOutput {
   370  	return o.ApplyT(func(v *ServerlessCollection) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
   371  }
   372  
   373  type ServerlessCollectionArrayOutput struct{ *pulumi.OutputState }
   374  
   375  func (ServerlessCollectionArrayOutput) ElementType() reflect.Type {
   376  	return reflect.TypeOf((*[]*ServerlessCollection)(nil)).Elem()
   377  }
   378  
   379  func (o ServerlessCollectionArrayOutput) ToServerlessCollectionArrayOutput() ServerlessCollectionArrayOutput {
   380  	return o
   381  }
   382  
   383  func (o ServerlessCollectionArrayOutput) ToServerlessCollectionArrayOutputWithContext(ctx context.Context) ServerlessCollectionArrayOutput {
   384  	return o
   385  }
   386  
   387  func (o ServerlessCollectionArrayOutput) Index(i pulumi.IntInput) ServerlessCollectionOutput {
   388  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ServerlessCollection {
   389  		return vs[0].([]*ServerlessCollection)[vs[1].(int)]
   390  	}).(ServerlessCollectionOutput)
   391  }
   392  
   393  type ServerlessCollectionMapOutput struct{ *pulumi.OutputState }
   394  
   395  func (ServerlessCollectionMapOutput) ElementType() reflect.Type {
   396  	return reflect.TypeOf((*map[string]*ServerlessCollection)(nil)).Elem()
   397  }
   398  
   399  func (o ServerlessCollectionMapOutput) ToServerlessCollectionMapOutput() ServerlessCollectionMapOutput {
   400  	return o
   401  }
   402  
   403  func (o ServerlessCollectionMapOutput) ToServerlessCollectionMapOutputWithContext(ctx context.Context) ServerlessCollectionMapOutput {
   404  	return o
   405  }
   406  
   407  func (o ServerlessCollectionMapOutput) MapIndex(k pulumi.StringInput) ServerlessCollectionOutput {
   408  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ServerlessCollection {
   409  		return vs[0].(map[string]*ServerlessCollection)[vs[1].(string)]
   410  	}).(ServerlessCollectionOutput)
   411  }
   412  
   413  func init() {
   414  	pulumi.RegisterInputType(reflect.TypeOf((*ServerlessCollectionInput)(nil)).Elem(), &ServerlessCollection{})
   415  	pulumi.RegisterInputType(reflect.TypeOf((*ServerlessCollectionArrayInput)(nil)).Elem(), ServerlessCollectionArray{})
   416  	pulumi.RegisterInputType(reflect.TypeOf((*ServerlessCollectionMapInput)(nil)).Elem(), ServerlessCollectionMap{})
   417  	pulumi.RegisterOutputType(ServerlessCollectionOutput{})
   418  	pulumi.RegisterOutputType(ServerlessCollectionArrayOutput{})
   419  	pulumi.RegisterOutputType(ServerlessCollectionMapOutput{})
   420  }