parser

package
v0.0.0-...-edc6381 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deployment

type Deployment struct {
	Kind       string `yaml:"kind"`
	APIVersion string `yaml:"apiVersion"`
	Metadata   struct {
		Name string `yaml:"name"`
	} `yaml:"metadata"`
	Spec struct {
		Template struct {
			Metadata struct {
				Labels struct {
					Name string `yaml:"name"`
				} `yaml:"labels"`
			} `yaml:"metadata"`
			Spec struct {
				Containers []struct {
					Name  string `yaml:"name"`
					Image string `yaml:"image"`
					Ports []struct {
						ContainerPort int    `yaml:"containerPort"`
						Protocol      string `yaml:"protocol"`
					} `yaml:"ports"`
				} `yaml:"containers"`
			} `yaml:"spec"`
		} `yaml:"template"`
		Replicas int `yaml:"replicas"`
		Triggers []struct {
			Type              string `yaml:"type"`
			ImageChangeParams struct {
				Automatic      bool     `yaml:"automatic"`
				ContainerNames []string `yaml:"containerNames"`
				From           struct {
					Kind string `yaml:"kind"`
					Name string `yaml:"name"`
				} `yaml:"from"`
			} `yaml:"imageChangeParams,omitempty"`
		} `yaml:"triggers,omitempty"`
		Strategy struct {
			Type string `yaml:"type"`
		} `yaml:"strategy"`
		Paused               bool `yaml:"paused"`
		RevisionHistoryLimit int  `yaml:"revisionHistoryLimit"`
		MinReadySeconds      int  `yaml:"minReadySeconds"`
	} `yaml:"spec"`
}

Deployment is the struct type for Openshift App Deployment configuration

type Parser

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

Parser is the main callable struct

func New

func New() Parser

New the client

func (*Parser) Deployment

func (p *Parser) Deployment(file string) error

Deployment reads the yaml and returns the Deployment struct

func (*Parser) GetImage

func (p *Parser) GetImage() string

GetImage returns the image used in 1st container

func (*Parser) GetImageForContainer

func (p *Parser) GetImageForContainer(containerName string) string

GetImageForContainer returns the image used in a specific container name

func (*Parser) SetImage

func (p *Parser) SetImage(newImage string)

SetImage sets new image for 1st container

func (*Parser) SetImageForContainer

func (p *Parser) SetImageForContainer(newImage string, containerName string)

SetImageForContainer sets new image for specific container name

func (*Parser) WriteDeployment

func (p *Parser) WriteDeployment(outFile string) error

WriteDeployment writes the parsed YAML into a file

Jump to

Keyboard shortcuts

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