replicatedapp

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

local.go has methods for resolving a local ship.yaml file, and patching in api.Release info that would usually be returned by pg.replicated.com

Index

Constants

View Source
const GetAppspecQuery = `
query($semver: String) {
  shipRelease (semver: $semver) {
` + ShipRelease + `
  }
}`
View Source
const GetLicenseQuery = `` /* 127-byte string literal not displayed */
View Source
const GetSlugAppSpecQuery = `
query($appSlug: String!, $licenseID: String, $releaseID: String, $semver: String) {
  shipSlugRelease (appSlug: $appSlug, licenseID: $licenseID, releaseID: $releaseID, semver: $semver) {
` + ShipRelease + `
  }
}`
View Source
const RegisterInstallQuery = `` /* 134-byte string literal not displayed */
View Source
const ShipRelease = `` /* 719-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type GQLGetLicenseResponse added in v0.47.0

type GQLGetLicenseResponse struct {
	Data   LicenseWrapper `json:"data,omitempty"`
	Errors []GraphQLError `json:"errors,omitempty"`
}

GQLLicenseResponse is the top-level response object from the graphql server

type GQLGetReleaseResponse

type GQLGetReleaseResponse struct {
	Data   ShipReleaseWrapper `json:"data,omitempty"`
	Errors []GraphQLError     `json:"errors,omitempty"`
}

GQLGetReleaseResponse is the top-level response object from the graphql server

type GQLGetSlugReleaseResponse added in v0.35.0

type GQLGetSlugReleaseResponse struct {
	Data   ShipSlugReleaseWrapper `json:"data,omitempty"`
	Errors []GraphQLError         `json:"errors,omitempty"`
}

GQLGetSlugReleaseResponse is the top-level response object from the graphql server

type GQLRegisterInstallResponse

type GQLRegisterInstallResponse struct {
	Data struct {
		ShipRegisterInstall bool `json:"shipRegisterInstall"`
	} `json:"data,omitempty"`
	Errors []GraphQLError `json:"errors,omitempty"`
}

GQLRegisterInstallResponse is the top-level response object from the graphql server

type GraphQLClient

type GraphQLClient struct {
	GQLServer *url.URL
	Client    *http.Client
}

GraphQLClient is a client for the graphql Payload API

func NewGraphqlClient

func NewGraphqlClient(v *viper.Viper, client *http.Client) (*GraphQLClient, error)

NewGraphqlClient builds a new client using a viper instance

func (*GraphQLClient) GetLicense added in v0.47.0

func (c *GraphQLClient) GetLicense(selector *Selector) (*license, error)

func (*GraphQLClient) GetRelease

func (c *GraphQLClient) GetRelease(selector *Selector) (*state.ShipRelease, error)

GetRelease gets a payload from the graphql server

func (*GraphQLClient) GetSlugRelease added in v0.35.0

func (c *GraphQLClient) GetSlugRelease(selector *Selector) (*state.ShipRelease, error)

GetSlugRelease gets a release from the graphql server by app slug

func (*GraphQLClient) RegisterInstall

func (c *GraphQLClient) RegisterInstall(customerID, installationID, channelID, releaseID string) error

type GraphQLError

type GraphQLError struct {
	Locations []map[string]interface{} `json:"locations"`
	Message   string                   `json:"message"`
	Code      string                   `json:"code"`
}

GraphQLError represents an error returned by the graphql server

type GraphQLRequest

type GraphQLRequest struct {
	Query         string            `json:"query"`
	Variables     map[string]string `json:"variables"`
	OperationName string            `json:"operationName"`
}

GraphQLRequest is a json-serializable request to the graphql server

type LicenseWrapper added in v0.47.0

type LicenseWrapper struct {
	License license `json:"license"`
}

ShipReleaseWrapper wraps the release response form GQL

type Resolver

type Resolver interface {
	ResolveAppRelease(
		ctx context.Context,
		selector *Selector,
		app apptype.LocalAppCopy,
	) (*api.Release, error)
	FetchRelease(
		ctx context.Context,
		selector *Selector,
	) (*state.ShipRelease, error)
	RegisterInstall(
		ctx context.Context,
		selector Selector,
		release *api.Release,
	) error
	SetRunbook(
		runbook string,
	)
	ResolveEditRelease(
		ctx context.Context,
	) (*api.Release, error)
}

func NewAppResolver

func NewAppResolver(
	v *viper.Viper,
	logger log.Logger,
	fs afero.Afero,
	graphql *GraphQLClient,
	stateManager state.Manager,
	ui cli.Ui,
) Resolver

NewAppResolver builds a resolver from a Viper instance

type Selector

type Selector struct {
	// required
	CustomerID     string `url:"customer_id,omitempty"`
	InstallationID string `url:"installation_id,omitempty"`
	// OR
	AppSlug string `url:"AppSlug,omitempty"`

	// optional
	Upstream      string `url:"upstream,omitempty"`
	ReleaseID     string `url:"release_id,omitempty"` // NOTE: this is unused
	ReleaseSemver string `url:"release_semver,omitempty"`
	LicenseID     string `url:"license_id,omitempty"`
}

Selector selects a replicated.app spec from the Vendor's releases and channels. See pkg/cli/root.go for some more info on which are required and why.

note that `url` struct tags are only for serialize, they don't work for deserialize

func (*Selector) GetBasicAuthUsername added in v0.37.0

func (s *Selector) GetBasicAuthUsername() string

func (*Selector) String

func (s *Selector) String() string

func (*Selector) UnmarshalFrom

func (s *Selector) UnmarshalFrom(url *url.URL) *Selector

this is less janky

type ShipReleaseWrapper

type ShipReleaseWrapper struct {
	ShipRelease state.ShipRelease `json:"shipRelease"`
}

ShipReleaseWrapper wraps the release response form GQL

type ShipSlugReleaseWrapper added in v0.35.0

type ShipSlugReleaseWrapper struct {
	ShipSlugRelease state.ShipRelease `json:"shipSlugRelease"`
}

ShipSlugReleaseWrapper wraps the release response form GQL

Jump to

Keyboard shortcuts

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