github.com/kubearmor/cilium@v1.6.12/api/v1/client/policy/put_policy_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package policy 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "fmt" 10 "io" 11 12 "github.com/go-openapi/runtime" 13 14 strfmt "github.com/go-openapi/strfmt" 15 16 models "github.com/cilium/cilium/api/v1/models" 17 ) 18 19 // PutPolicyReader is a Reader for the PutPolicy structure. 20 type PutPolicyReader struct { 21 formats strfmt.Registry 22 } 23 24 // ReadResponse reads a server response into the received o. 25 func (o *PutPolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 switch response.Code() { 27 28 case 200: 29 result := NewPutPolicyOK() 30 if err := result.readResponse(response, consumer, o.formats); err != nil { 31 return nil, err 32 } 33 return result, nil 34 35 case 400: 36 result := NewPutPolicyInvalidPolicy() 37 if err := result.readResponse(response, consumer, o.formats); err != nil { 38 return nil, err 39 } 40 return nil, result 41 42 case 460: 43 result := NewPutPolicyInvalidPath() 44 if err := result.readResponse(response, consumer, o.formats); err != nil { 45 return nil, err 46 } 47 return nil, result 48 49 case 500: 50 result := NewPutPolicyFailure() 51 if err := result.readResponse(response, consumer, o.formats); err != nil { 52 return nil, err 53 } 54 return nil, result 55 56 default: 57 return nil, runtime.NewAPIError("unknown error", response, response.Code()) 58 } 59 } 60 61 // NewPutPolicyOK creates a PutPolicyOK with default headers values 62 func NewPutPolicyOK() *PutPolicyOK { 63 return &PutPolicyOK{} 64 } 65 66 /*PutPolicyOK handles this case with default header values. 67 68 Success 69 */ 70 type PutPolicyOK struct { 71 Payload *models.Policy 72 } 73 74 func (o *PutPolicyOK) Error() string { 75 return fmt.Sprintf("[PUT /policy][%d] putPolicyOK %+v", 200, o.Payload) 76 } 77 78 func (o *PutPolicyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 79 80 o.Payload = new(models.Policy) 81 82 // response payload 83 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 84 return err 85 } 86 87 return nil 88 } 89 90 // NewPutPolicyInvalidPolicy creates a PutPolicyInvalidPolicy with default headers values 91 func NewPutPolicyInvalidPolicy() *PutPolicyInvalidPolicy { 92 return &PutPolicyInvalidPolicy{} 93 } 94 95 /*PutPolicyInvalidPolicy handles this case with default header values. 96 97 Invalid policy 98 */ 99 type PutPolicyInvalidPolicy struct { 100 Payload models.Error 101 } 102 103 func (o *PutPolicyInvalidPolicy) Error() string { 104 return fmt.Sprintf("[PUT /policy][%d] putPolicyInvalidPolicy %+v", 400, o.Payload) 105 } 106 107 func (o *PutPolicyInvalidPolicy) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 108 109 // response payload 110 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 111 return err 112 } 113 114 return nil 115 } 116 117 // NewPutPolicyInvalidPath creates a PutPolicyInvalidPath with default headers values 118 func NewPutPolicyInvalidPath() *PutPolicyInvalidPath { 119 return &PutPolicyInvalidPath{} 120 } 121 122 /*PutPolicyInvalidPath handles this case with default header values. 123 124 Invalid path 125 */ 126 type PutPolicyInvalidPath struct { 127 Payload models.Error 128 } 129 130 func (o *PutPolicyInvalidPath) Error() string { 131 return fmt.Sprintf("[PUT /policy][%d] putPolicyInvalidPath %+v", 460, o.Payload) 132 } 133 134 func (o *PutPolicyInvalidPath) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 135 136 // response payload 137 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 138 return err 139 } 140 141 return nil 142 } 143 144 // NewPutPolicyFailure creates a PutPolicyFailure with default headers values 145 func NewPutPolicyFailure() *PutPolicyFailure { 146 return &PutPolicyFailure{} 147 } 148 149 /*PutPolicyFailure handles this case with default header values. 150 151 Policy import failed 152 */ 153 type PutPolicyFailure struct { 154 Payload models.Error 155 } 156 157 func (o *PutPolicyFailure) Error() string { 158 return fmt.Sprintf("[PUT /policy][%d] putPolicyFailure %+v", 500, o.Payload) 159 } 160 161 func (o *PutPolicyFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 162 163 // response payload 164 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 165 return err 166 } 167 168 return nil 169 }