service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayFlag

type ArrayFlag struct {
	Target   *[]interface{}
	ItemType string
}

func (*ArrayFlag) Set

func (f *ArrayFlag) Set(v string) error

func (*ArrayFlag) String

func (f *ArrayFlag) String() string

func (*ArrayFlag) Type

func (f *ArrayFlag) Type() string

type CreateMethod

type CreateMethod struct {
	SupportsUserSettableCreate bool
}

type DeleteMethod

type DeleteMethod struct {
}

type GetMethod

type GetMethod struct {
}

type JSONFlag

type JSONFlag struct {
	Target interface{}
}

func (*JSONFlag) Set

func (f *JSONFlag) Set(v string) error

func (*JSONFlag) String

func (f *JSONFlag) String() string

func (*JSONFlag) Type

func (f *JSONFlag) Type() string

type ListMethod

type ListMethod struct {
}

type PatternInfo

type PatternInfo struct {
	// if true, the pattern represents an individual resource,
	// otherwise it represents a path to a collection of resources
	IsResourcePattern bool
}

type Resource

type Resource struct {
	Singular     string
	Plural       string
	Parents      []*Resource
	Pattern      []string // TOO(yft): support multiple patterns
	Schema       *openapi.Schema
	GetMethod    *GetMethod
	ListMethod   *ListMethod
	CreateMethod *CreateMethod
	UpdateMethod *UpdateMethod
	DeleteMethod *DeleteMethod
}

func (*Resource) ExecuteCommand

func (r *Resource) ExecuteCommand(args []string) (*http.Request, error, string)

type Service

type Service struct {
	ServiceDefinition
	Headers map[string]string
	Client  *http.Client
}

func NewService

func NewService(serviceDefinition ServiceDefinition, headers map[string]string) *Service

func (*Service) ExecuteCommand

func (s *Service) ExecuteCommand(args []string) (string, error)

func (*Service) PrintHelp

func (s *Service) PrintHelp() string

type ServiceDefinition

type ServiceDefinition struct {
	ServerURL string
	Resources map[string]*Resource
}

func GetServiceDefinition

func GetServiceDefinition(api *openapi.OpenAPI, serverURL, pathPrefix string) (*ServiceDefinition, error)

func (*ServiceDefinition) GetResource

func (s *ServiceDefinition) GetResource(resource string) (*Resource, error)

type UpdateMethod

type UpdateMethod struct {
}

Jump to

Keyboard shortcuts

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