platformclient

package
v0.88.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 17 Imported by: 2

Documentation

Overview

Package platformclient manages channels and releases through the Replicated Vendor API.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrForbidden = errors.New("the action is not allowed for the current user or team")
)
View Source
var ErrNotFound = errors.New("Not found")

ErrNotFound represents a 404 response from the API.

Functions

This section is empty.

Types

type APIError added in v0.53.1

type APIError struct {
	Method     string
	Endpoint   string
	StatusCode int
	Message    string
	Body       []byte
}

func (APIError) Error added in v0.53.1

func (e APIError) Error() string

type AppChannels

type AppChannels []channels.AppChannel

AppChannels sorts []channels.AppChannel by Channel.Position

func (AppChannels) Len

func (acs AppChannels) Len() int

func (AppChannels) Less

func (acs AppChannels) Less(i, j int) bool

func (AppChannels) Swap

func (acs AppChannels) Swap(i, j int)

type AppOptions

type AppOptions struct {
	Name string
}

type BadRequest

type BadRequest struct {
	MessageCode string `json:"messageCode"`
	Message     string `json:"message"`
}

BadRequest represents a 400 response from the API.

func (*BadRequest) Error

func (br *BadRequest) Error() string

Error prints the MessageCode and Message returned from the API.

type ChannelOptions

type ChannelOptions struct {
	Name        string
	Description string
}

type ChannelReleases

type ChannelReleases []channels.ChannelRelease

ChannelReleases sorts []channels.ChannelRelease newest to oldest

func (ChannelReleases) Len

func (crs ChannelReleases) Len() int

func (ChannelReleases) Less

func (crs ChannelReleases) Less(i, j int) bool

func (ChannelReleases) Swap

func (crs ChannelReleases) Swap(i, j int)

type HTTPClient

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

An HTTPClient communicates with the Replicated Vendor HTTP API. TODO: rename this to client

func New

func New(apiKey string) *HTTPClient

New returns a new HTTP client.

func NewHTTPClient

func NewHTTPClient(origin string, apiKey string) *HTTPClient

func (*HTTPClient) ArchiveChannel

func (c *HTTPClient) ArchiveChannel(appID, channelID string) error

ArchiveChannel archives a channel.

func (*HTTPClient) CreateApp

func (c *HTTPClient) CreateApp(opts *AppOptions) (*apps.App, error)

CreateApp creates a new app with the given name and returns it.

func (*HTTPClient) CreateChannel

func (c *HTTPClient) CreateChannel(appID string, name string, description string) error

CreateChannel adds a channel to an app.

func (*HTTPClient) CreateCollector added in v0.64.2

func (c *HTTPClient) CreateCollector(appID string, name string, yaml string) (*types.CollectorSpec, error)

func (*HTTPClient) CreateLicense

func (c *HTTPClient) CreateLicense(license *v2.LicenseV2) (*v2.LicenseV2, error)

CreateLicense creates a new License.

func (*HTTPClient) CreateRelease

func (c *HTTPClient) CreateRelease(appID string, yaml string) (*releases.AppReleaseInfo, error)

CreateRelease adds a release to an app.

func (*HTTPClient) DeleteApp

func (c *HTTPClient) DeleteApp(id string) error

DeleteApp deletes an app by id.

func (*HTTPClient) DoJSON added in v0.29.0

func (c *HTTPClient) DoJSON(ctx context.Context, method string, path string, successStatus int, reqBody interface{}, respBody interface{}) error

DoJSON makes the request, and respBody is a pointer to the struct that we should unmarshal the response into

func (*HTTPClient) DoJSONWithoutUnmarshal added in v0.47.0

func (c *HTTPClient) DoJSONWithoutUnmarshal(method string, path string, reqBody string) ([]byte, error)

func (*HTTPClient) GetApp

func (c *HTTPClient) GetApp(slugOrID string) (*apps.App, error)

GetApp resolves an app by either slug or ID.

func (*HTTPClient) GetChannel

func (c *HTTPClient) GetChannel(appID, channelID string) (*channels.AppChannel, []channels.ChannelRelease, error)

GetChannel returns channel details and release history

func (*HTTPClient) GetCollector added in v0.64.2

func (c *HTTPClient) GetCollector(appID string, specID string) (*types.CollectorSpec, error)

func (*HTTPClient) GetRelease

func (c *HTTPClient) GetRelease(appID string, sequence int64) (*releases.AppRelease, error)

GetRelease returns a release's properties.

func (*HTTPClient) HTTPGet added in v0.29.0

func (c *HTTPClient) HTTPGet(path string, successStatus int) ([]byte, error)

Minimal, simplified version of DoJSON for GET requests, just returns bytes

func (*HTTPClient) LintRelease added in v0.8.0

func (c *HTTPClient) LintRelease(appID string, yaml string) ([]types.LintMessage, error)

func (*HTTPClient) ListApps

func (c *HTTPClient) ListApps() ([]apps.AppAndChannels, error)

ListApps returns all apps and their channels.

func (*HTTPClient) ListChannels

func (c *HTTPClient) ListChannels(appID string) ([]channels.AppChannel, error)

ListChannels returns all channels for an app.

func (*HTTPClient) ListCollectors added in v0.64.2

func (c *HTTPClient) ListCollectors(appID string, appType string) ([]types.CollectorSpec, error)

func (*HTTPClient) ListReleases

func (c *HTTPClient) ListReleases(appID string) ([]releases.AppReleaseInfo, error)

ListReleases lists all releases for an app.

func (*HTTPClient) PromoteCollector added in v0.12.0

func (c *HTTPClient) PromoteCollector(appID string, specID string, channelIDs ...string) error

Vendor-API: PromoteCollector points the specified channels at a named collector.

func (*HTTPClient) PromoteRelease

func (c *HTTPClient) PromoteRelease(appID string, sequence int64, label, notes string, required bool, channelIDs ...string) error

PromoteRelease points the specified channels at a release sequence.

func (*HTTPClient) UpdateCollector added in v0.64.2

func (c *HTTPClient) UpdateCollector(appID string, specID string, yaml string, name string, isArchived bool) error

func (*HTTPClient) UpdateRelease

func (c *HTTPClient) UpdateRelease(appID string, sequence int64, yaml string) error

UpdateRelease updates a release's yaml.

Jump to

Keyboard shortcuts

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