resources

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendResourceData added in v0.6.0

func AppendResourceData(newResources map[string]Resource)

func GenerateResourceMetadataFromYaml added in v0.6.0

func GenerateResourceMetadataFromYaml(yamlTxt string) (map[string]Resource, error)

func GenerateUrl added in v0.1.0

func GenerateUrl(urlInfo *CrudEntityInfo, args []string) (string, error)

func GenerateUrlViaIdableAttributes added in v0.7.0

func GenerateUrlViaIdableAttributes(urlInfo *CrudEntityInfo, args []id.IdableAttributes) (string, error)

func GetNumberOfVariablesNeeded added in v0.1.0

func GetNumberOfVariablesNeeded(url string) (int, error)

func GetPluralResourceNames added in v0.1.0

func GetPluralResourceNames() []string

func GetPluralResources added in v0.1.0

func GetPluralResources() map[string]Resource

func GetSingularResourceNames added in v0.1.0

func GetSingularResourceNames() []string

func GetTypesOfVariablesNeeded added in v0.5.0

func GetTypesOfVariablesNeeded(url string) ([]string, error)

Types

type CrudEntityAttribute

type CrudEntityAttribute struct {
	// The name of the attribute
	Key string

	// The type of the attribute
	Type           string `yaml:"type"`
	AutoFill       string `yaml:"autofill"`
	AliasAttribute string `yaml:"alias_attribute"`
}

type CrudEntityInfo

type CrudEntityInfo struct {

	// A link to the docs specific for the Crud operation in EPCC.
	Docs string `yaml:"docs"`

	// The Url we should use when invoking this method.
	Url string `yaml:"url"`

	// Content type to send
	ContentType string `yaml:"content-type"`

	// A list of valid query parameters
	QueryParameters string `yaml:"query"`

	// Minimum resources so we don't keep trying to delete in
	MinResources int `yaml:"min"`

	// Override the attribute we use in the URL for a specific key
	ParentResourceValueOverrides map[string]string `yaml:"parent_resource_value_overrides"`
}

type Resource

type Resource struct {
	// The type as far as the EPCC CLI is concerned.
	Type string

	// A link to the generic documentation page about a type in the EPCC API
	Docs string `yaml:"docs"`

	// The type that should be used in the JSON API.
	JsonApiType string `yaml:"json-api-type"`

	// Alterative types used for aliases
	AlternateJsonApiTypesForAliases []string `yaml:"alternate-json-type-for-aliases"`

	// Some resources (e.g., PCM, accelerator svc, bury most attributes under the attributes key). This is considered "compliant", other services just bury attributes under data, this is "legacy.
	JsonApiFormat string `yaml:"json-api-format"`

	// Information about how to get a collection
	GetCollectionInfo *CrudEntityInfo `yaml:"get-collection"`

	// Information about how to get a single object.
	GetEntityInfo *CrudEntityInfo `yaml:"get-entity"`

	// Information about how to create an entity.
	CreateEntityInfo *CrudEntityInfo `yaml:"create-entity"`

	// Information about how to update an entity.
	UpdateEntityInfo *CrudEntityInfo `yaml:"update-entity"`

	// Information about how to delete an entity.
	DeleteEntityInfo *CrudEntityInfo `yaml:"delete-entity"`

	Attributes map[string]*CrudEntityAttribute `yaml:"attributes"`

	// If true, don't wrap json in a data tag
	NoWrapping bool `yaml:"no-wrapping"`

	// The singular name version of the resource.
	SingularName string `yaml:"singular-name"`

	PluralName string

	// Use this value to silence warnings about a resource not supporting resets.
	// This should only be used for cases where we manually fix things, or where
	// a store reset would clear a resource another way (e.g., the resource represents a projection).
	SuppressResetWarning bool `yaml:"suppress-reset-warning"`
}

func GetResourceByName added in v0.1.0

func GetResourceByName(name string) (Resource, bool)

Jump to

Keyboard shortcuts

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