mta

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	POST          string = "POST"
	GET           string = "GET"
	MTA_NOT_FOUND string = "no mta found with given id"
)
View Source
const (
	FinishedState string = "FINISHED"
	AbortedState  string = "ABORTED"
)

Variables

This section is empty.

Functions

func CheckOngoingOperation

func CheckOngoingOperation(ctx context.Context, client *APIClient, mtaId string, namespace string, spaceGuid string) (bool, error)

ref - https://github.com/cloudfoundry/multiapps-cli-plugin/blob/v3.2.2/commands/deploy_command.go CheckOngoingOperation checks for ongoing operation for mta with the specified id and tries to abort it.

func PollMtaOperation

func PollMtaOperation(ctx context.Context, client *APIClient, spaceGuid string, operationId string, targetState string) error

Keeps polling the MTA operation by its ID for completion.

Types

type APIClient

type APIClient struct {

	// API Services
	DefaultApi *DefaultApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the MTA REST API API v1.3.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks.

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration(basePath string, userAgent string, client *http.Client) *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type DefaultApiGetMtaOperationsOpts

type DefaultApiGetMtaOperationsOpts struct {
	MtaId *string
	Last  *int
	State []string
}

type DefaultApiService

type DefaultApiService service

func (*DefaultApiService) AsyncUploadFileFromURL

func (a *DefaultApiService) AsyncUploadFileFromURL(ctx context.Context, spaceGuid string, namespace string, fileURL string) (string, *http.Response, error)

Uploads an Multi Target Application archive from a remote URL.

func (*DefaultApiService) ExecuteOperationAction

func (a *DefaultApiService) ExecuteOperationAction(ctx context.Context, spaceGuid string, operationId string, actionId string) (string, *http.Response, error)

Executes a particular action over Multi-Target Application operation.

func (*DefaultApiService) GetAsyncUploadJob

func (a *DefaultApiService) GetAsyncUploadJob(ctx context.Context, spaceGuid string, jobId string, xInstance string, namespace string) (UploadStatus, *http.Response, error)

Gets the status of the upload job from the remote URL.

func (*DefaultApiService) GetCsrfToken

func (a *DefaultApiService) GetCsrfToken(ctx context.Context) (*http.Response, error)

Retrieves a csrf-token header.

func (*DefaultApiService) GetMta

func (a *DefaultApiService) GetMta(ctx context.Context, spaceGuid string, mtaId string, namespace string) (Mta, *http.Response, error)

Retrieves Multi-Target Application in a space.

func (*DefaultApiService) GetMtaOperation

func (a *DefaultApiService) GetMtaOperation(ctx context.Context, spaceGuid string, operationId string, embedProperty string) (Operation, *http.Response, error)

Retrieves Multi-Target Application operation.

func (*DefaultApiService) GetMtaOperations

func (a *DefaultApiService) GetMtaOperations(ctx context.Context, spaceGuid string, localVarOptionals *DefaultApiGetMtaOperationsOpts) ([]Operation, *http.Response, error)

Retrieves Multi-Target Application operations.

func (*DefaultApiService) GetMtas

func (a *DefaultApiService) GetMtas(ctx context.Context, spaceGuid string, namespace *string, mtaId string) ([]Mta, *http.Response, error)

Retrieves all Multi-Target Applications in a space.

func (*DefaultApiService) StartMtaOperation

func (a *DefaultApiService) StartMtaOperation(ctx context.Context, spaceGuid string, operationRequest Operation) (string, Operation, *http.Response, error)

Starts execution of a Multi-Target Application operation.

func (*DefaultApiService) UploadMtaFile

func (a *DefaultApiService) UploadMtaFile(ctx context.Context, spaceGuid string, namespace string, filePath string) (FileMetadata, *http.Response, error)

Uploads an Multi Target Application archive or an Extension Descriptor.

type FileMetadata

type FileMetadata struct {
	Id              string `json:"id,omitempty"`
	Name            string `json:"name,omitempty"`
	Size            int32  `json:"size,omitempty"`
	Digest          string `json:"digest,omitempty"`
	DigestAlgorithm string `json:"digestAlgorithm,omitempty"`
	Space           string `json:"space,omitempty"`
	Namespace       string `json:"namespace,omitempty"`
}

type FileUrl

type FileUrl struct {
	FileUrl string `json:"file_url,omitempty"`
}

type GenericError

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

GenericError Provides access to the body, error and model on returned errors.

func (GenericError) Body

func (e GenericError) Body() []byte

Body returns the raw bytes of the response.

func (GenericError) Error

func (e GenericError) Error() string

Error returns non-empty string if there was an error.

func (GenericError) Model

func (e GenericError) Model() interface{}

Model returns the unpacked model of the error.

type Log

type Log struct {
	Id           string    `json:"id,omitempty"`
	LastModified time.Time `json:"lastModified,omitempty"`
	Content      string    `json:"content,omitempty"`
	Size         int64     `json:"size,omitempty"`
	DisplayName  string    `json:"displayName,omitempty"`
	Description  string    `json:"description,omitempty"`
	ExternalInfo string    `json:"externalInfo,omitempty"`
}

type Message

type Message struct {
	Id        int64  `json:"id,omitempty"`
	Text      string `json:"text,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
	Type_     string `json:"type,omitempty"`
}

type Metadata

type Metadata struct {
	Id        string `json:"id,omitempty"`
	Version   string `json:"version,omitempty"`
	Namespace string `json:"namespace,omitempty"`
}

type Module

type Module struct {
	ModuleName            string    `json:"moduleName,omitempty"`
	AppName               string    `json:"appName,omitempty"`
	CreatedOn             time.Time `json:"createdOn,omitempty"`
	UpdatedOn             time.Time `json:"updatedOn,omitempty"`
	ProvidedDendencyNames []string  `json:"providedDendencyNames,omitempty"`
	Services              []string  `json:"services,omitempty"`
	Uris                  []string  `json:"uris,omitempty"`
}

type Mta

type Mta struct {
	Metadata *Metadata `json:"metadata,omitempty"`
	Modules  []Module  `json:"modules,omitempty"`
	Services []string  `json:"services,omitempty"`
}

type MtaDescriptor

type MtaDescriptor struct {
	SchemaVersion string `yaml:"_schema-version,omitempty"`
	ID            string `yaml:"ID,omitempty"`
	Version       string `yaml:"version,omitempty"`
	Namespace     string `yaml:"namespace,omitempty"`
}

func GetMtaDescriptorFromArchive

func GetMtaDescriptorFromArchive(mtaArchiveFilePath string) (MtaDescriptor, error)

ref - https://github.com/cloudfoundry/multiapps-cli-plugin/blob/v3.2.2/util/archive_handler.go GetMtaDescriptorFromArchive retrieves MTA ID from MTA archive.

type Operation

type Operation struct {
	ProcessId    string                 `json:"processId,omitempty"`
	ProcessType  string                 `json:"processType,omitempty"`
	StartedAt    string                 `json:"startedAt,omitempty"`
	EndedAt      string                 `json:"endedAt,omitempty"`
	SpaceId      string                 `json:"spaceId,omitempty"`
	MtaId        string                 `json:"mtaId,omitempty"`
	Namespace    string                 `json:"namespace,omitempty"`
	User         string                 `json:"user,omitempty"`
	AcquiredLock bool                   `json:"acquiredLock,omitempty"`
	State        string                 `json:"state,omitempty"`
	ErrorType    string                 `json:"errorType,omitempty"`
	Messages     []Message              `json:"messages,omitempty"`
	Parameters   map[string]interface{} `json:"parameters,omitempty"`
}

type ProcessType

type ProcessType struct {
	Name string `json:"name,omitempty"`
}

type Request

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

type UploadStatus

type UploadStatus struct {
	Status string       `json:"status,omitempty"`
	File   FileMetadata `json:"file,omitempty"`
	MtaId  string       `json:"mta_id,omitempty"`
	Error  string       `json:"error,omitempty"`
}

func PollMtaJob

func PollMtaJob(ctx context.Context, client *APIClient, spaceGuid string, jobId string, targetState string, xInstance string, namespace string) (jobResponse UploadStatus, err error)

Keeps polling the MTA job by its ID for completion.

Jump to

Keyboard shortcuts

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