clouddriver

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskIDKey       = `TaskID`
	TaskTypeCleanup = `cleanup`
	TaskTypeDelete  = `delete`
	TaskTypeNoOp    = `noop`
)

Variables

This section is empty.

Functions

func Error

func Error(c *gin.Context, status int, err error)

Error attaches a given Go error to a gin context and sets its type to public.

func Log

func Log(err error, meta ...ErrorMeta)

Log logs a given error. It checks if meta was passed in. If no meta was passed in, it defines the meta as the function and line number of what called the Log func.

See https://stackoverflow.com/questions/24809287/how-do-you-get-a-golang-program-to-print-the-line-number-of-the-error-it-just-ca

func TaskIDFromContext

func TaskIDFromContext(c *gin.Context) string

Types

type Artifact added in v0.18.0

type Artifact struct {
	CustomKind bool             `json:"customKind"`
	Location   string           `json:"location,omitempty"`
	Metadata   ArtifactMetadata `json:"metadata"`
	Name       string           `json:"name"`
	Reference  string           `json:"reference"`
	Type       artifact.Type    `json:"type"`
	Version    string           `json:"version,omitempty"`
}

type ArtifactMetadata added in v0.18.0

type ArtifactMetadata struct {
	Account string `json:"account,omitempty"`
}

type Credentials added in v0.18.0

type Credentials struct {
	AccountType                 string        `json:"accountType"`
	CacheThreads                int           `json:"cacheThreads"`
	ChallengeDestructiveActions bool          `json:"challengeDestructiveActions"`
	CloudProvider               string        `json:"cloudProvider"`
	DockerRegistries            []interface{} `json:"dockerRegistries"`
	Enabled                     bool          `json:"enabled"`
	Environment                 string        `json:"environment"`
	Name                        string        `json:"name"`
	Namespaces                  []string      `json:"namespaces"`
	Permissions                 struct {
		READ  []string `json:"READ"`
		WRITE []string `json:"WRITE"`
	} `json:"permissions"`
	PrimaryAccount          bool              `json:"primaryAccount"`
	ProviderVersion         string            `json:"providerVersion"`
	RequiredGroupMembership []interface{}     `json:"requiredGroupMembership"`
	Skin                    string            `json:"skin"`
	SpinnakerKindMap        map[string]string `json:"spinnakerKindMap"`
	Type                    string            `json:"type"`
}

type ErrorMeta

type ErrorMeta struct {
	FuncName string
	FileName string
	GUID     string
	LineNum  int
}

func Meta

func Meta(msg *gin.Error) ErrorMeta

type ErrorResponse

type ErrorResponse struct {
	Error     string `json:"error"`
	Message   string `json:"message"`
	Status    int    `json:"status"`
	Timestamp int64  `json:"timestamp"`
}

This represents a clouddriver error.

func NewError

func NewError(err, message string, status int) ErrorResponse

Example.

{
  "error":"Forbidden",
  "message":"Access denied to account spin-cluster-account - required authorization: READ",
  "status":403,
  "timestamp":1597608027851
}

type Permissions

type Permissions struct {
	READ  []string `json:"READ"`
	WRITE []string `json:"WRITE"`
}

type ReadPermission

type ReadPermission struct {
	ID          string `json:"-" gorm:"primary_key"`
	AccountName string `json:"accountName" gorm:"index:account_name_idx"`
	ReadGroup   string `json:"readGroup"`
}

func (ReadPermission) TableName

func (ReadPermission) TableName() string

type Task

type Task struct {
	ID string `json:"id"`
	// SagaIds []interface{} `json:"sagaIds"`
	// History []struct {
	// 	Phase  string `json:"phase"`
	// 	Status string `json:"status"`
	// } `json:"history"`
	// OwnerIDClouddriverSQL   string `json:"ownerId$clouddriver_sql"`
	// RequestIDClouddriverSQL string `json:"requestId$clouddriver_sql"`
	// Retryable                 bool  `json:"retryable"`
	// StartTimeMsClouddriverSQL int64 `json:"startTimeMs$clouddriver_sql"`
	ResultObjects []TaskResultObject `json:"resultObjects"`
	Status        TaskStatus         `json:"status"`
}

func NewDefaultTask

func NewDefaultTask(id string) Task

type TaskResultObject

type TaskResultObject struct {
	BoundArtifacts                    []Artifact               `json:"boundArtifacts"`
	CreatedArtifacts                  []Artifact               `json:"createdArtifacts"`
	DeployedNamesByLocation           map[string][]string      `json:"deployedNamesByLocation"`
	ManifestNamesByNamespace          map[string][]string      `json:"manifestNamesByNamespace"`
	ManifestNamesByNamespaceToRefresh map[string][]string      `json:"manifestNamesByNamespaceToRefresh"`
	Manifests                         []map[string]interface{} `json:"manifests"`
}

type TaskStatus

type TaskStatus struct {
	Complete  bool   `json:"complete"`
	Completed bool   `json:"completed"`
	Failed    bool   `json:"failed"`
	Phase     string `json:"phase"`
	Retryable bool   `json:"retryable"`
	Status    string `json:"status"`
}

type WritePermission

type WritePermission struct {
	ID          string `json:"-" gorm:"primary_key"`
	AccountName string `json:"accountName" gorm:"index:account_name_idx"`
	WriteGroup  string `json:"writeGroup"`
}

func (WritePermission) TableName

func (WritePermission) TableName() string

Jump to

Keyboard shortcuts

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