generator

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandInformation

type CommandInformation struct {
	Command string              `yaml:"command"` // The command, such as '/show/system', or 'show system'
	Meta    string              `yaml:"meta"`    // The meta resource, which may be different from the main command name, such as 'drives'
	Include []string            `yaml:"include"` // When a response object includes other response types at the root level, such as 'status'
	Nested  []NestedMeta        `yaml:"nested"`  // When one or more response objects are nested into the main response object, such as 'redundancy' is nested under 'system'
	Options []OptionInformation `yaml:"options"` // One or more command line options
}

type ConfigurationYaml

type ConfigurationYaml struct {
	Header     string                 `yaml:"mc-configuration"`
	Info       GeneralInformation     `yaml:"info"`
	Commands   []CommandInformation   `yaml:"commands"`
	Exceptions []ExceptionInformation `yaml:"exceptions"`
}

func ReadYamlConfigurationFile

func ReadYamlConfigurationFile(ctx context.Context, filename string) (*ConfigurationYaml, error)

ReadYamlConfigurationFile: Read configuration.yaml

type ExceptionInformation

type ExceptionInformation struct {
	Resource    string `yaml:"resource"`     // The meta resource which has an issue
	Type        string `yaml:"type"`         // The type of exception to handle
	OldProperty string `yaml:"old-property"` // For a rename exception, the old property name
	NewProperty string `yaml:"new-property"` // For a rename exception, the new property name
}

type GeneralInformation

type GeneralInformation struct {
	Title       string `yaml:"title"`
	Description string `yaml:"description"`
}

type NestedMeta

type NestedMeta struct {
	Name   string       `yaml:"name"`   // The name of the meta object, such as 'hosts-groups'
	Nested []NestedMeta `yaml:"nested"` // When one or more response objects are nested into the main response object, such as 'redundancy' is nested under 'system'
}

type OptionInformation

type OptionInformation struct {
	Flag            string `yaml:"flag"`             // The command line parameter option
	Type            string `yaml:"type"`             // The option type: string, enum, abs
	Values          string `yaml:"values"`           // Optional. Allowed enumeration values
	Required        string `yaml:"required"`         // Required is true or false
	KeywordRequired string `yaml:"keyword-required"` // Bool. Indicates keyword should be used in path, or must not be used in path
	Description     string `yaml:"description"`      // Optional. Command description
}

type Section

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

type Specification

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

func (*Specification) AddCommand

func (s *Specification) AddCommand(ctx context.Context, config *common.Config, command *CommandInformation, exceptions []ExceptionInformation) error

AddCommand: retrieve meta data for the command and return schema and add to the specification object in memory

func (*Specification) AddMetaProperties

func (s *Specification) AddMetaProperties(ctx context.Context, config *common.Config, meta string, nested []NestedMeta, exceptions []ExceptionInformation) error

AddMetaProperties: retrieve meta data for the schema and adds properties to specification object in memory This routine is called recursively for each level of nested resources, until the last Nested slice is nil

func (*Specification) GenerateHeader

func (s *Specification) GenerateHeader(ctx context.Context) error

GenerateOpenAPIHeader: Add all required lines for the openapi header section

func (*Specification) GenerateLoginLogout added in v2.1.0

func (s *Specification) GenerateLoginLogout(ctx context.Context) error

GenerateLoginLogout: Add all required lines for MC login and logout paths

func (*Specification) GenerateMetaSchema

func (s *Specification) GenerateMetaSchema(ctx context.Context) error

GenerateMetaSchema: Add required lines to support the meta API command which provides a JSON representation of a resource

func (*Specification) Header

func (s *Specification) Header(level int, line string)

Header: add a new line to the openapi: section of the specification

func (*Specification) Objects

func (s *Specification) Objects(level int, line string)

Objects: add a new line to the components/schemas-objects section of the specification

func (*Specification) Parameters

func (s *Specification) Parameters(level int, line string)

Parameters: add a new line to the components/parameters section of the specification

func (*Specification) Paths

func (s *Specification) Paths(level int, line string)

Paths: add a new line to the paths: section of the specification

func (*Specification) Reset

func (s *Specification) Reset()

Reset: reset all sections of the specification object

func (*Specification) Resources

func (s *Specification) Resources(level int, line string)

Resources: add a new line to the components/schemas-resources section of the specification

func (*Specification) Write

func (s *Specification) Write(ctx context.Context, filename string, append bool) error

Write: write all sections to create an openapi specification yaml file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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