github.com/minio/console@v1.4.1/api/operations/site_replication/get_site_replication_status_parameters.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 site_replication
    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  	"net/http"
    27  
    28  	"github.com/go-openapi/errors"
    29  	"github.com/go-openapi/runtime"
    30  	"github.com/go-openapi/runtime/middleware"
    31  	"github.com/go-openapi/strfmt"
    32  	"github.com/go-openapi/swag"
    33  )
    34  
    35  // NewGetSiteReplicationStatusParams creates a new GetSiteReplicationStatusParams object
    36  // with the default values initialized.
    37  func NewGetSiteReplicationStatusParams() GetSiteReplicationStatusParams {
    38  
    39  	var (
    40  		// initialize parameters with default values
    41  
    42  		bucketsDefault = bool(true)
    43  
    44  		groupsDefault   = bool(true)
    45  		policiesDefault = bool(true)
    46  		usersDefault    = bool(true)
    47  	)
    48  
    49  	return GetSiteReplicationStatusParams{
    50  		Buckets: &bucketsDefault,
    51  
    52  		Groups: &groupsDefault,
    53  
    54  		Policies: &policiesDefault,
    55  
    56  		Users: &usersDefault,
    57  	}
    58  }
    59  
    60  // GetSiteReplicationStatusParams contains all the bound params for the get site replication status operation
    61  // typically these are obtained from a http.Request
    62  //
    63  // swagger:parameters GetSiteReplicationStatus
    64  type GetSiteReplicationStatusParams struct {
    65  
    66  	// HTTP Request Object
    67  	HTTPRequest *http.Request `json:"-"`
    68  
    69  	/*Include Bucket stats
    70  	  In: query
    71  	  Default: true
    72  	*/
    73  	Buckets *bool
    74  	/*Entity Type to lookup
    75  	  In: query
    76  	*/
    77  	EntityType *string
    78  	/*Entity Value to lookup
    79  	  In: query
    80  	*/
    81  	EntityValue *string
    82  	/*Include Group stats
    83  	  In: query
    84  	  Default: true
    85  	*/
    86  	Groups *bool
    87  	/*Include Policies stats
    88  	  In: query
    89  	  Default: true
    90  	*/
    91  	Policies *bool
    92  	/*Include Policies stats
    93  	  In: query
    94  	  Default: true
    95  	*/
    96  	Users *bool
    97  }
    98  
    99  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
   100  // for simple values it will use straight method calls.
   101  //
   102  // To ensure default values, the struct must have been initialized with NewGetSiteReplicationStatusParams() beforehand.
   103  func (o *GetSiteReplicationStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
   104  	var res []error
   105  
   106  	o.HTTPRequest = r
   107  
   108  	qs := runtime.Values(r.URL.Query())
   109  
   110  	qBuckets, qhkBuckets, _ := qs.GetOK("buckets")
   111  	if err := o.bindBuckets(qBuckets, qhkBuckets, route.Formats); err != nil {
   112  		res = append(res, err)
   113  	}
   114  
   115  	qEntityType, qhkEntityType, _ := qs.GetOK("entityType")
   116  	if err := o.bindEntityType(qEntityType, qhkEntityType, route.Formats); err != nil {
   117  		res = append(res, err)
   118  	}
   119  
   120  	qEntityValue, qhkEntityValue, _ := qs.GetOK("entityValue")
   121  	if err := o.bindEntityValue(qEntityValue, qhkEntityValue, route.Formats); err != nil {
   122  		res = append(res, err)
   123  	}
   124  
   125  	qGroups, qhkGroups, _ := qs.GetOK("groups")
   126  	if err := o.bindGroups(qGroups, qhkGroups, route.Formats); err != nil {
   127  		res = append(res, err)
   128  	}
   129  
   130  	qPolicies, qhkPolicies, _ := qs.GetOK("policies")
   131  	if err := o.bindPolicies(qPolicies, qhkPolicies, route.Formats); err != nil {
   132  		res = append(res, err)
   133  	}
   134  
   135  	qUsers, qhkUsers, _ := qs.GetOK("users")
   136  	if err := o.bindUsers(qUsers, qhkUsers, route.Formats); err != nil {
   137  		res = append(res, err)
   138  	}
   139  	if len(res) > 0 {
   140  		return errors.CompositeValidationError(res...)
   141  	}
   142  	return nil
   143  }
   144  
   145  // bindBuckets binds and validates parameter Buckets from query.
   146  func (o *GetSiteReplicationStatusParams) bindBuckets(rawData []string, hasKey bool, formats strfmt.Registry) error {
   147  	var raw string
   148  	if len(rawData) > 0 {
   149  		raw = rawData[len(rawData)-1]
   150  	}
   151  
   152  	// Required: false
   153  	// AllowEmptyValue: false
   154  
   155  	if raw == "" { // empty values pass all other validations
   156  		// Default values have been previously initialized by NewGetSiteReplicationStatusParams()
   157  		return nil
   158  	}
   159  
   160  	value, err := swag.ConvertBool(raw)
   161  	if err != nil {
   162  		return errors.InvalidType("buckets", "query", "bool", raw)
   163  	}
   164  	o.Buckets = &value
   165  
   166  	return nil
   167  }
   168  
   169  // bindEntityType binds and validates parameter EntityType from query.
   170  func (o *GetSiteReplicationStatusParams) bindEntityType(rawData []string, hasKey bool, formats strfmt.Registry) error {
   171  	var raw string
   172  	if len(rawData) > 0 {
   173  		raw = rawData[len(rawData)-1]
   174  	}
   175  
   176  	// Required: false
   177  	// AllowEmptyValue: false
   178  
   179  	if raw == "" { // empty values pass all other validations
   180  		return nil
   181  	}
   182  	o.EntityType = &raw
   183  
   184  	return nil
   185  }
   186  
   187  // bindEntityValue binds and validates parameter EntityValue from query.
   188  func (o *GetSiteReplicationStatusParams) bindEntityValue(rawData []string, hasKey bool, formats strfmt.Registry) error {
   189  	var raw string
   190  	if len(rawData) > 0 {
   191  		raw = rawData[len(rawData)-1]
   192  	}
   193  
   194  	// Required: false
   195  	// AllowEmptyValue: false
   196  
   197  	if raw == "" { // empty values pass all other validations
   198  		return nil
   199  	}
   200  	o.EntityValue = &raw
   201  
   202  	return nil
   203  }
   204  
   205  // bindGroups binds and validates parameter Groups from query.
   206  func (o *GetSiteReplicationStatusParams) bindGroups(rawData []string, hasKey bool, formats strfmt.Registry) error {
   207  	var raw string
   208  	if len(rawData) > 0 {
   209  		raw = rawData[len(rawData)-1]
   210  	}
   211  
   212  	// Required: false
   213  	// AllowEmptyValue: false
   214  
   215  	if raw == "" { // empty values pass all other validations
   216  		// Default values have been previously initialized by NewGetSiteReplicationStatusParams()
   217  		return nil
   218  	}
   219  
   220  	value, err := swag.ConvertBool(raw)
   221  	if err != nil {
   222  		return errors.InvalidType("groups", "query", "bool", raw)
   223  	}
   224  	o.Groups = &value
   225  
   226  	return nil
   227  }
   228  
   229  // bindPolicies binds and validates parameter Policies from query.
   230  func (o *GetSiteReplicationStatusParams) bindPolicies(rawData []string, hasKey bool, formats strfmt.Registry) error {
   231  	var raw string
   232  	if len(rawData) > 0 {
   233  		raw = rawData[len(rawData)-1]
   234  	}
   235  
   236  	// Required: false
   237  	// AllowEmptyValue: false
   238  
   239  	if raw == "" { // empty values pass all other validations
   240  		// Default values have been previously initialized by NewGetSiteReplicationStatusParams()
   241  		return nil
   242  	}
   243  
   244  	value, err := swag.ConvertBool(raw)
   245  	if err != nil {
   246  		return errors.InvalidType("policies", "query", "bool", raw)
   247  	}
   248  	o.Policies = &value
   249  
   250  	return nil
   251  }
   252  
   253  // bindUsers binds and validates parameter Users from query.
   254  func (o *GetSiteReplicationStatusParams) bindUsers(rawData []string, hasKey bool, formats strfmt.Registry) error {
   255  	var raw string
   256  	if len(rawData) > 0 {
   257  		raw = rawData[len(rawData)-1]
   258  	}
   259  
   260  	// Required: false
   261  	// AllowEmptyValue: false
   262  
   263  	if raw == "" { // empty values pass all other validations
   264  		// Default values have been previously initialized by NewGetSiteReplicationStatusParams()
   265  		return nil
   266  	}
   267  
   268  	value, err := swag.ConvertBool(raw)
   269  	if err != nil {
   270  		return errors.InvalidType("users", "query", "bool", raw)
   271  	}
   272  	o.Users = &value
   273  
   274  	return nil
   275  }