github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/policy/put_policy_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 policy
     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/models"
    17  )
    18  
    19  // PutPolicyOKCode is the HTTP code returned for type PutPolicyOK
    20  const PutPolicyOKCode int = 200
    21  
    22  /*
    23  PutPolicyOK Success
    24  
    25  swagger:response putPolicyOK
    26  */
    27  type PutPolicyOK struct {
    28  
    29  	/*
    30  	  In: Body
    31  	*/
    32  	Payload *models.Policy `json:"body,omitempty"`
    33  }
    34  
    35  // NewPutPolicyOK creates PutPolicyOK with default headers values
    36  func NewPutPolicyOK() *PutPolicyOK {
    37  
    38  	return &PutPolicyOK{}
    39  }
    40  
    41  // WithPayload adds the payload to the put policy o k response
    42  func (o *PutPolicyOK) WithPayload(payload *models.Policy) *PutPolicyOK {
    43  	o.Payload = payload
    44  	return o
    45  }
    46  
    47  // SetPayload sets the payload to the put policy o k response
    48  func (o *PutPolicyOK) SetPayload(payload *models.Policy) {
    49  	o.Payload = payload
    50  }
    51  
    52  // WriteResponse to the client
    53  func (o *PutPolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    54  
    55  	rw.WriteHeader(200)
    56  	if o.Payload != nil {
    57  		payload := o.Payload
    58  		if err := producer.Produce(rw, payload); err != nil {
    59  			panic(err) // let the recovery middleware deal with this
    60  		}
    61  	}
    62  }
    63  
    64  // PutPolicyInvalidPolicyCode is the HTTP code returned for type PutPolicyInvalidPolicy
    65  const PutPolicyInvalidPolicyCode int = 400
    66  
    67  /*
    68  PutPolicyInvalidPolicy Invalid policy
    69  
    70  swagger:response putPolicyInvalidPolicy
    71  */
    72  type PutPolicyInvalidPolicy struct {
    73  
    74  	/*
    75  	  In: Body
    76  	*/
    77  	Payload models.Error `json:"body,omitempty"`
    78  }
    79  
    80  // NewPutPolicyInvalidPolicy creates PutPolicyInvalidPolicy with default headers values
    81  func NewPutPolicyInvalidPolicy() *PutPolicyInvalidPolicy {
    82  
    83  	return &PutPolicyInvalidPolicy{}
    84  }
    85  
    86  // WithPayload adds the payload to the put policy invalid policy response
    87  func (o *PutPolicyInvalidPolicy) WithPayload(payload models.Error) *PutPolicyInvalidPolicy {
    88  	o.Payload = payload
    89  	return o
    90  }
    91  
    92  // SetPayload sets the payload to the put policy invalid policy response
    93  func (o *PutPolicyInvalidPolicy) SetPayload(payload models.Error) {
    94  	o.Payload = payload
    95  }
    96  
    97  // WriteResponse to the client
    98  func (o *PutPolicyInvalidPolicy) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    99  
   100  	rw.WriteHeader(400)
   101  	payload := o.Payload
   102  	if err := producer.Produce(rw, payload); err != nil {
   103  		panic(err) // let the recovery middleware deal with this
   104  	}
   105  }
   106  
   107  // PutPolicyForbiddenCode is the HTTP code returned for type PutPolicyForbidden
   108  const PutPolicyForbiddenCode int = 403
   109  
   110  /*
   111  PutPolicyForbidden Forbidden
   112  
   113  swagger:response putPolicyForbidden
   114  */
   115  type PutPolicyForbidden struct {
   116  }
   117  
   118  // NewPutPolicyForbidden creates PutPolicyForbidden with default headers values
   119  func NewPutPolicyForbidden() *PutPolicyForbidden {
   120  
   121  	return &PutPolicyForbidden{}
   122  }
   123  
   124  // WriteResponse to the client
   125  func (o *PutPolicyForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   126  
   127  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
   128  
   129  	rw.WriteHeader(403)
   130  }
   131  
   132  // PutPolicyInvalidPathCode is the HTTP code returned for type PutPolicyInvalidPath
   133  const PutPolicyInvalidPathCode int = 460
   134  
   135  /*
   136  PutPolicyInvalidPath Invalid path
   137  
   138  swagger:response putPolicyInvalidPath
   139  */
   140  type PutPolicyInvalidPath struct {
   141  
   142  	/*
   143  	  In: Body
   144  	*/
   145  	Payload models.Error `json:"body,omitempty"`
   146  }
   147  
   148  // NewPutPolicyInvalidPath creates PutPolicyInvalidPath with default headers values
   149  func NewPutPolicyInvalidPath() *PutPolicyInvalidPath {
   150  
   151  	return &PutPolicyInvalidPath{}
   152  }
   153  
   154  // WithPayload adds the payload to the put policy invalid path response
   155  func (o *PutPolicyInvalidPath) WithPayload(payload models.Error) *PutPolicyInvalidPath {
   156  	o.Payload = payload
   157  	return o
   158  }
   159  
   160  // SetPayload sets the payload to the put policy invalid path response
   161  func (o *PutPolicyInvalidPath) SetPayload(payload models.Error) {
   162  	o.Payload = payload
   163  }
   164  
   165  // WriteResponse to the client
   166  func (o *PutPolicyInvalidPath) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   167  
   168  	rw.WriteHeader(460)
   169  	payload := o.Payload
   170  	if err := producer.Produce(rw, payload); err != nil {
   171  		panic(err) // let the recovery middleware deal with this
   172  	}
   173  }
   174  
   175  // PutPolicyFailureCode is the HTTP code returned for type PutPolicyFailure
   176  const PutPolicyFailureCode int = 500
   177  
   178  /*
   179  PutPolicyFailure Policy import failed
   180  
   181  swagger:response putPolicyFailure
   182  */
   183  type PutPolicyFailure struct {
   184  
   185  	/*
   186  	  In: Body
   187  	*/
   188  	Payload models.Error `json:"body,omitempty"`
   189  }
   190  
   191  // NewPutPolicyFailure creates PutPolicyFailure with default headers values
   192  func NewPutPolicyFailure() *PutPolicyFailure {
   193  
   194  	return &PutPolicyFailure{}
   195  }
   196  
   197  // WithPayload adds the payload to the put policy failure response
   198  func (o *PutPolicyFailure) WithPayload(payload models.Error) *PutPolicyFailure {
   199  	o.Payload = payload
   200  	return o
   201  }
   202  
   203  // SetPayload sets the payload to the put policy failure response
   204  func (o *PutPolicyFailure) SetPayload(payload models.Error) {
   205  	o.Payload = payload
   206  }
   207  
   208  // WriteResponse to the client
   209  func (o *PutPolicyFailure) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   210  
   211  	rw.WriteHeader(500)
   212  	payload := o.Payload
   213  	if err := producer.Produce(rw, payload); err != nil {
   214  		panic(err) // let the recovery middleware deal with this
   215  	}
   216  }