Documentation ¶
Index ¶
- Constants
- Variables
- func IsNotFoundError(err error) bool
- type App
- type AppCruder
- type AppRepoBuilder
- type AppTypes
- type ArtifactRetriever
- type AttrFilterFunc
- type Attributer
- type AuthChecker
- type AuthCheckerBuilder
- type Build
- type BuildAsset
- type BuildAssetType
- type BuildConfig
- type BuildCruder
- type BuildDownload
- type BuildGitRepo
- type BuildRepoBuilder
- type BuildStatus
- type ConfigParams
- type ExternalHTTPRequester
- type GatheredMetric
- type GenericClientConfig
- type HTTPRequesterBuilder
- type K8ClientBuilder
- type MetricsGetter
- type MounterBuilder
- type NotFoundError
- type OSClientBuilder
- type SCCInterface
- type SCClientBuilder
- type Service
- type ServiceConfig
- type ServiceCruder
- type ServiceIntegration
- type ServiceRepoBuilder
- type ServiceTypes
- type StatusError
- type User
- type UserAccessChecker
- type UserRepo
- type UserRepoBuilder
- type VolumeMounter
- type VolumeMounterUnmounter
- type VolumeUnmounter
Constants ¶
const ( ServiceNameKeycloak = "keycloak" ServiceNameThreeScale = "3scale" ServiceNameSync = "fh-sync-server" ServiceNameMobileCICD = "aerogear-digger" ServiceNameCustom = "custom" IntegrationAPIKeys = "mcp-mobile-keys" )
const AndroidApp = "android"
AndroidApp Type for Android app
const (
//AppAPIKeyHeader is the header sent by mobile clients when they want to interact with mcp
AppAPIKeyHeader = "x-app-api-key"
)
const CordovaApp = "cordova"
CordovaApp Type for Cordova app
const IOSApp = "iOS"
IOSApp Type for iOS app
Variables ¶
var ValidAppTypes = AppTypes{CordovaApp, AndroidApp, IOSApp}
ValidAppTypes is a list of valid app types
var ValidClientConfigServices = ServiceTypes{ServiceNameKeycloak, ServiceNameSync, ServiceNameCustom}
var ValidServiceTypes = ServiceTypes{ServiceNameKeycloak, ServiceNameThreeScale, ServiceNameSync, ServiceNameMobileCICD, ServiceNameCustom}
var ValidServicesAndIntegrations = ServiceTypes{ServiceNameKeycloak, ServiceNameThreeScale, ServiceNameSync, ServiceNameMobileCICD, ServiceNameCustom, IntegrationAPIKeys}
Functions ¶
func IsNotFoundError ¶
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 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 ArtifactRetriever ¶
type AttrFilterFunc ¶
type AttrFilterFunc func(attrs Attributer) bool
type Attributer ¶
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 BuildGitRepo ¶
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 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 ServiceCruder ¶
type ServiceIntegration ¶
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 ¶
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 ¶
func (*User) InAnyGroup ¶
type UserAccessChecker ¶
type UserRepoBuilder ¶
type UserRepoBuilder interface { WithToken(token string) UserRepoBuilder WithClient(client UserAccessChecker) UserRepoBuilder Build() UserRepo }
type VolumeMounter ¶
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 ¶
VolumeUnmounter defines an interface for unmounting volumes mounted in services