Documentation ¶
Index ¶
- Constants
- Variables
- func AreCertsSame(p common.Printer, server, local []byte) bool
- func AreCertsTrusted(host string, certs []byte) (bool, error)
- func BinaryLocation() (string, error)
- func CacheDir() (string, error)
- func ConfigDir() (string, error)
- func Confirm(message string, defaultValue bool, help string) bool
- func ControllerCreate(api API, entityType string, body string, out io.Writer, ...) (*gabs.Container, error)
- func ControllerDelete(api API, entityType string, id string, body string, out io.Writer, ...) error
- func ControllerDetailEntity(api API, entityType, entityId string, logJSON bool, out io.Writer, timeout int, ...) (*gabs.Container, error)
- func ControllerList(api API, path string, params url.Values, logJSON bool, out io.Writer, ...) (*gabs.Container, error)
- func ControllerUpdate(api API, entityType string, body string, out io.Writer, method string, ...) (*gabs.Container, error)
- func CopyDir(src string, dst string, force bool) (err error)
- func CopyDirOverwrite(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- func CreateUniqueDirectory(dir string, name string, maximumAttempts int) (string, error)
- func DownloadArtifactoryFile(url string, filepath string) (err error)
- func DownloadFile(filepath string, url string) (err error)
- func EdgeControllerGetManagementApiBasePath(host string, cert string) string
- func EdgeControllerList(path string, params url.Values, logJSON bool, out io.Writer, timeout int, ...) (*gabs.Container, error)
- func EdgeControllerListSubEntities(entityType, subType, entityId string, filter string, logJSON bool, ...) (*gabs.Container, error)
- func EdgeControllerRequest(entityType string, out io.Writer, logJSON bool, timeout int, verbose bool, ...) (*gabs.Container, error)
- func EdgeControllerVerify(entityType, id, body string, out io.Writer, logJSON bool, timeout int, ...) error
- func EnvironmentsDir() (string, error)
- func FabricConfigDir() (string, error)
- func FileExists(path string) (bool, error)
- func FirstNotEmptyString(values ...string) string
- func GetArtifactoryPath(staging bool, appName string, branch string) string
- func GetCommandOutput(dir string, name string, args ...string) (string, error)
- func GetLatestSemanticVersionFromArtifactory(verbose bool, staging bool, branch string, appName string, ...) (semver.Version, error)
- func GetLatestTerraformProviderVersionFromArtifactory(branch string, provider string) (semver.Version, error)
- func GetLatestVersionFromArtifactory(verbose bool, staging bool, branch string, appName string) (semver.Version, error)
- func GetTerraformProviderArtifactoryPath(provider string, branch string) string
- func GetWellKnownCerts(host string) ([]byte, []*x509.Certificate, error)
- func HomeDir() string
- func InvalidArg(value string, values []string) error
- func InvalidArgError(value string, err error) error
- func InvalidArgf(value string, message string, a ...interface{}) error
- func InvalidOption(name string, value string, values []string) error
- func InvalidOptionError(option string, value string, err error) error
- func InvalidOptionf(option string, value string, message string, a ...interface{}) error
- func IsEmpty(name string) (bool, error)
- func IsServerTrusted(host string) (bool, error)
- func LoadBytes(dir, name string) ([]byte, error)
- func LogReleaseVersionCheck(zitiComponent string)
- func MissingOption(name string) error
- func NewClient() *resty.Client
- func NewEdgeManagementClient(clientOpts ClientOpts) (*rest_management_api_client.ZitiEdgeManagement, error)
- func NewEmptyParentCmd(name string, description string) *cobra.Command
- func NewEnvironmentDir(envName string) (string, error)
- func NewFabricManagementClient(clientOpts ClientOpts) (*fabric_rest_client.ZitiFabric, error)
- func NewRequest(restClientIdentity RestClientIdentity, timeoutInSeconds int, verbose bool) (*resty.Request, error)
- func OutputJson(out io.Writer, data []byte)
- func PKIRootDir() (string, error)
- func PathWithBinary() string
- func PersistRestClientConfig(config *RestClientConfig) error
- func PickName(names []string, message string) (string, error)
- func PickNameWithDefault(names []string, message string, defaultValue string) (string, error)
- func PickNames(names []string, message string) ([]string, error)
- func PickPassword(message string) (string, error)
- func PickRequiredNameWithDefault(names []string, message string, defaultValue string) (string, error)
- func PickValue(message string, defaultValue string, required bool) (string, error)
- func PrettyPrintResponse(resp *resty.Response) string
- func ReadCert(id string) ([]byte, string, error)
- func ReadZitiAppConfigFile(zitiApp string, configData interface{}) error
- func ReadZitiAppFile(zitiApp string, fileType string, configData interface{}) error
- func RegexpSplit(text string, regexSeperator string) []string
- func RenameDir(src string, dst string, force bool) (err error)
- func RenameFile(src string, dst string) (err error)
- func ReverseStrings(a []string)
- func RunAWSCommand(args ...string) error
- func RunCommand(dir string, name string, args ...string) error
- func SelectNames(names []string, message string, selectAll bool) ([]string, error)
- func SelectNamesWithFilter(names []string, message string, selectAll bool, filter string) ([]string, error)
- func SortedMapKeys(m map[string]string) []string
- func StringArrayIndex(array []string, value string) int
- func StringArrayToLower(values []string) []string
- func StringIndexes(text string, value string) []int
- func StringMatchesAny(text string, includes []string, excludes []string) bool
- func StringMatchesPattern(text string, pattern string) bool
- func SuggestionsFor(typedName string, values []string, suggestionsMinimumDistance int, ...) []string
- func TerraformProviderBinaryLocation() (string, error)
- func UnTargz(tarball, target string, onlyFiles []string) error
- func WrapIfApiError(err error) error
- func WriteCert(p common.Printer, id string, cert []byte) (string, error)
- func WriteZitiAppConfigFile(zitiApp string, configData interface{}) error
- func WriteZitiAppFile(zitiApp string, fileType string, appData interface{}) error
- func ZitiAppConfigDir(zitiApp string) (string, error)
- type API
- type AQLResult
- type AQLVars
- type ApiErrorPayload
- type ArtifactoryAQLData
- type ArtifactoryStorageChildrenData
- type ArtifactoryStorageData
- type ArtifactoryVersionsData
- type ClientOpts
- type Data
- type EdgeManagementAuth
- type RestApiError
- type RestClientConfig
- type RestClientEdgeIdentity
- func (self *RestClientEdgeIdentity) GetBaseUrlForApi(api API) (string, error)
- func (self *RestClientEdgeIdentity) IsReadOnly() bool
- func (self *RestClientEdgeIdentity) NewClient(timeout time.Duration, verbose bool) (*resty.Client, error)
- func (self *RestClientEdgeIdentity) NewEdgeManagementClient(clientOpts ClientOpts) (*rest_management_api_client.ZitiEdgeManagement, error)
- func (self *RestClientEdgeIdentity) NewFabricManagementClient(clientOpts ClientOpts) (*fabric_rest_client.ZitiFabric, error)
- func (self *RestClientEdgeIdentity) NewRequest(client *resty.Client) *resty.Request
- func (self *RestClientEdgeIdentity) NewTlsClientConfig() (*tls.Config, error)
- func (self *RestClientEdgeIdentity) NewWsHeader() http.Header
- type RestClientFabricIdentity
- func (self *RestClientFabricIdentity) GetBaseUrlForApi(api API) (string, error)
- func (self *RestClientFabricIdentity) IsReadOnly() bool
- func (self *RestClientFabricIdentity) NewClient(timeout time.Duration, verbose bool) (*resty.Client, error)
- func (self *RestClientFabricIdentity) NewEdgeManagementClient(ClientOpts) (*rest_management_api_client.ZitiEdgeManagement, error)
- func (self *RestClientFabricIdentity) NewFabricManagementClient(clientOpts ClientOpts) (*fabric_rest_client.ZitiFabric, error)
- func (self *RestClientFabricIdentity) NewRequest(client *resty.Client) *resty.Request
- func (self *RestClientFabricIdentity) NewTlsClientConfig() (*tls.Config, error)
- func (self *RestClientFabricIdentity) NewWsHeader() http.Header
- type RestClientIdentity
- type Session
Constants ¶
const ( DefaultWritePermissions = 0760 MaximumNewDirectoryAttempts = 1000 )
const (
CONFIGFILENAME = "config"
)
const (
DefaultSuggestionsMinimumDistance = 2
)
Variables ¶
var ColorError = color.New(color.FgRed).SprintFunc()
var ColorInfo = color.New(color.FgGreen).SprintFunc()
var ColorStatus = color.New(color.FgBlue).SprintFunc()
var ColorWarning = color.New(color.FgYellow).SprintFunc()
Functions ¶
func AreCertsTrusted ¶ added in v0.27.0
func BinaryLocation ¶ added in v0.27.0
func ControllerCreate ¶ added in v0.27.0
func ControllerCreate(api API, entityType string, body string, out io.Writer, logRequestJson, logResponseJson bool, timeout int, verbose bool) (*gabs.Container, error)
ControllerCreate will create entities of the given type in the given Edge Controller
func ControllerDelete ¶ added in v0.27.0
func ControllerDelete(api API, entityType string, id string, body string, out io.Writer, logRequestJson bool, logResponseJson bool, timeout int, verbose bool) error
ControllerDelete will delete entities of the given type in the given Controller
func ControllerDetailEntity ¶ added in v0.27.0
func ControllerList ¶ added in v0.27.0
func ControllerList(api API, path string, params url.Values, logJSON bool, out io.Writer, timeout int, verbose bool) (*gabs.Container, error)
ControllerList will list entities of the given type in the given Edge Controller
func ControllerUpdate ¶ added in v0.27.0
func ControllerUpdate(api API, entityType string, body string, out io.Writer, method string, logRequestJson, logResponseJSON bool, timeout int, verbose bool) (*gabs.Container, error)
ControllerUpdate will update entities of the given type in the given Edge Controller
func CopyDir ¶ added in v0.27.0
credit https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04
func CopyDirOverwrite ¶ added in v0.27.0
CopyDirOverwrite copies from the source dir to the destination dir overwriting files along the way
func CopyFile ¶ added in v0.27.0
credit https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04
func CreateUniqueDirectory ¶ added in v0.27.0
CreateUniqueDirectory creates a new directory but if the combination of dir and name exists then append a number until a unique name is found
func DownloadArtifactoryFile ¶ added in v0.27.0
DownloadArtifactoryFile will download a file from the given Artifactory URL
func DownloadFile ¶ added in v0.27.0
Download a file from the given URL
func EdgeControllerGetManagementApiBasePath ¶ added in v0.27.0
EdgeControllerGetManagementApiBasePath accepts host as `http://domain:port` and attempts to determine the proper path that should be used to access the Edge Management API. Depending on the version of the Edge Controller the API may be monolith on `/edge/<version>` and `/` or split into `/edge/management/<version>` and `/edge/client/<version>`.
func EdgeControllerList ¶ added in v0.27.0
func EdgeControllerList(path string, params url.Values, logJSON bool, out io.Writer, timeout int, verbose bool) (*gabs.Container, error)
EdgeControllerList will list entities of the given type in the given Edge Controller
func EdgeControllerListSubEntities ¶ added in v0.27.0
func EdgeControllerListSubEntities(entityType, subType, entityId string, filter string, logJSON bool, out io.Writer, timeout int, verbose bool) (*gabs.Container, error)
EdgeControllerListSubEntities will list entities of the given type in the given Edge Controller
func EdgeControllerRequest ¶ added in v0.27.0
func EdgeControllerVerify ¶ added in v0.27.0
func EdgeControllerVerify(entityType, id, body string, out io.Writer, logJSON bool, timeout int, verbose bool) error
EdgeControllerVerify will verify entities of the given type in the given Edge Controller
func EnvironmentsDir ¶ added in v0.27.0
func FabricConfigDir ¶ added in v0.27.0
func FileExists ¶ added in v0.27.0
func FirstNotEmptyString ¶ added in v0.27.0
FirstNotEmptyString returns the first non empty string or the empty string if none can be found
func GetArtifactoryPath ¶ added in v0.27.0
func GetCommandOutput ¶ added in v0.27.0
GetCommandOutput evaluates the given command and returns the trimmed output
func GetLatestSemanticVersionFromArtifactory ¶ added in v0.27.0
func GetLatestTerraformProviderVersionFromArtifactory ¶ added in v0.27.0
func GetLatestVersionFromArtifactory ¶ added in v0.27.0
func GetTerraformProviderArtifactoryPath ¶ added in v0.27.0
func GetWellKnownCerts ¶ added in v0.27.0
func GetWellKnownCerts(host string) ([]byte, []*x509.Certificate, error)
func InvalidArg ¶ added in v0.27.0
func InvalidArgError ¶ added in v0.27.0
func InvalidArgf ¶ added in v0.27.0
func InvalidOption ¶ added in v0.27.0
func InvalidOptionError ¶ added in v0.27.0
func InvalidOptionf ¶ added in v0.27.0
func IsServerTrusted ¶ added in v0.27.0
func LogReleaseVersionCheck ¶ added in v0.27.0
func LogReleaseVersionCheck(zitiComponent string)
func MissingOption ¶ added in v0.27.0
func NewClient ¶ added in v0.28.0
func NewClient() *resty.Client
Use a 2-second timeout with a retry count of 5
func NewEdgeManagementClient ¶ added in v0.27.0
func NewEdgeManagementClient(clientOpts ClientOpts) (*rest_management_api_client.ZitiEdgeManagement, error)
func NewEmptyParentCmd ¶ added in v0.27.0
NewEmptyParentCmd creates a new cobra command with no parent
func NewEnvironmentDir ¶ added in v0.27.0
func NewFabricManagementClient ¶ added in v0.27.0
func NewFabricManagementClient(clientOpts ClientOpts) (*fabric_rest_client.ZitiFabric, error)
func NewRequest ¶ added in v0.27.0
func NewRequest(restClientIdentity RestClientIdentity, timeoutInSeconds int, verbose bool) (*resty.Request, error)
func OutputJson ¶ added in v0.28.0
func PKIRootDir ¶ added in v0.27.0
func PathWithBinary ¶ added in v0.27.0
func PathWithBinary() string
func PersistRestClientConfig ¶ added in v0.27.0
func PersistRestClientConfig(config *RestClientConfig) error
func PickNameWithDefault ¶ added in v0.27.0
func PickPassword ¶ added in v0.27.0
func PickRequiredNameWithDefault ¶ added in v0.27.0
func PrettyPrintResponse ¶ added in v0.28.0
func PrettyPrintResponse(resp *resty.Response) string
func ReadZitiAppConfigFile ¶ added in v0.27.0
ReadZitiAppConfigFile reads in the config file data for the given Ziti application from an appropriate location
func ReadZitiAppFile ¶ added in v0.27.0
ReadZitiAppFile reads application data (config, session, preferences, etc) for the given Ziti application from an appropriate location
func RegexpSplit ¶ added in v0.27.0
RegexpSplit splits a string into an array using the regexSep as a separator
func RenameFile ¶ added in v0.27.0
func ReverseStrings ¶ added in v0.27.0
func ReverseStrings(a []string)
func RunAWSCommand ¶ added in v0.27.0
RunAWSCommand evaluates the given AWS CLI command and returns the trimmed output
func RunCommand ¶ added in v0.27.0
RunCommand evaluates the given command and returns the trimmed output
func SelectNames ¶ added in v0.27.0
SelectNames select which names from the list should be chosen
func SelectNamesWithFilter ¶ added in v0.27.0
func SelectNamesWithFilter(names []string, message string, selectAll bool, filter string) ([]string, error)
SelectNamesWithFilter selects from a list of names with a given filter. Optionally selecting them all
func SortedMapKeys ¶ added in v0.27.0
SortedMapKeys returns the sorted keys of the given map
func StringArrayIndex ¶ added in v0.27.0
func StringArrayToLower ¶ added in v0.27.0
StringArrayToLower returns a string slice with all the values converted to lower case
func StringIndexes ¶ added in v0.27.0
StringIndexes returns all the indices where the value occurs in the given string
func StringMatchesAny ¶ added in v0.27.0
StringMatches returns true if the given text matches the includes/excludes lists
func StringMatchesPattern ¶ added in v0.27.0
StringMatchesPattern returns true if the given text matches the includes/excludes lists
func SuggestionsFor ¶ added in v0.27.0
func TerraformProviderBinaryLocation ¶ added in v0.27.0
TerraformProviderBinaryLocation provides the proper location to place a Terraform provider based on the currently running OS. In Mac/Linux, it's `~/.terraform.d/plugins` and on Windows it's `%APPDATA%\terraform.d\plugins`
func UnTargz ¶ added in v0.27.0
untargz a tarball to a target, from http://blog.ralch.com/tutorial/golang-working-with-tar-and-gzip
func WrapIfApiError ¶ added in v0.27.0
func WriteZitiAppConfigFile ¶ added in v0.27.0
WriteZitiAppConfigFile writes out the config file data for the given Ziti application to the appropriate config file
func WriteZitiAppFile ¶ added in v0.27.0
WriteZitiAppFile writes application data (config, session, preferences, etc) to an appropriate location
func ZitiAppConfigDir ¶ added in v0.27.0
Types ¶
type AQLResult ¶ added in v0.27.0
type AQLResult struct { Repo string Path string Name string Type string Size int Created string CreatedBy string Modified string ModifiedBy string Updated string Properties []struct { Key string Value string } }
Used to parse the '/api/search/aql' response from Artifactory
type ApiErrorPayload ¶ added in v0.27.0
type ApiErrorPayload interface {
GetPayload() *rest_model.APIErrorEnvelope
}
type ArtifactoryAQLData ¶ added in v0.27.0
type ArtifactoryAQLData struct {
Results []AQLResult
}
type ArtifactoryStorageChildrenData ¶ added in v0.27.0
Used to parse the '/api/storage' response from Artifactory
func GetCurrentSnapshotListFromArtifactory ¶ added in v0.27.0
func GetCurrentSnapshotListFromArtifactory(verbose bool) ([]ArtifactoryStorageChildrenData, error)
type ArtifactoryStorageData ¶ added in v0.27.0
type ArtifactoryVersionsData ¶ added in v0.27.0
type ArtifactoryVersionsData struct { Version string `json:"version"` Artifacts []struct { } }
Used to parse the '/api/versions' response from Artifactory
type ClientOpts ¶ added in v0.27.0
type EdgeManagementAuth ¶ added in v0.27.0
type EdgeManagementAuth struct {
Token string
}
func (EdgeManagementAuth) AuthenticateRequest ¶ added in v0.27.0
func (e EdgeManagementAuth) AuthenticateRequest(request openApiRuntime.ClientRequest, registry strfmt.Registry) error
type RestApiError ¶ added in v0.27.0
type RestApiError struct {
ApiErrorPayload
}
func (RestApiError) Error ¶ added in v0.27.0
func (a RestApiError) Error() string
type RestClientConfig ¶ added in v0.27.0
type RestClientConfig struct { EdgeIdentities map[string]*RestClientEdgeIdentity `json:"edgeIdentities"` FabricIdentities map[string]*RestClientFabricIdentity `json:"fabricIdentities"` Default string `json:"default"` }
func LoadRestClientConfig ¶ added in v0.27.0
func LoadRestClientConfig() (*RestClientConfig, string, error)
func (*RestClientConfig) GetIdentity ¶ added in v0.27.0
func (self *RestClientConfig) GetIdentity() string
type RestClientEdgeIdentity ¶ added in v0.27.0
type RestClientEdgeIdentity struct { Url string `json:"url"` Username string `json:"username"` Token string `json:"token"` LoginTime string `json:"loginTime"` CaCert string `json:"caCert,omitempty"` ReadOnly bool `json:"readOnly"` }
func (*RestClientEdgeIdentity) GetBaseUrlForApi ¶ added in v0.27.0
func (self *RestClientEdgeIdentity) GetBaseUrlForApi(api API) (string, error)
func (*RestClientEdgeIdentity) IsReadOnly ¶ added in v0.27.0
func (self *RestClientEdgeIdentity) IsReadOnly() bool
func (*RestClientEdgeIdentity) NewClient ¶ added in v0.27.0
func (self *RestClientEdgeIdentity) NewClient(timeout time.Duration, verbose bool) (*resty.Client, error)
func (*RestClientEdgeIdentity) NewEdgeManagementClient ¶ added in v0.27.0
func (self *RestClientEdgeIdentity) NewEdgeManagementClient(clientOpts ClientOpts) (*rest_management_api_client.ZitiEdgeManagement, error)
func (*RestClientEdgeIdentity) NewFabricManagementClient ¶ added in v0.27.0
func (self *RestClientEdgeIdentity) NewFabricManagementClient(clientOpts ClientOpts) (*fabric_rest_client.ZitiFabric, error)
func (*RestClientEdgeIdentity) NewRequest ¶ added in v0.27.0
func (self *RestClientEdgeIdentity) NewRequest(client *resty.Client) *resty.Request
func (*RestClientEdgeIdentity) NewTlsClientConfig ¶ added in v0.27.0
func (self *RestClientEdgeIdentity) NewTlsClientConfig() (*tls.Config, error)
func (*RestClientEdgeIdentity) NewWsHeader ¶ added in v0.27.0
func (self *RestClientEdgeIdentity) NewWsHeader() http.Header
type RestClientFabricIdentity ¶ added in v0.27.0
type RestClientFabricIdentity struct { Url string `json:"url"` CaCert string `json:"caCert,omitempty"` ClientCert string `json:"clientCert,omitempty"` ClientKey string `json:"clientKey,omitempty"` ReadOnly bool `json:"readOnly"` }
func (*RestClientFabricIdentity) GetBaseUrlForApi ¶ added in v0.27.0
func (self *RestClientFabricIdentity) GetBaseUrlForApi(api API) (string, error)
func (*RestClientFabricIdentity) IsReadOnly ¶ added in v0.27.0
func (self *RestClientFabricIdentity) IsReadOnly() bool
func (*RestClientFabricIdentity) NewClient ¶ added in v0.27.0
func (self *RestClientFabricIdentity) NewClient(timeout time.Duration, verbose bool) (*resty.Client, error)
func (*RestClientFabricIdentity) NewEdgeManagementClient ¶ added in v0.27.0
func (self *RestClientFabricIdentity) NewEdgeManagementClient(ClientOpts) (*rest_management_api_client.ZitiEdgeManagement, error)
func (*RestClientFabricIdentity) NewFabricManagementClient ¶ added in v0.27.0
func (self *RestClientFabricIdentity) NewFabricManagementClient(clientOpts ClientOpts) (*fabric_rest_client.ZitiFabric, error)
func (*RestClientFabricIdentity) NewRequest ¶ added in v0.27.0
func (self *RestClientFabricIdentity) NewRequest(client *resty.Client) *resty.Request
func (*RestClientFabricIdentity) NewTlsClientConfig ¶ added in v0.27.0
func (self *RestClientFabricIdentity) NewTlsClientConfig() (*tls.Config, error)
func (*RestClientFabricIdentity) NewWsHeader ¶ added in v0.27.0
func (self *RestClientFabricIdentity) NewWsHeader() http.Header
type RestClientIdentity ¶ added in v0.27.0
type RestClientIdentity interface { NewTlsClientConfig() (*tls.Config, error) NewClient(timeout time.Duration, verbose bool) (*resty.Client, error) NewRequest(client *resty.Client) *resty.Request IsReadOnly() bool GetBaseUrlForApi(api API) (string, error) NewEdgeManagementClient(clientOpts ClientOpts) (*rest_management_api_client.ZitiEdgeManagement, error) NewFabricManagementClient(clientOpts ClientOpts) (*fabric_rest_client.ZitiFabric, error) NewWsHeader() http.Header }
func LoadSelectedIdentity ¶ added in v0.27.0
func LoadSelectedIdentity() (RestClientIdentity, error)
func LoadSelectedIdentityForApi ¶ added in v0.27.0
func LoadSelectedIdentityForApi(api API) (RestClientIdentity, error)
func LoadSelectedRWIdentity ¶ added in v0.27.0
func LoadSelectedRWIdentity() (RestClientIdentity, error)
func LoadSelectedRWIdentityForApi ¶ added in v0.27.0
func LoadSelectedRWIdentityForApi(api API) (RestClientIdentity, error)