Documentation ¶
Index ¶
- Constants
- Variables
- func CheckCredentialRequests(executor *Executor, spec *PackageSpecification, espec *ExecutorSpecification) (map[string]CredentialsRequestSpec, map[string]string, error)
- func GetCredentials(ctx credentials.Context, spec *Credentials, ...) (*globalconfig.Config, error)
- func GetResource(res ocm.ResourceAccess, target interface{}) error
- func ProcessConfig(name string, octx ocm.Context, cv ocm.ComponentVersionAccess, ...) ([]byte, error)
- func ValidateByScheme(src []byte, schemedata []byte) error
- type CredentialSpec
- type Credentials
- type CredentialsRequest
- type CredentialsRequestSpec
- type Driver
- type Executor
- type ExecutorContext
- type ExecutorSpecification
- type Image
- type Operation
- type OperationResult
- type OutputSpec
- type PackageSpecification
Constants ¶
View Source
const ( PathTOI = "/toi" Inputs = "inputs" Outputs = "outputs" PathExec = PathTOI + "/run" PathOutputs = PathTOI + "/" + Outputs PathInputs = PathTOI + "/" + Inputs InputParameters = "parameters" InputConfig = "config" InputOCMConfig = "ocmconfig" InputOCMRepo = "ocmrepo" )
View Source
const ( TypeTOIPackage = "toiPackage" PackageSpecificationMimeType = "application/vnd.toi.ocm.software.package.v1+yaml" )
View Source
const ( TypeTOIExecutor = "toiExecutor" ExecutorSpecificationMimeType = "application/vnd.toi.ocm.software.executor.v1+yaml" )
Variables ¶
View Source
var ErrUndefined error = errors.New("nil reference")
Functions ¶
func CheckCredentialRequests ¶
func CheckCredentialRequests(executor *Executor, spec *PackageSpecification, espec *ExecutorSpecification) (map[string]CredentialsRequestSpec, map[string]string, error)
CheckCredentialRequests determine required credentials for executor.
func GetCredentials ¶
func GetCredentials(ctx credentials.Context, spec *Credentials, req map[string]CredentialsRequestSpec, mapping map[string]string) (*globalconfig.Config, error)
func GetResource ¶
func GetResource(res ocm.ResourceAccess, target interface{}) error
func ProcessConfig ¶
func ProcessConfig(name string, octx ocm.Context, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver, template []byte, config []byte, libraries []metav1.ResourceReference, schemedata []byte) ([]byte, error)
func ValidateByScheme ¶
Types ¶
type CredentialSpec ¶
type CredentialSpec struct { // ConsumerId specifies the consumer id to look for the crentials ConsumerId credentials.ConsumerIdentity `json:"consumerId,omitempty"` // Reference refers to credentials store in some othe repo Reference *cpi.GenericCredentialsSpec `json:"reference,omitempty"` // Credentials are direct credentials (one of Reference or Credentials must be set) Credentials common.Properties `json:"credentials,omitempty"` // TargetConsumerId specifies the consumer id to feed with this crednetials TargetConsumerId credentials.ConsumerIdentity `json:"targetConsumerId,omitempty"` }
type Credentials ¶
type Credentials struct {
Credentials map[string]CredentialSpec `json:"credentials,omitempty"`
}
func ParseCredentialSpecification ¶
func ParseCredentialSpecification(data []byte, desc string) (*Credentials, error)
type CredentialsRequest ¶
type CredentialsRequest struct {
Credentials map[string]CredentialsRequestSpec `json:"credentials,omitempty"`
}
func ParseCredentialRequest ¶
func ParseCredentialRequest(data []byte) (*CredentialsRequest, error)
type CredentialsRequestSpec ¶
type CredentialsRequestSpec struct { // ConsumerId specified to consumer id the credentials are used for ConsumerId credentials.ConsumerIdentity `json:"consumerId,omitempty"` // Description described the usecase the credentials will be used for Description string `json:"description"` // Properties describes the meaning of the used properties for this // credential set. Properties common.Properties `json:"properties"` // Optional set to true make the request optional Optional bool `json:"optional,omitempty"` }
func (*CredentialsRequestSpec) Match ¶
func (s *CredentialsRequestSpec) Match(o *CredentialsRequestSpec) error
type Executor ¶
type Executor struct { Actions []string `json:"actions,omitempty"` ResourceRef *metav1.ResourceReference `json:"resourceRef,omitempty"` Image *Image `json:"image,omitempty"` CredentialMapping map[string]string `json:"credentialMapping,omitempty"` ParameterMapping json.RawMessage `json:"parameterMapping,omitempty"` Config json.RawMessage `json:"config,omitempty"` Outputs map[string]string `json:"outputs,omitempty"` }
type ExecutorContext ¶
type ExecutorContext struct { Spec ExecutorSpecification Image *Image CV ocm.ComponentVersionAccess }
func DetermineExecutor ¶
func DetermineExecutor(executor *Executor, octx ocm.Context, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver) (*ExecutorContext, error)
type ExecutorSpecification ¶
type ExecutorSpecification struct { CredentialsRequest `json:",inline"` Actions []string `json:"actions,omitempty"` Image *Image `json:"image,omitempty"` ImageRef *metav1.ResourceReference `json:"imageRef,omitempty"` Template json.RawMessage `json:"configTemplate,omitempty"` Libraries []metav1.ResourceReference `json:"templateLibraries,omitempty"` Scheme json.RawMessage `json:"configScheme,omitempty"` Outputs map[string]OutputSpec `json:"outputs,omitempty"` }
type Operation ¶
type Operation struct { // Action is the action to be performed. It is passed a srgument to the executable Action string // ComponentVersion is the name of the root component/version to install ComponentVersion string // Image is the image to invoke Image Image // Environment contains environment variables that should be injected into the container execution Environment map[string]string // Files contains files that should be injected into the invocation image. Files map[string]accessio.BlobAccess // Outputs map of output (sub)paths (e.g. NAME) to the name of the output. // Indicates which outputs the driver should return the contents of in the OperationResult. Outputs map[string]string // Output stream for log messages from the driver Out io.Writer // Output stream for error messages from the driver Err io.Writer }
Operation describes the data passed into the driver to run an operation.
type OperationResult ¶
type OperationResult struct { // Outputs maps from the name of the output to its content. Outputs map[string][]byte // Error is any errors from executing the operation. Error error }
OperationResult is the output of the Driver running an Operation.
func Execute ¶
func Execute(p common.Printer, d Driver, name string, rid metav1.Identity, credsrc accessio.DataSource, paramsrc accessio.DataSource, octx ocm.Context, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver) (*OperationResult, error)
func ExecuteAction ¶
func ExecuteAction(p common.Printer, d Driver, name string, spec *PackageSpecification, creds *Credentials, params []byte, octx ocm.Context, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver) (*OperationResult, error)
type OutputSpec ¶
type OutputSpec struct {
Description string `json:"description,omitempty"`
}
type PackageSpecification ¶
type PackageSpecification struct { CredentialsRequest `json:",inline"` Template json.RawMessage `json:"configTemplate,omitempty"` Libraries []metav1.ResourceReference `json:"templateLibraries,omitempty"` Scheme json.RawMessage `json:"configScheme,omitempty"` Executors []Executor `json:"executors"` }
Click to show internal directories.
Click to hide internal directories.