types

package
v0.0.0-...-616269c Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorCommon

func ErrorCommon(key string, message string) error

func ErrorMismatch

func ErrorMismatch(key, expected, actual string) error

func ErrorNotMatchAny

func ErrorNotMatchAny(key string) error

func ErrorNotMatchAnyValues

func ErrorNotMatchAnyValues(key string, value string, options []string) error

func ErrorShouldDefine

func ErrorShouldDefine(key string) error

func ErrorShouldNotDefine

func ErrorShouldNotDefine(key string, options []string) error

func ErrorShouldNotDefineReadOnly

func ErrorShouldNotDefineReadOnly(key string) error

Types

type AnyType

type AnyType struct {
	Type        string `json:"$type"`
	Description string `json:"description"`
}

func (*AnyType) AsTypeBase

func (t *AnyType) AsTypeBase() *TypeBase

func (*AnyType) FilterConfigurableFields

func (t *AnyType) FilterConfigurableFields(i interface{}) interface{}

func (*AnyType) FilterReadOnlyFields

func (t *AnyType) FilterReadOnlyFields(i interface{}) interface{}

func (*AnyType) Validate

func (t *AnyType) Validate(i interface{}, s string) []error

type ArrayType

type ArrayType struct {
	Type      string         `json:"$type"`
	ItemType  *TypeReference `json:"itemType"`
	MinLength *uint64        `json:"minLength"`
	MaxLength *uint64        `json:"maxLength"`
}

func (*ArrayType) AsTypeBase

func (t *ArrayType) AsTypeBase() *TypeBase

func (*ArrayType) FilterConfigurableFields

func (t *ArrayType) FilterConfigurableFields(i interface{}) interface{}

func (*ArrayType) FilterReadOnlyFields

func (t *ArrayType) FilterReadOnlyFields(i interface{}) interface{}

func (*ArrayType) Validate

func (t *ArrayType) Validate(body interface{}, path string) []error

type BooleanType

type BooleanType struct {
	Type string `json:"$type"`
}

func (*BooleanType) AsTypeBase

func (t *BooleanType) AsTypeBase() *TypeBase

func (*BooleanType) FilterConfigurableFields

func (t *BooleanType) FilterConfigurableFields(i interface{}) interface{}

func (*BooleanType) FilterReadOnlyFields

func (t *BooleanType) FilterReadOnlyFields(i interface{}) interface{}

func (*BooleanType) Validate

func (t *BooleanType) Validate(i interface{}, s string) []error

type ExternalDocumentation

type ExternalDocumentation struct {
	Description string `json:"description"`
	Url         string `json:"url"`
}

type MSGraphSchemaLoader

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

func DefaultMSGraphSchemaLoader

func DefaultMSGraphSchemaLoader() *MSGraphSchemaLoader

func NewMSGraphSchemaLoader

func NewMSGraphSchemaLoader(staticFiles embed.FS) *MSGraphSchemaLoader

func (*MSGraphSchemaLoader) GetResourceDefinition

func (r *MSGraphSchemaLoader) GetResourceDefinition(apiVersion, url string) *ResourceType

func (*MSGraphSchemaLoader) GetSchema

func (r *MSGraphSchemaLoader) GetSchema(apiVersion string) *openapi3.T

func (*MSGraphSchemaLoader) ListAPIVersions

func (r *MSGraphSchemaLoader) ListAPIVersions() []string

func (*MSGraphSchemaLoader) ListReadableResources

func (r *MSGraphSchemaLoader) ListReadableResources(apiVersion string) []ResourceType

func (*MSGraphSchemaLoader) ListResources

func (r *MSGraphSchemaLoader) ListResources(apiVersion string) []ResourceType

type NumberType

type NumberType struct {
	Type     string   `json:"$type"`
	Format   string   `json:"format"`
	MinValue *float64 `json:"minValue"`
	MaxValue *float64 `json:"maxValue"`
}

func (*NumberType) AsTypeBase

func (t *NumberType) AsTypeBase() *TypeBase

func (*NumberType) FilterConfigurableFields

func (t *NumberType) FilterConfigurableFields(i interface{}) interface{}

func (*NumberType) FilterReadOnlyFields

func (t *NumberType) FilterReadOnlyFields(i interface{}) interface{}

func (*NumberType) Validate

func (t *NumberType) Validate(body interface{}, path string) []error

type ObjectProperty

type ObjectProperty struct {
	Type        *TypeReference
	Flags       []ObjectPropertyFlag
	Description *string
}

func (*ObjectProperty) IsDeployTimeConstant

func (o *ObjectProperty) IsDeployTimeConstant() bool

func (*ObjectProperty) IsReadOnly

func (o *ObjectProperty) IsReadOnly() bool

func (*ObjectProperty) IsRequired

func (o *ObjectProperty) IsRequired() bool

func (*ObjectProperty) UnmarshalJSON

func (o *ObjectProperty) UnmarshalJSON(body []byte) error

type ObjectPropertyFlag

type ObjectPropertyFlag int
const (
	None ObjectPropertyFlag = 0

	Required ObjectPropertyFlag = 1 << 0

	ReadOnly ObjectPropertyFlag = 1 << 1

	WriteOnly ObjectPropertyFlag = 1 << 2

	DeployTimeConstant ObjectPropertyFlag = 1 << 3

	Identifier ObjectPropertyFlag = 1 << 4
)

func PossibleObjectPropertyFlagValues

func PossibleObjectPropertyFlagValues() []ObjectPropertyFlag

type ObjectType

type ObjectType struct {
	Type                 string                    `json:"$type"`
	Name                 string                    `json:"name"`
	Properties           map[string]ObjectProperty `json:"properties"`
	AdditionalProperties *TypeReference            `json:"additionalProperties"`
	Sensitive            bool                      `json:"sensitive"`
}

func (*ObjectType) AsTypeBase

func (t *ObjectType) AsTypeBase() *TypeBase

func (*ObjectType) FilterConfigurableFields

func (t *ObjectType) FilterConfigurableFields(body interface{}) interface{}

func (*ObjectType) FilterReadOnlyFields

func (t *ObjectType) FilterReadOnlyFields(body interface{}) interface{}

func (*ObjectType) Validate

func (t *ObjectType) Validate(body interface{}, path string) []error

type ResourceType

type ResourceType struct {
	Type               string
	Name               string
	Url                string
	Description        string
	ExternalDocs       *ExternalDocumentation
	ScopeTypes         []ScopeType
	ReadOnlyScopeTypes []ScopeType
	Body               *TypeReference
	Flags              []ResourceTypeFlag
}

func (*ResourceType) AsTypeBase

func (t *ResourceType) AsTypeBase() *TypeBase

func (*ResourceType) FilterConfigurableFields

func (t *ResourceType) FilterConfigurableFields(body interface{}) interface{}

func (*ResourceType) FilterReadOnlyFields

func (t *ResourceType) FilterReadOnlyFields(i interface{}) interface{}

func (*ResourceType) IsReadOnly

func (t *ResourceType) IsReadOnly() bool

func (*ResourceType) UnmarshalJSON

func (t *ResourceType) UnmarshalJSON(body []byte) error

func (*ResourceType) Validate

func (t *ResourceType) Validate(body interface{}, path string) []error

type ResourceTypeFlag

type ResourceTypeFlag int
const (
	ResourceTypeFlagNone ResourceTypeFlag = 0

	ResourceTypeFlagReadOnly ResourceTypeFlag = 1 << 0
)

func PossibleResourceTypeFlagValues

func PossibleResourceTypeFlagValues() []ResourceTypeFlag

type ScopeType

type ScopeType int
const (
	Unknown ScopeType = 0

	Tenant ScopeType = 1 << 0

	ManagementGroup ScopeType = 1 << 1

	Subscription ScopeType = 1 << 2

	ResourceGroup ScopeType = 1 << 3

	Extension ScopeType = 1 << 4
)

func PossibleScopeTypeValues

func PossibleScopeTypeValues() []ScopeType

func (ScopeType) String

func (scope ScopeType) String() string

type StringType

type StringType struct {
	Type      string   `json:"$type"`
	MinLength *uint64  `json:"minLength"`
	MaxLength *uint64  `json:"maxLength"`
	Sensitive bool     `json:"sensitive"`
	Pattern   string   `json:"pattern"`
	Enum      []string `json:"enum"`
}

func (*StringType) AsTypeBase

func (s *StringType) AsTypeBase() *TypeBase

func (*StringType) FilterConfigurableFields

func (s *StringType) FilterConfigurableFields(i interface{}) interface{}

func (*StringType) FilterReadOnlyFields

func (s *StringType) FilterReadOnlyFields(i interface{}) interface{}

func (*StringType) Validate

func (s *StringType) Validate(body interface{}, path string) []error

type TypeBase

type TypeBase interface {
	AsTypeBase() *TypeBase

	FilterConfigurableFields(interface{}) interface{}

	FilterReadOnlyFields(interface{}) interface{}

	Validate(interface{}, string) []error
}

func NewTypeBaseFromOpenAPISchema

func NewTypeBaseFromOpenAPISchema(input *openapi3.Schema, cache map[*openapi3.Schema]*TypeBase) *TypeBase

type TypeReference

type TypeReference struct {
	Type TypeBase
	Ref  string `json:"$ref"`
}

func (*TypeReference) UpdateType

func (t *TypeReference) UpdateType(types []*TypeBase)

type UnionType

type UnionType struct {
	Type     string           `json:"$type"`
	Elements []*TypeReference `json:"elements"`
}

func (*UnionType) AsTypeBase

func (t *UnionType) AsTypeBase() *TypeBase

func (*UnionType) FilterConfigurableFields

func (t *UnionType) FilterConfigurableFields(i interface{}) interface{}

func (*UnionType) FilterReadOnlyFields

func (t *UnionType) FilterReadOnlyFields(i interface{}) interface{}

func (*UnionType) Validate

func (t *UnionType) Validate(body interface{}, path string) []error

Jump to

Keyboard shortcuts

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