github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/ipam/post_ipam_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 ipam
     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  // PostIpamCreatedCode is the HTTP code returned for type PostIpamCreated
    20  const PostIpamCreatedCode int = 201
    21  
    22  /*
    23  PostIpamCreated Success
    24  
    25  swagger:response postIpamCreated
    26  */
    27  type PostIpamCreated struct {
    28  
    29  	/*
    30  	  In: Body
    31  	*/
    32  	Payload *models.IPAMResponse `json:"body,omitempty"`
    33  }
    34  
    35  // NewPostIpamCreated creates PostIpamCreated with default headers values
    36  func NewPostIpamCreated() *PostIpamCreated {
    37  
    38  	return &PostIpamCreated{}
    39  }
    40  
    41  // WithPayload adds the payload to the post ipam created response
    42  func (o *PostIpamCreated) WithPayload(payload *models.IPAMResponse) *PostIpamCreated {
    43  	o.Payload = payload
    44  	return o
    45  }
    46  
    47  // SetPayload sets the payload to the post ipam created response
    48  func (o *PostIpamCreated) SetPayload(payload *models.IPAMResponse) {
    49  	o.Payload = payload
    50  }
    51  
    52  // WriteResponse to the client
    53  func (o *PostIpamCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    54  
    55  	rw.WriteHeader(201)
    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  // PostIpamForbiddenCode is the HTTP code returned for type PostIpamForbidden
    65  const PostIpamForbiddenCode int = 403
    66  
    67  /*
    68  PostIpamForbidden Forbidden
    69  
    70  swagger:response postIpamForbidden
    71  */
    72  type PostIpamForbidden struct {
    73  }
    74  
    75  // NewPostIpamForbidden creates PostIpamForbidden with default headers values
    76  func NewPostIpamForbidden() *PostIpamForbidden {
    77  
    78  	return &PostIpamForbidden{}
    79  }
    80  
    81  // WriteResponse to the client
    82  func (o *PostIpamForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    83  
    84  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
    85  
    86  	rw.WriteHeader(403)
    87  }
    88  
    89  // PostIpamFailureCode is the HTTP code returned for type PostIpamFailure
    90  const PostIpamFailureCode int = 502
    91  
    92  /*
    93  PostIpamFailure Allocation failure
    94  
    95  swagger:response postIpamFailure
    96  */
    97  type PostIpamFailure struct {
    98  
    99  	/*
   100  	  In: Body
   101  	*/
   102  	Payload models.Error `json:"body,omitempty"`
   103  }
   104  
   105  // NewPostIpamFailure creates PostIpamFailure with default headers values
   106  func NewPostIpamFailure() *PostIpamFailure {
   107  
   108  	return &PostIpamFailure{}
   109  }
   110  
   111  // WithPayload adds the payload to the post ipam failure response
   112  func (o *PostIpamFailure) WithPayload(payload models.Error) *PostIpamFailure {
   113  	o.Payload = payload
   114  	return o
   115  }
   116  
   117  // SetPayload sets the payload to the post ipam failure response
   118  func (o *PostIpamFailure) SetPayload(payload models.Error) {
   119  	o.Payload = payload
   120  }
   121  
   122  // WriteResponse to the client
   123  func (o *PostIpamFailure) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   124  
   125  	rw.WriteHeader(502)
   126  	payload := o.Payload
   127  	if err := producer.Produce(rw, payload); err != nil {
   128  		panic(err) // let the recovery middleware deal with this
   129  	}
   130  }