|
|
|
@ -180,92 +180,3 @@ type Resource struct {
|
|
|
|
|
Properties map[string]interface{} `json:"properties,omitempty"`
|
|
|
|
|
State *ResourceState `json:"state,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: Remove the following section when the refactoring of pkg/registry is complete.
|
|
|
|
|
|
|
|
|
|
// BasicAuthCredential holds a username and password.
|
|
|
|
|
type BasicAuthCredential struct {
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
Password string `json:"password"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// APITokenCredential defines an API token.
|
|
|
|
|
type APITokenCredential string
|
|
|
|
|
|
|
|
|
|
// JWTTokenCredential defines a JWT token.
|
|
|
|
|
type JWTTokenCredential string
|
|
|
|
|
|
|
|
|
|
// RegistryCredential holds a credential used to access a registry.
|
|
|
|
|
type RegistryCredential struct {
|
|
|
|
|
APIToken APITokenCredential `json:"apitoken,omitempty"`
|
|
|
|
|
BasicAuth BasicAuthCredential `json:"basicauth,omitempty"`
|
|
|
|
|
ServiceAccount JWTTokenCredential `json:"serviceaccount,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Registry describes a template registry
|
|
|
|
|
type Registry struct {
|
|
|
|
|
Name string `json:"name,omitempty"` // Friendly name for the registry
|
|
|
|
|
Type RegistryType `json:"type,omitempty"` // Technology implementing the registry
|
|
|
|
|
URL string `json:"url,omitempty"` // URL to the root of the registry
|
|
|
|
|
Format RegistryFormat `json:"format,omitempty"` // Format of the registry
|
|
|
|
|
CredentialName string `json:"credentialname,omitempty"` // Name of the credential to use
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RegistryType defines the technology that implements a registry.
|
|
|
|
|
type RegistryType string
|
|
|
|
|
|
|
|
|
|
// Constants that identify the supported registry types.
|
|
|
|
|
const (
|
|
|
|
|
GithubRegistryType RegistryType = "github"
|
|
|
|
|
GCSRegistryType RegistryType = "gcs"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// RegistryFormat is a semi-colon delimited string that describes the format
|
|
|
|
|
// of a registry.
|
|
|
|
|
type RegistryFormat string
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// Versioning.
|
|
|
|
|
|
|
|
|
|
// VersionedRegistry identifies a versioned registry, where types appear under versions.
|
|
|
|
|
VersionedRegistry RegistryFormat = "versioned"
|
|
|
|
|
// UnversionedRegistry identifies an unversioned registry, where types appear under their names.
|
|
|
|
|
UnversionedRegistry RegistryFormat = "unversioned"
|
|
|
|
|
|
|
|
|
|
// Organization.
|
|
|
|
|
|
|
|
|
|
// CollectionRegistry identfies a collection registry, where types are grouped into collections.
|
|
|
|
|
CollectionRegistry RegistryFormat = "collection"
|
|
|
|
|
// OneLevelRegistry identifies a one level registry, where all types appear at the top level.
|
|
|
|
|
OneLevelRegistry RegistryFormat = "onelevel"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// RegistryService maintains a set of registries that defines the scope of all
|
|
|
|
|
// registry based operations, such as search and type resolution.
|
|
|
|
|
type RegistryService interface {
|
|
|
|
|
// List all the registries
|
|
|
|
|
List() ([]*Registry, error)
|
|
|
|
|
// Create a new registry
|
|
|
|
|
Create(registry *Registry) error
|
|
|
|
|
// Get a registry
|
|
|
|
|
Get(name string) (*Registry, error)
|
|
|
|
|
// Get a registry with credential.
|
|
|
|
|
GetRegistry(name string) (*Registry, error)
|
|
|
|
|
// Delete a registry
|
|
|
|
|
Delete(name string) error
|
|
|
|
|
// Find a registry that backs the given URL
|
|
|
|
|
GetByURL(URL string) (*Registry, error)
|
|
|
|
|
// GetRegistryByURL returns a registry that handles the types for a given URL.
|
|
|
|
|
GetRegistryByURL(URL string) (*Registry, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CredentialProvider provides credentials for registries.
|
|
|
|
|
type CredentialProvider interface {
|
|
|
|
|
// Set the credential for a registry.
|
|
|
|
|
// May not be supported by some registry services.
|
|
|
|
|
SetCredential(name string, credential *RegistryCredential) error
|
|
|
|
|
|
|
|
|
|
// GetCredential returns the specified credential or nil if there's no credential.
|
|
|
|
|
// Error is non-nil if fetching the credential failed.
|
|
|
|
|
GetCredential(name string) (*RegistryCredential, error)
|
|
|
|
|
}
|
|
|
|
|