github.com/minio/console@v1.3.0/models/idp_server_configuration.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 // IdpServerConfiguration idp server configuration 35 // 36 // swagger:model idpServerConfiguration 37 type IdpServerConfiguration struct { 38 39 // enabled 40 Enabled bool `json:"enabled,omitempty"` 41 42 // info 43 Info []*IdpServerConfigurationInfo `json:"info"` 44 45 // input 46 Input string `json:"input,omitempty"` 47 48 // name 49 Name string `json:"name,omitempty"` 50 51 // type 52 Type string `json:"type,omitempty"` 53 } 54 55 // Validate validates this idp server configuration 56 func (m *IdpServerConfiguration) Validate(formats strfmt.Registry) error { 57 var res []error 58 59 if err := m.validateInfo(formats); err != nil { 60 res = append(res, err) 61 } 62 63 if len(res) > 0 { 64 return errors.CompositeValidationError(res...) 65 } 66 return nil 67 } 68 69 func (m *IdpServerConfiguration) validateInfo(formats strfmt.Registry) error { 70 if swag.IsZero(m.Info) { // not required 71 return nil 72 } 73 74 for i := 0; i < len(m.Info); i++ { 75 if swag.IsZero(m.Info[i]) { // not required 76 continue 77 } 78 79 if m.Info[i] != nil { 80 if err := m.Info[i].Validate(formats); err != nil { 81 if ve, ok := err.(*errors.Validation); ok { 82 return ve.ValidateName("info" + "." + strconv.Itoa(i)) 83 } else if ce, ok := err.(*errors.CompositeError); ok { 84 return ce.ValidateName("info" + "." + strconv.Itoa(i)) 85 } 86 return err 87 } 88 } 89 90 } 91 92 return nil 93 } 94 95 // ContextValidate validate this idp server configuration based on the context it is used 96 func (m *IdpServerConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 97 var res []error 98 99 if err := m.contextValidateInfo(ctx, formats); err != nil { 100 res = append(res, err) 101 } 102 103 if len(res) > 0 { 104 return errors.CompositeValidationError(res...) 105 } 106 return nil 107 } 108 109 func (m *IdpServerConfiguration) contextValidateInfo(ctx context.Context, formats strfmt.Registry) error { 110 111 for i := 0; i < len(m.Info); i++ { 112 113 if m.Info[i] != nil { 114 115 if swag.IsZero(m.Info[i]) { // not required 116 return nil 117 } 118 119 if err := m.Info[i].ContextValidate(ctx, formats); err != nil { 120 if ve, ok := err.(*errors.Validation); ok { 121 return ve.ValidateName("info" + "." + strconv.Itoa(i)) 122 } else if ce, ok := err.(*errors.CompositeError); ok { 123 return ce.ValidateName("info" + "." + strconv.Itoa(i)) 124 } 125 return err 126 } 127 } 128 129 } 130 131 return nil 132 } 133 134 // MarshalBinary interface implementation 135 func (m *IdpServerConfiguration) MarshalBinary() ([]byte, error) { 136 if m == nil { 137 return nil, nil 138 } 139 return swag.WriteJSON(m) 140 } 141 142 // UnmarshalBinary interface implementation 143 func (m *IdpServerConfiguration) UnmarshalBinary(b []byte) error { 144 var res IdpServerConfiguration 145 if err := swag.ReadJSON(b, &res); err != nil { 146 return err 147 } 148 *m = res 149 return nil 150 }