model

package
v0.0.0-...-6175eb3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: GPL-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	FirewalldProtocolTCP = "tcp"
	FirewalldProtocolUDP = "udp"
)
View Source
const (
	/*
		InstanceNumberSubstitutionMagic is a substring that appears among HANA networks service port definitions.
		The substring serves as a placeholder, the actual port number will be calculated by substituting the placeholder
		by a HANA instance number. For example, given a port definition of "1__INST_NUM__2" and an instance number of 00,
		the calculated port number will be "1002".
	*/
	InstanceNumberSubstitutionMagic = "__INST_NUM__"

	/*
		InstanceNumberPlusOneSubstitutionMagic is a substring that appears among HANA networks service port definitions.
		Similar to InstanceNumberSubstitutionMagic, this placeholder will be substituted by instance number plus one.
	*/
	InstanceNumberPlusOneSubstitutionMagic = "__INST_NUM+1__"

	HANAServiceDefinitionTCPKey  = "TCP"
	HANAServiceDefinitionUDPKey  = "UDP"
	HANAGlobalInstanceNumbersKey = "HANA_INSTANCE_NUMBERS"
)

Variables

This section is empty.

Functions

func UniqueSortedInts

func UniqueSortedInts(in []int) (out []int)

UniqueSortedInts returns unique integers among the input, sorted in ascending order.

Types

type FirewalldPort

type FirewalldPort struct {
	Port     int    `xml:"port,attr"`
	Protocol string `xml:"protocol,attr"`
}

FirewalldPort defines a port to be opened in a service.

type FirewalldService

type FirewalldService struct {
	ShortName   string          `xml:"short"`
	Description string          `xml:"description"`
	Ports       []FirewalldPort `xml:"port"`
}

FirewalldService defines a service with its name, description, and ports.

func (*FirewalldService) String

func (svc *FirewalldService) String() string

String returns firewall service details in an easy to read, indented format.

func (*FirewalldService) ToXML

func (svc *FirewalldService) ToXML() string

ToXML serialised service definition into a complete XML document that includes the XML header.

type HANAGlobalParameters

type HANAGlobalParameters struct {
	InstanceNumbers []string
}

HANAGlobalParameters are settings that come from /etc/sysconfig/hana-firewall.

func (*HANAGlobalParameters) GetPortNumbers

func (global *HANAGlobalParameters) GetPortNumbers(portDefinition string) (ret []int, err error)

GetPortNumbers returns actual service port numbers calculated by expanding definition string with instance number parameter. An error will be returned only if there is a number formatting.

func (*HANAGlobalParameters) MakeFirewalldService

func (global *HANAGlobalParameters) MakeFirewalldService(def *HANAServiceDefinition) (serviceShortName string, svc FirewalldService, err error)

MakeFirewalldService generates firewalld service definition for a single HANA service definition.

func (*HANAGlobalParameters) ReadFrom

func (global *HANAGlobalParameters) ReadFrom(txt *txtparser.Sysconfig)

func (*HANAGlobalParameters) WriteInto

func (global *HANAGlobalParameters) WriteInto(txt *txtparser.Sysconfig)

type HANAServiceDefinition

type HANAServiceDefinition struct {
	FileBaseName string   // FileBaseName is the base name of service definition file.
	TCP          []string // TCP port numbers, each one may include the instance number substitution magic.
	UDP          []string // UDP port numbers, each one may include the instance number substitution magic.
}

HANAServiceDefinition is a HANA network service definition written in a sysconfig-style text file.

func (*HANAServiceDefinition) GetShortName

func (def *HANAServiceDefinition) GetShortName() string

GetShortName returns a linted "short name" that identifies a Firewalld service and its XML file.

func (*HANAServiceDefinition) ReadFrom

func (def *HANAServiceDefinition) ReadFrom(txt *txtparser.Sysconfig)

ReadFromText reads definition content from a sysconfig-style text file.

func (*HANAServiceDefinition) WriteInto

func (def *HANAServiceDefinition) WriteInto(txt *txtparser.Sysconfig)

WriteInto overwrites keys and values of text file with the current definition content.

Jump to

Keyboard shortcuts

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