From b9363edb59d8021ac8fe56429fa90f1804ca3b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Tue, 14 May 2024 14:09:22 +0000 Subject: [PATCH] chore(backend): regenerate openapi code --- .../mapper/v017/client/alert/alert_client.go | 28 ++++++++++++++++++- .../v017/client/alert/get_alerts_responses.go | 19 +++++++++---- .../client/alert/post_alerts_responses.go | 17 +++++++---- .../client/alertgroup/alertgroup_client.go | 28 ++++++++++++++++++- .../alertgroup/get_alert_groups_responses.go | 19 +++++++++---- .../v017/client/general/general_client.go | 28 ++++++++++++++++++- .../client/general/get_status_responses.go | 7 +++-- .../receiver/get_receivers_responses.go | 7 +++-- .../v017/client/receiver/receiver_client.go | 28 ++++++++++++++++++- .../silence/delete_silence_responses.go | 11 +++++--- .../client/silence/get_silence_responses.go | 17 +++++++---- .../client/silence/get_silences_responses.go | 13 ++++++--- .../client/silence/post_silences_responses.go | 19 +++++++++---- .../v017/client/silence/silence_client.go | 28 ++++++++++++++++++- internal/mapper/v017/models/alert_status.go | 2 +- internal/mapper/v017/models/cluster_status.go | 2 +- internal/mapper/v017/models/silence_status.go | 2 +- 17 files changed, 225 insertions(+), 50 deletions(-) diff --git a/internal/mapper/v017/client/alert/alert_client.go b/internal/mapper/v017/client/alert/alert_client.go index 6046d46f9..9ea82890c 100644 --- a/internal/mapper/v017/client/alert/alert_client.go +++ b/internal/mapper/v017/client/alert/alert_client.go @@ -9,6 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) @@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi return &Client{transport: transport, formats: formats} } +// New creates a new alert API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new alert API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + /* Client for alert API */ @@ -25,7 +51,7 @@ type Client struct { formats strfmt.Registry } -// ClientOption is the option for Client methods +// ClientOption may be used to customize the behavior of Client methods. type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods diff --git a/internal/mapper/v017/client/alert/get_alerts_responses.go b/internal/mapper/v017/client/alert/get_alerts_responses.go index 4cb65c428..f33a74588 100644 --- a/internal/mapper/v017/client/alert/get_alerts_responses.go +++ b/internal/mapper/v017/client/alert/get_alerts_responses.go @@ -6,6 +6,7 @@ package alert // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -91,11 +92,13 @@ func (o *GetAlertsOK) Code() int { } func (o *GetAlertsOK) Error() string { - return fmt.Sprintf("[GET /alerts][%d] getAlertsOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts][%d] getAlertsOK %s", 200, payload) } func (o *GetAlertsOK) String() string { - return fmt.Sprintf("[GET /alerts][%d] getAlertsOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts][%d] getAlertsOK %s", 200, payload) } func (o *GetAlertsOK) GetPayload() models.GettableAlerts { @@ -157,11 +160,13 @@ func (o *GetAlertsBadRequest) Code() int { } func (o *GetAlertsBadRequest) Error() string { - return fmt.Sprintf("[GET /alerts][%d] getAlertsBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts][%d] getAlertsBadRequest %s", 400, payload) } func (o *GetAlertsBadRequest) String() string { - return fmt.Sprintf("[GET /alerts][%d] getAlertsBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts][%d] getAlertsBadRequest %s", 400, payload) } func (o *GetAlertsBadRequest) GetPayload() string { @@ -223,11 +228,13 @@ func (o *GetAlertsInternalServerError) Code() int { } func (o *GetAlertsInternalServerError) Error() string { - return fmt.Sprintf("[GET /alerts][%d] getAlertsInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts][%d] getAlertsInternalServerError %s", 500, payload) } func (o *GetAlertsInternalServerError) String() string { - return fmt.Sprintf("[GET /alerts][%d] getAlertsInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts][%d] getAlertsInternalServerError %s", 500, payload) } func (o *GetAlertsInternalServerError) GetPayload() string { diff --git a/internal/mapper/v017/client/alert/post_alerts_responses.go b/internal/mapper/v017/client/alert/post_alerts_responses.go index 2c997cb90..ff46225b7 100644 --- a/internal/mapper/v017/client/alert/post_alerts_responses.go +++ b/internal/mapper/v017/client/alert/post_alerts_responses.go @@ -6,6 +6,7 @@ package alert // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -88,11 +89,11 @@ func (o *PostAlertsOK) Code() int { } func (o *PostAlertsOK) Error() string { - return fmt.Sprintf("[POST /alerts][%d] postAlertsOK ", 200) + return fmt.Sprintf("[POST /alerts][%d] postAlertsOK", 200) } func (o *PostAlertsOK) String() string { - return fmt.Sprintf("[POST /alerts][%d] postAlertsOK ", 200) + return fmt.Sprintf("[POST /alerts][%d] postAlertsOK", 200) } func (o *PostAlertsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -145,11 +146,13 @@ func (o *PostAlertsBadRequest) Code() int { } func (o *PostAlertsBadRequest) Error() string { - return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %s", 400, payload) } func (o *PostAlertsBadRequest) String() string { - return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %s", 400, payload) } func (o *PostAlertsBadRequest) GetPayload() string { @@ -211,11 +214,13 @@ func (o *PostAlertsInternalServerError) Code() int { } func (o *PostAlertsInternalServerError) Error() string { - return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %s", 500, payload) } func (o *PostAlertsInternalServerError) String() string { - return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %s", 500, payload) } func (o *PostAlertsInternalServerError) GetPayload() string { diff --git a/internal/mapper/v017/client/alertgroup/alertgroup_client.go b/internal/mapper/v017/client/alertgroup/alertgroup_client.go index 48a55ba68..703c44b6f 100644 --- a/internal/mapper/v017/client/alertgroup/alertgroup_client.go +++ b/internal/mapper/v017/client/alertgroup/alertgroup_client.go @@ -9,6 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) @@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi return &Client{transport: transport, formats: formats} } +// New creates a new alertgroup API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new alertgroup API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + /* Client for alertgroup API */ @@ -25,7 +51,7 @@ type Client struct { formats strfmt.Registry } -// ClientOption is the option for Client methods +// ClientOption may be used to customize the behavior of Client methods. type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods diff --git a/internal/mapper/v017/client/alertgroup/get_alert_groups_responses.go b/internal/mapper/v017/client/alertgroup/get_alert_groups_responses.go index 753ecb5bb..b7dcb9e1f 100644 --- a/internal/mapper/v017/client/alertgroup/get_alert_groups_responses.go +++ b/internal/mapper/v017/client/alertgroup/get_alert_groups_responses.go @@ -6,6 +6,7 @@ package alertgroup // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -91,11 +92,13 @@ func (o *GetAlertGroupsOK) Code() int { } func (o *GetAlertGroupsOK) Error() string { - return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %s", 200, payload) } func (o *GetAlertGroupsOK) String() string { - return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %s", 200, payload) } func (o *GetAlertGroupsOK) GetPayload() models.AlertGroups { @@ -157,11 +160,13 @@ func (o *GetAlertGroupsBadRequest) Code() int { } func (o *GetAlertGroupsBadRequest) Error() string { - return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %s", 400, payload) } func (o *GetAlertGroupsBadRequest) String() string { - return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %s", 400, payload) } func (o *GetAlertGroupsBadRequest) GetPayload() string { @@ -223,11 +228,13 @@ func (o *GetAlertGroupsInternalServerError) Code() int { } func (o *GetAlertGroupsInternalServerError) Error() string { - return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %s", 500, payload) } func (o *GetAlertGroupsInternalServerError) String() string { - return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %s", 500, payload) } func (o *GetAlertGroupsInternalServerError) GetPayload() string { diff --git a/internal/mapper/v017/client/general/general_client.go b/internal/mapper/v017/client/general/general_client.go index 2fa2be13e..473de9ea4 100644 --- a/internal/mapper/v017/client/general/general_client.go +++ b/internal/mapper/v017/client/general/general_client.go @@ -9,6 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) @@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi return &Client{transport: transport, formats: formats} } +// New creates a new general API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new general API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + /* Client for general API */ @@ -25,7 +51,7 @@ type Client struct { formats strfmt.Registry } -// ClientOption is the option for Client methods +// ClientOption may be used to customize the behavior of Client methods. type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods diff --git a/internal/mapper/v017/client/general/get_status_responses.go b/internal/mapper/v017/client/general/get_status_responses.go index 0f854fec7..11dedcedb 100644 --- a/internal/mapper/v017/client/general/get_status_responses.go +++ b/internal/mapper/v017/client/general/get_status_responses.go @@ -6,6 +6,7 @@ package general // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -79,11 +80,13 @@ func (o *GetStatusOK) Code() int { } func (o *GetStatusOK) Error() string { - return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /status][%d] getStatusOK %s", 200, payload) } func (o *GetStatusOK) String() string { - return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /status][%d] getStatusOK %s", 200, payload) } func (o *GetStatusOK) GetPayload() *models.AlertmanagerStatus { diff --git a/internal/mapper/v017/client/receiver/get_receivers_responses.go b/internal/mapper/v017/client/receiver/get_receivers_responses.go index 8318f8f6a..c15680c79 100644 --- a/internal/mapper/v017/client/receiver/get_receivers_responses.go +++ b/internal/mapper/v017/client/receiver/get_receivers_responses.go @@ -6,6 +6,7 @@ package receiver // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -79,11 +80,13 @@ func (o *GetReceiversOK) Code() int { } func (o *GetReceiversOK) Error() string { - return fmt.Sprintf("[GET /receivers][%d] getReceiversOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /receivers][%d] getReceiversOK %s", 200, payload) } func (o *GetReceiversOK) String() string { - return fmt.Sprintf("[GET /receivers][%d] getReceiversOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /receivers][%d] getReceiversOK %s", 200, payload) } func (o *GetReceiversOK) GetPayload() []*models.Receiver { diff --git a/internal/mapper/v017/client/receiver/receiver_client.go b/internal/mapper/v017/client/receiver/receiver_client.go index 600b78c92..c53b9766c 100644 --- a/internal/mapper/v017/client/receiver/receiver_client.go +++ b/internal/mapper/v017/client/receiver/receiver_client.go @@ -9,6 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) @@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi return &Client{transport: transport, formats: formats} } +// New creates a new receiver API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new receiver API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + /* Client for receiver API */ @@ -25,7 +51,7 @@ type Client struct { formats strfmt.Registry } -// ClientOption is the option for Client methods +// ClientOption may be used to customize the behavior of Client methods. type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods diff --git a/internal/mapper/v017/client/silence/delete_silence_responses.go b/internal/mapper/v017/client/silence/delete_silence_responses.go index 3eddea81a..38bb11ff0 100644 --- a/internal/mapper/v017/client/silence/delete_silence_responses.go +++ b/internal/mapper/v017/client/silence/delete_silence_responses.go @@ -6,6 +6,7 @@ package silence // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -82,11 +83,11 @@ func (o *DeleteSilenceOK) Code() int { } func (o *DeleteSilenceOK) Error() string { - return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceOK ", 200) + return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceOK", 200) } func (o *DeleteSilenceOK) String() string { - return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceOK ", 200) + return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceOK", 200) } func (o *DeleteSilenceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -139,11 +140,13 @@ func (o *DeleteSilenceInternalServerError) Code() int { } func (o *DeleteSilenceInternalServerError) Error() string { - return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceInternalServerError %s", 500, payload) } func (o *DeleteSilenceInternalServerError) String() string { - return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceInternalServerError %s", 500, payload) } func (o *DeleteSilenceInternalServerError) GetPayload() string { diff --git a/internal/mapper/v017/client/silence/get_silence_responses.go b/internal/mapper/v017/client/silence/get_silence_responses.go index 831f4b6fb..dca34fa87 100644 --- a/internal/mapper/v017/client/silence/get_silence_responses.go +++ b/internal/mapper/v017/client/silence/get_silence_responses.go @@ -6,6 +6,7 @@ package silence // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -91,11 +92,13 @@ func (o *GetSilenceOK) Code() int { } func (o *GetSilenceOK) Error() string { - return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceOK %s", 200, payload) } func (o *GetSilenceOK) String() string { - return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceOK %s", 200, payload) } func (o *GetSilenceOK) GetPayload() *models.GettableSilence { @@ -158,11 +161,11 @@ func (o *GetSilenceNotFound) Code() int { } func (o *GetSilenceNotFound) Error() string { - return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceNotFound ", 404) + return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceNotFound", 404) } func (o *GetSilenceNotFound) String() string { - return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceNotFound ", 404) + return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceNotFound", 404) } func (o *GetSilenceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -215,11 +218,13 @@ func (o *GetSilenceInternalServerError) Code() int { } func (o *GetSilenceInternalServerError) Error() string { - return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceInternalServerError %s", 500, payload) } func (o *GetSilenceInternalServerError) String() string { - return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceInternalServerError %s", 500, payload) } func (o *GetSilenceInternalServerError) GetPayload() string { diff --git a/internal/mapper/v017/client/silence/get_silences_responses.go b/internal/mapper/v017/client/silence/get_silences_responses.go index a4dbf12f1..0fa20f8be 100644 --- a/internal/mapper/v017/client/silence/get_silences_responses.go +++ b/internal/mapper/v017/client/silence/get_silences_responses.go @@ -6,6 +6,7 @@ package silence // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -85,11 +86,13 @@ func (o *GetSilencesOK) Code() int { } func (o *GetSilencesOK) Error() string { - return fmt.Sprintf("[GET /silences][%d] getSilencesOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /silences][%d] getSilencesOK %s", 200, payload) } func (o *GetSilencesOK) String() string { - return fmt.Sprintf("[GET /silences][%d] getSilencesOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /silences][%d] getSilencesOK %s", 200, payload) } func (o *GetSilencesOK) GetPayload() models.GettableSilences { @@ -151,11 +154,13 @@ func (o *GetSilencesInternalServerError) Code() int { } func (o *GetSilencesInternalServerError) Error() string { - return fmt.Sprintf("[GET /silences][%d] getSilencesInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /silences][%d] getSilencesInternalServerError %s", 500, payload) } func (o *GetSilencesInternalServerError) String() string { - return fmt.Sprintf("[GET /silences][%d] getSilencesInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /silences][%d] getSilencesInternalServerError %s", 500, payload) } func (o *GetSilencesInternalServerError) GetPayload() string { diff --git a/internal/mapper/v017/client/silence/post_silences_responses.go b/internal/mapper/v017/client/silence/post_silences_responses.go index 401e0f21b..4a6e19bfa 100644 --- a/internal/mapper/v017/client/silence/post_silences_responses.go +++ b/internal/mapper/v017/client/silence/post_silences_responses.go @@ -7,6 +7,7 @@ package silence import ( "context" + "encoding/json" "fmt" "io" @@ -91,11 +92,13 @@ func (o *PostSilencesOK) Code() int { } func (o *PostSilencesOK) Error() string { - return fmt.Sprintf("[POST /silences][%d] postSilencesOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /silences][%d] postSilencesOK %s", 200, payload) } func (o *PostSilencesOK) String() string { - return fmt.Sprintf("[POST /silences][%d] postSilencesOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /silences][%d] postSilencesOK %s", 200, payload) } func (o *PostSilencesOK) GetPayload() *PostSilencesOKBody { @@ -159,11 +162,13 @@ func (o *PostSilencesBadRequest) Code() int { } func (o *PostSilencesBadRequest) Error() string { - return fmt.Sprintf("[POST /silences][%d] postSilencesBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /silences][%d] postSilencesBadRequest %s", 400, payload) } func (o *PostSilencesBadRequest) String() string { - return fmt.Sprintf("[POST /silences][%d] postSilencesBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /silences][%d] postSilencesBadRequest %s", 400, payload) } func (o *PostSilencesBadRequest) GetPayload() string { @@ -225,11 +230,13 @@ func (o *PostSilencesNotFound) Code() int { } func (o *PostSilencesNotFound) Error() string { - return fmt.Sprintf("[POST /silences][%d] postSilencesNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /silences][%d] postSilencesNotFound %s", 404, payload) } func (o *PostSilencesNotFound) String() string { - return fmt.Sprintf("[POST /silences][%d] postSilencesNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /silences][%d] postSilencesNotFound %s", 404, payload) } func (o *PostSilencesNotFound) GetPayload() string { diff --git a/internal/mapper/v017/client/silence/silence_client.go b/internal/mapper/v017/client/silence/silence_client.go index b4b927fb9..98b43e146 100644 --- a/internal/mapper/v017/client/silence/silence_client.go +++ b/internal/mapper/v017/client/silence/silence_client.go @@ -9,6 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) @@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi return &Client{transport: transport, formats: formats} } +// New creates a new silence API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new silence API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + /* Client for silence API */ @@ -25,7 +51,7 @@ type Client struct { formats strfmt.Registry } -// ClientOption is the option for Client methods +// ClientOption may be used to customize the behavior of Client methods. type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods diff --git a/internal/mapper/v017/models/alert_status.go b/internal/mapper/v017/models/alert_status.go index 3b124106e..e76350322 100644 --- a/internal/mapper/v017/models/alert_status.go +++ b/internal/mapper/v017/models/alert_status.go @@ -30,7 +30,7 @@ type AlertStatus struct { // state // Required: true - // Enum: [unprocessed active suppressed] + // Enum: ["unprocessed","active","suppressed"] State *string `json:"state"` } diff --git a/internal/mapper/v017/models/cluster_status.go b/internal/mapper/v017/models/cluster_status.go index 3407ec339..b7160ff81 100644 --- a/internal/mapper/v017/models/cluster_status.go +++ b/internal/mapper/v017/models/cluster_status.go @@ -29,7 +29,7 @@ type ClusterStatus struct { // status // Required: true - // Enum: [ready settling disabled] + // Enum: ["ready","settling","disabled"] Status *string `json:"status"` } diff --git a/internal/mapper/v017/models/silence_status.go b/internal/mapper/v017/models/silence_status.go index b85f1fea5..8c76b8399 100644 --- a/internal/mapper/v017/models/silence_status.go +++ b/internal/mapper/v017/models/silence_status.go @@ -22,7 +22,7 @@ type SilenceStatus struct { // state // Required: true - // Enum: [expired active pending] + // Enum: ["expired","active","pending"] State *string `json:"state"` }