garm/client/organizations/list_orgs_parameters.go
Gabriel Adrian Samfira 499fbde60c Add a rudimentary filter option when listing entities
This change adds the ability to filter the list of entities returned
by the API by entity owner, name or endpoint, depending on the entity
type.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2025-06-18 21:23:34 +00:00

197 lines
4.6 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package organizations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewListOrgsParams creates a new ListOrgsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewListOrgsParams() *ListOrgsParams {
return &ListOrgsParams{
timeout: cr.DefaultTimeout,
}
}
// NewListOrgsParamsWithTimeout creates a new ListOrgsParams object
// with the ability to set a timeout on a request.
func NewListOrgsParamsWithTimeout(timeout time.Duration) *ListOrgsParams {
return &ListOrgsParams{
timeout: timeout,
}
}
// NewListOrgsParamsWithContext creates a new ListOrgsParams object
// with the ability to set a context for a request.
func NewListOrgsParamsWithContext(ctx context.Context) *ListOrgsParams {
return &ListOrgsParams{
Context: ctx,
}
}
// NewListOrgsParamsWithHTTPClient creates a new ListOrgsParams object
// with the ability to set a custom HTTPClient for a request.
func NewListOrgsParamsWithHTTPClient(client *http.Client) *ListOrgsParams {
return &ListOrgsParams{
HTTPClient: client,
}
}
/*
ListOrgsParams contains all the parameters to send to the API endpoint
for the list orgs operation.
Typically these are written to a http.Request.
*/
type ListOrgsParams struct {
/* Endpoint.
Exact endpoint name to filter by
*/
Endpoint *string
/* Name.
Exact organization name to filter by
*/
Name *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list orgs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListOrgsParams) WithDefaults() *ListOrgsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list orgs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListOrgsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list orgs params
func (o *ListOrgsParams) WithTimeout(timeout time.Duration) *ListOrgsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list orgs params
func (o *ListOrgsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list orgs params
func (o *ListOrgsParams) WithContext(ctx context.Context) *ListOrgsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list orgs params
func (o *ListOrgsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list orgs params
func (o *ListOrgsParams) WithHTTPClient(client *http.Client) *ListOrgsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list orgs params
func (o *ListOrgsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithEndpoint adds the endpoint to the list orgs params
func (o *ListOrgsParams) WithEndpoint(endpoint *string) *ListOrgsParams {
o.SetEndpoint(endpoint)
return o
}
// SetEndpoint adds the endpoint to the list orgs params
func (o *ListOrgsParams) SetEndpoint(endpoint *string) {
o.Endpoint = endpoint
}
// WithName adds the name to the list orgs params
func (o *ListOrgsParams) WithName(name *string) *ListOrgsParams {
o.SetName(name)
return o
}
// SetName adds the name to the list orgs params
func (o *ListOrgsParams) SetName(name *string) {
o.Name = name
}
// WriteToRequest writes these params to a swagger request
func (o *ListOrgsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Endpoint != nil {
// query param endpoint
var qrEndpoint string
if o.Endpoint != nil {
qrEndpoint = *o.Endpoint
}
qEndpoint := qrEndpoint
if qEndpoint != "" {
if err := r.SetQueryParam("endpoint", qEndpoint); err != nil {
return err
}
}
}
if o.Name != nil {
// query param name
var qrName string
if o.Name != nil {
qrName = *o.Name
}
qName := qrName
if qName != "" {
if err := r.SetQueryParam("name", qName); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}