...

Package api

Overview ▾

Package api contains structures returned by commands as JSON and utilities to build values of these structures

Constants

const (
    // TypeUnknown means that odo cannot tell its state
    TypeUnknown = "Unknown"
    // TypeNone means that it has not been pushed to the cluster *at all* in either deploy or dev
    TypeNone = "None"
)

type BindableService

type BindableService struct {
    Name       string `json:"name,omitempty"`
    Namespace  string `json:"namespace,omitempty"`
    Kind       string `json:"kind,omitempty"`
    APIVersion string `json:"apiVersion,omitempty"`
    Service    string `json:"service,omitempty"`
}

type ClusterClientInfo

type ClusterClientInfo struct {
    Version string `json:"version,omitempty"`
}

type ClusterInfo

type ClusterInfo struct {
    ServerURL  string             `json:"serverURL,omitempty"`
    Kubernetes *ClusterClientInfo `json:"kubernetes,omitempty"`
    OpenShift  *ClusterClientInfo `json:"openshift,omitempty"`
}

type Component

Component describes the state of a devfile component

type Component struct {
    DevfilePath       string            `json:"devfilePath,omitempty"`
    DevfileData       *DevfileData      `json:"devfileData,omitempty"`
    DevControlPlane   []DevControlPlane `json:"devControlPlane,omitempty"`
    DevForwardedPorts []ForwardedPort   `json:"devForwardedPorts,omitempty"`
    // RunningIn is the overall running mode map of the component;
    // this is computing as a merge of RunningOn (all the different running modes
    // for each platform the component is running on).
    RunningIn RunningModes `json:"runningIn"`
    // RunningOn represents the map of running modes for each platform the component is running on.
    // The key is the platform, either cluster or podman.
    RunningOn map[string]RunningModes `json:"runningOn,omitempty"`
    Ingresses []ConnectionData        `json:"ingresses,omitempty"`
    Routes    []ConnectionData        `json:"routes,omitempty"`
    ManagedBy string                  `json:"managedBy"`
}

type ComponentAbstract

ComponentAbstract represents a component as part of a list of components

type ComponentAbstract struct {
    Name             string `json:"name"`
    ManagedBy        string `json:"managedBy"`
    ManagedByVersion string `json:"managedByVersion"`
    // RunningIn are the modes the component is running in, among Dev and Deploy
    RunningIn RunningModes `json:"runningIn"`
    Type      string       `json:"projectType"`
    // RunningOn is the platform the component is running on, either cluster or podman
    //
    // Deprecated: This field is deprecated and will be replaced by Platform
    RunningOn string `json:"runningOn,omitempty"`
    // Platform is the platform the component is running on, either cluster or podman
    Platform string `json:"platform,omitempty"`
}

type ConnectionData

type ConnectionData struct {
    Name  string  `json:"name"`
    Rules []Rules `json:"rules,omitempty"`
}

type DetectionResult

DetectionResult indicates the result of an analysis against a given project. Analysis might be performed via the Alizer backend or non-interactively via the Flags backend. It contains detection analysis information such as the location of a devfile, either in a devfile registry or using a path or a URI or the application ports if any.

type DetectionResult struct {
    // name of the Devfile in Devfile registry (required if DevfilePath is not defined)
    Devfile string `json:"devfile,omitempty"`

    // name of the devfile registry (as configured in odo registry). It can be used in combination with Devfile, but not with DevfilePath (optional)
    DevfileRegistry string `json:"devfileRegistry,omitempty"`

    // path to a devfile. This is alternative to using devfile from Devfile registry. It can be local filesystem path or http(s) URL (required if Devfile is not defined)
    DevfilePath string `json:"devfilePath,omitempty"`

    // ApplicationPorts represents the list of ports detected
    ApplicationPorts []int  `json:"ports,omitempty"`
    DevfileVersion   string `json:"devfileVersion,omitempty"`
    // Name represents the project/application name as detected by alizer
    Name string `json:"name,omitempty"`
    // Architectures represent the architectures with which the Devfile must be compatible with.
    Architectures []string `json:"architectures,omitempty"`
}

type DevControlPlane

type DevControlPlane struct {
    Platform         string `json:"platform,omitempty"`
    LocalPort        int    `json:"localPort"`
    APIServerPath    string `json:"apiServerPath"`
    WebInterfacePath string `json:"webInterfacePath,omitempty"`
}

func (DevControlPlane) GetPlatform

func (o DevControlPlane) GetPlatform() string

type DevfileCommand

type DevfileCommand struct {
    Name          string               `json:"name,omitempty"`
    Type          DevfileCommandType   `json:"type,omitempty"`
    Group         DevfileCommandGroup  `json:"group,omitempty"`
    IsDefault     *bool                `json:"isDefault,omitempty"`
    CommandLine   string               `json:"commandLine,omitempty"`
    Component     string               `json:"component,omitempty"`
    ComponentType DevfileComponentType `json:"componentType,omitempty"`
    ImageName     string               `json:"imageName,omitempty"`
}

type DevfileCommandGroup

type DevfileCommandGroup string
const (
    BuildCommandGroup  DevfileCommandGroup = "build"
    RunCommandGroup    DevfileCommandGroup = "run"
    TestCommandGroup   DevfileCommandGroup = "test"
    DebugCommandGroup  DevfileCommandGroup = "debug"
    DeployCommandGroup DevfileCommandGroup = "deploy"
)

type DevfileCommandType

type DevfileCommandType string
const (
    ExecCommandType      DevfileCommandType = "exec"
    ApplyCommandType     DevfileCommandType = "apply"
    CompositeCommandType DevfileCommandType = "composite"
)

type DevfileComponentType

type DevfileComponentType string
const (
    ImageComponentType      DevfileComponentType = "image"
    ContainerComponentType  DevfileComponentType = "container"
    KubernetesComponentType DevfileComponentType = "kubernetes"
    OpenshiftComponentType  DevfileComponentType = "openshift"
)

type DevfileData

DevfileData describes a devfile content

type DevfileData struct {
    Devfile              data.DevfileData      `json:"devfile"`
    Commands             []DevfileCommand      `json:"commands,omitempty"`
    SupportedOdoFeatures *SupportedOdoFeatures `json:"supportedOdoFeatures,omitempty"`
}

func GetDevfileData

func GetDevfileData(devfileObj parser.DevfileObj) (*DevfileData, error)

type DevfileStack

DevfileStack is the main struct for devfile stack

type DevfileStack struct {
    Name        string   `json:"name"`
    DisplayName string   `json:"displayName"`
    Description string   `json:"description"`
    Registry    Registry `json:"registry"`
    Language    string   `json:"language"`
    Tags        []string `json:"tags"`
    ProjectType string   `json:"projectType"`

    // DefaultVersion is the default version. Marshalled as "version" for backward compatibility.
    // Deprecated. Use Versions instead.
    DefaultVersion string                `json:"version"`
    Versions       []DevfileStackVersion `json:"versions,omitempty"`

    // DefaultStarterProjects is the list of starter projects for the default stack.
    // Marshalled as "starterProjects" for backward compatibility.
    // Deprecated. Use Versions.StarterProjects instead.
    DefaultStarterProjects []string     `json:"starterProjects"`
    DevfileData            *DevfileData `json:"devfileData,omitempty"`
    Architectures          []string     `json:"architectures,omitempty"`
}

type DevfileStackVersion

type DevfileStackVersion struct {
    Version         string                           `json:"version,omitempty"`
    IsDefault       bool                             `json:"isDefault"`
    SchemaVersion   string                           `json:"schemaVersion,omitempty"`
    StarterProjects []string                         `json:"starterProjects"`
    CommandGroups   map[schema.CommandGroupKind]bool `json:"commandGroups"`
}

type ForwardedPort

type ForwardedPort struct {
    Platform      string `json:"platform,omitempty"`
    ContainerName string `json:"containerName"`
    PortName      string `json:"portName"`
    IsDebug       bool   `json:"isDebug"`
    LocalAddress  string `json:"localAddress"`
    LocalPort     int    `json:"localPort"`
    ContainerPort int    `json:"containerPort"`
    Exposure      string `json:"exposure,omitempty"`
    Protocol      string `json:"protocol,omitempty"`
}

func (ForwardedPort) GetPlatform

func (o ForwardedPort) GetPlatform() string

type GenericError

GenericError for machine readable output error messages

type GenericError struct {
    Message string `json:"message"`
}

type OdoVersion

type OdoVersion struct {
    Version   string       `json:"version"`
    GitCommit string       `json:"gitCommit"`
    Cluster   *ClusterInfo `json:"cluster,omitempty"`
    Podman    *PodmanInfo  `json:"podman,omitempty"`
}

type PodmanClientInfo

type PodmanClientInfo struct {
    Version string `json:"version,omitempty"`
}

type PodmanInfo

type PodmanInfo struct {
    Client *PodmanClientInfo `json:"client,omitempty"`
}

type PreferenceItem

type PreferenceItem struct {
    Name        string      `json:"name"`
    Value       interface{} `json:"value"`       // The value set by the user, this will be nil if the user hasn't set it
    Default     interface{} `json:"default"`     // default value of the preference if the user hasn't set the value
    Type        string      `json:"type"`        // the type of the preference, possible values int, string, bool
    Description string      `json:"description"` // The description of the preference
}

type PreferenceList

type PreferenceList struct {
    Items []PreferenceItem `json:"items,omitempty"`
}

type PreferenceView

type PreferenceView struct {
    Preferences []PreferenceItem `json:"preferences,omitempty"`
    Registries  []Registry       `json:"registries,omitempty"`
}

type Project

type Project struct {
    Name   string `json:"name,omitempty"`
    Active bool   `json:"active"`
}

type Registry

Registry is the main struct of devfile registry

type Registry struct {
    Name   string `json:"name"`
    URL    string `json:"url"`
    Secure bool   `json:"secure"`
    // Priority of the registry for listing purposes. The higher the number, the higher the priority
    Priority int `json:"-"`
}

type ResourcesList

ResourcesList is the result of the `odo list` command

type ResourcesList struct {
    // ComponentInDevfile is the component name present in the local Devfile when `odo list` is executed, or empty
    ComponentInDevfile string `json:"componentInDevfile,omitempty"`
    // Components is a list of components deployed in the cluster or present in the local Devfile
    Components []ComponentAbstract `json:"components,omitempty"`

    // BindingsInDevfile is the list of binding names present in the local devfile
    BindingsInDevfile []string `json:"bindingsInDevfile,omitempty"`
    // Bindings is a list of bindings in the local devfile and/or cluster
    Bindings []ServiceBinding `json:"bindings,omitempty"`

    // BindableServices is the list of bindable services that could be bound to the component
    BindableServices []BindableService `json:"bindableServices,omitempty"`

    // Namespaces is the list of namespces available for the user on the cluster
    Namespaces []Project `json:"namespaces,omitempty"`
}

type Rules

type Rules struct {
    Host  string   `json:"host"`
    Paths []string `json:"paths"`
}

type RunningMode

type RunningMode string
const (
    RunningModeDev    RunningMode = "dev"
    RunningModeDeploy RunningMode = "deploy"
)

type RunningModes

type RunningModes map[RunningMode]bool

func MergeRunningModes

func MergeRunningModes(m map[string]RunningModes) RunningModes

MergeRunningModes returns a new RunningModes map which is the result of merging all the running modes from each platform, from the map specified.

func NewRunningModes

func NewRunningModes() RunningModes

func (RunningModes) AddRunningMode

func (o RunningModes) AddRunningMode(mode RunningMode)

AddRunningMode sets a running mode as true

func (RunningModes) String

func (o RunningModes) String() string

type ServiceBinding

ServiceBinding describes a service binding, from group binding.operators.coreos.com/v1alpha1 or servicebinding.io/v1alpha3

type ServiceBinding struct {
    Name   string                `json:"name"`
    Spec   ServiceBindingSpec    `json:"spec"`
    Status *ServiceBindingStatus `json:"status,omitempty"`
}

type ServiceBindingReference

type ServiceBindingReference struct {
    Kind       string `json:"kind,omitempty"`
    Resource   string `json:"resource,omitempty"`
    Namespace  string `json:"namespace,omitempty"`
    Name       string `json:"name,omitempty"`
    APIVersion string `json:"apiVersion,omitempty"`
}

type ServiceBindingSpec

type ServiceBindingSpec struct {
    Application            ServiceBindingReference   `json:"application"`
    Services               []ServiceBindingReference `json:"services"`
    DetectBindingResources bool                      `json:"detectBindingResources"`
    BindAsFiles            bool                      `json:"bindAsFiles"`
    NamingStrategy         string                    `json:"namingStrategy,omitempty"`
}

type ServiceBindingStatus

type ServiceBindingStatus struct {
    BindingFiles   []string     `json:"bindingFiles,omitempty"`
    BindingEnvVars []string     `json:"bindingEnvVars,omitempty"`
    RunningIn      RunningModes `json:"runningIn,omitempty"`
}

type SupportedOdoFeatures

SupportedOdoFeatures indicates the support of high-level (odo) features by a devfile component

type SupportedOdoFeatures struct {
    Dev    bool `json:"dev"`
    Deploy bool `json:"deploy"`
    Debug  bool `json:"debug"`
}