utils

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Copyright © 2019 Doppler <support@doppler.com>

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 © 2019 Doppler <support@doppler.com>

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 © 2019 Doppler <support@doppler.com>

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 © 2019 Doppler <support@doppler.com>

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 © 2019 Doppler <support@doppler.com>

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

This section is empty.

Variables

View Source
var Debug = false

Debug whether we're running in debug mode

View Source
var Insecure = false

Insecure whether we should support https connections without a valid cert

View Source
var JSON = false

JSON whether to print JSON

Functions

func ConfigDir

func ConfigDir() string

ConfigDir get configuration directory

func ConfirmationPrompt

func ConfirmationPrompt(message string) bool

ConfirmationPrompt prompt user to confirm yes/no

func Cwd

func Cwd() string

Cwd current working directory

func DeleteRequest

func DeleteRequest(host string, uri string, params []QueryParam, apiKey string) ([]byte, error)

DeleteRequest perform HTTP DELETE

func Err

func Err(e error, messages ...string)

Err prints the error and exits with code 1

func ErrExit

func ErrExit(e error, exitCode int, messages ...string)

ErrExit prints the error and exits with the specified code

func Exists

func Exists(path string) bool

Exists whether path exists

func GetBoolFlag

func GetBoolFlag(cmd *cobra.Command, flag string) bool

GetBoolFlag get flag parsed as a boolean

func GetFilePath

func GetFilePath(fullPath string, defaultPath string) string

GetFilePath verify file path and name are provided

func GetIntFlag

func GetIntFlag(cmd *cobra.Command, flag string, bits int) int

GetIntFlag get flag parsed as an int

func GetRequest

func GetRequest(host string, uri string, params []QueryParam, apiKey string) ([]byte, error)

GetRequest perform HTTP GET

func HomeDir

func HomeDir() string

HomeDir get home directory

func Log

func Log(info string)

Log info

func PostRequest

func PostRequest(host string, uri string, params []QueryParam, apiKey string, body []byte) ([]byte, error)

PostRequest perform HTTP POST

func PrintConfigInfo

func PrintConfigInfo(info models.ConfigInfo, jsonFlag bool)

PrintConfigInfo print config

func PrintConfigs

func PrintConfigs(configs map[string]models.Config, jsonFlag bool)

PrintConfigs print configs

func PrintConfigsInfo

func PrintConfigsInfo(info []models.ConfigInfo, jsonFlag bool)

PrintConfigsInfo print configs

func PrintEnvironmentInfo

func PrintEnvironmentInfo(info models.EnvironmentInfo, jsonFlag bool)

PrintEnvironmentInfo print environment

func PrintEnvironmentsInfo

func PrintEnvironmentsInfo(info []models.EnvironmentInfo, jsonFlag bool)

PrintEnvironmentsInfo print environments

func PrintJSON

func PrintJSON(structure interface{})

PrintJSON print object as json

func PrintLog

func PrintLog(log models.Log, jsonFlag bool)

PrintLog print log

func PrintLogs

func PrintLogs(logs []models.Log, number int, jsonFlag bool)

PrintLogs print logs

func PrintProjectInfo

func PrintProjectInfo(info models.ProjectInfo, jsonFlag bool)

PrintProjectInfo print project info

func PrintProjectsInfo

func PrintProjectsInfo(info []models.ProjectInfo, jsonFlag bool)

PrintProjectsInfo print projects info highest availability secrets storage on the planet

func PrintScopedConfig

func PrintScopedConfig(conf models.ScopedConfig)

PrintScopedConfig print scoped config

func PrintSecrets

func PrintSecrets(secrets map[string]models.ComputedSecret, secretsToPrint []string, jsonFlag bool, plain bool, raw bool)

PrintSecrets print secrets

func PrintSecretsNames added in v0.0.6

func PrintSecretsNames(secrets map[string]models.ComputedSecret, jsonFlag bool, plain bool)

PrintSecretsNames print secrets

func PrintSettings

func PrintSettings(settings models.WorkplaceSettings, jsonFlag bool)

PrintSettings print settings

func PrintTable

func PrintTable(headers []string, rows [][]string)

PrintTable prints table

func RunCommand

func RunCommand(command []string, env []string) (int, error)

RunCommand runs the specified command

Types

type QueryParam

type QueryParam struct {
	Key   string
	Value string
}

QueryParam a url query parameter. ex: ?foo=bar

type StopRetry

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

StopRetry indicates to stop attempting retries. wraps an error

Jump to

Keyboard shortcuts

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