/
getServerlessInstance.go
229 lines (200 loc) · 12 KB
/
getServerlessInstance.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package mongodbatlas
import (
"context"
"reflect"
"github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// `ServerlessInstance` describe a single serverless instance. This represents a single serverless instance that have been created.
// > **NOTE:** Serverless instances do not support some Atlas features at this time.
// For a full list of unsupported features, see [Serverless Instance Limitations](https://docs.atlas.mongodb.com/reference/serverless-instance-limitations/).
//
// > **NOTE:** Groups and projects are synonymous terms. You may find `groupId` in the official documentation.
//
// ## Example Usage
//
// ### Basic
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := mongodbatlas.LookupServerlessInstance(ctx, &mongodbatlas.LookupServerlessInstanceArgs{
// Name: "<SERVERLESS_INSTANCE_NAME>",
// ProjectId: "<PROJECT_ID >",
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// **NOTE:** `ServerlessInstance` and `PrivatelinkEndpointServiceServerless` resources have a circular dependency in some respects.\
// That is, the `serverlessInstance` must exist before the `privatelinkEndpointService` can be created,\
// and the `privatelinkEndpointService` must exist before the `serverlessInstance` gets its respective `connectionStringsPrivateEndpointSrv` values.
//
// Because of this, the `serverlessInstance` data source has particular value as a source of the `connectionStringsPrivateEndpointSrv`.\
// When using the dataSource in-tandem with the afforementioned resources, we can create and retrieve the `connectionStringsPrivateEndpointSrv` in a single `pulumi up`.
//
// Follow this example to setup private connection to a serverless instance using aws vpc and get the connection strings in a single `pulumi up`
func LookupServerlessInstance(ctx *pulumi.Context, args *LookupServerlessInstanceArgs, opts ...pulumi.InvokeOption) (*LookupServerlessInstanceResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupServerlessInstanceResult
err := ctx.Invoke("mongodbatlas:index/getServerlessInstance:getServerlessInstance", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getServerlessInstance.
type LookupServerlessInstanceArgs struct {
// Flag that indicates whether the serverless instance uses Serverless Continuous Backup.
ContinuousBackupEnabled *bool `pulumi:"continuousBackupEnabled"`
Links []GetServerlessInstanceLink `pulumi:"links"`
// Human-readable label that identifies your serverless instance.
Name string `pulumi:"name"`
// Unique 24-hexadecimal digit string that identifies the project that contains your serverless instance.
ProjectId string `pulumi:"projectId"`
// Stage of deployment of this serverless instance when the resource made its request.
StateName *string `pulumi:"stateName"`
}
// A collection of values returned by getServerlessInstance.
type LookupServerlessInstanceResult struct {
// List of Serverless Private Endpoint Connections
ConnectionStringsPrivateEndpointSrvs []string `pulumi:"connectionStringsPrivateEndpointSrvs"`
// Public `mongodb+srv://` connection string that you can use to connect to this serverless instance.
ConnectionStringsStandardSrv string `pulumi:"connectionStringsStandardSrv"`
// Flag that indicates whether the serverless instance uses Serverless Continuous Backup.
ContinuousBackupEnabled bool `pulumi:"continuousBackupEnabled"`
CreateDate string `pulumi:"createDate"`
// Unique 24-hexadecimal digit string that identifies the serverless instance.
Id string `pulumi:"id"`
Links []GetServerlessInstanceLink `pulumi:"links"`
// Version of MongoDB that the serverless instance runs, in `<major version>`.`<minor version>` format.
MongoDbVersion string `pulumi:"mongoDbVersion"`
Name string `pulumi:"name"`
ProjectId string `pulumi:"projectId"`
// Cloud service provider on which MongoDB Cloud provisioned the serverless instance.
ProviderSettingsBackingProviderName string `pulumi:"providerSettingsBackingProviderName"`
// Cloud service provider that applies to the provisioned the serverless instance.
ProviderSettingsProviderName string `pulumi:"providerSettingsProviderName"`
// Human-readable label that identifies the physical location of your MongoDB serverless instance. The region you choose can affect network latency for clients accessing your databases.
ProviderSettingsRegionName string `pulumi:"providerSettingsRegionName"`
// Stage of deployment of this serverless instance when the resource made its request.
StateName string `pulumi:"stateName"`
// Set that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the cluster. See below.
Tags []GetServerlessInstanceTag `pulumi:"tags"`
// Flag that indicates whether termination protection is enabled on the cluster. If set to true, MongoDB Cloud won't delete the cluster. If set to false, MongoDB Cloud will delete the cluster.
TerminationProtectionEnabled bool `pulumi:"terminationProtectionEnabled"`
}
func LookupServerlessInstanceOutput(ctx *pulumi.Context, args LookupServerlessInstanceOutputArgs, opts ...pulumi.InvokeOption) LookupServerlessInstanceResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupServerlessInstanceResult, error) {
args := v.(LookupServerlessInstanceArgs)
r, err := LookupServerlessInstance(ctx, &args, opts...)
var s LookupServerlessInstanceResult
if r != nil {
s = *r
}
return s, err
}).(LookupServerlessInstanceResultOutput)
}
// A collection of arguments for invoking getServerlessInstance.
type LookupServerlessInstanceOutputArgs struct {
// Flag that indicates whether the serverless instance uses Serverless Continuous Backup.
ContinuousBackupEnabled pulumi.BoolPtrInput `pulumi:"continuousBackupEnabled"`
Links GetServerlessInstanceLinkArrayInput `pulumi:"links"`
// Human-readable label that identifies your serverless instance.
Name pulumi.StringInput `pulumi:"name"`
// Unique 24-hexadecimal digit string that identifies the project that contains your serverless instance.
ProjectId pulumi.StringInput `pulumi:"projectId"`
// Stage of deployment of this serverless instance when the resource made its request.
StateName pulumi.StringPtrInput `pulumi:"stateName"`
}
func (LookupServerlessInstanceOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupServerlessInstanceArgs)(nil)).Elem()
}
// A collection of values returned by getServerlessInstance.
type LookupServerlessInstanceResultOutput struct{ *pulumi.OutputState }
func (LookupServerlessInstanceResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupServerlessInstanceResult)(nil)).Elem()
}
func (o LookupServerlessInstanceResultOutput) ToLookupServerlessInstanceResultOutput() LookupServerlessInstanceResultOutput {
return o
}
func (o LookupServerlessInstanceResultOutput) ToLookupServerlessInstanceResultOutputWithContext(ctx context.Context) LookupServerlessInstanceResultOutput {
return o
}
// List of Serverless Private Endpoint Connections
func (o LookupServerlessInstanceResultOutput) ConnectionStringsPrivateEndpointSrvs() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) []string { return v.ConnectionStringsPrivateEndpointSrvs }).(pulumi.StringArrayOutput)
}
// Public `mongodb+srv://` connection string that you can use to connect to this serverless instance.
func (o LookupServerlessInstanceResultOutput) ConnectionStringsStandardSrv() pulumi.StringOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) string { return v.ConnectionStringsStandardSrv }).(pulumi.StringOutput)
}
// Flag that indicates whether the serverless instance uses Serverless Continuous Backup.
func (o LookupServerlessInstanceResultOutput) ContinuousBackupEnabled() pulumi.BoolOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) bool { return v.ContinuousBackupEnabled }).(pulumi.BoolOutput)
}
func (o LookupServerlessInstanceResultOutput) CreateDate() pulumi.StringOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) string { return v.CreateDate }).(pulumi.StringOutput)
}
// Unique 24-hexadecimal digit string that identifies the serverless instance.
func (o LookupServerlessInstanceResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o LookupServerlessInstanceResultOutput) Links() GetServerlessInstanceLinkArrayOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) []GetServerlessInstanceLink { return v.Links }).(GetServerlessInstanceLinkArrayOutput)
}
// Version of MongoDB that the serverless instance runs, in `<major version>`.`<minor version>` format.
func (o LookupServerlessInstanceResultOutput) MongoDbVersion() pulumi.StringOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) string { return v.MongoDbVersion }).(pulumi.StringOutput)
}
func (o LookupServerlessInstanceResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) string { return v.Name }).(pulumi.StringOutput)
}
func (o LookupServerlessInstanceResultOutput) ProjectId() pulumi.StringOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) string { return v.ProjectId }).(pulumi.StringOutput)
}
// Cloud service provider on which MongoDB Cloud provisioned the serverless instance.
func (o LookupServerlessInstanceResultOutput) ProviderSettingsBackingProviderName() pulumi.StringOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) string { return v.ProviderSettingsBackingProviderName }).(pulumi.StringOutput)
}
// Cloud service provider that applies to the provisioned the serverless instance.
func (o LookupServerlessInstanceResultOutput) ProviderSettingsProviderName() pulumi.StringOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) string { return v.ProviderSettingsProviderName }).(pulumi.StringOutput)
}
// Human-readable label that identifies the physical location of your MongoDB serverless instance. The region you choose can affect network latency for clients accessing your databases.
func (o LookupServerlessInstanceResultOutput) ProviderSettingsRegionName() pulumi.StringOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) string { return v.ProviderSettingsRegionName }).(pulumi.StringOutput)
}
// Stage of deployment of this serverless instance when the resource made its request.
func (o LookupServerlessInstanceResultOutput) StateName() pulumi.StringOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) string { return v.StateName }).(pulumi.StringOutput)
}
// Set that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the cluster. See below.
func (o LookupServerlessInstanceResultOutput) Tags() GetServerlessInstanceTagArrayOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) []GetServerlessInstanceTag { return v.Tags }).(GetServerlessInstanceTagArrayOutput)
}
// Flag that indicates whether termination protection is enabled on the cluster. If set to true, MongoDB Cloud won't delete the cluster. If set to false, MongoDB Cloud will delete the cluster.
func (o LookupServerlessInstanceResultOutput) TerminationProtectionEnabled() pulumi.BoolOutput {
return o.ApplyT(func(v LookupServerlessInstanceResult) bool { return v.TerminationProtectionEnabled }).(pulumi.BoolOutput)
}
func init() {
pulumi.RegisterOutputType(LookupServerlessInstanceResultOutput{})
}