github.com/minio/console@v1.4.1/api/operations/site_replication/get_site_replication_status_urlbuilder.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 generate command
    24  
    25  import (
    26  	"errors"
    27  	"net/url"
    28  	golangswaggerpaths "path"
    29  
    30  	"github.com/go-openapi/swag"
    31  )
    32  
    33  // GetSiteReplicationStatusURL generates an URL for the get site replication status operation
    34  type GetSiteReplicationStatusURL struct {
    35  	Buckets     *bool
    36  	EntityType  *string
    37  	EntityValue *string
    38  	Groups      *bool
    39  	Policies    *bool
    40  	Users       *bool
    41  
    42  	_basePath string
    43  	// avoid unkeyed usage
    44  	_ struct{}
    45  }
    46  
    47  // WithBasePath sets the base path for this url builder, only required when it's different from the
    48  // base path specified in the swagger spec.
    49  // When the value of the base path is an empty string
    50  func (o *GetSiteReplicationStatusURL) WithBasePath(bp string) *GetSiteReplicationStatusURL {
    51  	o.SetBasePath(bp)
    52  	return o
    53  }
    54  
    55  // SetBasePath sets the base path for this url builder, only required when it's different from the
    56  // base path specified in the swagger spec.
    57  // When the value of the base path is an empty string
    58  func (o *GetSiteReplicationStatusURL) SetBasePath(bp string) {
    59  	o._basePath = bp
    60  }
    61  
    62  // Build a url path and query string
    63  func (o *GetSiteReplicationStatusURL) Build() (*url.URL, error) {
    64  	var _result url.URL
    65  
    66  	var _path = "/admin/site-replication/status"
    67  
    68  	_basePath := o._basePath
    69  	if _basePath == "" {
    70  		_basePath = "/api/v1"
    71  	}
    72  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    73  
    74  	qs := make(url.Values)
    75  
    76  	var bucketsQ string
    77  	if o.Buckets != nil {
    78  		bucketsQ = swag.FormatBool(*o.Buckets)
    79  	}
    80  	if bucketsQ != "" {
    81  		qs.Set("buckets", bucketsQ)
    82  	}
    83  
    84  	var entityTypeQ string
    85  	if o.EntityType != nil {
    86  		entityTypeQ = *o.EntityType
    87  	}
    88  	if entityTypeQ != "" {
    89  		qs.Set("entityType", entityTypeQ)
    90  	}
    91  
    92  	var entityValueQ string
    93  	if o.EntityValue != nil {
    94  		entityValueQ = *o.EntityValue
    95  	}
    96  	if entityValueQ != "" {
    97  		qs.Set("entityValue", entityValueQ)
    98  	}
    99  
   100  	var groupsQ string
   101  	if o.Groups != nil {
   102  		groupsQ = swag.FormatBool(*o.Groups)
   103  	}
   104  	if groupsQ != "" {
   105  		qs.Set("groups", groupsQ)
   106  	}
   107  
   108  	var policiesQ string
   109  	if o.Policies != nil {
   110  		policiesQ = swag.FormatBool(*o.Policies)
   111  	}
   112  	if policiesQ != "" {
   113  		qs.Set("policies", policiesQ)
   114  	}
   115  
   116  	var usersQ string
   117  	if o.Users != nil {
   118  		usersQ = swag.FormatBool(*o.Users)
   119  	}
   120  	if usersQ != "" {
   121  		qs.Set("users", usersQ)
   122  	}
   123  
   124  	_result.RawQuery = qs.Encode()
   125  
   126  	return &_result, nil
   127  }
   128  
   129  // Must is a helper function to panic when the url builder returns an error
   130  func (o *GetSiteReplicationStatusURL) Must(u *url.URL, err error) *url.URL {
   131  	if err != nil {
   132  		panic(err)
   133  	}
   134  	if u == nil {
   135  		panic("url can't be nil")
   136  	}
   137  	return u
   138  }
   139  
   140  // String returns the string representation of the path with query string
   141  func (o *GetSiteReplicationStatusURL) String() string {
   142  	return o.Must(o.Build()).String()
   143  }
   144  
   145  // BuildFull builds a full url with scheme, host, path and query string
   146  func (o *GetSiteReplicationStatusURL) BuildFull(scheme, host string) (*url.URL, error) {
   147  	if scheme == "" {
   148  		return nil, errors.New("scheme is required for a full url on GetSiteReplicationStatusURL")
   149  	}
   150  	if host == "" {
   151  		return nil, errors.New("host is required for a full url on GetSiteReplicationStatusURL")
   152  	}
   153  
   154  	base, err := o.Build()
   155  	if err != nil {
   156  		return nil, err
   157  	}
   158  
   159  	base.Scheme = scheme
   160  	base.Host = host
   161  	return base, nil
   162  }
   163  
   164  // StringFull returns the string representation of a complete url
   165  func (o *GetSiteReplicationStatusURL) StringFull(scheme, host string) string {
   166  	return o.Must(o.BuildFull(scheme, host)).String()
   167  }