github.com/minio/console@v1.4.1/models/service_accounts.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 models 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 "context" 27 "strconv" 28 29 "github.com/go-openapi/errors" 30 "github.com/go-openapi/strfmt" 31 "github.com/go-openapi/swag" 32 ) 33 34 // ServiceAccounts service accounts 35 // 36 // swagger:model serviceAccounts 37 type ServiceAccounts []*ServiceAccountsItems0 38 39 // Validate validates this service accounts 40 func (m ServiceAccounts) Validate(formats strfmt.Registry) error { 41 var res []error 42 43 for i := 0; i < len(m); i++ { 44 if swag.IsZero(m[i]) { // not required 45 continue 46 } 47 48 if m[i] != nil { 49 if err := m[i].Validate(formats); err != nil { 50 if ve, ok := err.(*errors.Validation); ok { 51 return ve.ValidateName(strconv.Itoa(i)) 52 } else if ce, ok := err.(*errors.CompositeError); ok { 53 return ce.ValidateName(strconv.Itoa(i)) 54 } 55 return err 56 } 57 } 58 59 } 60 61 if len(res) > 0 { 62 return errors.CompositeValidationError(res...) 63 } 64 return nil 65 } 66 67 // ContextValidate validate this service accounts based on the context it is used 68 func (m ServiceAccounts) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 69 var res []error 70 71 for i := 0; i < len(m); i++ { 72 73 if m[i] != nil { 74 75 if swag.IsZero(m[i]) { // not required 76 return nil 77 } 78 79 if err := m[i].ContextValidate(ctx, formats); err != nil { 80 if ve, ok := err.(*errors.Validation); ok { 81 return ve.ValidateName(strconv.Itoa(i)) 82 } else if ce, ok := err.(*errors.CompositeError); ok { 83 return ce.ValidateName(strconv.Itoa(i)) 84 } 85 return err 86 } 87 } 88 89 } 90 91 if len(res) > 0 { 92 return errors.CompositeValidationError(res...) 93 } 94 return nil 95 } 96 97 // ServiceAccountsItems0 service accounts items0 98 // 99 // swagger:model ServiceAccountsItems0 100 type ServiceAccountsItems0 struct { 101 102 // access key 103 AccessKey string `json:"accessKey,omitempty"` 104 105 // account status 106 AccountStatus string `json:"accountStatus,omitempty"` 107 108 // description 109 Description string `json:"description,omitempty"` 110 111 // expiration 112 Expiration string `json:"expiration,omitempty"` 113 114 // name 115 Name string `json:"name,omitempty"` 116 } 117 118 // Validate validates this service accounts items0 119 func (m *ServiceAccountsItems0) Validate(formats strfmt.Registry) error { 120 return nil 121 } 122 123 // ContextValidate validates this service accounts items0 based on context it is used 124 func (m *ServiceAccountsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 125 return nil 126 } 127 128 // MarshalBinary interface implementation 129 func (m *ServiceAccountsItems0) MarshalBinary() ([]byte, error) { 130 if m == nil { 131 return nil, nil 132 } 133 return swag.WriteJSON(m) 134 } 135 136 // UnmarshalBinary interface implementation 137 func (m *ServiceAccountsItems0) UnmarshalBinary(b []byte) error { 138 var res ServiceAccountsItems0 139 if err := swag.ReadJSON(b, &res); err != nil { 140 return err 141 } 142 *m = res 143 return nil 144 }