github.com/minio/console@v1.4.1/models/update_user.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  // UpdateUser update user
    35  //
    36  // swagger:model updateUser
    37  type UpdateUser struct {
    38  
    39  	// groups
    40  	// Required: true
    41  	Groups []string `json:"groups"`
    42  
    43  	// status
    44  	// Required: true
    45  	Status *string `json:"status"`
    46  }
    47  
    48  // Validate validates this update user
    49  func (m *UpdateUser) Validate(formats strfmt.Registry) error {
    50  	var res []error
    51  
    52  	if err := m.validateGroups(formats); err != nil {
    53  		res = append(res, err)
    54  	}
    55  
    56  	if err := m.validateStatus(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 *UpdateUser) validateGroups(formats strfmt.Registry) error {
    67  
    68  	if err := validate.Required("groups", "body", m.Groups); err != nil {
    69  		return err
    70  	}
    71  
    72  	return nil
    73  }
    74  
    75  func (m *UpdateUser) validateStatus(formats strfmt.Registry) error {
    76  
    77  	if err := validate.Required("status", "body", m.Status); err != nil {
    78  		return err
    79  	}
    80  
    81  	return nil
    82  }
    83  
    84  // ContextValidate validates this update user based on context it is used
    85  func (m *UpdateUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    86  	return nil
    87  }
    88  
    89  // MarshalBinary interface implementation
    90  func (m *UpdateUser) 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 *UpdateUser) UnmarshalBinary(b []byte) error {
    99  	var res UpdateUser
   100  	if err := swag.ReadJSON(b, &res); err != nil {
   101  		return err
   102  	}
   103  	*m = res
   104  	return nil
   105  }