mirror of
https://github.com/openziti/ziti.git
synced 2026-10-15 08:31:50 +00:00
Merge pull request #699 from openziti/add.authenticator.list.params
add list parameters to authenticators
This commit is contained in:
@@ -38,6 +38,7 @@ import (
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewListAuthenticatorsParams creates a new ListAuthenticatorsParams object,
|
||||
@@ -82,6 +83,16 @@ func NewListAuthenticatorsParamsWithHTTPClient(client *http.Client) *ListAuthent
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListAuthenticatorsParams struct {
|
||||
|
||||
// Filter.
|
||||
Filter *string
|
||||
|
||||
// Limit.
|
||||
Limit *int64
|
||||
|
||||
// Offset.
|
||||
Offset *int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
@@ -135,6 +146,39 @@ func (o *ListAuthenticatorsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithFilter adds the filter to the list authenticators params
|
||||
func (o *ListAuthenticatorsParams) WithFilter(filter *string) *ListAuthenticatorsParams {
|
||||
o.SetFilter(filter)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetFilter adds the filter to the list authenticators params
|
||||
func (o *ListAuthenticatorsParams) SetFilter(filter *string) {
|
||||
o.Filter = filter
|
||||
}
|
||||
|
||||
// WithLimit adds the limit to the list authenticators params
|
||||
func (o *ListAuthenticatorsParams) WithLimit(limit *int64) *ListAuthenticatorsParams {
|
||||
o.SetLimit(limit)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetLimit adds the limit to the list authenticators params
|
||||
func (o *ListAuthenticatorsParams) SetLimit(limit *int64) {
|
||||
o.Limit = limit
|
||||
}
|
||||
|
||||
// WithOffset adds the offset to the list authenticators params
|
||||
func (o *ListAuthenticatorsParams) WithOffset(offset *int64) *ListAuthenticatorsParams {
|
||||
o.SetOffset(offset)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOffset adds the offset to the list authenticators params
|
||||
func (o *ListAuthenticatorsParams) SetOffset(offset *int64) {
|
||||
o.Offset = offset
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListAuthenticatorsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
@@ -143,6 +187,57 @@ func (o *ListAuthenticatorsParams) WriteToRequest(r runtime.ClientRequest, reg s
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Filter != nil {
|
||||
|
||||
// query param filter
|
||||
var qrFilter string
|
||||
|
||||
if o.Filter != nil {
|
||||
qrFilter = *o.Filter
|
||||
}
|
||||
qFilter := qrFilter
|
||||
if qFilter != "" {
|
||||
|
||||
if err := r.SetQueryParam("filter", qFilter); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.Limit != nil {
|
||||
|
||||
// query param limit
|
||||
var qrLimit int64
|
||||
|
||||
if o.Limit != nil {
|
||||
qrLimit = *o.Limit
|
||||
}
|
||||
qLimit := swag.FormatInt64(qrLimit)
|
||||
if qLimit != "" {
|
||||
|
||||
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.Offset != nil {
|
||||
|
||||
// query param offset
|
||||
var qrOffset int64
|
||||
|
||||
if o.Offset != nil {
|
||||
qrOffset = *o.Offset
|
||||
}
|
||||
qOffset := swag.FormatInt64(qrOffset)
|
||||
if qOffset != "" {
|
||||
|
||||
if err := r.SetQueryParam("offset", qOffset); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
|
||||
@@ -465,6 +465,23 @@ func init() {
|
||||
],
|
||||
"summary": "List authenticators",
|
||||
"operationId": "listAuthenticators",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "offset",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "filter",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A list of authenticators",
|
||||
@@ -19055,6 +19072,23 @@ func init() {
|
||||
],
|
||||
"summary": "List authenticators",
|
||||
"operationId": "listAuthenticators",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "offset",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "filter",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A list of authenticators",
|
||||
|
||||
@@ -33,7 +33,10 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewListAuthenticatorsParams creates a new ListAuthenticatorsParams object
|
||||
@@ -52,6 +55,19 @@ type ListAuthenticatorsParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
In: query
|
||||
*/
|
||||
Filter *string
|
||||
/*
|
||||
In: query
|
||||
*/
|
||||
Limit *int64
|
||||
/*
|
||||
In: query
|
||||
*/
|
||||
Offset *int64
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
@@ -63,8 +79,88 @@ func (o *ListAuthenticatorsParams) BindRequest(r *http.Request, route *middlewar
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qFilter, qhkFilter, _ := qs.GetOK("filter")
|
||||
if err := o.bindFilter(qFilter, qhkFilter, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qLimit, qhkLimit, _ := qs.GetOK("limit")
|
||||
if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qOffset, qhkOffset, _ := qs.GetOK("offset")
|
||||
if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindFilter binds and validates parameter Filter from query.
|
||||
func (o *ListAuthenticatorsParams) bindFilter(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
o.Filter = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindLimit binds and validates parameter Limit from query.
|
||||
func (o *ListAuthenticatorsParams) bindLimit(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("limit", "query", "int64", raw)
|
||||
}
|
||||
o.Limit = &value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindOffset binds and validates parameter Offset from query.
|
||||
func (o *ListAuthenticatorsParams) bindOffset(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
|
||||
value, err := swag.ConvertInt64(raw)
|
||||
if err != nil {
|
||||
return errors.InvalidType("offset", "query", "int64", raw)
|
||||
}
|
||||
o.Offset = &value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -33,11 +33,19 @@ import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// ListAuthenticatorsURL generates an URL for the list authenticators operation
|
||||
type ListAuthenticatorsURL struct {
|
||||
Filter *string
|
||||
Limit *int64
|
||||
Offset *int64
|
||||
|
||||
_basePath string
|
||||
// avoid unkeyed usage
|
||||
_ struct{}
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
@@ -67,6 +75,34 @@ func (o *ListAuthenticatorsURL) Build() (*url.URL, error) {
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
var filterQ string
|
||||
if o.Filter != nil {
|
||||
filterQ = *o.Filter
|
||||
}
|
||||
if filterQ != "" {
|
||||
qs.Set("filter", filterQ)
|
||||
}
|
||||
|
||||
var limitQ string
|
||||
if o.Limit != nil {
|
||||
limitQ = swag.FormatInt64(*o.Limit)
|
||||
}
|
||||
if limitQ != "" {
|
||||
qs.Set("limit", limitQ)
|
||||
}
|
||||
|
||||
var offsetQ string
|
||||
if o.Offset != nil {
|
||||
offsetQ = swag.FormatInt64(*o.Offset)
|
||||
}
|
||||
if offsetQ != "" {
|
||||
qs.Set("offset", offsetQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -296,6 +296,16 @@ paths:
|
||||
- Authenticator
|
||||
summary: List authenticators
|
||||
operationId: listAuthenticators
|
||||
parameters:
|
||||
- type: integer
|
||||
name: limit
|
||||
in: query
|
||||
- type: integer
|
||||
name: offset
|
||||
in: query
|
||||
- type: string
|
||||
name: filter
|
||||
in: query
|
||||
responses:
|
||||
"200":
|
||||
description: A list of authenticators
|
||||
|
||||
@@ -12,7 +12,10 @@ paths:
|
||||
tags:
|
||||
- Authenticator
|
||||
operationId: listAuthenticators
|
||||
|
||||
parameters:
|
||||
- $ref: '../shared/parameters.yml#/limit'
|
||||
- $ref: '../shared/parameters.yml#/offset'
|
||||
- $ref: '../shared/parameters.yml#/filter'
|
||||
responses:
|
||||
'200':
|
||||
$ref: '../shared/authenticators.yml#/responses/listAuthenticators'
|
||||
|
||||
Reference in New Issue
Block a user