cmd

package
v0.0.0-...-f4bcfb3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Copyright © 2020 NAME HERE icjp2600@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2020 NAME HERE icjp2600@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const RequestIDKey ctxKeyRequestID = 0
View Source
const VariablePrefix = "$"

Variables

This section is empty.

Functions

func ErrList

func ErrList() map[ErrorSlug]ErrorInfo

func ErrText

func ErrText(slug ErrorSlug) string

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func Handle

func Handle(h http.Handler) http.Handler

func InterceptorOptionHandler

func InterceptorOptionHandler(p interface{}) error

func RunCmd

func RunCmd(cmd *cobra.Command, args []string)

Types

type ErrorInfo

type ErrorInfo struct {
	HttpCode int
	Message  string
}

type ErrorSlug

type ErrorSlug string
const (
	ErrSlugInternalError ErrorSlug = "INTERNAL_ERROR"
	ErrSlugEmptyQuery    ErrorSlug = "EMPTY_QUERY"
	ErrSlugNotFound      ErrorSlug = "Not Found"
)

func ErrToSlug

func ErrToSlug(e error) ErrorSlug

func ErrorConverter

func ErrorConverter(err ErrorSlug) (string, int, ErrorSlug)

func (ErrorSlug) Error

func (e ErrorSlug) Error() error

func (ErrorSlug) String

func (e ErrorSlug) String() string

type ErrorText

type ErrorText = map[ErrorSlug]string

type Handler

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

func NewHandler

func NewHandler(api *Server, logger zerolog.Logger) *Handler

func (*Handler) CustomHTTPError

func (h *Handler) CustomHTTPError(ctx context.Context, _ *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, req *http.Request, err error)

func (*Handler) Execute

func (h *Handler) Execute(c context.Context, request *pb.ExecuteRequest) (*pb.ExecuteResponse, error)

type RequestTranslator

type RequestTranslator struct {
	Job *pb.Job
	Ctx context.Context
	// contains filtered or unexported fields
}

func NewRequestTranslator

func NewRequestTranslator(job *pb.Job, logger zerolog.Logger) *RequestTranslator

func (*RequestTranslator) Execute

func (r *RequestTranslator) Execute(ctx floc.Context) (*resty.Response, error)

func (*RequestTranslator) FindVarByJPath

func (r *RequestTranslator) FindVarByJPath(js string, jPath string) (interface{}, error)

func (*RequestTranslator) FindVariables

func (r *RequestTranslator) FindVariables(ctx floc.Context, s string) string

func (*RequestTranslator) FlocExecute

func (r *RequestTranslator) FlocExecute() func(ctx floc.Context, ctrl floc.Control) error

type Server

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

func NewServer

func NewServer(logger zerolog.Logger, port string, grpc string) *Server

func (*Server) RunGRPC

func (r *Server) RunGRPC() error

func (*Server) RunHttp

func (r *Server) RunHttp(ctx context.Context) error

Jump to

Keyboard shortcuts

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