convert

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

README

Convert

This package aims at converting a CLI version of the automation config to the format required by the C/OM API

Documentation

Index

Constants

View Source
const (
	AdminDB = "admin"
)

Variables

This section is empty.

Functions

func BuildAtlasRoles added in v0.1.0

func BuildAtlasRoles(r []string) []atlas.Role

BuildAtlasRoles converts the roles inside the array of string in an array of mongodbatlas.Role structs r contains roles in the format roleName@dbName

func BuildOMRoles added in v0.1.0

func BuildOMRoles(r []string) []*opsmngr.Role

BuildOMRoles converts the roles inside the array of string in an array of opsmngr.Role structs r contains roles in the format roleName@dbName

Types

type ClusterConfig

type ClusterConfig struct {
	RSConfig `yaml:",inline"`
	MongoURI string           `yaml:"mongoURI,omitempty" json:"mongoURI,omitempty"`
	Shards   []*RSConfig      `yaml:"shards,omitempty" json:"shards,omitempty"`
	Config   *RSConfig        `yaml:"config,omitempty" json:"config,omitempty"`
	Mongos   []*ProcessConfig `yaml:"mongos,omitempty" json:"mongos,omitempty"`
}

ClusterConfig configuration for a cluster This cluster can be used to patch an automation config

func FromAutomationConfig

func FromAutomationConfig(c *opsmngr.AutomationConfig) []*ClusterConfig

FromAutomationConfig convert from opsmngr.AutomationConfig format to []*ClusterConfig the given opsmngr.AutomationConfig will be modified

func (*ClusterConfig) PatchAutomationConfig

func (c *ClusterConfig) PatchAutomationConfig(out *opsmngr.AutomationConfig) error

PatchAutomationConfig adds the ClusterConfig to a opsmngr.AutomationConfig this method will modify the given AutomationConfig to add the new replica set or sharded cluster information

type ProcessConfig

type ProcessConfig struct {
	BuildIndexes *bool    `yaml:"buildIndexes,omitempty" json:"buildIndexes,omitempty"`
	DBPath       string   `yaml:"dbPath,omitempty" json:"dbPath,omitempty"`
	FCVersion    string   `yaml:"featureCompatibilityVersion,omitempty" json:"featureCompatibilityVersion,omitempty"`
	Hostname     string   `yaml:"hostname" json:"hostname"`
	LogPath      string   `yaml:"logPath" json:"logPath"`
	Name         string   `yaml:"name,omitempty" json:"name,omitempty"`
	Port         int      `yaml:"port" json:"port"`
	Priority     *float64 `yaml:"priority,omitempty" json:"priority,omitempty"`
	ProcessType  string   `yaml:"processType" json:"processType"`
	SlaveDelay   *float64 `yaml:"slaveDelay,omitempty" json:"slaveDelay,omitempty"`
	Version      string   `yaml:"version,omitempty" json:"version,omitempty"`
	Votes        *float64 `yaml:"votes,omitempty" json:"votes,omitempty"`
	ArbiterOnly  *bool    `yaml:"arbiterOnly,omitempty" json:"arbiterOnly,omitempty"`
	Disabled     bool     `yaml:"disabled" json:"disabled"`
	Hidden       *bool    `yaml:"hidden,omitempty" json:"hidden,omitempty"`
}

ProcessConfig that belongs to a cluster

type RSConfig added in v1.1.0

type RSConfig struct {
	Name           string           `yaml:"name,omitempty" json:"name,omitempty"`
	FCVersion      string           `yaml:"featureCompatibilityVersion,omitempty" json:"featureCompatibilityVersion,omitempty"`
	ProcessConfigs []*ProcessConfig `yaml:"processes,omitempty" json:"processes,omitempty"`
	Tags           []string         `yaml:"tags,omitempty" json:"tags,omitempty"`
	Version        string           `yaml:"version,omitempty" json:"version,omitempty"`
}

RSConfig shared properties of replica sets, config servers, and sharded clusters

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL