mobile

package
v0.0.0-...-4e66905 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceNameKeycloak   = "keycloak"
	ServiceNameThreeScale = "3scale"
	ServiceNameSync       = "fh-sync-server"
	ServiceNameMobileCICD = "aerogear-digger"
	ServiceNameCustom     = "custom"
	IntegrationAPIKeys    = "mcp-mobile-keys"
)
View Source
const AndroidApp = "android"

AndroidApp Type for Android app

View Source
const (
	//AppAPIKeyHeader is the header sent by mobile clients when they want to interact with mcp
	AppAPIKeyHeader = "x-app-api-key"
)
View Source
const CordovaApp = "cordova"

CordovaApp Type for Cordova app

View Source
const IOSApp = "iOS"

IOSApp Type for iOS app

Variables

ValidAppTypes is a list of valid app types

Functions

func IsNotFoundError

func IsNotFoundError(err error) bool

Types

type App

type App struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	DisplayName string            `json:"displayName"`
	Description string            `json:"description"`
	ClientType  string            `json:"clientType"`
	Labels      map[string]string `json:"labels"`
	APIKey      string            `json:"apiKey"`
	MetaData    map[string]string `json:"metadata"`
}

App represents a mobile app

type AppCruder

type AppCruder interface {
	ReadByName(name string) (*App, error)
	Create(app *App) error
	DeleteByName(name string) error
	List() ([]*App, error)
	Update(app *App) (*App, error)
	CreateAPIKeyMap() error
	AddAPIKeyToMap(app *App) error
	RemoveAPIKeyFromMap(appID string) error
}

type AppRepoBuilder

type AppRepoBuilder interface {
	WithToken(token string) AppRepoBuilder
	//UseDefaultSAToken delegates off to the service account token setup with the MCP. This should only be used for APIs where no real token is provided and should always be protected
	UseDefaultSAToken() AppRepoBuilder
	Build() (AppCruder, error)
}

type AppTypes

type AppTypes []string

AppTypes are the valid app types

func (AppTypes) Contains

func (at AppTypes) Contains(v string) bool

func (AppTypes) String

func (at AppTypes) String() string

type ArtifactRetriever

type ArtifactRetriever interface {
	Retrieve(location *url.URL, token string) (io.ReadCloser, error)
}

type AttrFilterFunc

type AttrFilterFunc func(attrs Attributer) bool

type Attributer

type Attributer interface {
	GetName() string
	GetLabels() map[string]string
	GetType() string
}

type AuthChecker

type AuthChecker interface {
	Check(resource, namespace string, client ExternalHTTPRequester) (bool, error)
}

AuthChecker performs a check for authorization to write the provided resource in the provided namespace

type AuthCheckerBuilder

type AuthCheckerBuilder interface {
	Build() AuthChecker
	WithToken(token string) AuthCheckerBuilder
	WithUserRepo(repo UserRepo) AuthCheckerBuilder
	IgnoreCerts() AuthCheckerBuilder
}

AuthCheckerBuilder builds AuthCheckers

type Build

type Build struct {
	Name     string         `json:"name"`
	Download *BuildDownload `json:"download"`
}

type BuildAsset

type BuildAsset struct {
	Password  string
	Platform  string
	Path      string
	BuildName string
	AppName   string
	Name      string
	Type      BuildAssetType
	AssetData map[string][]byte
}

func (*BuildAsset) Validate

func (ba *BuildAsset) Validate(assetType BuildAssetType) error

type BuildAssetType

type BuildAssetType string
var (
	BuildAssetTypeSourceCredential BuildAssetType = "mobile-src"
	BuildAssetTypeBuildSecret      BuildAssetType = "mobile-build"
)

type BuildConfig

type BuildConfig struct {
	AppID   string        `json:"appID"`
	Name    string        `json:"name"`
	GitRepo *BuildGitRepo `json:"gitRepo"`
}

BuildConfig represents a build of a mobile client. It is converted to a buildconfig

type BuildCruder

type BuildCruder interface {
	Create(b *BuildConfig) error
	BuildApp(name string) error
	AddBuildAsset(asset BuildAsset) (string, error)
	AddDownload(buildName string, dl *BuildDownload) error
	GetDownload(buildName string) (*BuildDownload, error)
	Status(buildName string) (*BuildStatus, error)
}

type BuildDownload

type BuildDownload struct {
	URL     string `json:"url"`
	Expires int64  `json:"expires"`
	Token   string `json:"-"`
}

type BuildGitRepo

type BuildGitRepo struct {
	URI             string `json:"uri"`
	Private         bool   `json:"private"`
	Ref             string `json:"ref"`
	PublicKey       string `json:"public"`
	PublicKeyID     string `json:"publicKeyId"`
	JenkinsFilePath string `json:"jenkinsFilePath"`
}

type BuildRepoBuilder

type BuildRepoBuilder interface {
	WithToken(token string) BuildRepoBuilder
	//UseDefaultSAToken delegates off to the service account token setup with the MCP. This should only be used for APIs where no real token is provided and should always be protected
	UseDefaultSAToken() BuildRepoBuilder
	Build() (BuildCruder, error)
}

type BuildStatus

type BuildStatus struct {
	Links struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		Artifacts struct {
			Href string `json:"href"`
		} `json:"artifacts"`
	} `json:"_links"`
	Phase string `json:"phase"`
}

func (*BuildStatus) ArtifactURL

func (bs *BuildStatus) ArtifactURL() (*url.URL, error)

func (*BuildStatus) Host

func (bs *BuildStatus) Host() (string, error)

type ConfigParams

type ConfigParams map[string]interface{}

type ExternalHTTPRequester

type ExternalHTTPRequester interface {
	Do(req *http.Request) (*http.Response, error)
	Get(url string) (*http.Response, error)
}

type GatheredMetric

type GatheredMetric struct {
	Type string             `json:"type"`
	X    []string           `json:"x"`
	Y    map[string][]int64 `json:"y"`
}

GatheredMetric is a common container for returning metrics to the dashboard

type GenericClientConfig

type GenericClientConfig struct {
	ConfigParams
	Headers map[string]string `json:"headers"`
}

type HTTPRequesterBuilder

type HTTPRequesterBuilder interface {
	Insecure(i bool) HTTPRequesterBuilder
	Timeout(t int) HTTPRequesterBuilder
	Build() ExternalHTTPRequester
}

type K8ClientBuilder

type K8ClientBuilder interface {
	WithToken(token string) K8ClientBuilder
	WithNamespace(ns string) K8ClientBuilder
	WithHost(host string) K8ClientBuilder
	WithHostAndNamespace(host, ns string) K8ClientBuilder
	BuildClient() (kubernetes.Interface, error)
}

TODO probably not a core interface but rather we should wrap it inside the other repos as a dependency and have it consumed via the builders

type MetricsGetter

type MetricsGetter interface {
	GetAll(serviceName string) []*GatheredMetric
	GetOne(serviceName, metric string) *GatheredMetric
}

type MounterBuilder

type MounterBuilder interface {
	Build() (VolumeMounterUnmounter, error)
	WithToken(token string) MounterBuilder
	//UseDefaultSAToken delegates off to the service account token setup with the MCP. This should only be used for APIs where no real token is provided and should always be protected
	UseDefaultSAToken() MounterBuilder
}

MounterBuilder creates VolumeMounterUnmounter objects

type NotFoundError

type NotFoundError struct {
	Message string
}

func (*NotFoundError) Error

func (nfe *NotFoundError) Error() string

type OSClientBuilder

type OSClientBuilder interface {
	WithToken(token string) OSClientBuilder
	WithNamespace(ns string) OSClientBuilder
	WithHost(host string) OSClientBuilder
	WithHostAndNamespace(host, ns string) OSClientBuilder
	//TODO change to Build to be consistent
	BuildClient() (client.Interface, error)
}

type SCCInterface

type SCCInterface interface {
	BindToService(bindableService, targetSvcName string, bindingParams map[string]interface{}, bindableServiceNamespace, targetSvcNamespace string) error
	UnBindFromService(bindableService, targetSvcName, bindableServiceNamespace string) error
	AddMobileApiKeys(targetSvcName, namespace string) error
	RemoveMobileApiKeys(targetSvcName, namespace string) error
}

type SCClientBuilder

type SCClientBuilder interface {
	WithToken(token string) SCClientBuilder
	WithHost(host string) SCClientBuilder
	UseDefaultSAToken() SCClientBuilder
	Build() (SCCInterface, error)
}

type Service

type Service struct {
	ID           string                         `json:"id"`
	Name         string                         `json:"name"`
	DisplayName  string                         `json:"displayName"`
	Namespace    string                         `json:"namespace"`
	Host         string                         `json:"host"`
	Description  string                         `json:"description"`
	Type         string                         `json:"type"`
	Capabilities map[string][]string            `json:"capabilities"`
	Params       map[string]string              `json:"params"`
	Labels       map[string]string              `json:"labels"`
	Integrations map[string]*ServiceIntegration `json:"integrations"`
	External     bool                           `json:"external"`
	Writable     bool                           `json:"writable"`
}

Service represents a serverside application that mobile application will interact with

func NewMobileService

func NewMobileService() *Service

type ServiceConfig

type ServiceConfig struct {
	Config map[string]interface{} `json:"config"`
	Name   string                 `json:"name"`
}

type ServiceCruder

type ServiceCruder interface {
	List(AttrFilterFunc) ([]*Service, error)
	Read(id string) (*Service, error)
	ListConfigs(AttrFilterFunc) ([]*ServiceConfig, error)
	UpdateEnabledIntegrations(svcName string, integrations map[string]string) error
	Create(ms *Service) error
	Delete(serviceID string) error
}

type ServiceIntegration

type ServiceIntegration struct {
	Enabled         bool   `json:"enabled"`
	Component       string `json:"component"`
	Service         string `json:"service"`
	Namespace       string `json:"namespace"`
	ComponentSecret string `json:"componentSecret"`
	DisplayName     string `json:"displayName"`
}

type ServiceRepoBuilder

type ServiceRepoBuilder interface {
	WithToken(token string) ServiceRepoBuilder
	//UseDefaultSAToken delegates off to the service account token setup with the MCP. This should only be used for APIs where no real token is provided and should always be protected
	UseDefaultSAToken() ServiceRepoBuilder
	Build() (ServiceCruder, error)
}

type ServiceTypes

type ServiceTypes []string

TODO move out to config or env var ValidServiceTypes are the service types that we are aware of and support

func (ServiceTypes) Contains

func (st ServiceTypes) Contains(service string) bool

type StatusError

type StatusError struct {
	Message string
	Code    int
}

func (*StatusError) DefaultStatusCode

func (se *StatusError) DefaultStatusCode() int

func (*StatusError) Error

func (se *StatusError) Error() string

func (*StatusError) StatusCode

func (se *StatusError) StatusCode() int

type User

type User struct {
	User   string
	Groups []string
}

func (*User) InAnyGroup

func (u *User) InAnyGroup(groups []string) bool

type UserAccessChecker

type UserAccessChecker interface {
	ReadUserFromToken(host, token string, insecure bool) (*User, error)
}

type UserRepo

type UserRepo interface {
	GetUser() (*User, error)
}

type UserRepoBuilder

type UserRepoBuilder interface {
	WithToken(token string) UserRepoBuilder
	WithClient(client UserAccessChecker) UserRepoBuilder
	Build() UserRepo
}

type VolumeMounter

type VolumeMounter interface {
	Mount(service, clientService *Service) error
}

VolumeMounter defines an interface for mounting volumes into services

type VolumeMounterUnmounter

type VolumeMounterUnmounter interface {
	VolumeMounter
	VolumeUnmounter
}

VolumeMounterUnmounter can both mount and unmount volumes

type VolumeUnmounter

type VolumeUnmounter interface {
	Unmount(service, clientService *Service) error
}

VolumeUnmounter defines an interface for unmounting volumes mounted in services

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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