utils

package
v0.92.3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const AdminUrl = "https://api-admin.qovery.com"
View Source
const ContextFileName = "context"

Variables

View Source
var Alias string
View Source
var ApplicationScope string
View Source
var ContainerScope string
View Source
var HelmScope string
View Source
var IsSecret bool
View Source
var JobScope string
View Source
var PrettyPrint bool
View Source
var ShowValues bool
View Source
var Value string

Functions

func AddEnvironmentVariable added in v0.40.0

func AddEnvironmentVariable(application Id, key string, value string) error

func AddSecret added in v0.40.0

func AddSecret(application Id, key string, value string) error

func Bool added in v0.61.0

func Bool(v bool) *bool

func CancelEnvironmentDeployment added in v0.52.22

func CancelEnvironmentDeployment(client *qovery.APIClient, envId string, watchFlag bool) error

func CancelServiceDeployment added in v0.52.22

func CancelServiceDeployment(client *qovery.APIClient, envId string, serviceId string, serviceType ServiceType, watchFlag bool) (string, error)

func Capture

func Capture(command *cobra.Command)

func CheckAdminUrl added in v0.40.0

func CheckAdminUrl()

func CreateAlias added in v0.51.0

func CreateAlias(
	client *qovery.APIClient,
	projectId string,
	environmentId string,
	serviceId string,
	serviceType ServiceType,
	key string,
	alias string,
	scope string,
) error

func CreateEnvironmentVariable added in v0.51.0

func CreateEnvironmentVariable(
	client *qovery.APIClient,
	projectId string,
	environmentId string,
	serviceId string,
	scope string,
	key string,
	value string,
	isSecret bool,
) error

func CreateEnvironmentVariableAlias added in v0.51.0

func CreateEnvironmentVariableAlias(
	client *qovery.APIClient,
	aliasParentId string,
	aliasScope qovery.APIVariableScopeEnum,
	variableId string,
	alias string,
) error

func CreateEnvironmentVariableOverride added in v0.51.0

func CreateEnvironmentVariableOverride(
	client *qovery.APIClient,
	overrideParentId string,
	overrideScope qovery.APIVariableScopeEnum,
	variableId string,
	value string,
) error

func CreateOverride added in v0.51.0

func CreateOverride(
	client *qovery.APIClient,
	projectId string,
	environmentId string,
	serviceId string,
	serviceType ServiceType,
	key string,
	value string,
	scope string,
) error

func CurrentEnvironment

func CurrentEnvironment() (Id, Name, error)

func CurrentOrganization

func CurrentOrganization() (Id, Name, error)

func CurrentProject

func CurrentProject() (Id, Name, error)

func DeleteEnvironmentVariable added in v0.40.0

func DeleteEnvironmentVariable(application Id, key string) error

func DeleteFile

func DeleteFile(path string)

func DeleteFolder

func DeleteFolder(path string)

func DeleteSecret added in v0.40.0

func DeleteSecret(application Id, key string) error

func DeleteService added in v0.52.22

func DeleteService(client *qovery.APIClient, envId string, serviceId string, serviceType ServiceType, watchFlag bool) (string, error)

func DeleteServices added in v0.73.0

func DeleteServices(client *qovery.APIClient, envId string, serviceIds []string, serviceType ServiceType) (string, error)

func DeleteVariable added in v0.77.0

func DeleteVariable(client *qovery.APIClient, serviceId string, serviceType ServiceType, key string) error

func DeployApplications added in v0.52.0

func DeployApplications(client *qovery.APIClient, envId string, applicationNames string, commitId string) error

func DeployContainers added in v0.52.0

func DeployContainers(client *qovery.APIClient, envId string, containerNames string, tag string) error

func DeployDatabases added in v0.73.8

func DeployDatabases(client *qovery.APIClient, envId string, databaseNames string) error

func DeployHelms added in v0.75.4

func DeployHelms(client *qovery.APIClient, envId string, helmNames string, chartVersion string, chartGitCommitId string, valuesOverrideCommitId string) error

func DeployJobs added in v0.52.0

func DeployJobs(client *qovery.APIClient, envId string, jobNames string, commitId string, tag string) error

func DeployService added in v0.52.22

func DeployService(client *qovery.APIClient, envId string, serviceId string, serviceType ServiceType, request interface{}, watchFlag bool) (string, error)

func DryRunPrint added in v0.40.0

func DryRunPrint(dryRunDisabled bool)

func FindByApplicationName added in v0.47.0

func FindByApplicationName(applications []qovery.Application, name string) *qovery.Application

func FindByClusterName added in v0.65.0

func FindByClusterName(clusters []qovery.Cluster, name string) *qovery.Cluster

func FindByContainerName added in v0.47.0

func FindByContainerName(containers []qovery.ContainerResponse, name string) *qovery.ContainerResponse

func FindByCustomDomainName added in v0.52.22

func FindByCustomDomainName(customDomains []qovery.CustomDomain, name string) *qovery.CustomDomain

func FindByDatabaseName added in v0.47.0

func FindByDatabaseName(databases []qovery.Database, name string) *qovery.Database

func FindByEnvironmentName added in v0.47.0

func FindByEnvironmentName(environments []qovery.Environment, name string) *qovery.Environment

func FindByHelmName added in v0.75.0

func FindByHelmName(helms []qovery.HelmResponse, name string) *qovery.HelmResponse

func FindByJobName added in v0.47.0

func FindByJobName(jobs []qovery.JobResponse, name string) *qovery.JobResponse

func FindByOrganizationName added in v0.47.0

func FindByOrganizationName(organizations []qovery.Organization, name string) *qovery.Organization

func FindByProjectName added in v0.47.0

func FindByProjectName(projects []qovery.Project, name string) *qovery.Project

func FindEnvironmentVariableByKey added in v0.51.0

func FindEnvironmentVariableByKey(key string, envVars []qovery.VariableResponse) *qovery.VariableResponse

func FindStatus added in v0.69.0

func FindStatus(statuses []qovery.Status, serviceId string) string

func FindStatusTextWithColor added in v0.69.0

func FindStatusTextWithColor(statuses []qovery.Status, serviceId string) string

func GenerateExportEnvVarsScript

func GenerateExportEnvVarsScript(vars []Var, clusterId string)

func GetAccessToken

func GetAccessToken() (AccessTokenType, AccessToken, error)

func GetAccessTokenExpiration

func GetAccessTokenExpiration() (time.Time, error)

func GetAuthorizationHeaderValue added in v0.47.0

func GetAuthorizationHeaderValue(tokenType AccessTokenType, token AccessToken) string

func GetClusterStatusTextWithColor added in v0.73.0

func GetClusterStatusTextWithColor(s qovery.ClusterStateEnum) string

func GetDeploymentStageId added in v0.50.2

func GetDeploymentStageId(client *qovery.APIClient, serviceId string) string

func GetDuration added in v0.68.0

func GetDuration(startTime time.Time, endTime time.Time) string

func GetEnvVarJsonOutput added in v0.69.0

func GetEnvVarJsonOutput(variables []EnvVarLineOutput) string

func GetEnvironmentStatus added in v0.52.22

func GetEnvironmentStatus(statuses []qovery.EnvironmentStatus, serviceId string) string

func GetEnvironmentStatusWithColor added in v0.69.0

func GetEnvironmentStatusWithColor(statuses []qovery.EnvironmentStatus, serviceId string) string

func GetFullPath

func GetFullPath(clusterId string) string

func GetGitSource added in v0.75.4

func GetGitSource(helm *qovery.HelmResponse) *qovery.ApplicationGitRepository

func GetHelmRepository added in v0.75.4

func GetHelmRepository(helm *qovery.HelmResponse) *qovery.HelmResponseAllOfSourceOneOf1Repository

func GetJobDocker added in v0.75.0

func GetJobDocker(job *qovery.JobResponse) *qovery.BaseJobResponseAllOfSourceOneOf1Docker

func GetJobId added in v0.75.0

func GetJobId(job *qovery.JobResponse) string

func GetJobImage added in v0.75.0

func GetJobImage(job *qovery.JobResponse) *qovery.ContainerSource

func GetJobName added in v0.75.0

func GetJobName(job *qovery.JobResponse) string

func GetQoveryClient added in v0.47.0

func GetQoveryClient(tokenType AccessTokenType, token AccessToken) *qovery.APIClient

func GetServiceNameByIdAndType added in v0.49.0

func GetServiceNameByIdAndType(client *qovery.APIClient, serviceId string, serviceType string) string

func GetStatusTextWithColor added in v0.47.0

func GetStatusTextWithColor(s qovery.StateEnum) string

func InitializeQoveryContext

func InitializeQoveryContext() error

func Int32 added in v0.61.0

func Int32(v int32) *int32

func IsEnvironmentInATerminalState added in v0.47.1

func IsEnvironmentInATerminalState(envId string, client *qovery.APIClient) bool

func IsTerminalClusterState added in v0.73.0

func IsTerminalClusterState(state qovery.ClusterStateEnum) bool

func IsTerminalState added in v0.65.0

func IsTerminalState(state qovery.StateEnum) bool

func ListEnvironmentVariables added in v0.51.0

func ListEnvironmentVariables(
	client *qovery.APIClient,
	serviceId string,
	serviceType ServiceType,
) ([]qovery.VariableResponse, error)

func PrintTable added in v0.47.0

func PrintTable(headers []string, data [][]string) error

func Println added in v0.41.0

func Println(text string)

func PrintlnContext

func PrintlnContext() error

func PrintlnError

func PrintlnError(err error)

func PrintlnInfo

func PrintlnInfo(info string)

func QoveryContextExists

func QoveryContextExists() bool

func QoveryContextPath

func QoveryContextPath() (string, error)

func QoveryDirExists

func QoveryDirExists() bool

func QoveryDirPath

func QoveryDirPath() (string, error)

func RandStringBytes added in v0.92.0

func RandStringBytes(n int) string

func RedeployService added in v0.52.22

func RedeployService(client *qovery.APIClient, envId string, serviceId string, serviceName string, serviceType ServiceType, watchFlag bool) (string, error)

func RefreshAccessToken

func RefreshAccessToken() error

func RefreshExpiredTokenSilently

func RefreshExpiredTokenSilently()

func ResetApplicationContext

func ResetApplicationContext() error

func ServiceTypeToScope added in v0.77.0

func ServiceTypeToScope(serviceType ServiceType) (qovery.APIVariableScopeEnum, error)

func SetAccessToken

func SetAccessToken(token AccessToken, expiration time.Time) error

func SetEnvironment

func SetEnvironment(env *Environment) error

func SetOrganization

func SetOrganization(orga *Organization) error

func SetProject

func SetProject(project *Project) error

func SetRefreshToken

func SetRefreshToken(token RefreshToken) error

func SetService added in v0.45.0

func SetService(service *Service) error

func StopService added in v0.52.22

func StopService(client *qovery.APIClient, envId string, serviceIds string, serviceType ServiceType, watchFlag bool) (string, error)

func StopServices added in v0.73.0

func StopServices(client *qovery.APIClient, envId string, serviceIds []string, serviceType ServiceType) (string, error)

func StoreContext

func StoreContext(context QoveryContext) error

func ToIso8601 added in v0.69.0

func ToIso8601(v *time.Time) *string

func ToJobRequest added in v0.67.0

func ToJobRequest(job qovery.JobResponse) qovery.JobRequest

func UpdateEnvironmentVariable added in v0.84.0

func UpdateEnvironmentVariable(
	client *qovery.APIClient,
	key string,
	value string,
	serviceId string,
	serviceType ServiceType,
) error

func Validate added in v0.40.0

func Validate(actionType string) bool

func WatchApplication added in v0.47.0

func WatchApplication(applicationId string, envId string, client *qovery.APIClient)

func WatchContainer added in v0.47.0

func WatchContainer(containerId string, envId string, client *qovery.APIClient)

func WatchDatabase added in v0.47.0

func WatchDatabase(databaseId string, envId string, client *qovery.APIClient)

func WatchEnvironment added in v0.47.0

func WatchEnvironment(envId string, finalServiceState qovery.StateEnum, client *qovery.APIClient)

func WatchEnvironmentWithOptions added in v0.47.1

func WatchEnvironmentWithOptions(envId string, finalServiceState qovery.StateEnum, client *qovery.APIClient, displaySimpleText bool)

func WatchHelm added in v0.75.0

func WatchHelm(helmId string, envId string, client *qovery.APIClient)

func WatchJob added in v0.47.0

func WatchJob(jobId string, envId string, client *qovery.APIClient)

func WriteInFile

func WriteInFile(clusterId string, fileName string, content []byte) string

Types

type AccessToken

type AccessToken string

type AccessTokenType added in v0.47.0

type AccessTokenType string

type Application added in v0.40.0

type Application struct {
	ID   Id
	Name Name
}

func GetApplicationById added in v0.41.6

func GetApplicationById(id string) (*Application, error)

type Container added in v0.45.0

type Container struct {
	ID   Id
	Name Name
}

func GetContainerById added in v0.45.0

func GetContainerById(id string) (*Container, error)

type EnvVarLineOutput added in v0.51.0

type EnvVarLineOutput struct {
	Id                string
	Key               string
	Value             *string
	CreatedAt         time.Time
	UpdatedAt         *time.Time
	Service           *string
	Scope             string
	IsSecret          bool
	AliasParentKey    *string
	OverrideParentKey *string
}

func FromEnvironmentVariableToEnvVarLineOutput added in v0.51.0

func FromEnvironmentVariableToEnvVarLineOutput(envVar qovery.VariableResponse) EnvVarLineOutput

func (EnvVarLineOutput) Data added in v0.51.0

func (e EnvVarLineOutput) Data(showValues bool) []string

type EnvVarLines added in v0.51.0

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

func NewEnvVarLines added in v0.51.0

func NewEnvVarLines() EnvVarLines

func (EnvVarLines) Add added in v0.51.0

func (e EnvVarLines) Add(env EnvVarLineOutput)

func (EnvVarLines) Header added in v0.51.0

func (e EnvVarLines) Header(prettyPrint bool) []string

func (EnvVarLines) Lines added in v0.51.0

func (e EnvVarLines) Lines(showValues bool, prettyPrint bool) [][]string

type Environment added in v0.40.0

type Environment struct {
	ID        Id
	ClusterID Id
	Name      Name
}

func GetEnvironmentById added in v0.41.6

func GetEnvironmentById(id string) (*Environment, error)

func SelectAndSetEnvironment added in v0.40.0

func SelectAndSetEnvironment(projectID Id) (*Environment, error)

func SelectEnvironment

func SelectEnvironment(projectID Id) (*Environment, error)

type EnvironmentService added in v0.48.5

type EnvironmentService struct {
	ID   string
	Type ServiceType
}

func GetEnvironmentServicesById added in v0.48.5

func GetEnvironmentServicesById(id string) ([]EnvironmentService, error)

type HttpResponseError added in v0.74.3

type HttpResponseError struct {
	Code    int
	Message string
}

func (*HttpResponseError) Error added in v0.74.3

func (m *HttpResponseError) Error() string

type Id

type Id string

type Job added in v0.48.5

type Job struct {
	ID   Id
	Name Name
}

func GetJobById added in v0.48.5

func GetJobById(id string) (*Job, error)

type Name

type Name string

type Organization added in v0.40.0

type Organization struct {
	ID   Id
	Name Name
}

func GetOrganizationById added in v0.41.6

func GetOrganizationById(id string) (*Organization, error)

func SelectAndSetOrganization added in v0.40.0

func SelectAndSetOrganization() (*Organization, error)

func SelectOrganization

func SelectOrganization() (*Organization, error)

type Project added in v0.40.0

type Project struct {
	ID   Id
	Name Name
}

func GetProjectById added in v0.41.6

func GetProjectById(id string) (*Project, error)

func SelectAndSetProject added in v0.40.0

func SelectAndSetProject(organizationID Id) (*Project, error)

func SelectProject

func SelectProject(organizationID Id) (*Project, error)

type QoveryContext

type QoveryContext struct {
	AccessToken           AccessToken  `json:"access_token"`
	AccessTokenExpiration time.Time    `json:"access_token_expiration"`
	RefreshToken          RefreshToken `json:"refresh_token"`
	OrganizationId        Id           `json:"organization_id"`
	OrganizationName      Name         `json:"organization_name"`
	ProjectId             Id           `json:"project_id"`
	ProjectName           Name         `json:"project_name"`
	EnvironmentId         Id           `json:"environment_id"`
	EnvironmentName       Name         `json:"environment_name"`
	ServiceId             Id           `json:"service_id"`
	ServiceName           Name         `json:"service_name"`
	ServiceType           ServiceType  `json:"service_type"`
	User                  Name         `json:"user"`
}

func CurrentContext

func CurrentContext() (QoveryContext, error)

func (QoveryContext) ToPosthogProperties

func (c QoveryContext) ToPosthogProperties() map[string]interface{}

type RefreshToken

type RefreshToken string

func GetRefreshToken

func GetRefreshToken() (RefreshToken, error)

type Role added in v0.73.0

type Role struct {
	ID   string
	Name Name
}

func SelectRole added in v0.73.0

func SelectRole(organization *Organization) (*Role, error)

type Service added in v0.45.0

type Service struct {
	ID   Id
	Name Name
	Type ServiceType
}

func CurrentService added in v0.45.0

func CurrentService() (*Service, error)

func GetDatabaseById added in v0.77.0

func GetDatabaseById(id string) (*Service, error)

func GetHelmById added in v0.77.0

func GetHelmById(id string) (*Service, error)

func SelectAndSetService added in v0.45.0

func SelectAndSetService(environment Id) (*Service, error)

func SelectService added in v0.45.0

func SelectService(environment Id) (*Service, error)

type ServiceType added in v0.45.0

type ServiceType string
const (
	ApplicationType ServiceType = "application"
	ContainerType   ServiceType = "container"
	DatabaseType    ServiceType = "database"
	JobType         ServiceType = "job"
	HelmType        ServiceType = "helm"
)

type Status added in v0.47.1

type Status int8
const (
	Continue Status = iota
	Stop
	Err
)

func WatchStatus added in v0.47.0

func WatchStatus(status *qovery.Status) Status

type TokenInformation added in v0.41.1

type TokenInformation struct {
	Organization *Organization
	Role         *Role
	Name         string
	Description  string
}

func SelectTokenInformation added in v0.41.1

func SelectTokenInformation() (*TokenInformation, error)

type TokensResponse

type TokensResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

type Var

type Var struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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