model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Name    string
	Content []byte
}

Data holds the raw unparsed data of the model files

type Definition

type Definition struct {
	Name       string
	URL        string
	Operations []Operation
}

Definition contains the service URL and describes all operations the service provides.

type Operation

type Operation struct {
	Name        string
	Description string
	Parameters  []Parameter
	Method      string
	Path        string
}

Operation describes a single api and all its input parameters e.g. GET /nitag/v1/tags/{name}

  • Method is GET
  • Path is /nitag/v1/tags/{name}
  • Parameters contains name as one of the input parameters

type Parameter

type Parameter struct {
	Name        string
	Description string
	TypeInfo    ParameterType
	Location    ParameterLocation
	Required    bool
}

Parameter contains the parsed metadata information of input parameters

type ParameterLocation

type ParameterLocation int

ParameterLocation describes where a parameter value is located

const (
	// PathLocation means the parameter is stored in the path of the URL
	// e.g. /nitag/v1/tags/<path>
	PathLocation ParameterLocation = 1 + iota
	// BodyLocation means the parameter is stored in the message body
	// e.g. { path: "<path>", type: "INT" }
	BodyLocation
	// QueryLocation means the parameter is stored in the query string
	// e.g. /nitag/v1/tags?path=<path>
	QueryLocation
	// HeaderLocation means the parameter is stored in the http header
	// e.g. x-ni-api-key: <api-key>
	HeaderLocation
	// FormDataLocation means the parameter is transferred as part
	// of a form upload
	FormDataLocation
)

type ParameterType

type ParameterType int

ParameterType describes the data type of the parameter

const (
	// StringType means the parameter is a simple UTF8 string
	StringType ParameterType = 1 + iota
	// IntegerType means the parameter is a 32-bit integer
	IntegerType
	// NumberType means the parameter is a floating point number
	NumberType
	// BooleanType means the parameter is boolean
	BooleanType
	// ObjectType means the parameter is a generic object which is simply serialized
	ObjectType
	// FileType means the parameter is a file blob
	FileType
	// StringArrayType means the parameter is an string array
	StringArrayType
	// IntegerArrayType means the parameter is an integer array
	IntegerArrayType
	// NumberArrayType means the parameter is an number array
	NumberArrayType
	// BooleanArrayType means the parameter is an boolean array
	BooleanArrayType
	// ObjectArrayType means the parameter is an object array
	ObjectArrayType
)

type ParameterValue

type ParameterValue struct {
	Parameter
	Value interface{}
}

ParameterValue contains the parameter model definition and its corresponding value

type Settings

type Settings struct {
	APIKey       string
	Username     string
	Password     string
	Verbose      bool
	URL          string
	Insecure     bool
	SSHProxy     string
	SSHKey       string
	SSHKnownHost string
}

Settings are all the global CLI input parameters which can be provided through global CLI switches or the systemlink.yaml configuration file

Jump to

Keyboard shortcuts

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