github.com/minio/console@v1.4.1/models/account_change_password_request.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  	"github.com/go-openapi/validate"
    32  )
    33  
    34  // AccountChangePasswordRequest account change password request
    35  //
    36  // swagger:model accountChangePasswordRequest
    37  type AccountChangePasswordRequest struct {
    38  
    39  	// current secret key
    40  	// Required: true
    41  	CurrentSecretKey *string `json:"current_secret_key"`
    42  
    43  	// new secret key
    44  	// Required: true
    45  	NewSecretKey *string `json:"new_secret_key"`
    46  }
    47  
    48  // Validate validates this account change password request
    49  func (m *AccountChangePasswordRequest) Validate(formats strfmt.Registry) error {
    50  	var res []error
    51  
    52  	if err := m.validateCurrentSecretKey(formats); err != nil {
    53  		res = append(res, err)
    54  	}
    55  
    56  	if err := m.validateNewSecretKey(formats); err != nil {
    57  		res = append(res, err)
    58  	}
    59  
    60  	if len(res) > 0 {
    61  		return errors.CompositeValidationError(res...)
    62  	}
    63  	return nil
    64  }
    65  
    66  func (m *AccountChangePasswordRequest) validateCurrentSecretKey(formats strfmt.Registry) error {
    67  
    68  	if err := validate.Required("current_secret_key", "body", m.CurrentSecretKey); err != nil {
    69  		return err
    70  	}
    71  
    72  	return nil
    73  }
    74  
    75  func (m *AccountChangePasswordRequest) validateNewSecretKey(formats strfmt.Registry) error {
    76  
    77  	if err := validate.Required("new_secret_key", "body", m.NewSecretKey); err != nil {
    78  		return err
    79  	}
    80  
    81  	return nil
    82  }
    83  
    84  // ContextValidate validates this account change password request based on context it is used
    85  func (m *AccountChangePasswordRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    86  	return nil
    87  }
    88  
    89  // MarshalBinary interface implementation
    90  func (m *AccountChangePasswordRequest) MarshalBinary() ([]byte, error) {
    91  	if m == nil {
    92  		return nil, nil
    93  	}
    94  	return swag.WriteJSON(m)
    95  }
    96  
    97  // UnmarshalBinary interface implementation
    98  func (m *AccountChangePasswordRequest) UnmarshalBinary(b []byte) error {
    99  	var res AccountChangePasswordRequest
   100  	if err := swag.ReadJSON(b, &res); err != nil {
   101  		return err
   102  	}
   103  	*m = res
   104  	return nil
   105  }