utils

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

MIT License

(C) Copyright 2022 Hewlett Packard Enterprise Development LP

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

MIT License

(C) Copyright 2022 Hewlett Packard Enterprise Development LP

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

MIT License

(C) Copyright 2022 Hewlett Packard Enterprise Development LP

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

MIT License

(C) Copyright 2022 Hewlett Packard Enterprise Development LP

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

MIT License

(C) Copyright 2022 Hewlett Packard Enterprise Development LP

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

Module exports dependency

Functions

func GenerateName added in v0.9.13

func GenerateName(prefix string) string

GenerateName generates a name with the given prefix. Makes sure result doesn't go beyond 63 characters

func RandomString added in v0.9.13

func RandomString(length int) string

RandomString A random string of the given length.

Types

type Env

type Env struct {
	ServerPort                  string `mapstructure:"SERVER_PORT"`
	Environment                 string `mapstructure:"ENV"`
	ArgoToken                   string `mapstructure:"ARGO_TOKEN"`
	ArgoServerURL               string `mapstructure:"ARGO_SERVER_URL"`
	ApiGatewayURL               string `mapstructure:"API_GATEWAY_URL"`
	WorkerRebuildWorkflowFiles  string `mapstructure:"WORKER_REBUILD_WORKFLOW_FILES"`
	StorageRebuildWorkflowFiles string `mapstructure:"STORAGE_REBUILD_WORKFLOW_FILES"`
	IufInstallWorkflowFiles     string `mapstructure:"IUF_INSTALL_WORKFLOW_FILES"`
	MediaDirBase                string `mapstructure:"MEDIA_DIR_BASE"`
}

Env has environment stored

func NewEnv

func NewEnv(log Logger) Env

NewEnv creates a new environment

type FxLogger

type FxLogger struct {
	*Logger
}

func (FxLogger) Printf

func (l FxLogger) Printf(str string, args ...interface{})

Printf prits go-fx logs

type GenericError added in v0.9.13

type GenericError struct {
	Message string
}

func (GenericError) Error added in v0.9.13

func (e GenericError) Error() string

type GinLogger

type GinLogger struct {
	*Logger
}

func (GinLogger) Write

func (l GinLogger) Write(p []byte) (n int, err error)

Write interface implementation for gin-framework

type Logger

type Logger struct {
	*zap.SugaredLogger
}

Logger structure

func GetLogger

func GetLogger() Logger

GetLogger get the logger

func (Logger) GetFxLogger

func (l Logger) GetFxLogger() FxLogger

GetFxLogger get the fx logger

func (Logger) GetGinLogger

func (l Logger) GetGinLogger() GinLogger

GetGinLogger get the gin logger

type RequestHandler

type RequestHandler struct {
	Gin *gin.Engine
}

RequestHandler function

func NewRequestHandler

func NewRequestHandler(logger Logger, env Env) RequestHandler

NewRequestHandler creates a new request handler

type ResponseError

type ResponseError struct {
	Message string `json:"message"`

} //@name ResponseError

type ResponseOk

type ResponseOk struct {
	Message string `json:"message"`

} //@name ResponseOk

type Validator

type Validator struct {
}

func NewValidator

func NewValidator() Validator

NewValidator creates a new environment

func (Validator) ValidateHostnames

func (validator Validator) ValidateHostnames(hostnames []string) error

func (Validator) ValidateStorageHostnames

func (validator Validator) ValidateStorageHostnames(hostnames []string) error

func (Validator) ValidateWorkerHostnames

func (validator Validator) ValidateWorkerHostnames(hostnames []string) error

Jump to

Keyboard shortcuts

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