github.com/minio/console@v1.4.1/api/operations/service_account/list_user_service_accounts_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // This file is part of MinIO Console Server 4 // Copyright (c) 2023 MinIO, Inc. 5 // 6 // This program is free software: you can redistribute it and/or modify 7 // it under the terms of the GNU Affero General Public License as published by 8 // the Free Software Foundation, either version 3 of the License, or 9 // (at your option) any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU Affero General Public License for more details. 15 // 16 // You should have received a copy of the GNU Affero General Public License 17 // along with this program. If not, see <http://www.gnu.org/licenses/>. 18 // 19 20 package service_account 21 22 // This file was generated by the swagger tool. 23 // Editing this file might prove futile when you re-run the swagger generate command 24 25 import ( 26 "net/http" 27 28 "github.com/go-openapi/errors" 29 "github.com/go-openapi/runtime" 30 "github.com/go-openapi/runtime/middleware" 31 "github.com/go-openapi/strfmt" 32 "github.com/go-openapi/swag" 33 ) 34 35 // NewListUserServiceAccountsParams creates a new ListUserServiceAccountsParams object 36 // with the default values initialized. 37 func NewListUserServiceAccountsParams() ListUserServiceAccountsParams { 38 39 var ( 40 // initialize parameters with default values 41 42 limitDefault = int32(20) 43 offsetDefault = int32(0) 44 ) 45 46 return ListUserServiceAccountsParams{ 47 Limit: &limitDefault, 48 49 Offset: &offsetDefault, 50 } 51 } 52 53 // ListUserServiceAccountsParams contains all the bound params for the list user service accounts operation 54 // typically these are obtained from a http.Request 55 // 56 // swagger:parameters ListUserServiceAccounts 57 type ListUserServiceAccountsParams struct { 58 59 // HTTP Request Object 60 HTTPRequest *http.Request `json:"-"` 61 62 /* 63 In: query 64 Default: 20 65 */ 66 Limit *int32 67 /* 68 In: query 69 Default: 0 70 */ 71 Offset *int32 72 } 73 74 // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 75 // for simple values it will use straight method calls. 76 // 77 // To ensure default values, the struct must have been initialized with NewListUserServiceAccountsParams() beforehand. 78 func (o *ListUserServiceAccountsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 79 var res []error 80 81 o.HTTPRequest = r 82 83 qs := runtime.Values(r.URL.Query()) 84 85 qLimit, qhkLimit, _ := qs.GetOK("limit") 86 if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { 87 res = append(res, err) 88 } 89 90 qOffset, qhkOffset, _ := qs.GetOK("offset") 91 if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { 92 res = append(res, err) 93 } 94 if len(res) > 0 { 95 return errors.CompositeValidationError(res...) 96 } 97 return nil 98 } 99 100 // bindLimit binds and validates parameter Limit from query. 101 func (o *ListUserServiceAccountsParams) bindLimit(rawData []string, hasKey bool, formats strfmt.Registry) error { 102 var raw string 103 if len(rawData) > 0 { 104 raw = rawData[len(rawData)-1] 105 } 106 107 // Required: false 108 // AllowEmptyValue: false 109 110 if raw == "" { // empty values pass all other validations 111 // Default values have been previously initialized by NewListUserServiceAccountsParams() 112 return nil 113 } 114 115 value, err := swag.ConvertInt32(raw) 116 if err != nil { 117 return errors.InvalidType("limit", "query", "int32", raw) 118 } 119 o.Limit = &value 120 121 return nil 122 } 123 124 // bindOffset binds and validates parameter Offset from query. 125 func (o *ListUserServiceAccountsParams) bindOffset(rawData []string, hasKey bool, formats strfmt.Registry) error { 126 var raw string 127 if len(rawData) > 0 { 128 raw = rawData[len(rawData)-1] 129 } 130 131 // Required: false 132 // AllowEmptyValue: false 133 134 if raw == "" { // empty values pass all other validations 135 // Default values have been previously initialized by NewListUserServiceAccountsParams() 136 return nil 137 } 138 139 value, err := swag.ConvertInt32(raw) 140 if err != nil { 141 return errors.InvalidType("offset", "query", "int32", raw) 142 } 143 o.Offset = &value 144 145 return nil 146 }