definition

package
v0.0.0-...-9e3994c Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MessageTypeMeta = &Message{
		Dep:       true,
		Virtual:   true,
		Name:      ".k8s.io.apimachinery.pkg.apis.meta.v1.TypeMeta",
		ShortName: "TypeMeta",
		Fields: []*Field{
			{
				Name:        "kind",
				FieldName:   "kind",
				Optional:    true,
				Kind:        protoreflect.StringKind,
				Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated.",
			},
			{
				Name:        "api_version",
				FieldName:   "apiVersion",
				Optional:    true,
				Kind:        protoreflect.StringKind,
				Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.",
			},
		},
		Package: ImportPackage{Path: "go.f110.dev/kubeproto/go/apis/metav1"},
	}
	MessageObjectMeta = &Message{
		Dep:       true,
		Virtual:   true,
		Name:      ".k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta",
		ShortName: "ObjectMeta",
		Package:   ImportPackage{Path: "go.f110.dev/kubeproto/go/apis/metav1"},
	}
	MessageListMeta = &Message{
		Dep:       true,
		Virtual:   true,
		Name:      ".k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta",
		ShortName: "ListMeta",
		Package:   ImportPackage{Path: "go.f110.dev/kubeproto/go/apis/metav1"},
	}
)
View Source
var ProtoreflectKindToJSONSchemaType = map[protoreflect.Kind]string{
	protoreflect.StringKind: "string",
	protoreflect.Int64Kind:  "integer",
	protoreflect.Int32Kind:  "integer",
	protoreflect.BoolKind:   "boolean",
}

Functions

This section is empty.

Types

type Enum

type Enum struct {
	// Name is a fully qualified enum name.
	Name string
	// ShortName is a name of enum
	ShortName string
	Values    []string
	Package   ImportPackage
	// External indicates that this enum is defined by imported proto.
	External bool
}

func NewEnumFromEnumDescriptor

func NewEnumFromEnumDescriptor(e protoreflect.EnumDescriptor, f protoreflect.FileDescriptor, external bool) *Enum

type Enums

type Enums []*Enum

func (Enums) Find

func (e Enums) Find(name string) *Enum

func (*Enums) Own

func (e *Enums) Own() Enums

type Field

type Field struct {
	// Name is a struct field name
	Name Name
	// FieldName is a json tag name
	FieldName string
	Kind      protoreflect.Kind
	// Repeated indicates that this field is an array.
	Repeated bool
	// MessageName is a name of Message if Kind is MessageKind
	MessageName string
	// Description is a string of an account of this field
	Description string
	// Inline indicates the embed field
	Inline bool
	// Optional indicates that this field is an optional field.
	Optional bool
	// Embed indicates that this field is embed
	Embed bool
	// SubResource indicates that this field is the sub resource of Kind
	SubResource bool
	// contains filtered or unexported fields
}

func (*Field) IsMap

func (f *Field) IsMap() bool

func (*Field) MapKeyValue

func (*Field) Tag

func (f *Field) Tag() string

type Fields

type Fields []*Field

type ImportPackage

type ImportPackage struct {
	Name  string
	Path  string
	Alias string
}

type Lister

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

func NewLister

func NewLister(files []string, all *protoregistry.Files, nsm *PackageNamespaceManager) *Lister

func (*Lister) GetEnums

func (l *Lister) GetEnums() Enums

func (*Lister) GetMessages

func (l *Lister) GetMessages() Messages

func (*Lister) ResolveGoType

func (l *Lister) ResolveGoType(packageName string, f *Field) (importPath string, packageAlias string, typeName string)

type Message

type Message struct {
	// Dep indicates that this message is dependent
	Dep bool
	// Name is a fully qualified message name that includes a package name. (e,g, .k8s.io.apimachinery.pkg.apis.meta.v1.TypeMeta)
	Name string
	// ShortName is a name of message (e,g, TypeMeta)
	ShortName string
	// Kind indicates this message is runtime.Object.
	Kind bool
	// Fields has all fields of the message.
	Fields Fields
	// Virtual indicates that the message is not defined protobuf.
	Virtual                  bool
	AdditionalPrinterColumns []*kubeproto.PrinterColumn
	Package                  ImportPackage
	// Group is the api group (e,g, authorization.k8s.io)
	Group    string
	SubGroup string
	// Version is the api version (e,g, v1alpha1)
	Version string
	// Scope is a type of this message.
	Scope ScopeType
	// HasTypeMeta indicates this message contains TypeMeta
	HasTypeMeta bool
	// contains filtered or unexported fields
}

func (*Message) ClientName

func (m *Message) ClientName(fqdn bool) string

func (*Message) IsDefinedSubResource

func (m *Message) IsDefinedSubResource() bool

func (*Message) IsList

func (m *Message) IsList() bool

func (*Message) Kubernetes

func (m *Message) Kubernetes() (*kubeproto.Kubernetes, error)

type Messages

type Messages []*Message

func (Messages) FilterKind

func (m Messages) FilterKind() Messages

func (Messages) Find

func (m Messages) Find(name string) *Message

type Name

type Name string

func (Name) CamelCase

func (n Name) CamelCase() string

type PackageNamespaceManager

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

func NewPackageNamespaceManager

func NewPackageNamespaceManager() *PackageNamespaceManager

func (*PackageNamespaceManager) Add

func (m *PackageNamespaceManager) Add(importPath, packageName string) string

Add will manages new package namespace and returns the alias for importPath. packageName argument is an optional.

func (*PackageNamespaceManager) Alias

func (m *PackageNamespaceManager) Alias(importPath string) string

func (*PackageNamespaceManager) All

func (m *PackageNamespaceManager) All() map[string]string

type ScopeType

type ScopeType string
const (
	ScopeTypeNamespaced ScopeType = "namespaced"
	ScopeTypeCluster    ScopeType = "cluster"
)

Jump to

Keyboard shortcuts

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