Documentation
¶
Overview ¶
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
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.
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
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.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
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.
Copyright © 2021 Level27 [email protected]
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 CheckCBValueForParameter(value string, options l27.CookbookParameterOptionValue, givenParameter string, ...) (bool, error)
- func CheckForMultipleIDs(ids []string) []string
- func CheckSubJobs(job l27.Job) bool
- func CheckforValidType(input string, validTypes []string) (string, bool)
- func Execute()
- func FindNotcompletedJobs(jobs []l27.Job) []l27.Job
- func FindNotcompletedJobsRoot(jobs []l27.HistoryRootJob) []l27.HistoryRootJob
- func ParseMigrationItem(appID l27.IntID, values string) (l27.AppMigrationItem, error)
- func ParseMigrationItemKeyValuePair(keyValuePair string) (string, string, error)
- func SplitCustomParameters(customP []string) (map[string]interface{}, error)
- type DescribeSystem
- type DescribeSystemNetworks
- type GitHubRelease
- type GitHubReleaseAsset
Constants ¶
This section is empty.
Variables ¶
var AppActionActivateCmd = &cobra.Command{ Use: "activate", Short: "Activate an app", Example: "lvl app action activate 2077", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { appID, err := resolveApp(args[0]) if err != nil { return err } err = Level27Client.AppAction(appID, "activate") if err != nil { return err } outputFormatTemplate(nil, "templates/entities/app/activate.tmpl") return nil }, }
---- ACTIVATE APP
var AppActionCmd = &cobra.Command{
Use: "action",
Short: "commands to run specific actions on an app",
Example: "lvl app action [subcommand]",
}
---- ACTION COMMAND
var AppActionDeactivateCmd = &cobra.Command{ Use: "deactivate", Short: "Deactivate an app", Example: "lvl app action deactivate 2077", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { appID, err := resolveApp(args[0]) if err != nil { return err } err = Level27Client.AppAction(appID, "deactivate") if err != nil { return err } outputFormatTemplate(nil, "templates/entities/app/deactivate.tmpl") return nil }, }
---- DEACTIVATE APP
var AppComponentDeleteCmd = &cobra.Command{ Use: "delete", Short: "Delete component from an app.", Example: "lvl app component delete MyAppName MyComponentName", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { appID, err := resolveApp(args[0]) if err != nil { return err } appComponentID, err := resolveAppComponent(appID, args[1]) if err != nil { return err } if !optDeleteConfirmed { app, err := Level27Client.App(appID) if err != nil { return err } appComponent, err := Level27Client.AppComponentGetSingle(appID, appComponentID) if err != nil { return err } if !confirmPrompt(fmt.Sprintf("Delete app component %s (%d) on app %s (%d)?", appComponent.Name, appComponent.ID, app.Name, app.ID)) { return nil } } err = Level27Client.AppComponentsDelete(appID, appComponentID) if err != nil { return err } outputFormatTemplate(nil, "templates/entities/appComponent/delete.tmpl") return nil }, }
APP COMPONENT DELETE
var AppDescribeCmd = &cobra.Command{ Use: "describe", Short: "Get detailed info about an app.", Example: "lvl app describe 2077", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { appID, err := resolveApp(args[0]) if err != nil { return err } app, err := Level27Client.App(appID) if err != nil { return err } outputFormatTemplate(app, "templates/app.tmpl") return nil }, }
---- DESCRIBE APP
var Level27Client *l27.Client
var RootCmd = &cobra.Command{ Use: "lvl", Short: "CLI tool to manage Level27 entities", Long: `lvl is a CLI tool that empowers users.`, SilenceErrors: true, SilenceUsage: true, Version: strings.TrimSpace(version), PersistentPreRunE: func(cmd *cobra.Command, args []string) error { outputSet := viper.GetString("output") if outputSet != "text" && outputSet != "json" && output != "yaml" && output != "id" { return fmt.Errorf("invalid output mode specified: '%s'", outputSet) } return nil }, }
rootCmd represents the base command when called without any subcommands
var SystemCookbookTypesGetCmd = &cobra.Command{ Use: "parameters", Short: "Show all default parameters for a specific cookbooktype.", RunE: func(cmd *cobra.Command, args []string) error { inputType := cmd.Flag("type").Value.String() validCookbooktype, _, err := Level27Client.SystemCookbookTypeGet(inputType) if err != nil { return err } outputFormatTable(validCookbooktype.CookbookType.Parameters, []string{"NAME", "DESCRIPTION", "DEFAULT_VALUE"}, []string{"Name", "Description", "DefaultValue"}) return nil }, }
----------- GET COOKBOOKTYPE PARAMETERS seperate command used to see wich parameters can be used for a specific cookbooktype. also shows the description and default values
var SystemSystemgroupsAddCmd = &cobra.Command{ Use: "add [systemID] [systemgroupID]", Short: "Link a system with a systemgroup.", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { systemID, err := resolveSystem(args[0]) if err != nil { return err } groupID, err := resolveSystemgroup(args[1]) if err != nil { return err } jsonRequest := gabs.New() jsonRequest.Set(groupID, "systemgroup") err = Level27Client.SystemSystemgroupsAdd(systemID, jsonRequest) if err != nil { return err } outputFormatTemplate(nil, "templates/entities/system/groupAdd.tmpl") return nil }, }
---------------- LINK SYSTEM TO A GROUP (ADD)
var SystemSystemgroupsCmd = &cobra.Command{
Use: "groups",
Short: "Manage a system's groups.",
}
------------------------------------------------- SYSTEMS/GROUPS (GET / ADD / DELETE)------------------------------------------------- ---------------- MAIN COMMAND (groups)
var SystemSystemgroupsGetCmd = &cobra.Command{ Use: "get [systemID]", Short: "Show list of all groups from a system.", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { systemID, err := resolveSystem(args[0]) if err != nil { return err } groups, err := Level27Client.SystemSystemgroupsGet(systemID) if err != nil { return err } outputFormatTable(groups, []string{"ID", "NAME"}, []string{"ID", "Name"}) return nil }, }
---------------- GET GROUPS
var SystemSystemgroupsRemoveCmd = &cobra.Command{ Use: "remove [systemID] [systemgroupID]", Short: "Unlink a system from a systemgroup.", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { systemID, err := resolveSystem(args[0]) if err != nil { return err } groupID, err := resolveSystemgroup(args[1]) if err != nil { return err } err = Level27Client.SystemSystemgroupsRemove(systemID, groupID) if err != nil { return err } outputFormatTemplate(nil, "templates/entities/system/groupRemove.tmpl") return nil }, }
---------------- UNLINK SYSTEM FROM A GROUP (DELETE)
Functions ¶
func CheckCBValueForParameter ¶
func CheckCBValueForParameter(value string, options l27.CookbookParameterOptionValue, givenParameter string, currentSystemOs string) (bool, error)
check a value if its a valid option for the given parameter for the cookbook. also do checks on compatibility with system and exlusivity
func CheckForMultipleIDs ¶
Try to split the given cmd args into ID's (works with whitespace and komma's)
func CheckSubJobs ¶
func CheckSubJobs(job l27.Job) bool
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 FindNotcompletedJobs ¶
func FindNotcompletedJobs(jobs []l27.Job) []l27.Job
func FindNotcompletedJobsRoot ¶ added in v1.5.0
func FindNotcompletedJobsRoot(jobs []l27.HistoryRootJob) []l27.HistoryRootJob
func ParseMigrationItem ¶
func SplitCustomParameters ¶
--------------------------- DYNAMICALY SETTING PARAMETERS this can be used when you need flags to set different paramaters but you don't know the amount of parameters beforehand. we can use something like a parameter flag where the user has to set the keys and values himself. example lvl system cookbooks create -p key=value -p key2=value2 function used for commands with dynamic parameters. (different parameters defined by 1 flag)
Types ¶
type DescribeSystem ¶
type DescribeSystem struct { l27.System SshKeys []l27.SystemSshkey `json:"sshKeys"` InstallSecurityUpdatesString string `json:"installSecurityUpdatesString"` HasNetworks []l27.SystemHasNetwork `json:"hasNetworks"` Volumes []l27.SystemVolume `json:"volumes"` Checks []l27.SystemCheckGet `json:"checks"` }
type DescribeSystemNetworks ¶
type DescribeSystemNetworks struct { Networks []l27.SystemNetwork `json:"networks"` HasNetworks []l27.SystemHasNetwork `json:"hasNetworks"` }
type GitHubRelease ¶ added in v1.7.0
type GitHubReleaseAsset ¶ added in v1.7.0
Source Files
¶
- access.go
- app.go
- appComponent.go
- appComponentAttachment.go
- appComponentCron.go
- appComponentDomain.go
- appComponentRestore.go
- appComponentUrl.go
- appMigration.go
- appSsl.go
- billing.go
- common.go
- completion.go
- customPackage.go
- domain.go
- domainRecord.go
- domainZoneImport.go
- integritycheck.go
- jobs.go
- login.go
- mail.go
- mailBox.go
- mailBoxAddress.go
- mailDomain.go
- mailForwarder.go
- misc.go
- network.go
- organisation.go
- region.go
- root.go
- sshkey.go
- system.go
- systemCheck.go
- systemCookbook.go
- systemNetwork.go
- systemNetworkIp.go
- systemSsh.go
- systemSshKeys.go
- systemVolume.go
- systemgroups.go
- task.go
- token.go
- update.go
- update_unix.go
- volume.go