github.com/minio/console@v1.4.1/api/operations/system/list_nodes_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 system
    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  
    31  // ListNodesURL generates an URL for the list nodes operation
    32  type ListNodesURL struct {
    33  	_basePath string
    34  }
    35  
    36  // WithBasePath sets the base path for this url builder, only required when it's different from the
    37  // base path specified in the swagger spec.
    38  // When the value of the base path is an empty string
    39  func (o *ListNodesURL) WithBasePath(bp string) *ListNodesURL {
    40  	o.SetBasePath(bp)
    41  	return o
    42  }
    43  
    44  // SetBasePath sets the base path for this url builder, only required when it's different from the
    45  // base path specified in the swagger spec.
    46  // When the value of the base path is an empty string
    47  func (o *ListNodesURL) SetBasePath(bp string) {
    48  	o._basePath = bp
    49  }
    50  
    51  // Build a url path and query string
    52  func (o *ListNodesURL) Build() (*url.URL, error) {
    53  	var _result url.URL
    54  
    55  	var _path = "/nodes"
    56  
    57  	_basePath := o._basePath
    58  	if _basePath == "" {
    59  		_basePath = "/api/v1"
    60  	}
    61  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    62  
    63  	return &_result, nil
    64  }
    65  
    66  // Must is a helper function to panic when the url builder returns an error
    67  func (o *ListNodesURL) Must(u *url.URL, err error) *url.URL {
    68  	if err != nil {
    69  		panic(err)
    70  	}
    71  	if u == nil {
    72  		panic("url can't be nil")
    73  	}
    74  	return u
    75  }
    76  
    77  // String returns the string representation of the path with query string
    78  func (o *ListNodesURL) String() string {
    79  	return o.Must(o.Build()).String()
    80  }
    81  
    82  // BuildFull builds a full url with scheme, host, path and query string
    83  func (o *ListNodesURL) BuildFull(scheme, host string) (*url.URL, error) {
    84  	if scheme == "" {
    85  		return nil, errors.New("scheme is required for a full url on ListNodesURL")
    86  	}
    87  	if host == "" {
    88  		return nil, errors.New("host is required for a full url on ListNodesURL")
    89  	}
    90  
    91  	base, err := o.Build()
    92  	if err != nil {
    93  		return nil, err
    94  	}
    95  
    96  	base.Scheme = scheme
    97  	base.Host = host
    98  	return base, nil
    99  }
   100  
   101  // StringFull returns the string representation of a complete url
   102  func (o *ListNodesURL) StringFull(scheme, host string) string {
   103  	return o.Must(o.BuildFull(scheme, host)).String()
   104  }