github.com/minio/console@v1.4.1/models/kms_describe_self_identity_response.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 28 "github.com/go-openapi/errors" 29 "github.com/go-openapi/strfmt" 30 "github.com/go-openapi/swag" 31 ) 32 33 // KmsDescribeSelfIdentityResponse kms describe self identity response 34 // 35 // swagger:model kmsDescribeSelfIdentityResponse 36 type KmsDescribeSelfIdentityResponse struct { 37 38 // admin 39 Admin bool `json:"admin,omitempty"` 40 41 // created at 42 CreatedAt string `json:"createdAt,omitempty"` 43 44 // created by 45 CreatedBy string `json:"createdBy,omitempty"` 46 47 // identity 48 Identity string `json:"identity,omitempty"` 49 50 // policy 51 Policy *KmsGetPolicyResponse `json:"policy,omitempty"` 52 53 // policy name 54 PolicyName string `json:"policyName,omitempty"` 55 } 56 57 // Validate validates this kms describe self identity response 58 func (m *KmsDescribeSelfIdentityResponse) Validate(formats strfmt.Registry) error { 59 var res []error 60 61 if err := m.validatePolicy(formats); err != nil { 62 res = append(res, err) 63 } 64 65 if len(res) > 0 { 66 return errors.CompositeValidationError(res...) 67 } 68 return nil 69 } 70 71 func (m *KmsDescribeSelfIdentityResponse) validatePolicy(formats strfmt.Registry) error { 72 if swag.IsZero(m.Policy) { // not required 73 return nil 74 } 75 76 if m.Policy != nil { 77 if err := m.Policy.Validate(formats); err != nil { 78 if ve, ok := err.(*errors.Validation); ok { 79 return ve.ValidateName("policy") 80 } else if ce, ok := err.(*errors.CompositeError); ok { 81 return ce.ValidateName("policy") 82 } 83 return err 84 } 85 } 86 87 return nil 88 } 89 90 // ContextValidate validate this kms describe self identity response based on the context it is used 91 func (m *KmsDescribeSelfIdentityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 92 var res []error 93 94 if err := m.contextValidatePolicy(ctx, formats); err != nil { 95 res = append(res, err) 96 } 97 98 if len(res) > 0 { 99 return errors.CompositeValidationError(res...) 100 } 101 return nil 102 } 103 104 func (m *KmsDescribeSelfIdentityResponse) contextValidatePolicy(ctx context.Context, formats strfmt.Registry) error { 105 106 if m.Policy != nil { 107 108 if swag.IsZero(m.Policy) { // not required 109 return nil 110 } 111 112 if err := m.Policy.ContextValidate(ctx, formats); err != nil { 113 if ve, ok := err.(*errors.Validation); ok { 114 return ve.ValidateName("policy") 115 } else if ce, ok := err.(*errors.CompositeError); ok { 116 return ce.ValidateName("policy") 117 } 118 return err 119 } 120 } 121 122 return nil 123 } 124 125 // MarshalBinary interface implementation 126 func (m *KmsDescribeSelfIdentityResponse) MarshalBinary() ([]byte, error) { 127 if m == nil { 128 return nil, nil 129 } 130 return swag.WriteJSON(m) 131 } 132 133 // UnmarshalBinary interface implementation 134 func (m *KmsDescribeSelfIdentityResponse) UnmarshalBinary(b []byte) error { 135 var res KmsDescribeSelfIdentityResponse 136 if err := swag.ReadJSON(b, &res); err != nil { 137 return err 138 } 139 *m = res 140 return nil 141 }