feat: logging
This commit is contained in:
parent
778d5ef146
commit
fe5e40162b
10 changed files with 151 additions and 75 deletions
|
|
@ -32,37 +32,37 @@ type Invoker interface {
|
|||
//
|
||||
// Get available satellites.
|
||||
//
|
||||
// GET /satellite
|
||||
// GET /api/v1/satellite
|
||||
GetSatellites(ctx context.Context) (*GetSatellitesOK, error)
|
||||
// GetStations invokes GetStations operation.
|
||||
//
|
||||
// Get available stations.
|
||||
//
|
||||
// GET /station
|
||||
// GET /api/v1/station
|
||||
GetStations(ctx context.Context) (*GetStationsOK, error)
|
||||
// GetSubscriptions invokes GetSubscriptions operation.
|
||||
//
|
||||
// Get current subscriptions.
|
||||
//
|
||||
// GET /subscription
|
||||
// GET /api/v1/subscription
|
||||
GetSubscriptions(ctx context.Context) (*GetSubscriptionsOK, error)
|
||||
// SubscribeSatellite invokes SubscribeSatellite operation.
|
||||
//
|
||||
// Subscribe to a given station.
|
||||
//
|
||||
// POST /satellite/subscribe
|
||||
// POST /api/v1/satellite/subscribe
|
||||
SubscribeSatellite(ctx context.Context, request *SubscribeSatelliteReq) (*SubscribeSatelliteOK, error)
|
||||
// SubscribeStation invokes SubscribeStation operation.
|
||||
//
|
||||
// Subscribe to a given station.
|
||||
//
|
||||
// POST /station/subscribe
|
||||
// POST /api/v1/station/subscribe
|
||||
SubscribeStation(ctx context.Context, request *SubscribeStationReq) (*SubscribeStationOK, error)
|
||||
// Unsubscribe invokes Unsubscribe operation.
|
||||
//
|
||||
// Remove subscription by subscription ID.
|
||||
//
|
||||
// DELETE /subscription
|
||||
// DELETE /api/v1/subscription
|
||||
Unsubscribe(ctx context.Context, params UnsubscribeParams) error
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ func (c *Client) requestURL(ctx context.Context) *url.URL {
|
|||
//
|
||||
// Get available satellites.
|
||||
//
|
||||
// GET /satellite
|
||||
// GET /api/v1/satellite
|
||||
func (c *Client) GetSatellites(ctx context.Context) (*GetSatellitesOK, error) {
|
||||
res, err := c.sendGetSatellites(ctx)
|
||||
return res, err
|
||||
|
|
@ -127,7 +127,7 @@ func (c *Client) sendGetSatellites(ctx context.Context) (res *GetSatellitesOK, e
|
|||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("GetSatellites"),
|
||||
semconv.HTTPRequestMethodKey.String("GET"),
|
||||
semconv.HTTPRouteKey.String("/satellite"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/satellite"),
|
||||
}
|
||||
|
||||
// Run stopwatch.
|
||||
|
|
@ -160,7 +160,7 @@ func (c *Client) sendGetSatellites(ctx context.Context) (res *GetSatellitesOK, e
|
|||
stage = "BuildURL"
|
||||
u := uri.Clone(c.requestURL(ctx))
|
||||
var pathParts [1]string
|
||||
pathParts[0] = "/satellite"
|
||||
pathParts[0] = "/api/v1/satellite"
|
||||
uri.AddPathParts(u, pathParts[:]...)
|
||||
|
||||
stage = "EncodeRequest"
|
||||
|
|
@ -189,7 +189,7 @@ func (c *Client) sendGetSatellites(ctx context.Context) (res *GetSatellitesOK, e
|
|||
//
|
||||
// Get available stations.
|
||||
//
|
||||
// GET /station
|
||||
// GET /api/v1/station
|
||||
func (c *Client) GetStations(ctx context.Context) (*GetStationsOK, error) {
|
||||
res, err := c.sendGetStations(ctx)
|
||||
return res, err
|
||||
|
|
@ -199,7 +199,7 @@ func (c *Client) sendGetStations(ctx context.Context) (res *GetStationsOK, err e
|
|||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("GetStations"),
|
||||
semconv.HTTPRequestMethodKey.String("GET"),
|
||||
semconv.HTTPRouteKey.String("/station"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/station"),
|
||||
}
|
||||
|
||||
// Run stopwatch.
|
||||
|
|
@ -232,7 +232,7 @@ func (c *Client) sendGetStations(ctx context.Context) (res *GetStationsOK, err e
|
|||
stage = "BuildURL"
|
||||
u := uri.Clone(c.requestURL(ctx))
|
||||
var pathParts [1]string
|
||||
pathParts[0] = "/station"
|
||||
pathParts[0] = "/api/v1/station"
|
||||
uri.AddPathParts(u, pathParts[:]...)
|
||||
|
||||
stage = "EncodeRequest"
|
||||
|
|
@ -261,7 +261,7 @@ func (c *Client) sendGetStations(ctx context.Context) (res *GetStationsOK, err e
|
|||
//
|
||||
// Get current subscriptions.
|
||||
//
|
||||
// GET /subscription
|
||||
// GET /api/v1/subscription
|
||||
func (c *Client) GetSubscriptions(ctx context.Context) (*GetSubscriptionsOK, error) {
|
||||
res, err := c.sendGetSubscriptions(ctx)
|
||||
return res, err
|
||||
|
|
@ -271,7 +271,7 @@ func (c *Client) sendGetSubscriptions(ctx context.Context) (res *GetSubscription
|
|||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("GetSubscriptions"),
|
||||
semconv.HTTPRequestMethodKey.String("GET"),
|
||||
semconv.HTTPRouteKey.String("/subscription"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/subscription"),
|
||||
}
|
||||
|
||||
// Run stopwatch.
|
||||
|
|
@ -304,7 +304,7 @@ func (c *Client) sendGetSubscriptions(ctx context.Context) (res *GetSubscription
|
|||
stage = "BuildURL"
|
||||
u := uri.Clone(c.requestURL(ctx))
|
||||
var pathParts [1]string
|
||||
pathParts[0] = "/subscription"
|
||||
pathParts[0] = "/api/v1/subscription"
|
||||
uri.AddPathParts(u, pathParts[:]...)
|
||||
|
||||
stage = "EncodeRequest"
|
||||
|
|
@ -333,7 +333,7 @@ func (c *Client) sendGetSubscriptions(ctx context.Context) (res *GetSubscription
|
|||
//
|
||||
// Subscribe to a given station.
|
||||
//
|
||||
// POST /satellite/subscribe
|
||||
// POST /api/v1/satellite/subscribe
|
||||
func (c *Client) SubscribeSatellite(ctx context.Context, request *SubscribeSatelliteReq) (*SubscribeSatelliteOK, error) {
|
||||
res, err := c.sendSubscribeSatellite(ctx, request)
|
||||
return res, err
|
||||
|
|
@ -343,7 +343,7 @@ func (c *Client) sendSubscribeSatellite(ctx context.Context, request *SubscribeS
|
|||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("SubscribeSatellite"),
|
||||
semconv.HTTPRequestMethodKey.String("POST"),
|
||||
semconv.HTTPRouteKey.String("/satellite/subscribe"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/satellite/subscribe"),
|
||||
}
|
||||
|
||||
// Run stopwatch.
|
||||
|
|
@ -376,7 +376,7 @@ func (c *Client) sendSubscribeSatellite(ctx context.Context, request *SubscribeS
|
|||
stage = "BuildURL"
|
||||
u := uri.Clone(c.requestURL(ctx))
|
||||
var pathParts [1]string
|
||||
pathParts[0] = "/satellite/subscribe"
|
||||
pathParts[0] = "/api/v1/satellite/subscribe"
|
||||
uri.AddPathParts(u, pathParts[:]...)
|
||||
|
||||
stage = "EncodeRequest"
|
||||
|
|
@ -408,7 +408,7 @@ func (c *Client) sendSubscribeSatellite(ctx context.Context, request *SubscribeS
|
|||
//
|
||||
// Subscribe to a given station.
|
||||
//
|
||||
// POST /station/subscribe
|
||||
// POST /api/v1/station/subscribe
|
||||
func (c *Client) SubscribeStation(ctx context.Context, request *SubscribeStationReq) (*SubscribeStationOK, error) {
|
||||
res, err := c.sendSubscribeStation(ctx, request)
|
||||
return res, err
|
||||
|
|
@ -418,7 +418,7 @@ func (c *Client) sendSubscribeStation(ctx context.Context, request *SubscribeSta
|
|||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("SubscribeStation"),
|
||||
semconv.HTTPRequestMethodKey.String("POST"),
|
||||
semconv.HTTPRouteKey.String("/station/subscribe"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/station/subscribe"),
|
||||
}
|
||||
|
||||
// Run stopwatch.
|
||||
|
|
@ -451,7 +451,7 @@ func (c *Client) sendSubscribeStation(ctx context.Context, request *SubscribeSta
|
|||
stage = "BuildURL"
|
||||
u := uri.Clone(c.requestURL(ctx))
|
||||
var pathParts [1]string
|
||||
pathParts[0] = "/station/subscribe"
|
||||
pathParts[0] = "/api/v1/station/subscribe"
|
||||
uri.AddPathParts(u, pathParts[:]...)
|
||||
|
||||
stage = "EncodeRequest"
|
||||
|
|
@ -483,7 +483,7 @@ func (c *Client) sendSubscribeStation(ctx context.Context, request *SubscribeSta
|
|||
//
|
||||
// Remove subscription by subscription ID.
|
||||
//
|
||||
// DELETE /subscription
|
||||
// DELETE /api/v1/subscription
|
||||
func (c *Client) Unsubscribe(ctx context.Context, params UnsubscribeParams) error {
|
||||
_, err := c.sendUnsubscribe(ctx, params)
|
||||
return err
|
||||
|
|
@ -493,7 +493,7 @@ func (c *Client) sendUnsubscribe(ctx context.Context, params UnsubscribeParams)
|
|||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("Unsubscribe"),
|
||||
semconv.HTTPRequestMethodKey.String("DELETE"),
|
||||
semconv.HTTPRouteKey.String("/subscription"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/subscription"),
|
||||
}
|
||||
|
||||
// Run stopwatch.
|
||||
|
|
@ -526,7 +526,7 @@ func (c *Client) sendUnsubscribe(ctx context.Context, params UnsubscribeParams)
|
|||
stage = "BuildURL"
|
||||
u := uri.Clone(c.requestURL(ctx))
|
||||
var pathParts [1]string
|
||||
pathParts[0] = "/subscription"
|
||||
pathParts[0] = "/api/v1/subscription"
|
||||
uri.AddPathParts(u, pathParts[:]...)
|
||||
|
||||
stage = "EncodeQueryParams"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue