codespec

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OASTypeString     = "string"
	OASTypeInteger    = "integer"
	OASTypeNumber     = "number"
	OASTypeBoolean    = "boolean"
	OASTypeArray      = "array"
	OASTypeObject     = "object"
	OASFormatDouble   = "double"
	OASFormatFloat    = "float"
	OASFormatPassword = "password"
	OASFormatSet      = "set"

	OASResponseCodeOK      = "200"
	OASResponseCodeCreated = "201"

	OASPathParam = "path"

	DefaultDeprecationMsg = "This resource has been deprecated"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APISpecResource

type APISpecResource struct {
	Description        *string
	DeprecationMessage *string
	CreateOp           *high.Operation
	ReadOp             *high.Operation
	UpdateOp           *high.Operation
	DeleteOp           *high.Operation
	CommonParameters   []*high.Parameter
}

type APISpecSchema

type APISpecSchema struct {
	Schema *base.Schema
	Type   string
}

func BuildSchema

func BuildSchema(proxy *base.SchemaProxy) (*APISpecSchema, error)

This function only builds the schema from a proxy and returns the basic type and format without handling oneOf, anyOf, allOf, or nullable types.

func (*APISpecSchema) GetComputability

func (s *APISpecSchema) GetComputability(name string) ComputedOptionalRequired

func (*APISpecSchema) GetDeprecationMessage

func (s *APISpecSchema) GetDeprecationMessage() *string

func (*APISpecSchema) GetDescription

func (s *APISpecSchema) GetDescription() *string

func (*APISpecSchema) IsSensitive

func (s *APISpecSchema) IsSensitive() *bool

type Attribute

type Attribute struct {
	List      *ListAttribute
	SetNested *SetNestedAttribute

	Float64 *Float64Attribute
	String  *StringAttribute

	Bool         *BoolAttribute
	ListNested   *ListNestedAttribute
	Map          *MapAttribute
	MapNested    *MapNestedAttribute
	Number       *NumberAttribute
	Set          *SetAttribute
	Int64        *Int64Attribute
	SingleNested *SingleNestedAttribute
	Timeouts     *TimeoutsAttribute

	Description              *string
	Name                     SnakeCaseString
	DeprecationMessage       *string
	Sensitive                *bool
	ComputedOptionalRequired ComputedOptionalRequired
}

type Attributes

type Attributes []Attribute

type BoolAttribute

type BoolAttribute struct {
	Default *bool
}

type ComputedOptionalRequired

type ComputedOptionalRequired string
const (
	Computed         ComputedOptionalRequired = "computed"
	ComputedOptional ComputedOptionalRequired = "computed_optional"
	Optional         ComputedOptionalRequired = "optional"
	Required         ComputedOptionalRequired = "required"
)

type CustomDefault

type CustomDefault struct {
	Definition string
	Imports    []string
}

type ElemType

type ElemType int
const (
	Bool ElemType = iota
	Float64
	Int64
	Number
	String
	Unknown
)

type Float64Attribute

type Float64Attribute struct {
	Default *float64
}

type Int64Attribute

type Int64Attribute struct {
	Default *int64
}

type ListAttribute

type ListAttribute struct {
	Default     *CustomDefault
	ElementType ElemType
}

type ListNestedAttribute

type ListNestedAttribute struct {
	Default      *CustomDefault
	NestedObject NestedAttributeObject
}

type MapAttribute

type MapAttribute struct {
	Default     *CustomDefault
	ElementType ElemType
}

type MapNestedAttribute

type MapNestedAttribute struct {
	Default      *CustomDefault
	NestedObject NestedAttributeObject
}

type Model

type Model struct {
	Resources []Resource
}

func ToCodeSpecModel

func ToCodeSpecModel(atlasAdminAPISpecFilePath, configPath string, resourceName *string) (*Model, error)

type NestedAttributeObject

type NestedAttributeObject struct {
	Attributes Attributes
}

type NumberAttribute

type NumberAttribute struct {
	Default *CustomDefault
}

type Operation

type Operation int
const (
	Create Operation = iota
	Update
	Read
	Delete
)

type Resource

type Resource struct {
	Schema *Schema
	Name   SnakeCaseString
}

type Schema

type Schema struct {
	Description        *string
	DeprecationMessage *string

	Attributes Attributes
}

type SetAttribute

type SetAttribute struct {
	Default     *CustomDefault
	ElementType ElemType
}

type SetNestedAttribute

type SetNestedAttribute struct {
	Default      *CustomDefault
	NestedObject NestedAttributeObject
}

type SingleNestedAttribute

type SingleNestedAttribute struct {
	Default      *CustomDefault
	NestedObject NestedAttributeObject
}

type SnakeCaseString

type SnakeCaseString string

func (SnakeCaseString) LowerCaseNoUnderscore

func (snake SnakeCaseString) LowerCaseNoUnderscore() string

func (SnakeCaseString) PascalCase

func (snake SnakeCaseString) PascalCase() string

func (SnakeCaseString) SnakeCase

func (snake SnakeCaseString) SnakeCase() string

type StringAttribute

type StringAttribute struct {
	Default *string
}

type TimeoutsAttribute

type TimeoutsAttribute struct {
	ConfigurableTimeouts []Operation
}

Jump to

Keyboard shortcuts

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