github.com/kubearmor/cilium@v1.6.12/api/v1/server/restapi/policy/get_fqdn_cache_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  	"net/http"
    10  
    11  	"github.com/go-openapi/runtime"
    12  
    13  	models "github.com/cilium/cilium/api/v1/models"
    14  )
    15  
    16  // GetFqdnCacheOKCode is the HTTP code returned for type GetFqdnCacheOK
    17  const GetFqdnCacheOKCode int = 200
    18  
    19  /*GetFqdnCacheOK Success
    20  
    21  swagger:response getFqdnCacheOK
    22  */
    23  type GetFqdnCacheOK struct {
    24  
    25  	/*
    26  	  In: Body
    27  	*/
    28  	Payload []*models.DNSLookup `json:"body,omitempty"`
    29  }
    30  
    31  // NewGetFqdnCacheOK creates GetFqdnCacheOK with default headers values
    32  func NewGetFqdnCacheOK() *GetFqdnCacheOK {
    33  
    34  	return &GetFqdnCacheOK{}
    35  }
    36  
    37  // WithPayload adds the payload to the get fqdn cache o k response
    38  func (o *GetFqdnCacheOK) WithPayload(payload []*models.DNSLookup) *GetFqdnCacheOK {
    39  	o.Payload = payload
    40  	return o
    41  }
    42  
    43  // SetPayload sets the payload to the get fqdn cache o k response
    44  func (o *GetFqdnCacheOK) SetPayload(payload []*models.DNSLookup) {
    45  	o.Payload = payload
    46  }
    47  
    48  // WriteResponse to the client
    49  func (o *GetFqdnCacheOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    50  
    51  	rw.WriteHeader(200)
    52  	payload := o.Payload
    53  	if payload == nil {
    54  		// return empty array
    55  		payload = make([]*models.DNSLookup, 0, 50)
    56  	}
    57  
    58  	if err := producer.Produce(rw, payload); err != nil {
    59  		panic(err) // let the recovery middleware deal with this
    60  	}
    61  }
    62  
    63  // GetFqdnCacheBadRequestCode is the HTTP code returned for type GetFqdnCacheBadRequest
    64  const GetFqdnCacheBadRequestCode int = 400
    65  
    66  /*GetFqdnCacheBadRequest Invalid request (error parsing parameters)
    67  
    68  swagger:response getFqdnCacheBadRequest
    69  */
    70  type GetFqdnCacheBadRequest struct {
    71  
    72  	/*
    73  	  In: Body
    74  	*/
    75  	Payload models.Error `json:"body,omitempty"`
    76  }
    77  
    78  // NewGetFqdnCacheBadRequest creates GetFqdnCacheBadRequest with default headers values
    79  func NewGetFqdnCacheBadRequest() *GetFqdnCacheBadRequest {
    80  
    81  	return &GetFqdnCacheBadRequest{}
    82  }
    83  
    84  // WithPayload adds the payload to the get fqdn cache bad request response
    85  func (o *GetFqdnCacheBadRequest) WithPayload(payload models.Error) *GetFqdnCacheBadRequest {
    86  	o.Payload = payload
    87  	return o
    88  }
    89  
    90  // SetPayload sets the payload to the get fqdn cache bad request response
    91  func (o *GetFqdnCacheBadRequest) SetPayload(payload models.Error) {
    92  	o.Payload = payload
    93  }
    94  
    95  // WriteResponse to the client
    96  func (o *GetFqdnCacheBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    97  
    98  	rw.WriteHeader(400)
    99  	payload := o.Payload
   100  	if err := producer.Produce(rw, payload); err != nil {
   101  		panic(err) // let the recovery middleware deal with this
   102  	}
   103  }
   104  
   105  // GetFqdnCacheNotFoundCode is the HTTP code returned for type GetFqdnCacheNotFound
   106  const GetFqdnCacheNotFoundCode int = 404
   107  
   108  /*GetFqdnCacheNotFound No DNS data with provided parameters found
   109  
   110  swagger:response getFqdnCacheNotFound
   111  */
   112  type GetFqdnCacheNotFound struct {
   113  }
   114  
   115  // NewGetFqdnCacheNotFound creates GetFqdnCacheNotFound with default headers values
   116  func NewGetFqdnCacheNotFound() *GetFqdnCacheNotFound {
   117  
   118  	return &GetFqdnCacheNotFound{}
   119  }
   120  
   121  // WriteResponse to the client
   122  func (o *GetFqdnCacheNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   123  
   124  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
   125  
   126  	rw.WriteHeader(404)
   127  }