replicatedapp

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 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 GithubContent

type GithubContent struct {
	Repo  string       `json:"repo"`
	Path  string       `json:"path"`
	Ref   string       `json:"ref"`
	Files []GithubFile `json:"files"`
}

type GithubFile

type GithubFile struct {
	Name string `json:"name"`
	Path string `json:"path"`
	Sha  string `json:"sha"`
	Size int64  `json:"size"`
	Data string `json:"data"`
}

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) (*GraphQLClient, error)

NewGraphqlClient builds a new client using a viper instance

func (*GraphQLClient) GetRelease

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

GetRelease gets a payload from the graphql server

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 Image

type Image struct {
	URL      string `json:"url"`
	Source   string `json:"source"`
	AppSlug  string `json:"appSlug"`
	ImageKey string `json:"imageKey"`
}

type Resolver

type Resolver interface {
	ResolveAppRelease(
		ctx context.Context,
		selector *Selector,
	) (*api.Release, error)
	RegisterInstall(
		ctx context.Context,
		selector Selector,
		release *api.Release,
	) error
}

func NewAppResolver

func NewAppResolver(
	v *viper.Viper,
	logger log.Logger,
	fs afero.Afero,
	graphql *GraphQLClient,
) Resolver

NewAppResolver builds a resolver from a Viper instance

type Selector

type Selector struct {
	// required
	CustomerID     string `url:"customer_id"`
	InstallationID string `url:"installation_id"`

	// optional
	Upstream      string `url:"upstream,omitempty"`
	ReleaseSemver string `url:"release_semver,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) String

func (s *Selector) String() string

func (*Selector) UnmarshalFrom

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

this is kinda janky

type ShipRelease

type ShipRelease struct {
	ID             string          `json:"id"`
	ChannelID      string          `json:"channelId"`
	ChannelName    string          `json:"channelName"`
	ChannelIcon    string          `json:"channelIcon"`
	Semver         string          `json:"semver"`
	ReleaseNotes   string          `json:"releaseNotes"`
	Spec           string          `json:"spec"`
	Images         []Image         `json:"images"`
	GithubContents []GithubContent `json:"githubContents"`
	Created        string          `json:"created"` // TODO: this time is not in RFC 3339 format
	RegistrySecret string          `json:"registrySecret"`
}

ShipRelease is the release response form GQL

func (*ShipRelease) ToReleaseMeta

func (r *ShipRelease) ToReleaseMeta() api.ReleaseMetadata

ToReleaseMeta linter

type ShipReleaseWrapper

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

ShipReleaseWrapper wraps the release response form GQL

Jump to

Keyboard shortcuts

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