client

package
v2.14.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	BooberApiVersion    = "/v1"
	ErrAccessDenied     = "Access Denied"
	ErrfTokenHasExpired = "Token has expired for (%s). Please login: ao login <affiliation>"
)

Variables

This section is empty.

Functions

func NewApplicationDeploymentRef

func NewApplicationDeploymentRef(name string) *applicationDeploymentRef

Types

type APIClientMock

type APIClientMock struct {
	mock.Mock
}

APIClientMock is a base mock type

func (*APIClientMock) Do

func (api *APIClientMock) Do(method string, endpoint string, payload []byte) (*BooberResponse, error)

Do default mock implementation

func (*APIClientMock) DoWithHeader

func (api *APIClientMock) DoWithHeader(method string, endpoint string, header map[string]string, payload []byte) (*ResponseBundle, error)

DoWithHeader default mock implementation

type ApiClient

type ApiClient struct {
	Host        string
	GoboHost    string
	Token       string
	Affiliation string
	RefName     string
}

func NewApiClient

func NewApiClient(host, token, affiliation, refName string) *ApiClient

func NewApiClientDefaultRef

func NewApiClientDefaultRef(host, token, affiliation string) *ApiClient

func (*ApiClient) Delete

func (api *ApiClient) Delete(deletePayload *DeletePayload) (*DeleteResults, error)

func (*ApiClient) DeleteVault

func (api *ApiClient) DeleteVault(vaultName string) error

func (*ApiClient) Deploy

func (api *ApiClient) Deploy(deployPayload *DeployPayload) (*DeployResults, error)

func (*ApiClient) Do

func (api *ApiClient) Do(method string, endpoint string, payload []byte) (*BooberResponse, error)

func (*ApiClient) DoWithHeader

func (api *ApiClient) DoWithHeader(method string, endpoint string, header map[string]string, payload []byte) (*ResponseBundle, error)

func (*ApiClient) Exists

func (api *ApiClient) Exists(existsPayload *ExistsPayload) (*ExistsResults, error)

func (*ApiClient) GetApplyResult

func (api *ApiClient) GetApplyResult(deployId string) (string, error)

func (*ApiClient) GetAuroraConfig

func (api *ApiClient) GetAuroraConfig() (*auroraconfig.AuroraConfig, error)

func (*ApiClient) GetAuroraConfigFile

func (api *ApiClient) GetAuroraConfigFile(fileName string) (*auroraconfig.AuroraConfigFile, string, error)

func (*ApiClient) GetAuroraConfigNames added in v1.2.3

func (api *ApiClient) GetAuroraConfigNames() (*auroraconfig.AuroraConfigNames, error)

func (*ApiClient) GetAuroraDeploySpec

func (api *ApiClient) GetAuroraDeploySpec(applications []string, defaults bool) ([]deploymentspec.DeploymentSpec, error)

func (*ApiClient) GetAuroraDeploySpecFormatted

func (api *ApiClient) GetAuroraDeploySpecFormatted(environment, application string, defaults bool) (string, error)

func (*ApiClient) GetClientConfig

func (api *ApiClient) GetClientConfig() (*ClientConfig, error)

func (*ApiClient) GetFileNames

func (api *ApiClient) GetFileNames() (auroraconfig.FileNames, error)

func (*ApiClient) GetSecretFile

func (api *ApiClient) GetSecretFile(vault, secret string) (string, string, error)

func (*ApiClient) GetVault

func (api *ApiClient) GetVault(vaultName string) (*AuroraSecretVault, error)

func (*ApiClient) GetVaults

func (api *ApiClient) GetVaults() ([]*AuroraVaultInfo, error)

func (*ApiClient) PutAuroraConfig

func (api *ApiClient) PutAuroraConfig(endpoint string, payload []byte) (string, error)

func (*ApiClient) PutAuroraConfigFile

func (api *ApiClient) PutAuroraConfigFile(file *auroraconfig.AuroraConfigFile, eTag string) error

func (*ApiClient) RunGraphQl

func (api *ApiClient) RunGraphQl(graphQlRequest string, response interface{}) error

func (*ApiClient) RunGraphQlMutation

func (api *ApiClient) RunGraphQlMutation(graphQlRequest *graphql.Request, response interface{}) error

func (*ApiClient) SaveVault

func (api *ApiClient) SaveVault(vault AuroraSecretVault) error

func (*ApiClient) UpdateSecretFile

func (api *ApiClient) UpdateSecretFile(vault, secret, eTag string, content []byte) error

func (*ApiClient) ValidateAuroraConfig

func (api *ApiClient) ValidateAuroraConfig(ac *auroraconfig.AuroraConfig, fullValidation bool) (string, error)

func (*ApiClient) ValidateRemoteAuroraConfig

func (api *ApiClient) ValidateRemoteAuroraConfig(fullValidation bool) (string, error)

type ApplicationDeploymentClient

type ApplicationDeploymentClient interface {
	Doer
	Deploy(deployPayload *DeployPayload) (*DeployResults, error)
	Delete(deletePayload *DeletePayload) (*DeleteResults, error)
	Exists(existPayload *ExistsPayload) (*ExistsResults, error)
	GetApplyResult(deployId string) (string, error)
}

type ApplicationDeploymentClientMock

type ApplicationDeploymentClientMock struct {
	APIClientMock
}

ApplicationDeploymentClientMock is a base mock type

func NewApplicationDeploymentClientMock

func NewApplicationDeploymentClientMock() *ApplicationDeploymentClientMock

NewApplicationDeploymentClientMock creates a new ApplicationDeploymentClientMock

func (*ApplicationDeploymentClientMock) Delete

func (api *ApplicationDeploymentClientMock) Delete(deletePayload *DeletePayload) (*DeleteResults, error)

Delete default mock implementation

func (*ApplicationDeploymentClientMock) Deploy

func (api *ApplicationDeploymentClientMock) Deploy(deployPayload *DeployPayload) (*DeployResults, error)

Deploy default mock implementation

func (*ApplicationDeploymentClientMock) Exists

func (api *ApplicationDeploymentClientMock) Exists(existsPayload *ExistsPayload) (*ExistsResults, error)

Exists default mock implementation

func (*ApplicationDeploymentClientMock) GetApplyResult

func (api *ApplicationDeploymentClientMock) GetApplyResult(deployID string) (string, error)

GetApplyResult default mock implementation

type ApplicationRef

type ApplicationRef struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
}

func NewApplicationRef

func NewApplicationRef(namespace, name string) *ApplicationRef

type AuroraConfigClient

type AuroraConfigClient interface {
	Doer
	GetFileNames() (auroraconfig.FileNames, error)
	GetAuroraConfig() (*auroraconfig.AuroraConfig, error)
	GetAuroraConfigNames() (*auroraconfig.AuroraConfigNames, error)
	PutAuroraConfig(endpoint string, payload []byte) (string, error)
	ValidateAuroraConfig(ac *auroraconfig.AuroraConfig, fullValidation bool) (string, error)
	GetAuroraConfigFile(fileName string) (*auroraconfig.AuroraConfigFile, string, error)
	PutAuroraConfigFile(file *auroraconfig.AuroraConfigFile, eTag string) error
}

type AuroraConfigClientMock

type AuroraConfigClientMock struct {
	APIClientMock
	// contains filtered or unexported fields
}

AuroraConfigClientMock is a base mock type

func NewAuroraConfigClientMock

func NewAuroraConfigClientMock(fileNames auroraconfig.FileNames) *AuroraConfigClientMock

NewAuroraConfigClientMock returns a new AurorConfigClientMock

func (*AuroraConfigClientMock) GetAuroraConfig

func (api *AuroraConfigClientMock) GetAuroraConfig() (*auroraconfig.AuroraConfig, error)

GetAuroraConfig default mock implementation

func (*AuroraConfigClientMock) GetAuroraConfigFile

func (api *AuroraConfigClientMock) GetAuroraConfigFile(fileName string) (*auroraconfig.AuroraConfigFile, string, error)

GetAuroraConfigFile default mock implementation

func (*AuroraConfigClientMock) GetAuroraConfigNames

func (api *AuroraConfigClientMock) GetAuroraConfigNames() (*auroraconfig.AuroraConfigNames, error)

GetAuroraConfigNames default mock implementation

func (*AuroraConfigClientMock) GetFileNames

func (api *AuroraConfigClientMock) GetFileNames() (auroraconfig.FileNames, error)

GetFileNames default mock implementation

func (*AuroraConfigClientMock) PutAuroraConfig

func (api *AuroraConfigClientMock) PutAuroraConfig(endpoint string, payload []byte) (string, error)

PutAuroraConfig default mock implementation

func (*AuroraConfigClientMock) PutAuroraConfigFile

func (api *AuroraConfigClientMock) PutAuroraConfigFile(file *auroraconfig.AuroraConfigFile, eTag string) error

PutAuroraConfigFile default mock implementation

func (*AuroraConfigClientMock) ValidateAuroraConfig

func (api *AuroraConfigClientMock) ValidateAuroraConfig(ac *auroraconfig.AuroraConfig, fullValidation bool) (string, error)

ValidateAuroraConfig default mock implementation

type AuroraSecretVault

type AuroraSecretVault struct {
	Name        string   `json:"name"`
	Permissions []string `json:"permissions"`
	Secrets     Secrets  `json:"secrets"`
}

TODO: rename to request

func NewAuroraSecretVault

func NewAuroraSecretVault(name string) *AuroraSecretVault

type AuroraVaultInfo

type AuroraVaultInfo struct {
	Name        string   `json:"name"`
	Permissions []string `json:"permissions"`
	Secrets     Secrets  `json:"secrets"`
	HasAccess   bool     `json:"hasAccess"`
}

TODO: rename to response

type BooberResponse

type BooberResponse struct {
	Success bool            `json:"success"`
	Message string          `json:"message"`
	Items   json.RawMessage `json:"items"`
	Count   int             `json:"count"`
}

func (*BooberResponse) Error

func (res *BooberResponse) Error() error

func (*BooberResponse) ParseFirstItem

func (res *BooberResponse) ParseFirstItem(data interface{}) error

func (*BooberResponse) ParseItems

func (res *BooberResponse) ParseItems(data interface{}) error

type ClientConfig

type ClientConfig struct {
	GitUrlPattern string `json:"gitUrlPattern"`
	ApiVersion    int    `json:"apiVersion"`
}

type DeletePayload

type DeletePayload struct {
	ApplicationRefs []ApplicationRef `json:"applicationRefs"`
}

func NewDeletePayload

func NewDeletePayload(applicationRefs []ApplicationRef) *DeletePayload

type DeleteResult

type DeleteResult struct {
	ApplicationRef ApplicationRef `json:"applicationRef"`
	Success        bool           `json:"success"`
	Reason         string         `json:"reason"`
}

type DeleteResults

type DeleteResults struct {
	Message string
	Success bool
	Results []DeleteResult
}

type DeployPayload

type DeployPayload struct {
	ApplicationDeploymentRefs []applicationDeploymentRef `json:"applicationDeploymentRefs"`
	Overrides                 map[string]string          `json:"overrides"`
	Deploy                    bool                       `json:"deploy"`
}

func NewDeployPayload

func NewDeployPayload(applications []string, overrides map[string]string) *DeployPayload

type DeployResult

type DeployResult struct {
	DeployId       string                        `json:"deployId"`
	DeploymentSpec deploymentspec.DeploymentSpec `json:"deploymentSpec"`
	Success        bool                          `json:"success"`
	Ignored        bool                          `json:"ignored"`
	Reason         string                        `json:"reason"`
	Warnings       []string                      `json:"warnings"`
}

type DeployResults

type DeployResults struct {
	Message string
	Success bool
	Results []DeployResult
}

type DeploySpecClient

type DeploySpecClient interface {
	Doer
	GetAuroraDeploySpec(applications []string, defaults bool) ([]deploymentspec.DeploymentSpec, error)
	GetAuroraDeploySpecFormatted(environment, application string, defaults bool) (string, error)
}

type DeploySpecClientMock

type DeploySpecClientMock struct {
	APIClientMock
	// contains filtered or unexported fields
}

DeploySpecClientMock is a base mock type

func NewDeploySpecClientMock

func NewDeploySpecClientMock(deploySpecs []deploymentspec.DeploymentSpec) *DeploySpecClientMock

NewDeploySpecClientMock creates a new DeploySpecClientMock

func (*DeploySpecClientMock) GetAuroraDeploySpec

func (api *DeploySpecClientMock) GetAuroraDeploySpec(applications []string, defaults bool) ([]deploymentspec.DeploymentSpec, error)

GetAuroraDeploySpec default mock implementation

func (*DeploySpecClientMock) GetAuroraDeploySpecFormatted

func (api *DeploySpecClientMock) GetAuroraDeploySpecFormatted(environment, application string, defaults bool) (string, error)

GetAuroraDeploySpecFormatted default mock implementation

type Doer

type Doer interface {
	Do(method string, endpoint string, payload []byte) (*BooberResponse, error)
	DoWithHeader(method string, endpoint string, header map[string]string, payload []byte) (*ResponseBundle, error)
}

type ErrorResponse

type ErrorResponse struct {
	ContainsError      bool
	GenericErrors      []string
	IllegalFieldErrors []string
	MissingFieldErrors []string
	InvalidFieldErrors []string
	// contains filtered or unexported fields
}

func (*ErrorResponse) String

func (e *ErrorResponse) String() string

type ExistsPayload

type ExistsPayload struct {
	ApplicationDeploymentRefs []applicationDeploymentRef `json:"adr"`
}

func NewExistsPayload

func NewExistsPayload(applications []string) *ExistsPayload

type ExistsResult

type ExistsResult struct {
	ApplicationRef ApplicationRef `json:"applicationRef"`
	Exists         bool           `json:"exists"`
	Success        bool           `json:"success"`
	Message        string         `json:"message"`
}

type ExistsResults

type ExistsResults struct {
	Message string
	Success bool
	Results []ExistsResult
}

type ResponseBundle

type ResponseBundle struct {
	BooberResponse *BooberResponse
	HttpResponse   *http.Response
}

type Secrets

type Secrets map[string]string

func (Secrets) AddSecret

func (s Secrets) AddSecret(name, content string)

func (Secrets) GetSecret

func (s Secrets) GetSecret(name string) (string, error)

func (Secrets) RemoveSecret

func (s Secrets) RemoveSecret(name string)

type VaultFileResource

type VaultFileResource struct {
	Contents string `json:"contents"`
}

Jump to

Keyboard shortcuts

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