ack

package module
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2019 License: Apache-2.0 Imports: 10 Imported by: 10

README

Ack

Ack: A TXN2 common API acknowledgement (ACK) struct.

Example Implementation

Run Example

AGENT=test SERVICE_ENV=dev SERVICE_NS=example go run ./example/server.go --test

Example Ack Payload

{
    "ack_version": 8,
    "agent": "test",
    "srv_env": "dev",
    "srv_ns": "example",
    "ack_uuid": "65143cad-8b06-4388-b618-ce3a364b7136",
    "req_uuid": "",
    "date_time": "2019-04-11T19:09:32-07:00",
    "success": true,
    "error_code": "",
    "error_message": "",
    "server_code": 200,
    "location": "/test",
    "payload_type": "Message",
    "payload": "A test message.",
    "duration": "514ns"
}

Example Ack Headers

< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< X-Ack-Agent: test
< X-Ack-Duration: 487ns
< X-Ack-Payload-Type: Message
< X-Ack-Req-Uuid: 2031e500-20d6-454a-a641-dc409334e8f3
< X-Ack-Srv-Env: dev
< X-Ack-Srv-Ns: example
< X-Ack-Uuid: 21fe6c71-6148-4ade-b64c-d9ccd71f8325
< X-Ack-Version: 8
< Date: Fri, 12 Apr 2019 02:58:52 GMT
< Content-Length: 366

Documentation

Overview

Copyright 2019 txn2

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.

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 VERSION = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type Ack

type Ack struct {
	Version      int         `json:"ack_version"`
	Agent        string      `json:"agent"`
	SrvEnv       string      `json:"srv_env"`
	SrvNS        string      `json:"srv_ns"`
	Uuid         string      `json:"ack_uuid"`
	RequestUuid  string      `json:"req_uuid"`
	DateTime     string      `json:"date_time"`
	Success      bool        `json:"success"`
	ErrorCode    string      `json:"error_code"`
	ErrorMessage string      `json:"error_message"`
	ServerCode   int         `json:"server_code"`
	Location     string      `json:"location"`
	PayloadType  string      `json:"payload_type"`
	Payload      interface{} `json:"payload"`
	Duration     string      `json:"duration"`
	// contains filtered or unexported fields
}

Ack

func (*Ack) MakeError

func (a *Ack) MakeError(ServerCode int, errorCode string, errorMessage string)

MakeError

func (*Ack) SetPayload

func (a *Ack) SetPayload(payload interface{})

SetPayload

func (*Ack) SetPayloadType

func (a *Ack) SetPayloadType(payloadType string)

SetPayloadType

func (*Ack) StartTimer

func (a *Ack) StartTimer()

StartTimer

type GinAck

type GinAck struct {
	Ack Ack
	// contains filtered or unexported fields
}

GinAck

func Gin

func Gin(c *gin.Context) GinAck

Gin Ack

func (*GinAck) GinErrorAbort

func (ga *GinAck) GinErrorAbort(ServerCode int, errorCode string, errorMessage string)

GinError aborts gin context with JSON error

func (*GinAck) GinSend

func (ga *GinAck) GinSend(payload interface{})

GinSend responds with JSON on the gin context

func (*GinAck) MakeError

func (ga *GinAck) MakeError(ServerCode int, errorCode string, errorMessage string)

MakeError

func (*GinAck) SetPayload

func (ga *GinAck) SetPayload(payload interface{})

SetPayload

func (*GinAck) SetPayloadType

func (ga *GinAck) SetPayloadType(payloadType string)

SetPayloadType

func (*GinAck) UnmarshalAbort

func (ga *GinAck) UnmarshalAbort(data []byte, v interface{}) error

UnmarshalAbort unmarshals data and aborts if it can not.

func (*GinAck) UnmarshalPostAbort

func (ga *GinAck) UnmarshalPostAbort(v interface{}) error

UnmarshalPostAbort unmarshal raw data posted through gin or aborts.

type MappedMetricFamily

type MappedMetricFamily map[string]*io_prometheus_client.MetricFamily

MappedMetricFamily

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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