-
Notifications
You must be signed in to change notification settings - Fork 66
/
global_deployment.go
40 lines (35 loc) · 1.51 KB
/
global_deployment.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
package v1
import (
"go.mongodb.org/atlas/mongodbatlas"
)
type CustomZoneMapping struct {
Location string `json:"location"`
Zone string `json:"zone"`
}
// ManagedNamespace represents the information about managed namespace configuration.
type ManagedNamespace struct {
Db string `json:"db"` //nolint:stylecheck // not changing this as is a breaking change
Collection string `json:"collection"`
CustomShardKey string `json:"customShardKey,omitempty"`
NumInitialChunks int `json:"numInitialChunks,omitempty"`
PresplitHashedZones *bool `json:"presplitHashedZones,omitempty"`
IsCustomShardKeyHashed *bool `json:"isCustomShardKeyHashed,omitempty"` // Flag that specifies whether the custom shard key for the collection is hashed.
IsShardKeyUnique *bool `json:"isShardKeyUnique,omitempty"` // Flag that specifies whether the underlying index enforces a unique constraint.
}
func (in *ManagedNamespace) ToAtlas() mongodbatlas.ManagedNamespace {
return mongodbatlas.ManagedNamespace{
Db: in.Db,
Collection: in.Collection,
CustomShardKey: in.CustomShardKey,
IsCustomShardKeyHashed: in.IsCustomShardKeyHashed,
IsShardKeyUnique: in.IsShardKeyUnique,
NumInitialChunks: in.NumInitialChunks,
PresplitHashedZones: in.PresplitHashedZones,
}
}
func (c *CustomZoneMapping) ToAtlas() mongodbatlas.CustomZoneMapping {
return mongodbatlas.CustomZoneMapping{
Location: c.Location,
Zone: c.Zone,
}
}