Documentation
¶
Overview ¶
Package client manages channels and releases through the Replicated Vendor API.
Index ¶
- Variables
- type BadRequest
- type Client
- type HTTPClient
- func (c *HTTPClient) ArchiveChannel(appID, channelID string) error
- func (c *HTTPClient) CreateApp(name string) (*apps.App, error)
- func (c *HTTPClient) CreateChannel(appID, name, desc string) ([]channels.AppChannel, error)
- func (c *HTTPClient) CreateRelease(appID string) (*releases.AppReleaseInfo, error)
- func (c *HTTPClient) DeleteApp(id string) error
- func (c *HTTPClient) GetAppBySlug(slug string) (*apps.App, error)
- func (c *HTTPClient) GetChannel(appID, channelID string) (*channels.AppChannel, []channels.ChannelRelease, error)
- func (c *HTTPClient) GetRelease(appID string, sequence int64) (*releases.AppRelease, error)
- func (c *HTTPClient) ListApps() ([]apps.AppAndChannels, error)
- func (c *HTTPClient) ListChannels(appID string) ([]channels.AppChannel, error)
- func (c *HTTPClient) ListReleases(appID string) ([]releases.AppReleaseInfo, error)
- func (c *HTTPClient) PromoteRelease(appID string, sequence int64, label, notes string, required bool, ...) error
- func (c *HTTPClient) UpdateRelease(appID string, sequence int64, yaml string) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("Not found")
ErrNotFound represnets a 404 response from the API.
Functions ¶
This section is empty.
Types ¶
type BadRequest ¶
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 Client ¶
type Client interface { GetAppBySlug(slug string) (*apps.App, error) CreateApp(name string) (*apps.App, error) ListChannels(appID string) ([]channels.AppChannel, error) CreateChannel(appID, name, desc string) ([]channels.AppChannel, error) ArchiveChannel(appID, channelID string) error GetChannel(appID, channelID string) (*channels.AppChannel, []channels.ChannelRelease, error) ListReleases(appID string) ([]releases.AppReleaseInfo, error) CreateRelease(appID string) (*releases.AppReleaseInfo, error) UpdateRelease(appID string, sequence int64, yaml string) error GetRelease(appID string, sequence int64) (*releases.AppRelease, error) PromoteRelease( appID string, sequence int64, label string, notes string, required bool, channelIDs ...string) error }
Client provides methods to manage apps, channels, and releases.
func New ¶
New returns a new HTTP client.
Example ¶
token := os.Getenv("REPLICATED_API_TOKEN") appSlug := os.Getenv("REPLICATED_APP_SLUG") api := New(token) app, err := api.GetAppBySlug(appSlug) if err != nil { log.Fatal(err) } channels, err := api.ListChannels(app.Id) if err != nil { log.Fatal(err) } for _, c := range channels { if c.Name == "Stable" { fmt.Println("We have a Stable channel") } }
Output: We have a Stable channel
func NewHTTPClient ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
An HTTPClient communicates with the Replicated Vendor HTTP API.
func (*HTTPClient) ArchiveChannel ¶
func (c *HTTPClient) ArchiveChannel(appID, channelID string) error
ArchiveChannel archives a channel.
func (*HTTPClient) CreateApp ¶
func (c *HTTPClient) CreateApp(name string) (*apps.App, error)
CreateApp creates a new app with the given name and returns it.
func (*HTTPClient) CreateChannel ¶
func (c *HTTPClient) CreateChannel(appID, name, desc string) ([]channels.AppChannel, error)
CreateChannel adds a channel to an app.
func (*HTTPClient) CreateRelease ¶
func (c *HTTPClient) CreateRelease(appID 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) GetAppBySlug ¶
func (c *HTTPClient) GetAppBySlug(slug string) (*apps.App, error)
GetAppBySlug resolves an app by slug.
func (*HTTPClient) GetChannel ¶
func (c *HTTPClient) GetChannel(appID, channelID string) (*channels.AppChannel, []channels.ChannelRelease, error)
GetChannel returns channel details and release history
func (*HTTPClient) GetRelease ¶
func (c *HTTPClient) GetRelease(appID string, sequence int64) (*releases.AppRelease, error)
GetRelease returns a release's properties.
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) ListReleases ¶
func (c *HTTPClient) ListReleases(appID string) ([]releases.AppReleaseInfo, error)
ListReleases lists all releases for an app.
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) UpdateRelease ¶
func (c *HTTPClient) UpdateRelease(appID string, sequence int64, yaml string) error
UpdateRelease updates a release's yaml.