github.com/cilium/cilium@v1.16.2/api/v1/operator/server/restapi/metrics/get_metrics_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright Authors of Cilium 4 // SPDX-License-Identifier: Apache-2.0 5 6 package metrics 7 8 // This file was generated by the swagger tool. 9 // Editing this file might prove futile when you re-run the swagger generate command 10 11 import ( 12 "net/http" 13 14 "github.com/go-openapi/runtime" 15 16 "github.com/cilium/cilium/api/v1/operator/models" 17 ) 18 19 // GetMetricsOKCode is the HTTP code returned for type GetMetricsOK 20 const GetMetricsOKCode int = 200 21 22 /* 23 GetMetricsOK Success 24 25 swagger:response getMetricsOK 26 */ 27 type GetMetricsOK struct { 28 29 /* 30 In: Body 31 */ 32 Payload []*models.Metric `json:"body,omitempty"` 33 } 34 35 // NewGetMetricsOK creates GetMetricsOK with default headers values 36 func NewGetMetricsOK() *GetMetricsOK { 37 38 return &GetMetricsOK{} 39 } 40 41 // WithPayload adds the payload to the get metrics o k response 42 func (o *GetMetricsOK) WithPayload(payload []*models.Metric) *GetMetricsOK { 43 o.Payload = payload 44 return o 45 } 46 47 // SetPayload sets the payload to the get metrics o k response 48 func (o *GetMetricsOK) SetPayload(payload []*models.Metric) { 49 o.Payload = payload 50 } 51 52 // WriteResponse to the client 53 func (o *GetMetricsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 54 55 rw.WriteHeader(200) 56 payload := o.Payload 57 if payload == nil { 58 // return empty array 59 payload = make([]*models.Metric, 0, 50) 60 } 61 62 if err := producer.Produce(rw, payload); err != nil { 63 panic(err) // let the recovery middleware deal with this 64 } 65 } 66 67 // GetMetricsFailedCode is the HTTP code returned for type GetMetricsFailed 68 const GetMetricsFailedCode int = 500 69 70 /* 71 GetMetricsFailed Metrics cannot be retrieved 72 73 swagger:response getMetricsFailed 74 */ 75 type GetMetricsFailed struct { 76 } 77 78 // NewGetMetricsFailed creates GetMetricsFailed with default headers values 79 func NewGetMetricsFailed() *GetMetricsFailed { 80 81 return &GetMetricsFailed{} 82 } 83 84 // WriteResponse to the client 85 func (o *GetMetricsFailed) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 86 87 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 88 89 rw.WriteHeader(500) 90 }