github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/policy/get_policy_selectors_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  // GetPolicySelectorsOKCode is the HTTP code returned for type GetPolicySelectorsOK
    20  const GetPolicySelectorsOKCode int = 200
    21  
    22  /*
    23  GetPolicySelectorsOK Success
    24  
    25  swagger:response getPolicySelectorsOK
    26  */
    27  type GetPolicySelectorsOK struct {
    28  
    29  	/*
    30  	  In: Body
    31  	*/
    32  	Payload models.SelectorCache `json:"body,omitempty"`
    33  }
    34  
    35  // NewGetPolicySelectorsOK creates GetPolicySelectorsOK with default headers values
    36  func NewGetPolicySelectorsOK() *GetPolicySelectorsOK {
    37  
    38  	return &GetPolicySelectorsOK{}
    39  }
    40  
    41  // WithPayload adds the payload to the get policy selectors o k response
    42  func (o *GetPolicySelectorsOK) WithPayload(payload models.SelectorCache) *GetPolicySelectorsOK {
    43  	o.Payload = payload
    44  	return o
    45  }
    46  
    47  // SetPayload sets the payload to the get policy selectors o k response
    48  func (o *GetPolicySelectorsOK) SetPayload(payload models.SelectorCache) {
    49  	o.Payload = payload
    50  }
    51  
    52  // WriteResponse to the client
    53  func (o *GetPolicySelectorsOK) 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 = models.SelectorCache{}
    60  	}
    61  
    62  	if err := producer.Produce(rw, payload); err != nil {
    63  		panic(err) // let the recovery middleware deal with this
    64  	}
    65  }