mirror of
https://github.com/prymitive/karma
synced 2026-08-23 11:56:20 +00:00
fix(backend): update api v2 client code
This commit is contained in:
@@ -9,12 +9,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new alert API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
@@ -26,8 +25,17 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
GetAlerts(params *GetAlertsParams) (*GetAlertsOK, error)
|
||||
|
||||
PostAlerts(params *PostAlertsParams) (*PostAlertsOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
GetAlerts Get a list of alerts
|
||||
GetAlerts Get a list of alerts
|
||||
*/
|
||||
func (a *Client) GetAlerts(params *GetAlertsParams) (*GetAlertsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
@@ -61,7 +69,7 @@ func (a *Client) GetAlerts(params *GetAlertsParams) (*GetAlertsOK, error) {
|
||||
}
|
||||
|
||||
/*
|
||||
PostAlerts Create new Alerts
|
||||
PostAlerts Create new Alerts
|
||||
*/
|
||||
func (a *Client) PostAlerts(params *PostAlertsParams) (*PostAlertsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
"github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
)
|
||||
|
||||
// GetAlertsReader is a Reader for the GetAlerts structure.
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
"github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
)
|
||||
|
||||
// NewPostAlertsParams creates a new PostAlertsParams object
|
||||
|
||||
@@ -9,12 +9,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new alertgroup API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
@@ -26,8 +25,15 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
GetAlertGroups(params *GetAlertGroupsParams) (*GetAlertGroupsOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
GetAlertGroups Get a list of alert groups
|
||||
GetAlertGroups Get a list of alert groups
|
||||
*/
|
||||
func (a *Client) GetAlertGroups(params *GetAlertGroupsParams) (*GetAlertGroupsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
"github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
)
|
||||
|
||||
// GetAlertGroupsReader is a Reader for the GetAlertGroups structure.
|
||||
|
||||
@@ -6,10 +6,10 @@ package client
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/prymitive/karma/internal/mapper/v017/client/alert"
|
||||
"github.com/prymitive/karma/internal/mapper/v017/client/alertgroup"
|
||||
@@ -60,17 +60,11 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Alertmanag
|
||||
|
||||
cli := new(Alertmanager)
|
||||
cli.Transport = transport
|
||||
|
||||
cli.Alert = alert.New(transport, formats)
|
||||
|
||||
cli.Alertgroup = alertgroup.New(transport, formats)
|
||||
|
||||
cli.General = general.New(transport, formats)
|
||||
|
||||
cli.Receiver = receiver.New(transport, formats)
|
||||
|
||||
cli.Silence = silence.New(transport, formats)
|
||||
|
||||
return cli
|
||||
}
|
||||
|
||||
@@ -115,15 +109,15 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
|
||||
|
||||
// Alertmanager is a client for alertmanager
|
||||
type Alertmanager struct {
|
||||
Alert *alert.Client
|
||||
Alert alert.ClientService
|
||||
|
||||
Alertgroup *alertgroup.Client
|
||||
Alertgroup alertgroup.ClientService
|
||||
|
||||
General *general.Client
|
||||
General general.ClientService
|
||||
|
||||
Receiver *receiver.Client
|
||||
Receiver receiver.ClientService
|
||||
|
||||
Silence *silence.Client
|
||||
Silence silence.ClientService
|
||||
|
||||
Transport runtime.ClientTransport
|
||||
}
|
||||
@@ -131,15 +125,9 @@ type Alertmanager struct {
|
||||
// SetTransport changes the transport on the client and all its subresources
|
||||
func (c *Alertmanager) SetTransport(transport runtime.ClientTransport) {
|
||||
c.Transport = transport
|
||||
|
||||
c.Alert.SetTransport(transport)
|
||||
|
||||
c.Alertgroup.SetTransport(transport)
|
||||
|
||||
c.General.SetTransport(transport)
|
||||
|
||||
c.Receiver.SetTransport(transport)
|
||||
|
||||
c.Silence.SetTransport(transport)
|
||||
|
||||
}
|
||||
|
||||
@@ -9,12 +9,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new general API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
@@ -26,8 +25,15 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
GetStatus(params *GetStatusParams) (*GetStatusOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
GetStatus Get current status of an Alertmanager instance and its cluster
|
||||
GetStatus Get current status of an Alertmanager instance and its cluster
|
||||
*/
|
||||
func (a *Client) GetStatus(params *GetStatusParams) (*GetStatusOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
"github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
)
|
||||
|
||||
// GetStatusReader is a Reader for the GetStatus structure.
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
"github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
)
|
||||
|
||||
// GetReceiversReader is a Reader for the GetReceivers structure.
|
||||
|
||||
@@ -9,12 +9,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new receiver API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
@@ -26,8 +25,15 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
GetReceivers(params *GetReceiversParams) (*GetReceiversOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
GetReceivers Get list of all receivers (name of notification integrations)
|
||||
GetReceivers Get list of all receivers (name of notification integrations)
|
||||
*/
|
||||
func (a *Client) GetReceivers(params *GetReceiversParams) (*GetReceiversOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
"github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
)
|
||||
|
||||
// GetSilenceReader is a Reader for the GetSilence structure.
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
"github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
)
|
||||
|
||||
// GetSilencesReader is a Reader for the GetSilences structure.
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
models "github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
"github.com/prymitive/karma/internal/mapper/v017/models"
|
||||
)
|
||||
|
||||
// NewPostSilencesParams creates a new PostSilencesParams object
|
||||
|
||||
@@ -9,12 +9,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new silence API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
@@ -26,8 +25,21 @@ type Client struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
DeleteSilence(params *DeleteSilenceParams) (*DeleteSilenceOK, error)
|
||||
|
||||
GetSilence(params *GetSilenceParams) (*GetSilenceOK, error)
|
||||
|
||||
GetSilences(params *GetSilencesParams) (*GetSilencesOK, error)
|
||||
|
||||
PostSilences(params *PostSilencesParams) (*PostSilencesOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteSilence Delete a silence by its ID
|
||||
DeleteSilence Delete a silence by its ID
|
||||
*/
|
||||
func (a *Client) DeleteSilence(params *DeleteSilenceParams) (*DeleteSilenceOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
@@ -61,7 +73,7 @@ func (a *Client) DeleteSilence(params *DeleteSilenceParams) (*DeleteSilenceOK, e
|
||||
}
|
||||
|
||||
/*
|
||||
GetSilence Get a silence by its ID
|
||||
GetSilence Get a silence by its ID
|
||||
*/
|
||||
func (a *Client) GetSilence(params *GetSilenceParams) (*GetSilenceOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
@@ -95,7 +107,7 @@ func (a *Client) GetSilence(params *GetSilenceParams) (*GetSilenceOK, error) {
|
||||
}
|
||||
|
||||
/*
|
||||
GetSilences Get a list of silences
|
||||
GetSilences Get a list of silences
|
||||
*/
|
||||
func (a *Client) GetSilences(params *GetSilencesParams) (*GetSilencesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
@@ -129,7 +141,7 @@ func (a *Client) GetSilences(params *GetSilencesParams) (*GetSilencesOK, error)
|
||||
}
|
||||
|
||||
/*
|
||||
PostSilences Post a new silence or update an existing one
|
||||
PostSilences Post a new silence or update an existing one
|
||||
*/
|
||||
func (a *Client) PostSilences(params *PostSilencesParams) (*PostSilencesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
|
||||
@@ -6,9 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,8 @@ package models
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,8 @@ package models
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
|
||||
@@ -8,9 +8,8 @@ package models
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -6,9 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -6,9 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -9,9 +9,8 @@ import (
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,8 @@ package models
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,8 @@ package models
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,9 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,8 @@ package models
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,9 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,8 @@ package models
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -6,9 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -6,9 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,8 @@ package models
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,9 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,9 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -6,9 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,8 @@ package models
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
@@ -6,9 +6,8 @@ package models
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user