Documentation ¶
Index ¶
- Constants
- Variables
- func AddQueryParameters(baseURL string, queryParams map[string]string) string
- func AsigServer(e *echo.Echo, cs []Controller) error
- func AsigServerGroup(e *echo.Echo, cs []Controller, group string) error
- func BasicAuth(username, password string) string
- func BuildRequestObject(request Request) (*http.Request, error)
- func ExtKey(c echo.Context) string
- func JSONSend(data StDataEnv, e echo.Context) error
- func MakeRequest(req *http.Request) (*http.Response, error)
- func NewNetClient(timeout int) *http.Client
- func RequestNew(tp, scope, message, appName, project, licenseKey string, payload interface{}) (*http.Request, error)
- func SendLogRelic(tp, scope, message, appName, project, licenseKey string, payload interface{})
- func TokenHeaders(token string) map[string]string
- type Browser
- type Client
- type ConfigServer
- type Controller
- type EchoRelic
- type HTTPPet
- type HTTPTip
- type MapMsjPet
- type Request
- type Response
- type RestError
- type StDataEnv
- type StInfoPet
- type StInfoReq
- type StMsjPet
- type StRelicSend
- type UserAgent
Constants ¶
const ( LgInfo = "info" LgSilly = "silly" LgTrace = "trace" LgDebug = "debug" LgWarn = "warn" LgError = "error" LgFatal = "fatal" /*UrlRelic : base url for logs*/ UrlRelic = "https://log-api.newrelic.com/log/v1" )
Variables ¶
var ( /*DefaultClient : cliente http con parametros default*/ DefaultClient = &Client{HTTPClient: &http.Client{}} )
Functions ¶
func AddQueryParameters ¶
AddQueryParameters : agrega los parametros para un param querie
func AsigServer ¶
func AsigServer(e *echo.Echo, cs []Controller) error
AsigServer : asigna peticiones a una instancia ECHO
func AsigServerGroup ¶ added in v1.0.1
func AsigServerGroup(e *echo.Echo, cs []Controller, group string) error
AsigServerGroup : crea sub asignaciones o grupos de path
func BuildRequestObject ¶
BuildRequestObject : Contruccion de objeto http
func MakeRequest ¶
MakeRequest : obtiene la respuesta de una peticion
func NewNetClient ¶
NewNetClient : crea una instancia de http client
func RequestNew ¶ added in v1.1.6
func RequestNew(tp, scope, message, appName, project, licenseKey string, payload interface{}) (*http.Request, error)
RequestNew : structure to send logs to a new relic application
func SendLogRelic ¶ added in v1.1.6
func SendLogRelic(tp, scope, message, appName, project, licenseKey string, payload interface{})
SendLogRelic : send a log to new relic
func TokenHeaders ¶
TokenHeaders : autentificacion por medio de token bearer
Types ¶
type Client ¶
Client : cliente http
func (*Client) MakeRequest ¶
MakeRequest : envia la peticion de un servicio con un cliente por defecto
type ConfigServer ¶
type ConfigServer struct { /*Ipser : sirve para cuando este en modo produccion coloque la ip asignada al server*/ Ipser string `ini:"ipser"` /*Debug : modo debug para el proyecto*/ Debug bool `ini:"debug"` /*Local : habilita el modo local del servicio*/ Local bool `ini:"local"` /*Puerto : Coloca el puerto del servicio*/ Puerto int `ini:"puerto"` /*Protocol : protocolo del servicio*/ Protocol string `ini:"protocol"` /*CertFile : certificado ssl*/ CertFile string `ini:"certfile"` /*KeyFile : llave del certificado ssl*/ KeyFile string `ini:"keyfile"` /*DirSSL : carpeta donde esta el certificado*/ DirSSL string `ini:"dirssl"` /*Env : carga todas las variables en variables de entorno*/ Env bool `ini:"env"` }
ConfigServer : configuraciones del servicio generales
func (*ConfigServer) LoadIni ¶
func (p *ConfigServer) LoadIni(path string) error
LoadIni : leer el archivo de configuracion del servicio esta debe ser server
func (*ConfigServer) PathCert ¶
func (p *ConfigServer) PathCert() string
PathCert : recupera el path del certificado
func (*ConfigServer) PathKey ¶
func (p *ConfigServer) PathKey() string
PathKey : recupera el path de la llave
func (*ConfigServer) StarServer ¶
func (p *ConfigServer) StarServer(e *echo.Echo)
StarServer : inicia el servicio echo .
func (*ConfigServer) Valid ¶
func (p *ConfigServer) Valid() error
Valid : valida la estructa y la configura para el servicio
type Controller ¶
type Controller struct {
Pets []HTTPPet
}
Controller : estructura para crear Controladores
type EchoRelic ¶ added in v1.0.6
type EchoRelic struct {
// contains filtered or unexported fields
}
EchoRelic : structure to consume relic en go with echo
func NewEchoRelic ¶ added in v1.0.6
NewEchoRelic : creating an instance in relic
func (*EchoRelic) Transaction ¶ added in v1.0.6
func (e *EchoRelic) Transaction(next echo.HandlerFunc) echo.HandlerFunc
Transaction : service transactions
type HTTPTip ¶
type HTTPTip string
HTTPTip : especifica el tipo de peticion a elaborar
const ( /*POST : peticion http POST*/ POST HTTPTip = "POST" /*GET : peticion http GET*/ GET HTTPTip = "GET" /*PUT : peticion http PUT*/ PUT HTTPTip = "PUT" /*DELETE : peticion http DELETE*/ DELETE HTTPTip = "DELETE" /*Tipos de protocolos : http https */ PATCH HTTPTip = "PATCH" /*Tipos de protocolos : http https */ ANY HTTPTip = "ANY" /*HTTP : protocolo http*/ HTTP = "http" /*HTTPS : protocolo https*/ HTTPS = "https" )
type MapMsjPet ¶
MapMsjPet : maneja el envio de mensajes con peticiones echo
type Request ¶
type Request struct { Method HTTPTip BaseURL string Headers map[string]string QueryParams map[string]string Body []byte }
Request : estructara para tener los datos del servicio
type Response ¶
Response : estructura para cargar la respuesta del servidor
func BuildResponse ¶
BuildResponse : construccion de una respuesta
type RestError ¶
type RestError struct {
Response *Response
}
RestError : Obtiene una respuesta incorrecta al lado del servidor
type StDataEnv ¶
type StDataEnv struct { Code int `json:"code"` Error string `json:"msj"` Data interface{} `json:"data"` }
StDataEnv : Envio de datos generico
func (*StDataEnv) ResultCodeJSON ¶
ResultCodeJSON : envia un json de los resultado del api rest pero asignando el codigo
func (*StDataEnv) ResultFullJSON ¶
ResultFullJSON : envia un json de los resultado del api rest pero asignando el codigo la data y el mensaje
type StInfoReq ¶
type StInfoReq struct { HostOrig string `json:"host"` IPRemote string `json:"ip"` Browser string `json:"browser"` SystemOI string `json:"oi"` UserAgent string `json:"useragent"` }
StInfoReq : Obtiene datos generales del request
type StRelicSend ¶ added in v1.1.6
type StRelicSend struct { Timestamp time.Time `json:"timestamp"` Message string `json:"message"` LogType string `json:"logtype"` Entity string `json:"entity.name"` Project string `json:"project"` Scope string `json:"scope"` Payload interface{} `json:"payload"` }
StRelicSend : Structure for sending role in new relic