github.com/minio/console@v1.4.1/models/add_user_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  // AddUserRequest add user request
    35  //
    36  // swagger:model addUserRequest
    37  type AddUserRequest struct {
    38  
    39  	// access key
    40  	// Required: true
    41  	AccessKey *string `json:"accessKey"`
    42  
    43  	// groups
    44  	// Required: true
    45  	Groups []string `json:"groups"`
    46  
    47  	// policies
    48  	// Required: true
    49  	Policies []string `json:"policies"`
    50  
    51  	// secret key
    52  	// Required: true
    53  	SecretKey *string `json:"secretKey"`
    54  }
    55  
    56  // Validate validates this add user request
    57  func (m *AddUserRequest) Validate(formats strfmt.Registry) error {
    58  	var res []error
    59  
    60  	if err := m.validateAccessKey(formats); err != nil {
    61  		res = append(res, err)
    62  	}
    63  
    64  	if err := m.validateGroups(formats); err != nil {
    65  		res = append(res, err)
    66  	}
    67  
    68  	if err := m.validatePolicies(formats); err != nil {
    69  		res = append(res, err)
    70  	}
    71  
    72  	if err := m.validateSecretKey(formats); err != nil {
    73  		res = append(res, err)
    74  	}
    75  
    76  	if len(res) > 0 {
    77  		return errors.CompositeValidationError(res...)
    78  	}
    79  	return nil
    80  }
    81  
    82  func (m *AddUserRequest) validateAccessKey(formats strfmt.Registry) error {
    83  
    84  	if err := validate.Required("accessKey", "body", m.AccessKey); err != nil {
    85  		return err
    86  	}
    87  
    88  	return nil
    89  }
    90  
    91  func (m *AddUserRequest) validateGroups(formats strfmt.Registry) error {
    92  
    93  	if err := validate.Required("groups", "body", m.Groups); err != nil {
    94  		return err
    95  	}
    96  
    97  	return nil
    98  }
    99  
   100  func (m *AddUserRequest) validatePolicies(formats strfmt.Registry) error {
   101  
   102  	if err := validate.Required("policies", "body", m.Policies); err != nil {
   103  		return err
   104  	}
   105  
   106  	return nil
   107  }
   108  
   109  func (m *AddUserRequest) validateSecretKey(formats strfmt.Registry) error {
   110  
   111  	if err := validate.Required("secretKey", "body", m.SecretKey); err != nil {
   112  		return err
   113  	}
   114  
   115  	return nil
   116  }
   117  
   118  // ContextValidate validates this add user request based on context it is used
   119  func (m *AddUserRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   120  	return nil
   121  }
   122  
   123  // MarshalBinary interface implementation
   124  func (m *AddUserRequest) MarshalBinary() ([]byte, error) {
   125  	if m == nil {
   126  		return nil, nil
   127  	}
   128  	return swag.WriteJSON(m)
   129  }
   130  
   131  // UnmarshalBinary interface implementation
   132  func (m *AddUserRequest) UnmarshalBinary(b []byte) error {
   133  	var res AddUserRequest
   134  	if err := swag.ReadJSON(b, &res); err != nil {
   135  		return err
   136  	}
   137  	*m = res
   138  	return nil
   139  }