types

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AutomationAgentConfigSchema = &schema.Resource{
	Schema: map[string]*schema.Schema{
		"mms_base_url": {
			Type:     schema.TypeString,
			Required: true,
		},
		"mms_group_id": {
			Type:     schema.TypeString,
			Required: true,
		},
		"mms_agent_api_key": {
			Type:     schema.TypeString,
			Required: true,
		},
		"version": {
			Type:     schema.TypeString,
			Optional: true,
			Default:  "latest",
		},
		"workdir": {
			Type:     schema.TypeString,
			Optional: true,
			Default:  "/var/lib/mongodb-mms-automation",
		},
	},
}

AutomationAgentConfigSchema holds a minimal set of parameters required to start an automation agent

View Source
var OpsManagerConfigSchema = &schema.Resource{
	Schema: map[string]*schema.Schema{
		"binary": {
			Type:     schema.TypeString,
			Required: true,
		},
		"workdir": {
			Type:     schema.TypeString,
			Required: true,
		},
		"mongo_uri": {
			Type:     schema.TypeString,
			Required: true,
		},
		"encryption_key": {
			Type:     schema.TypeString,
			Required: true,
		},
		"port": {
			Type:     schema.TypeInt,
			Optional: true,
			Default:  8080,
		},
		"central_url": {
			Type:     schema.TypeString,
			Optional: true,
		},
		"overrides": {
			Type:     schema.TypeMap,
			Optional: true,
		},
		"register_global_owner": {
			Type:     schema.TypeBool,
			Optional: true,
			Default:  true,
		},
		"global_owner_username": {
			Type:     schema.TypeString,
			Optional: true,
			Default:  "admin",
		},
		"global_owner_password": {
			Type:     schema.TypeString,
			Optional: true,
		},
		"external_port": {
			Type:     schema.TypeInt,
			Optional: true,
		},
		"mms_group_id": {
			Type:     schema.TypeString,
			Computed: true,
			ForceNew: true,
		},
		"mms_agent_api_key": {
			Type:     schema.TypeString,
			Computed: true,
			ForceNew: true,
		},
	},
}

OpsManagerConfigSchema holds a minimal set of parameters required to start a MongoDB process

View Source
var ProcessConfigSchema = &schema.Resource{
	Schema: map[string]*schema.Schema{
		"binary": {
			Type:     schema.TypeString,
			Required: true,
		},
		"workdir": {
			Type:     schema.TypeString,
			Required: true,
		},
		"bindip": {
			Type:     schema.TypeString,
			Required: true,
		},
		"port": {
			Type:     schema.TypeInt,
			Optional: true,
			Default:  27017,
		},
		"dbpath": {
			Type:     schema.TypeString,
			Optional: true,
			Default:  "data",
		},
		"wt_cachesize_gb": {
			Type:     schema.TypeFloat,
			Optional: true,
		},
		"logpath": {
			Type:     schema.TypeString,
			Optional: true,
			Default:  "mongod.log",
		},
	},
}

ProcessConfigSchema holds a minimal set of parameters required to start a MongoDB process

View Source
var RemoteConnectionSchema = &schema.Resource{
	Schema: map[string]*schema.Schema{
		"user": {
			Type:     schema.TypeString,
			Required: true,
		},
		"hostname": {
			Type:     schema.TypeString,
			Required: true,
		},
		"port": {
			Type:     schema.TypeInt,
			Required: true,
		},
		"prevent_sudo": {
			Type:     schema.TypeBool,
			Optional: true,
			Default:  false,
		},
		"private_key": {
			Type:     schema.TypeString,
			Optional: true,
			Default:  "",
		},
		"host_key": {
			Type:     schema.TypeString,
			Optional: true,
			Default:  "",
		},
	},
}

RemoteConnectionSchema holds parameters used to initialize a remote SSH connection

Functions

func NewSchemaMap

func NewSchemaMap(config ...func() map[string]*schema.Schema) map[string]*schema.Schema

NewSchemaMap build a new schema map based on the passed configuration

func ReadBool

func ReadBool(input map[string]interface{}, key string) (bool, bool)

ReadBool reads a string value from an input map by key

func ReadFloat

func ReadFloat(input map[string]interface{}, key string) (float64, bool)

ReadFloat reads a float value from an input map by key

func ReadInt

func ReadInt(input map[string]interface{}, key string) (int, bool)

ReadInt reads an int value from an input map by key

func ReadSSHAgentSchema

func ReadSSHAgentSchema(data *schema.ResourceData) ssh.Agent

ReadSSHAgentSchema reads SSH agent configuration from the passed schema.ResourceData struct

func ReadSSHBastionSchema

func ReadSSHBastionSchema(data *schema.ResourceData) ssh.Bastion

ReadSSHBastionSchema reads bastion host configuration from the passed schema.ResourceData struct

func ReadString

func ReadString(input map[string]interface{}, key string) (string, bool)

ReadString reads a string value from an input map by key

func ReadStringMap

func ReadStringMap(input map[string]interface{}, key string) (map[string]interface{}, bool)

ReadStringMap reads all values in a string-string map

func SSHAgentSchema

func SSHAgentSchema() map[string]*schema.Schema

SSHAgentSchema constructs a terraform schema map representing SSH agent configuration params

func SSHBastionSchema

func SSHBastionSchema() map[string]*schema.Schema

SSHBastionSchema constructs a terraform schema map representing SSH bastion host connection params

func StrictUnion

func StrictUnion(maps ...map[string]*schema.Schema) (map[string]*schema.Schema, error)

StrictUnion merges multiple terraform schema maps, ensuring keys are not repeated

func StrictUnionOrFatal

func StrictUnionOrFatal(maps ...map[string]*schema.Schema) map[string]*schema.Schema

StrictUnionOrFatal convenience method which throws a fatal error if duplicate keys are found while merging multiple terraform schema maps

Types

type AutomationAgentConfig

type AutomationAgentConfig struct {
	MMSBaseURL     string `json:"mms_base_url,omitempty" automation:"mmsBaseUrl"`
	WorkDir        string `json:"workdir,omitempty"`
	Version        string `json:"version,omitempty"`
	MMSGroupID     string `json:"mms_group_id,omitempty" automation:"mmsGroupId"`
	MMSAgentAPIKey string `json:"mms_agent_api_key,omitempty" automation:"mmsApiKey"`
}

AutomationAgentConfig holder for Automation Agent Config

func ReadAutomationAgentConfig

func ReadAutomationAgentConfig(list []interface{}) AutomationAgentConfig

ReadAutomationAgentConfig parses a singleton list of AutomationAgentConfigSchema resources as a AutomationAgentConfig type

func (AutomationAgentConfig) ConfigFilename

func (cfg AutomationAgentConfig) ConfigFilename() string

ConfigFilename returns the path to the process's config filename

func (AutomationAgentConfig) GetAutomationConfigTag

func (cfg AutomationAgentConfig) GetAutomationConfigTag(fieldName string) string

GetAutomationConfigTag given a valid AutomationConfig struct field name, returns the specified automation tag

func (AutomationAgentConfig) LogFilename

func (cfg AutomationAgentConfig) LogFilename() string

LogFilename returns the path to the process's log filename

type OpsManagerConfig

type OpsManagerConfig struct {
	Binary              string                 `json:"binary,omitempty"`
	WorkDir             string                 `json:"workdir,omitempty"`
	MongoURI            string                 `json:"mongo_uri,omitempty" opsmanager:"mongo.mongoUri"`
	EncryptionKey       string                 `json:"encryption_key,omitempty"` // /etc/mongodb-mms/gen.key
	Port                int                    `json:"port,omitempty" opsmanager:"BASE_PORT"`
	CentralURL          string                 `json:"central_url,omitempty" opsmanager:"mms.centralUrl"`
	Overrides           map[string]interface{} `json:"overrides,omitempty"`
	RegisterGlobalOwner bool                   `json:"register_global_owner,omitempty"`
	GlobalOwnerUsername string                 `json:"global_owner_username,omitempty"`
	GlobalOwnerPassword string                 `json:"global_owner_password,omitempty"`
	ExternalPort        int                    `json:"external_port,omitempty"`
	MMSGroupID          string                 `json:"mms_group_id,omitempty" automation:"mmsGroupId"`
	MMSAgentAPIKey      string                 `json:"mms_agent_api_key,omitempty" automation:"mmsApiKey"`
}

OpsManagerConfig holder for Ops Manager config

func ReadOpsManagerConfig

func ReadOpsManagerConfig(list []interface{}) OpsManagerConfig

ReadOpsManagerConfig parses a singleton list of OpsManagerConfigSchema resources as a OpsManagerConfig type

func (OpsManagerConfig) ConfigOverrideFilename

func (cfg OpsManagerConfig) ConfigOverrideFilename() string

ConfigOverrideFilename returns the path to the config override filename

func (OpsManagerConfig) GetOpsManagerTag

func (cfg OpsManagerConfig) GetOpsManagerTag(fieldName string) string

GetOpsManagerTag returns the specified opsmanager tag

func (OpsManagerConfig) SysConfigFilename

func (cfg OpsManagerConfig) SysConfigFilename() string

SysConfigFilename returns the path to the sysconfig filename

type ProcessConfig

type ProcessConfig struct {
	Binary                string  `json:"binary,omitempty"`
	WorkDir               string  `json:"workdir,omitempty"`
	Port                  int     `json:"port,string,omitempty"`
	BindIP                string  `json:"bindip,omitempty"`
	DbPath                string  `json:"dbpath,omitempty"`
	WiredTigerCacheSizeGB float64 `json:"wt_cachesize_gb,string,omitempty"`
	LogPath               string  `json:"logpath,omitempty"`
}

ProcessConfig holder for mongodb process parameters

func ReadProcessConfig

func ReadProcessConfig(list []interface{}) ProcessConfig

ReadProcessConfig parses a singleton list of ProcessConfigSchema resources as a ProcessConfig type

func (ProcessConfig) ConfigFilename

func (cfg ProcessConfig) ConfigFilename() string

ConfigFilename returns the path to the process's config filename

type PropertiesFile

type PropertiesFile struct {
	// contains filtered or unexported fields
}

PropertiesFile wrapper for Ops Manager config files

func NewPropertiesFile

func NewPropertiesFile(data string) *PropertiesFile

NewPropertiesFile create a new wrapper for Ops Manager config files

func (*PropertiesFile) SetComments

func (cfg *PropertiesFile) SetComments(key string, comments []string)

SetComments sets comment(s) for the specified key

func (*PropertiesFile) SetPropertyValue

func (cfg *PropertiesFile) SetPropertyValue(key string, value string)

SetPropertyValue sets/updates a property key, value pair

func (*PropertiesFile) Write

func (cfg *PropertiesFile) Write() (string, error)

Write return all properties as a string

type RemoteConnection

type RemoteConnection struct {
	User        string `json:"user,omitempty"`
	Hostname    string `json:"hostname,omitempty"`
	Port        int    `json:"port,string,omitempty"`
	PreventSudo bool   `json:"prevent_sudo,string,omitempty"`
	PrivateKey  string `json:"-"`
	HostKey     string `json:"-"`
}

RemoteConnection holder for remote connection parameters

func ReadRemoteConnection

func ReadRemoteConnection(list []interface{}) RemoteConnection

ReadRemoteConnection parses a singleton list of RemoteConnectionSchema resources as a RemoteConnection type

func ReadRemoteConnectionFromString

func ReadRemoteConnectionFromString(data string) (*RemoteConnection, error)

ReadRemoteConnectionFromString unmarshalls a JSON string into a RemoteConnection struct

func (RemoteConnection) SudoPrefix

func (r RemoteConnection) SudoPrefix(cmd string) string

SudoPrefix prefixes the specified command with 'sudo', if the RemoteConnection allows it and the user is not root

func (RemoteConnection) ToJSON

func (r RemoteConnection) ToJSON() string

ToJSON marshalls the struct to a JSON string

Jump to

Keyboard shortcuts

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