convert

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 9 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

Overview

Copyright 2021 MongoDB Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	AdminDB        = "admin"
	ExternalAuthDB = "$external"
)

Variables

This section is empty.

Functions

func BuildAtlasActions added in v1.11.0

func BuildAtlasActions(a []string) []atlas.Action

BuildAtlasActions converts the actions inside the array of string in an array of atlas.Action structs r contains roles in the format action[@dbName.collection]

func BuildAtlasInheritedRoles added in v1.11.0

func BuildAtlasInheritedRoles(r []string) []atlas.InheritedRole

BuildAtlasInheritedRoles converts the inherited roles inside the array of string in an array of atlas.InheritedRole structs r contains roles in the format roleName@dbName

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 BuildAtlasScopes added in v1.11.0

func BuildAtlasScopes(r []string) []atlas.Scope

BuildAtlasScopes converts the scopes inside the array of string in an array of mongodbatlas.Scope structs. r contains resources in the format resourceName:resourceType

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 {
	AuditLogPath           string                  `yaml:"auditLogPath,omitempty" json:"auditLogPath,omitempty"`
	AuditLogDestination    string                  `yaml:"auditLogDestination,omitempty" json:"auditLogDestination,omitempty"`
	AuditLogFormat         string                  `yaml:"auditLogFormat,omitempty" json:"auditLogFormat,omitempty"`
	AuditLogFilter         string                  `yaml:"auditLogFilter,omitempty" json:"auditLogFilter,omitempty"`
	BuildIndexes           *bool                   `yaml:"buildIndexes,omitempty" json:"buildIndexes,omitempty"`
	DBPath                 string                  `yaml:"dbPath,omitempty" json:"dbPath,omitempty"`
	BindIP                 *string                 `yaml:"bindIp,omitempty" json:"bindIp,omitempty"`
	BindIPAll              *bool                   `yaml:"bindIpAll,omitempty" json:"bindIpAll,omitempty"`
	DirectoryPerDB         *bool                   `yaml:"directoryPerDB,omitempty" json:"directoryPerDB,omitempty"`
	Engine                 string                  `yaml:"engine,omitempty" json:"engine,omitempty"`
	FCVersion              string                  `yaml:"featureCompatibilityVersion,omitempty" json:"featureCompatibilityVersion,omitempty"`
	Hostname               string                  `yaml:"hostname" json:"hostname"`
	InMemory               *map[string]interface{} `yaml:"inMemory,omitempty" json:"inMemory,omitempty"`
	IndexBuildRetry        *bool                   `yaml:"indexBuildRetry,omitempty" json:"indexBuildRetry,omitempty"`
	IPV6                   *bool                   `yaml:"ipv6,omitempty" json:"ipv6,omitempty"`
	Journal                *map[string]interface{} `yaml:"journal,omitempty" json:"journal,omitempty"`
	LogAppend              bool                    `yaml:"logAppend,omitempty" json:"logAppend,omitempty"`
	LogDestination         string                  `yaml:"logDestination,omitempty" json:"logDestination,omitempty"`
	LogPath                string                  `yaml:"logPath" json:"logPath"`
	LogRotate              string                  `yaml:"logRotate,omitempty" json:"logRotate,omitempty"`
	LogVerbosity           int                     `yaml:"logVerbosity,omitempty" json:"logVerbosity,omitempty"`
	LogQuiet               bool                    `yaml:"logQuiet,omitempty" json:"logQuiet,omitempty"`
	SyslogFacility         string                  `yaml:"syslogFacility,omitempty" json:"syslogFacility,omitempty"`
	LogTimeStampFormat     string                  `yaml:"logTimeStampFormat,omitempty" json:"logTimeStampFormat,omitempty"`
	Name                   string                  `yaml:"name,omitempty" json:"name,omitempty"`
	OplogMinRetentionHours *float64                `yaml:"oplogMinRetentionHours,omitempty" json:"oplogMinRetentionHours,omitempty"`
	Port                   int                     `yaml:"port" json:"port"`
	Priority               *float64                `yaml:"priority,omitempty" json:"priority,omitempty"`
	ProcessType            string                  `yaml:"processType" json:"processType"`
	SmallFiles             *bool                   `yaml:"smallFiles,omitempty" json:"smallFiles,omitempty"`
	SlaveDelay             *float64                `yaml:"slaveDelay,omitempty" json:"slaveDelay,omitempty"`
	SyncPeriodSecs         *float64                `yaml:"syncPeriodSecs,omitempty" json:"syncPeriodSecs,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"`
	Security               *map[string]interface{} `yaml:"security,omitempty" json:"security,omitempty"`
	SetParameter           *map[string]interface{} `yaml:"setParameter,omitempty" json:"setParameter,omitempty"`
	TLS                    *TLS                    `yaml:"tls,omitempty" json:"tls,omitempty"`
	Version                string                  `yaml:"version,omitempty" json:"version,omitempty"`
	WiredTiger             *map[string]interface{} `yaml:"wiredTiger,omitempty" json:"wiredTiger,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

type TLS added in v1.8.0

type TLS struct {
	CAFile                     string `yaml:"CAFile,omitempty" json:"CAFile,omitempty"`
	CertificateKeyFile         string `yaml:"certificateKeyFile,omitempty" json:"certificateKeyFile,omitempty"`
	CertificateKeyFilePassword string `yaml:"certificateKeyFilePassword,omitempty" json:"certificateKeyFilePassword,omitempty"`
	CertificateSelector        string `yaml:"certificateSelector,omitempty" json:"certificateSelector,omitempty"`
	ClusterCertificateSelector string `yaml:"clusterCertificateSelector,omitempty" json:"clusterCertificateSelector,omitempty"`
	ClusterFile                string `yaml:"clusterFile,omitempty" json:"clusterFile,omitempty"`
	ClusterPassword            string `yaml:"clusterPassword,omitempty" json:"clusterPassword,omitempty"`
	CRLFile                    string `yaml:"CRLFile,omitempty" json:"CRLFile,omitempty"`
	DisabledProtocols          string `yaml:"disabledProtocols,omitempty" json:"disabledProtocols,omitempty"`
	FIPSMode                   string `yaml:"FIPSMode,omitempty" json:"FIPSMode,omitempty"`
	Mode                       string `yaml:"mode,omitempty" json:"mode,omitempty"`
	PEMKeyFile                 string `yaml:"PEMKeyFile,omitempty" json:"PEMKeyFile,omitempty"`
}

TLS defines TLS parameters for Net

Jump to

Keyboard shortcuts

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