...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package general
18
19
20
21
22 import (
23 "fmt"
24 "io"
25
26 "github.com/go-openapi/runtime"
27 "github.com/go-openapi/strfmt"
28
29 "github.com/prometheus/alertmanager/api/v2/models"
30 )
31
32
33 type GetStatusReader struct {
34 formats strfmt.Registry
35 }
36
37
38 func (o *GetStatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
39 switch response.Code() {
40 case 200:
41 result := NewGetStatusOK()
42 if err := result.readResponse(response, consumer, o.formats); err != nil {
43 return nil, err
44 }
45 return result, nil
46 default:
47 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
48 }
49 }
50
51
52 func NewGetStatusOK() *GetStatusOK {
53 return &GetStatusOK{}
54 }
55
56
61 type GetStatusOK struct {
62 Payload *models.AlertmanagerStatus
63 }
64
65
66 func (o *GetStatusOK) IsSuccess() bool {
67 return true
68 }
69
70
71 func (o *GetStatusOK) IsRedirect() bool {
72 return false
73 }
74
75
76 func (o *GetStatusOK) IsClientError() bool {
77 return false
78 }
79
80
81 func (o *GetStatusOK) IsServerError() bool {
82 return false
83 }
84
85
86 func (o *GetStatusOK) IsCode(code int) bool {
87 return code == 200
88 }
89
90 func (o *GetStatusOK) Error() string {
91 return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload)
92 }
93
94 func (o *GetStatusOK) String() string {
95 return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload)
96 }
97
98 func (o *GetStatusOK) GetPayload() *models.AlertmanagerStatus {
99 return o.Payload
100 }
101
102 func (o *GetStatusOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
103
104 o.Payload = new(models.AlertmanagerStatus)
105
106
107 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
108 return err
109 }
110
111 return nil
112 }
113
View as plain text