cal

package
v0.0.0-...-b479636 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GQLKIND       graphQLType = "Kind"
	GQLAPIVERSION graphQLType = "ApiVersion"
	GQLMETADATA   graphQLType = "Metadata"
	GQLSPEC       graphQLType = "Spec"
	GQLSTATUS     graphQLType = "Status"
	GQLACCOUNT    graphQLType = "Account"
)
View Source
const (
	NAME graphqlEnum = iota
	NAMESPACE
	UID
	RESOURCEVERSION
	CREATETIMESTAMP
	DELETETIMESTAMP
	LABELS
	ANNOTATIONS
	CLUSTERNAME
)

Sub-fields of GraphQL type METADATA; aligns closely to ObjectMeta in apimachinery/pkg/apigroups/meta/v1/types.go

View Source
const (
	NULLABLE     nullable = ""
	NON_NULLABLE nullable = "!"
)

Variables

View Source
var DefaultTransformer backend.BackendTransformer = defaultTransformer{}
View Source
var MetadataMap = gqlStringMap{
	NAME:            "Name",
	NAMESPACE:       "Namespace",
	UID:             "Uid",
	RESOURCEVERSION: "ResourceVersion",
	CREATETIMESTAMP: "CreateTimestamp",
	DELETETIMESTAMP: "DeleteTimestamp",
	LABELS:          "Labels",
	ANNOTATIONS:     "Annotations",
	CLUSTERNAME:     "ClusterName",
}

Functions

func NewCalBackend

func NewCalBackend(codec runtime.Codec, copier runtime.ObjectCopier, transformer backend.BackendTransformer) backend.Interface

Types

type Argument

type Argument string
const (
	ARGKIND       Argument = "kind"
	ARGAPIVERSION Argument = "apiVersion"
	ARGMETADATA   Argument = "metadata"
	ARGSPEC       Argument = "spec"
	ARGSTATUS     Argument = "status"
)

type Field

type Field struct {
	FieldName        Argument
	FieldArguments   map[string]interface{}
	GraphQLDirective map[GqlDirective]Variable
	SubFields        []*Field
	InlineFrags      map[graphQLType][]graphqlEnum
}

type FragName

type FragName string

type Fragment

type Fragment struct {
	GqlTypeRef graphQLType
	FragFields []*Field
}

type GqlDirective

type GqlDirective string
const (
	INCLUDE GqlDirective = "@include"
	SKIP    GqlDirective = "@skip"
)

type GqlParameter

type GqlParameter struct {
	GqlType         graphQLType
	GqlTypeNullable nullable
}

type GraphQLBody

type GraphQLBody struct {
	OpKeyword  opKeyword
	FuncName   string
	Parameters map[Variable]GqlParameter
	OpBody     ObjectBody
}

type GraphQLDirective

type GraphQLDirective struct {
	Directive     GqlDirective
	DirectiveBool Variable // referenced value must resolve to boolean type
}

type ObjectBody

type ObjectBody struct {
	// ObjectName
	Alias     string
	ObjName   string
	Arguments map[Argument]Variable
	// Field Fragments
	Fields   []*Field
	FragRefs map[FragName]*Fragment
}

type Transformer

type Transformer struct {
	Resource         string // registered API resource
	SingularResource string
	GraphQLBodies    map[Verb]*GraphQLBody
}

func NewCalResourceTransformer

func NewCalResourceTransformer(resource string) *Transformer

func (*Transformer) BackendTransformerInitializer

func (t *Transformer) BackendTransformerInitializer(c backend.Config) error

func (*Transformer) NewGraphQLBody

func (t *Transformer) NewGraphQLBody(verb Verb) (*GraphQLBody, error)

func (*Transformer) TransformFromBackend

func (a *Transformer) TransformFromBackend(ctx context.Context, data string) (string, error)

func (*Transformer) TransformToBackend

func (t *Transformer) TransformToBackend(ctx context.Context, data string) (string, error)

type Variable

type Variable string
const (
	KIND       Variable = "$kind"
	APIVERSION Variable = "$apiVersion"
	METADATA   Variable = "$metadata"
	SPEC       Variable = "$spec"
	STATUS     Variable = "$status"
)

type Verb

type Verb string
const (
	CREATE Verb = "create"
	GET    Verb = "get"
	DELETE Verb = "delete"
	UPDATE Verb = "update"
)

Jump to

Keyboard shortcuts

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