apiroutes

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: EPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRegistrySecret

func AddRegistrySecret(conInfo *connections.Connection, conURL string, httpClient utils.HTTPClient, address string, username string, password string) (*[]RegistryResponse, error)

AddRegistrySecret : Set a registry secret in the PFE container

func AddTemplateRepoToPFE added in v0.14.0

func AddTemplateRepoToPFE(conID, URL, description, name string, gitCredentials *utils.GitCredentials) ([]utils.TemplateRepo, error)

AddTemplateRepoToPFE adds a template repo to PFE and returns the new list of existing repos

func CreateMockResponseBody

func CreateMockResponseBody(mockResponse interface{}) io.ReadCloser

CreateMockResponseBody is a helper function that creates a mock JSON response body

func DeleteTemplateRepoFromPFE added in v0.14.0

func DeleteTemplateRepoFromPFE(conID, URL string) ([]utils.TemplateRepo, error)

DeleteTemplateRepoFromPFE deletes a template repo from PFE and returns the new list of existing repos

func DisableTemplateRepos

func DisableTemplateRepos(conID string, repoURLs []string) ([]utils.TemplateRepo, error)

DisableTemplateRepos enables a template repo in PFE and returns the new list of template repos

func EnableTemplateRepos

func EnableTemplateRepos(conID string, repoURLs []string) ([]utils.TemplateRepo, error)

EnableTemplateRepos enables a template repo in PFE and returns the new list of template repos

func GetExtensions

func GetExtensions(conID string) ([]utils.Extension, error)

GetExtensions gets project extensions from PFE's REST API.

func GetGatekeeperVersionFromConnection

func GetGatekeeperVersionFromConnection(connection *connections.Connection, url string, HTTPClient utils.HTTPClient) (string, error)

GetGatekeeperVersionFromConnection : Get the version of the Gatekeeper container, deployed to the connection with the given ID

func GetPFEVersionFromConnection

func GetPFEVersionFromConnection(connection *connections.Connection, conURL string, HTTPClient utils.HTTPClient) (string, error)

GetPFEVersionFromConnection : Get the version of the PFE container, deployed to the connection with the given ID

func GetPerformanceVersionFromConnection

func GetPerformanceVersionFromConnection(connection *connections.Connection, url string, HTTPClient utils.HTTPClient) (string, error)

GetPerformanceVersionFromConnection : Get the version of the Performance container, deployed to the connection with the given ID

func GetRegistrySecrets

func GetRegistrySecrets(conInfo *connections.Connection, conURL string, httpClient utils.HTTPClient) (*[]RegistryResponse, error)

GetRegistrySecrets : Get the current registry secrets for the PFE container

func GetTemplateRepos

func GetTemplateRepos(conID string) ([]utils.TemplateRepo, error)

GetTemplateRepos gets all template repos from PFE's REST API

func GetTemplateStyles

func GetTemplateStyles(conID string) ([]string, error)

GetTemplateStyles gets all template styles from PFE's REST API

func HTTPRequestWithRetryOnLock

func HTTPRequestWithRetryOnLock(httpClient utils.HTTPClient, originalRequest *http.Request, connection *connections.Connection) (*http.Response, *sechttp.HTTPSecError)

HTTPRequestWithRetryOnLock : Retries a request until either the maxHTTPRetries limit has been hit or the response status code is not equal to 423 (templates locked HTTP code)

func IsPFEReady

func IsPFEReady(httpClient utils.HTTPClient, host string) (bool, error)

IsPFEReady : Get PFE Ready for connection

func RemoveRegistrySecret

func RemoveRegistrySecret(conInfo *connections.Connection, conURL string, httpClient utils.HTTPClient, address string) (*[]RegistryResponse, error)

RemoveRegistrySecret : Remove a registry secret from the PFE container

func SetLogLevel

func SetLogLevel(conInfo *connections.Connection, conURL string, httpClient utils.HTTPClient, newLogLevel string) error

SetLogLevel : Set the current log level for the PFE container

Types

type AddressParameter

type AddressParameter struct {
	Address string `json:"address"`
}

AddressParameter : Used when removing credentials.

type ContainerVersions

type ContainerVersions struct {
	CwctlVersion       string `json:"cwctlVersion,omitempty"`
	PerformanceVersion string `json:"performanceVersion"`
	GatekeeperVersion  string `json:"gatekeeperVersion,omitempty"`
	PFEVersion         string `json:"PFEVersion"`
}

ContainerVersions : The versions of the Codewind containers that are running

func GetContainerVersions

func GetContainerVersions(conURL, cwctlVersion string, connection *connections.Connection, httpClient utils.HTTPClient) (ContainerVersions, error)

GetContainerVersions : Get the versions of each Codewind container, for a given connection ID

type ContainerVersionsList

type ContainerVersionsList struct {
	CwctlVersion     string                       `json:"cwctlVersion"`
	Connections      map[string]ContainerVersions `json:"connections"`
	ConnectionErrors map[string]error             `json:"errors"`
}

ContainerVersionsList : The versions of the Codewind containers that are running on all connections Adds errors into the struct in order to report as many correct versions as possible

func GetAllContainerVersions

func GetAllContainerVersions(connectionsList []connections.Connection, cwctlVersion string, httpClient utils.HTTPClient) (ContainerVersionsList, error)

GetAllContainerVersions : Get the versions of each Codewind container for each given connection ID

type Credentials

type Credentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

Credentials : The registry credentials, sent as a base64 encoded string.

type EnvResponse

type EnvResponse struct {
	Version        string `json:"codewind_version"`
	ImageBuildTime string `json:"image_build_time"`
}

EnvResponse : The relevant response fields from the remote environment API

type IgnoredPaths

type IgnoredPaths []string

IgnoredPaths is the list of paths to ignore, when syncing a project

func GetIgnoredPaths

func GetIgnoredPaths(httpClient utils.HTTPClient, connection *connections.Connection, projectType string, conURL string) (IgnoredPaths, error)

GetIgnoredPaths calls pfe to get the default ignoredPaths for that projectType

type LogParameter

type LogParameter struct {
	Level string `json:"level"`
}

LogParameter : The request structure to set the log level

type LoggingResponse

type LoggingResponse struct {
	CurrentLevel string   `json:"currentLevel"`
	DefaultLevel string   `json:"defaultLevel"`
	AllLevels    []string `json:"allLevels"`
}

LoggingResponse : The logging level information

func GetLogLevel

func GetLogLevel(conInfo *connections.Connection, conURL string, httpClient utils.HTTPClient) (LoggingResponse, error)

GetLogLevel : Get the current log level for the PFE container

type MockMultipleResponses

type MockMultipleResponses struct {
	MockResponses []MockResponse
	Counter       int
}

MockMultipleResponses takes a slice of MockResponses and iterates through them on each request Used when a function makes multiple PFE API requests

func (*MockMultipleResponses) Do

Do makes a http request and increments the MockMultipleResponses counter

type MockResponse

type MockResponse struct {
	StatusCode int
	Body       io.ReadCloser
}

MockResponse mocks the response of a http client

func (*MockResponse) Do

func (c *MockResponse) Do(req *http.Request) (*http.Response, error)

Do makes a http request

type RegistryParameters

type RegistryParameters struct {
	Address     string `json:"address"`
	Credentials string `json:"credentials"`
}

RegistryParameters : The request structure to set the log level

type RegistryResponse

type RegistryResponse struct {
	Address          string `json:"address"`
	Username         string `json:"username"`
	LocalDockerError string `json:"localDockerError,omitempty"`
}

RegistryResponse : The registry information

type RepoCreationOptions added in v0.14.0

type RepoCreationOptions struct {
	URL            string                `json:"url,omitempty"`
	Description    string                `json:"description,omitempty"`
	Name           string                `json:"name,omitempty"`
	GitCredentials *utils.GitCredentials `json:"gitCredentials,omitempty"`
}

RepoCreationOptions is the request body for PFE's POST /templates/repositories API

type RepoOperation

type RepoOperation struct {
	Operation string `json:"op"`
	URL       string `json:"url"`
	Value     string `json:"value"`
}

RepoOperation represents a requested operation on a template repository.

type SubResponseFromBatchOperation

type SubResponseFromBatchOperation struct {
	Status             int           `json:"status"`
	RequestedOperation RepoOperation `json:"requestedOperation"`
	Error              string        `json:"error"`
}

SubResponseFromBatchOperation represents a sub-response to a requested operation on a template repository.

func BatchPatchTemplateRepos

func BatchPatchTemplateRepos(conID string, operations []RepoOperation) ([]SubResponseFromBatchOperation, error)

BatchPatchTemplateRepos requests that PFE perform batch operations on template repositories and returns a list of sub-responses to the requested operations

type Template

type Template struct {
	Label        string `json:"label"`
	Description  string `json:"description"`
	Language     string `json:"language"`
	URL          string `json:"url"`
	ProjectType  string `json:"projectType"`
	ProjectStyle string `json:"projectStyle,omitempty"`
	Source       string `json:"source,omitempty"`
	SourceID     string `json:"sourceId,omitempty"`
}

Template represents a project template.

func GetTemplates

func GetTemplates(conID, projectStyle string, showEnabledOnly bool) ([]Template, error)

GetTemplates gets project templates from PFE's REST API. Filter them using the function arguments

Jump to

Keyboard shortcuts

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