clouddriver

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: Apache-2.0 Imports: 5 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 Credential

type Credential 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"`
	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 TaskCreatedArtifact

type TaskCreatedArtifact struct {
	CustomKind bool                        `json:"customKind"`
	Location   string                      `json:"location"`
	Metadata   TaskCreatedArtifactMetadata `json:"metadata"`
	Name       string                      `json:"name"`
	Reference  string                      `json:"reference"`
	Type       string                      `json:"type"`
	Version    string                      `json:"version"`
}

type TaskCreatedArtifactMetadata

type TaskCreatedArtifactMetadata struct {
	Account string `json:"account"`
}

type TaskResultObject

type TaskResultObject struct {
	BoundArtifacts                    []TaskCreatedArtifact    `json:"boundArtifacts"`
	CreatedArtifacts                  []TaskCreatedArtifact    `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"`
}

Refactor bound artifact to it's own type or make genric type for both BoundArtifacts and CreatedArtifacts

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"`
	WriteGroup  string `json:"writeGroup"`
}

func (WritePermission) TableName

func (WritePermission) TableName() string

Directories

Path Synopsis
arcadefakes
Code generated by counterfeiter.
Code generated by counterfeiter.
artifactfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
fiatfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
helmfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
v1
cached/disk/diskfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
kubernetesfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
sql
sqlfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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