1 Star 1 Fork 0

FlexLB / flexlb-api

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
list_parameters.go 2.75 KB
一键复制 编辑 原始数据 按行查看 历史
王耀辉 提交于 2022-04-21 11:05 . add license
// Copyright (c) 2022 Yaohui Wang (yaohuiwang@outlook.com)
// FlexLB is licensed under Mulan PubL v2.
// You can use this software according to the terms and conditions of the Mulan PubL v2.
// You may obtain a copy of Mulan PubL v2 at:
// http://license.coscl.org.cn/MulanPubL-2.0
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PubL v2 for more details.
// Code generated by go-swagger; DO NOT EDIT.
package instance
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
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/validate"
)
// NewListParams creates a new ListParams object
//
// There are no default values defined in the spec.
func NewListParams() ListParams {
return ListParams{}
}
// ListParams contains all the bound params for the list operation
// typically these are obtained from a http.Request
//
// swagger:parameters list
type ListParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*Instance name
Pattern: ^[A-Za-z0-9\-_.]{1,32}$
In: query
*/
Name *string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewListParams() beforehand.
func (o *ListParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
qs := runtime.Values(r.URL.Query())
qName, qhkName, _ := qs.GetOK("name")
if err := o.bindName(qName, qhkName, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindName binds and validates parameter Name from query.
func (o *ListParams) bindName(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.Name = &raw
if err := o.validateName(formats); err != nil {
return err
}
return nil
}
// validateName carries on validations for parameter Name
func (o *ListParams) validateName(formats strfmt.Registry) error {
if err := validate.Pattern("name", "query", *o.Name, `^[A-Za-z0-9\-_.]{1,32}$`); err != nil {
return err
}
return nil
}
Go
1
https://gitee.com/flexlb/flexlb-api.git
git@gitee.com:flexlb/flexlb-api.git
flexlb
flexlb-api
flexlb-api
v0.4.2

搜索帮助