Documentation
¶
Overview ¶
DBDeployer - The MySQL Sandbox Copyright © 2006-2018 Giuseppe Maxia
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 ¶
- Variables
- func CommandToJson(c Command) string
- func Execute()
- func ExportAnnotationToJson(ea ExportAnnotation) string
- func ExportJson() string
- func ExportJsonNamed(name string, subCommand string) string
- func SandboxNames(n int) cobra.PositionalArgs
- type Command
- type ExportAnnotation
- type Option
- type RequiredInfo
- type TemplateInfo
Constants ¶
This section is empty.
Variables ¶
var CookbookNameExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: "cookbook-name"}, }, }
An annotation defining a string parameter of type sandbox cookbook-name
var DeployExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: "version-dir"}, }, }
An annotation defining a command that requires a version directory (such as 5.7.25) as an argument
var DoubleSandboxDirExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 2, Name: "sandbox-dir"}, }, }
An annotation defining two parameters of type sandbox directory
var DoubleStringExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 2, Name: "string"}, }, }
An annotation defining two generic string arguments
var IntegerExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: "integer"}, }, }
An annotation defining an argument as a generic integer
var ReplicationExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: "version-dir"}, }, Options: []RequiredInfo{ {HowMany: 1, Name: "topology", ReferenceData: "AllowedTopologies"}, }, }
An annotation defining what are the minimum required arguments for replication
var SandboxDirExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: "sandbox-dir"}, }, }
An annotation for commands that require a sandbox directory (such as msb_5_7_25) as an argument
var StringExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: "string"}, }, }
An annotation defining an argument as a generic string
var TemplateGroupExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: "template-group"}, {HowMany: 1, Name: "string"}, }, }
An annotation defining a string parameter of type sandbox template-group
var TemplateNameExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: "template-name"}, }, }
An annotation defining a string parameter of type sandbox template-name
Functions ¶
func CommandToJson ¶ added in v1.28.0
Converts a Command structure to JSON
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func ExportAnnotationToJson ¶ added in v1.28.0
func ExportAnnotationToJson(ea ExportAnnotation) string
Converts an annotation structure to a JSON string
func ExportJson ¶ added in v1.28.0
func ExportJson() string
Exports the whole dbdeployer structure to JSON
func ExportJsonNamed ¶ added in v1.28.0
Export a given sub-command as JSON
func SandboxNames ¶ added in v1.28.0
func SandboxNames(n int) cobra.PositionalArgs
Types ¶
type Command ¶ added in v1.28.0
type Command struct {
Version string `json:"version,omitempty"`
Name string `json:"name"`
Use string `json:"use"`
Aliases []string `json:"aliases,omitempty"`
Short string `json:"short,omitempty"`
Long string `json:"long,omitempty"`
Example string `json:"example,omitempty"`
SubCommands []Command `json:"commands,omitempty"`
Options []Option `json:"flags,omitempty"`
NeedSubCommands bool `json:"needs_sub_commands"`
Annotations ExportAnnotation `json:"annotations,omitempty"`
}
Describes a command (or sub-command)
type ExportAnnotation ¶ added in v1.28.0
type ExportAnnotation struct {
Arguments []RequiredInfo `json:"arguments"`
Options []RequiredInfo `json:"options"`
}
Defines what is needed for a command at the end of the known keywords
type Option ¶ added in v1.28.0
type Option struct {
Name string `json:"name"`
Type string `json:"type"`
Usage string `json:"usage"`
Short string `json:"short"`
Default string `json:"default"`
}
Describes a command option
type RequiredInfo ¶ added in v1.28.0
type RequiredInfo struct {
HowMany int `json:"n"`
Name string `json:"name"`
ReferenceData string `json:"ref_data,omitempty"`
}
Describes the parameters needed after a known parameter such as a command keyword or an option