Documentation
¶
Overview ¶
Program to create, update & delete aspect schemas in cayp Adapted from https://github.com/maxott/cayp-cli/blob/main/pkg/adapter/adapter.go
Adapted from https://github.com/maxott/magda-cli/blob/main/pkg/adapter/payload.go
Adapted from https://github.com/maxott/magda-cli/blob/main/pkg/adapter/adapter.go
Index ¶
- func ProcessErrorResponse(resp *http.Response, path string, pyld Payload, logger *log.Logger) (err error)
- func ReplyPrinter(pld Payload, useYAML bool) (err error)
- type Adapter
- type AdapterError
- type ApiError
- type ClientError
- type ConnectionCtxt
- type IAdapterError
- type MissingUrlError
- type Payload
- func Connect(ctxt context.Context, method string, path string, body io.Reader, length int64, ...) (Payload, error)
- func LoadPayloadFromBytes(data []byte, isYAML bool) (pyld Payload, err error)
- func LoadPayloadFromFile(fileName string, isYAML bool) (Payload, error)
- func LoadPayloadFromStdin(isYAML bool) (Payload, error)
- func ToPayload(body []byte, resp *http.Response, logger *log.Logger) Payload
- type ResourceNotFoundError
- type ResponseHandler
- type UnauthorizedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProcessErrorResponse ¶
func ReplyPrinter ¶
Types ¶
type Adapter ¶
type Adapter interface {
Head(ctxt context.Context, path string, headers *map[string]string, logger *log.Logger) (Payload, error)
Get(ctxt context.Context, path string, logger *log.Logger) (Payload, error)
Get2(ctxt context.Context, path string, headers *map[string]string, respHandler ResponseHandler, logger *log.Logger) error
Post(ctxt context.Context, path string, body io.Reader, length int64, headers *map[string]string, logger *log.Logger) (Payload, error)
PostForm(ctxt context.Context, path string, data url.Values, headers *map[string]string, logger *log.Logger) (Payload, error)
Put(ctxt context.Context, path string, body io.Reader, length int64, headers *map[string]string, logger *log.Logger) (Payload, error)
Patch(ctxt context.Context, path string, body io.Reader, length int64, headers *map[string]string, logger *log.Logger) (Payload, error)
Delete(ctxt context.Context, path string, logger *log.Logger) (Payload, error)
SetUrl(url string)
GetPath(url string) (path string, err error)
}
func RestAdapter ¶
func RestAdapter(connCtxt ConnectionCtxt) Adapter
type AdapterError ¶
type AdapterError struct {
// contains filtered or unexported fields
}
func (*AdapterError) Error ¶
func (e *AdapterError) Error() string
func (*AdapterError) Path ¶
func (e *AdapterError) Path() string
type ApiError ¶
type ApiError struct {
AdapterError
StatusCode int
Payload Payload
}
type ClientError ¶
type ClientError struct {
AdapterError
// contains filtered or unexported fields
}
func (*ClientError) Error ¶
func (e *ClientError) Error() string
type ConnectionCtxt ¶
type IAdapterError ¶
type MissingUrlError ¶
type MissingUrlError struct {
AdapterError
}
func (MissingUrlError) Error ¶
func (e MissingUrlError) Error() string
type Payload ¶
type Payload interface {
// IsObject() bool
AsType(r interface{}) error
AsObject() (map[string]interface{}, error)
AsArray() ([]interface{}, error)
AsBytes() []byte
IsEmpty() bool
Header(key string) string
StatusCode() int
}
func LoadPayloadFromBytes ¶
func LoadPayloadFromStdin ¶
type ResourceNotFoundError ¶
type ResourceNotFoundError struct {
AdapterError
}
func (ResourceNotFoundError) Error ¶
func (e ResourceNotFoundError) Error() string
type ResponseHandler ¶
type UnauthorizedError ¶
type UnauthorizedError struct {
}
func (*UnauthorizedError) Error ¶
func (e *UnauthorizedError) Error() string
Click to show internal directories.
Click to hide internal directories.