resources

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 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 ConvertUriTemplateValueToType added in v0.10.0

func ConvertUriTemplateValueToType(value string) string

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, useAliases bool) (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 GetSingularTypesOfVariablesNeeded added in v0.10.0

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

func GetTypesOfVariablesNeeded added in v0.5.0

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

func PublicInit added in v0.11.0

func PublicInit()

Types

type CrudEntityAttribute

type CrudEntityAttribute struct {
	// The name of the attribute
	Key string `yaml:"-"`

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

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,omitempty"`

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

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

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

type Resource

type Resource struct {
	// The type as far as the EPCC CLI is concerned.
	Type string `yaml:"-"`

	// 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,omitempty"`

	// 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,omitempty"`

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

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

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

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

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

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

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

	PluralName string `yaml:"-"`

	// 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,omitempty"`
}

func GetResourceByName added in v0.1.0

func GetResourceByName(name string) (Resource, bool)

func GetSingularResourceByName added in v0.9.3

func GetSingularResourceByName(name string) (Resource, bool)

func MustGetResourceByName added in v0.11.0

func MustGetResourceByName(name string) Resource

Jump to

Keyboard shortcuts

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