-
Notifications
You must be signed in to change notification settings - Fork 50
/
mongoDatabase.go
113 lines (100 loc) · 4.46 KB
/
mongoDatabase.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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package cosmosdb
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages a Mongo Database within a Cosmos DB Account.
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/r/cosmosdb_mongo_database.html.markdown.
type MongoDatabase struct {
s *pulumi.ResourceState
}
// NewMongoDatabase registers a new resource with the given unique name, arguments, and options.
func NewMongoDatabase(ctx *pulumi.Context,
name string, args *MongoDatabaseArgs, opts ...pulumi.ResourceOpt) (*MongoDatabase, error) {
if args == nil || args.AccountName == nil {
return nil, errors.New("missing required argument 'AccountName'")
}
if args == nil || args.ResourceGroupName == nil {
return nil, errors.New("missing required argument 'ResourceGroupName'")
}
inputs := make(map[string]interface{})
if args == nil {
inputs["accountName"] = nil
inputs["name"] = nil
inputs["resourceGroupName"] = nil
inputs["throughput"] = nil
} else {
inputs["accountName"] = args.AccountName
inputs["name"] = args.Name
inputs["resourceGroupName"] = args.ResourceGroupName
inputs["throughput"] = args.Throughput
}
s, err := ctx.RegisterResource("azure:cosmosdb/mongoDatabase:MongoDatabase", name, true, inputs, opts...)
if err != nil {
return nil, err
}
return &MongoDatabase{s: s}, nil
}
// GetMongoDatabase gets an existing MongoDatabase resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetMongoDatabase(ctx *pulumi.Context,
name string, id pulumi.ID, state *MongoDatabaseState, opts ...pulumi.ResourceOpt) (*MongoDatabase, error) {
inputs := make(map[string]interface{})
if state != nil {
inputs["accountName"] = state.AccountName
inputs["name"] = state.Name
inputs["resourceGroupName"] = state.ResourceGroupName
inputs["throughput"] = state.Throughput
}
s, err := ctx.ReadResource("azure:cosmosdb/mongoDatabase:MongoDatabase", name, id, inputs, opts...)
if err != nil {
return nil, err
}
return &MongoDatabase{s: s}, nil
}
// URN is this resource's unique name assigned by Pulumi.
func (r *MongoDatabase) URN() pulumi.URNOutput {
return r.s.URN()
}
// ID is this resource's unique identifier assigned by its provider.
func (r *MongoDatabase) ID() pulumi.IDOutput {
return r.s.ID()
}
// The name of the Cosmos DB Mongo Database to create the table within. Changing this forces a new resource to be created.
func (r *MongoDatabase) AccountName() pulumi.StringOutput {
return (pulumi.StringOutput)(r.s.State["accountName"])
}
// Specifies the name of the Cosmos DB Mongo Database. Changing this forces a new resource to be created.
func (r *MongoDatabase) Name() pulumi.StringOutput {
return (pulumi.StringOutput)(r.s.State["name"])
}
// The name of the resource group in which the Cosmos DB Mongo Database is created. Changing this forces a new resource to be created.
func (r *MongoDatabase) ResourceGroupName() pulumi.StringOutput {
return (pulumi.StringOutput)(r.s.State["resourceGroupName"])
}
func (r *MongoDatabase) Throughput() pulumi.IntOutput {
return (pulumi.IntOutput)(r.s.State["throughput"])
}
// Input properties used for looking up and filtering MongoDatabase resources.
type MongoDatabaseState struct {
// The name of the Cosmos DB Mongo Database to create the table within. Changing this forces a new resource to be created.
AccountName interface{}
// Specifies the name of the Cosmos DB Mongo Database. Changing this forces a new resource to be created.
Name interface{}
// The name of the resource group in which the Cosmos DB Mongo Database is created. Changing this forces a new resource to be created.
ResourceGroupName interface{}
Throughput interface{}
}
// The set of arguments for constructing a MongoDatabase resource.
type MongoDatabaseArgs struct {
// The name of the Cosmos DB Mongo Database to create the table within. Changing this forces a new resource to be created.
AccountName interface{}
// Specifies the name of the Cosmos DB Mongo Database. Changing this forces a new resource to be created.
Name interface{}
// The name of the resource group in which the Cosmos DB Mongo Database is created. Changing this forces a new resource to be created.
ResourceGroupName interface{}
Throughput interface{}
}