oam_utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Copyright 2022 Napptive

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppPolicy

type AppPolicy struct {
	// Name of the policy
	Name string `json:"name"`
	// Type of the policy
	Type string `json:"type"`
	// Properties of the policy
	Properties *runtime.RawExtension `json:"properties,omitempty"`
}

AppPolicy with the application policy

type Application

type Application struct {
	// contains filtered or unexported fields
}

Application with a catalog application

func NewApplication

func NewApplication(files []*ApplicationFile) (*Application, error)

NewApplication converts an oam application from an array of yaml files into an Application

func NewApplicationFromTGZ

func NewApplicationFromTGZ(rawApplication []byte) (*Application, error)

NewApplicationFromTGZ receives a tgz file and returns convert the content into an application

func (*Application) ApplyParameters

func (a *Application) ApplyParameters(applicationName string, newName string, newAppSpec string) error

ApplyParameters overwrite the application name and the components spec in application named `applicationName`

func (*Application) GetConfigurations

func (a *Application) GetConfigurations() (map[string]*InstanceConf, error)

GetConfigurations return the name and the componentSpec by application

func (*Application) GetNames

func (a *Application) GetNames() map[string]string

GetNames returns the application name

func (*Application) GetParameters

func (a *Application) GetParameters() (map[string]string, error)

GetParameters returns the components spec of an application indexed by application name

func (*Application) ToYAML

func (a *Application) ToYAML() ([][]byte, [][]byte, error)

ToYAML converts the application in YAML

type ApplicationDefinition

type ApplicationDefinition struct {
	// ApiVersion
	ApiVersion string `json:"apiVersion"`
	// Kind
	Kind string `json:"kind"`
	// Metadata
	Metadata Metadata `json:"metadata"`
	// Spec
	Spec ApplicationSpec `json:"spec"`
}

ApplicationDefinition with the definition of an OAM application

type ApplicationFile

type ApplicationFile struct {
	FileName string
	Content  []byte
}

ApplicationFile with a struct that relates the name of a file to its content

type ApplicationSpec

type ApplicationSpec struct {
	// Components of the applcication
	Components *runtime.RawExtension `json:"components"`
	// Policies of the application
	Policies []AppPolicy `json:"policies,omitempty"`
	// Workflow with the workflowsteps of the application
	Workflow *runtime.RawExtension `json:"workflow,omitempty"`
}

ApplicationSpec with the application specification

type ComponentsNode

type ComponentsNode struct {
	Spec ComponentsYAML
}

ComponentsNode with the components Spec in YAML (with comments) This struct is required to return Application parameters: components: - name: component1 ...

type ComponentsYAML

type ComponentsYAML struct {
	Components yamlV3.Node
}

ComponentsYAML with the components in YAML (the array of components)

type EntityType

type EntityType uint
const (
	EntityType_UNKNOWN EntityType = iota
	EntityType_APP
	EntityType_METADATA
)

type InstanceConf

type InstanceConf struct {
	// Name with the application name
	Name string
	// ComponentSpec with the component specification
	ComponentSpec string
}

type Metadata

type Metadata struct {
	// Name of the resource
	Name string `json:"name"`
	// Annotations of the resource.
	Annotations map[string]string `json:"annotations,omitempty"`
	// Labels related to the resource.
	Labels map[string]string `json:"labels,omitempty"`
}

Jump to

Keyboard shortcuts

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