chore(backend): regenerate am >=0.17 client code using swagger 0.20.0

This commit is contained in:
Łukasz Mierzwa
2019-08-19 11:03:25 +01:00
parent 771bcda27a
commit f2d04f662a
14 changed files with 154 additions and 39 deletions

View File

@@ -6,6 +6,8 @@ package alert
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
@@ -48,8 +50,14 @@ func (a *Client) GetAlerts(params *GetAlertsParams) (*GetAlertsOK, error) {
if err != nil {
return nil, err
}
return result.(*GetAlertsOK), nil
success, ok := result.(*GetAlertsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getAlerts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
@@ -76,8 +84,14 @@ func (a *Client) PostAlerts(params *PostAlertsParams) (*PostAlertsOK, error) {
if err != nil {
return nil, err
}
return result.(*PostAlertsOK), nil
success, ok := result.(*PostAlertsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postAlerts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client

View File

@@ -24,21 +24,18 @@ type GetAlertsReader struct {
// ReadResponse reads a server response into the received o.
func (o *GetAlertsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAlertsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewGetAlertsBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetAlertsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
@@ -68,6 +65,10 @@ func (o *GetAlertsOK) Error() string {
return fmt.Sprintf("[GET /alerts][%d] getAlertsOK %+v", 200, o.Payload)
}
func (o *GetAlertsOK) GetPayload() models.GettableAlerts {
return o.Payload
}
func (o *GetAlertsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
@@ -95,6 +96,10 @@ func (o *GetAlertsBadRequest) Error() string {
return fmt.Sprintf("[GET /alerts][%d] getAlertsBadRequest %+v", 400, o.Payload)
}
func (o *GetAlertsBadRequest) GetPayload() string {
return o.Payload
}
func (o *GetAlertsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
@@ -122,6 +127,10 @@ func (o *GetAlertsInternalServerError) Error() string {
return fmt.Sprintf("[GET /alerts][%d] getAlertsInternalServerError %+v", 500, o.Payload)
}
func (o *GetAlertsInternalServerError) GetPayload() string {
return o.Payload
}
func (o *GetAlertsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload

View File

@@ -22,21 +22,18 @@ type PostAlertsReader struct {
// ReadResponse reads a server response into the received o.
func (o *PostAlertsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostAlertsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewPostAlertsBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewPostAlertsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
@@ -87,6 +84,10 @@ func (o *PostAlertsBadRequest) Error() string {
return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %+v", 400, o.Payload)
}
func (o *PostAlertsBadRequest) GetPayload() string {
return o.Payload
}
func (o *PostAlertsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
@@ -114,6 +115,10 @@ func (o *PostAlertsInternalServerError) Error() string {
return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %+v", 500, o.Payload)
}
func (o *PostAlertsInternalServerError) GetPayload() string {
return o.Payload
}
func (o *PostAlertsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload

View File

@@ -6,6 +6,8 @@ package alertgroup
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
@@ -48,8 +50,14 @@ func (a *Client) GetAlertGroups(params *GetAlertGroupsParams) (*GetAlertGroupsOK
if err != nil {
return nil, err
}
return result.(*GetAlertGroupsOK), nil
success, ok := result.(*GetAlertGroupsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getAlertGroups: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client

View File

@@ -24,21 +24,18 @@ type GetAlertGroupsReader struct {
// ReadResponse reads a server response into the received o.
func (o *GetAlertGroupsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAlertGroupsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewGetAlertGroupsBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetAlertGroupsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
@@ -68,6 +65,10 @@ func (o *GetAlertGroupsOK) Error() string {
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %+v", 200, o.Payload)
}
func (o *GetAlertGroupsOK) GetPayload() models.AlertGroups {
return o.Payload
}
func (o *GetAlertGroupsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
@@ -95,6 +96,10 @@ func (o *GetAlertGroupsBadRequest) Error() string {
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %+v", 400, o.Payload)
}
func (o *GetAlertGroupsBadRequest) GetPayload() string {
return o.Payload
}
func (o *GetAlertGroupsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
@@ -122,6 +127,10 @@ func (o *GetAlertGroupsInternalServerError) Error() string {
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %+v", 500, o.Payload)
}
func (o *GetAlertGroupsInternalServerError) GetPayload() string {
return o.Payload
}
func (o *GetAlertGroupsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload

View File

@@ -6,6 +6,8 @@ package general
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
@@ -48,8 +50,14 @@ func (a *Client) GetStatus(params *GetStatusParams) (*GetStatusOK, error) {
if err != nil {
return nil, err
}
return result.(*GetStatusOK), nil
success, ok := result.(*GetStatusOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getStatus: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client

View File

@@ -24,7 +24,6 @@ type GetStatusReader struct {
// ReadResponse reads a server response into the received o.
func (o *GetStatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetStatusOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
@@ -54,6 +53,10 @@ func (o *GetStatusOK) Error() string {
return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload)
}
func (o *GetStatusOK) GetPayload() *models.AlertmanagerStatus {
return o.Payload
}
func (o *GetStatusOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.AlertmanagerStatus)

View File

@@ -24,7 +24,6 @@ type GetReceiversReader struct {
// ReadResponse reads a server response into the received o.
func (o *GetReceiversReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetReceiversOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
@@ -54,6 +53,10 @@ func (o *GetReceiversOK) Error() string {
return fmt.Sprintf("[GET /receivers][%d] getReceiversOK %+v", 200, o.Payload)
}
func (o *GetReceiversOK) GetPayload() []*models.Receiver {
return o.Payload
}
func (o *GetReceiversOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload

View File

@@ -6,6 +6,8 @@ package receiver
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
@@ -48,8 +50,14 @@ func (a *Client) GetReceivers(params *GetReceiversParams) (*GetReceiversOK, erro
if err != nil {
return nil, err
}
return result.(*GetReceiversOK), nil
success, ok := result.(*GetReceiversOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getReceivers: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client

View File

@@ -22,14 +22,12 @@ type DeleteSilenceReader struct {
// ReadResponse reads a server response into the received o.
func (o *DeleteSilenceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteSilenceOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 500:
result := NewDeleteSilenceInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
@@ -80,6 +78,10 @@ func (o *DeleteSilenceInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteSilenceInternalServerError) GetPayload() string {
return o.Payload
}
func (o *DeleteSilenceInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload

View File

@@ -24,21 +24,18 @@ type GetSilenceReader struct {
// ReadResponse reads a server response into the received o.
func (o *GetSilenceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetSilenceOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetSilenceNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetSilenceInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
@@ -68,6 +65,10 @@ func (o *GetSilenceOK) Error() string {
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceOK %+v", 200, o.Payload)
}
func (o *GetSilenceOK) GetPayload() *models.GettableSilence {
return o.Payload
}
func (o *GetSilenceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.GettableSilence)
@@ -118,6 +119,10 @@ func (o *GetSilenceInternalServerError) Error() string {
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceInternalServerError %+v", 500, o.Payload)
}
func (o *GetSilenceInternalServerError) GetPayload() string {
return o.Payload
}
func (o *GetSilenceInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload

View File

@@ -24,14 +24,12 @@ type GetSilencesReader struct {
// ReadResponse reads a server response into the received o.
func (o *GetSilencesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetSilencesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 500:
result := NewGetSilencesInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
@@ -61,6 +59,10 @@ func (o *GetSilencesOK) Error() string {
return fmt.Sprintf("[GET /silences][%d] getSilencesOK %+v", 200, o.Payload)
}
func (o *GetSilencesOK) GetPayload() models.GettableSilences {
return o.Payload
}
func (o *GetSilencesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
@@ -88,6 +90,10 @@ func (o *GetSilencesInternalServerError) Error() string {
return fmt.Sprintf("[GET /silences][%d] getSilencesInternalServerError %+v", 500, o.Payload)
}
func (o *GetSilencesInternalServerError) GetPayload() string {
return o.Payload
}
func (o *GetSilencesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload

View File

@@ -23,21 +23,18 @@ type PostSilencesReader struct {
// ReadResponse reads a server response into the received o.
func (o *PostSilencesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostSilencesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewPostSilencesBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewPostSilencesNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
@@ -67,6 +64,10 @@ func (o *PostSilencesOK) Error() string {
return fmt.Sprintf("[POST /silences][%d] postSilencesOK %+v", 200, o.Payload)
}
func (o *PostSilencesOK) GetPayload() *PostSilencesOKBody {
return o.Payload
}
func (o *PostSilencesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(PostSilencesOKBody)
@@ -96,6 +97,10 @@ func (o *PostSilencesBadRequest) Error() string {
return fmt.Sprintf("[POST /silences][%d] postSilencesBadRequest %+v", 400, o.Payload)
}
func (o *PostSilencesBadRequest) GetPayload() string {
return o.Payload
}
func (o *PostSilencesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
@@ -123,6 +128,10 @@ func (o *PostSilencesNotFound) Error() string {
return fmt.Sprintf("[POST /silences][%d] postSilencesNotFound %+v", 404, o.Payload)
}
func (o *PostSilencesNotFound) GetPayload() string {
return o.Payload
}
func (o *PostSilencesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload

View File

@@ -6,6 +6,8 @@ package silence
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
@@ -48,8 +50,14 @@ func (a *Client) DeleteSilence(params *DeleteSilenceParams) (*DeleteSilenceOK, e
if err != nil {
return nil, err
}
return result.(*DeleteSilenceOK), nil
success, ok := result.(*DeleteSilenceOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deleteSilence: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
@@ -76,8 +84,14 @@ func (a *Client) GetSilence(params *GetSilenceParams) (*GetSilenceOK, error) {
if err != nil {
return nil, err
}
return result.(*GetSilenceOK), nil
success, ok := result.(*GetSilenceOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getSilence: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
@@ -104,8 +118,14 @@ func (a *Client) GetSilences(params *GetSilencesParams) (*GetSilencesOK, error)
if err != nil {
return nil, err
}
return result.(*GetSilencesOK), nil
success, ok := result.(*GetSilencesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getSilences: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
@@ -132,8 +152,14 @@ func (a *Client) PostSilences(params *PostSilencesParams) (*PostSilencesOK, erro
if err != nil {
return nil, err
}
return result.(*PostSilencesOK), nil
success, ok := result.(*PostSilencesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postSilences: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client