github.com/minio/console@v1.4.1/api/operations/bucket/delete_remote_bucket_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 bucket
    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  	"strings"
    30  )
    31  
    32  // DeleteRemoteBucketURL generates an URL for the delete remote bucket operation
    33  type DeleteRemoteBucketURL struct {
    34  	Arn              string
    35  	SourceBucketName string
    36  
    37  	_basePath string
    38  	// avoid unkeyed usage
    39  	_ struct{}
    40  }
    41  
    42  // WithBasePath sets the base path for this url builder, only required when it's different from the
    43  // base path specified in the swagger spec.
    44  // When the value of the base path is an empty string
    45  func (o *DeleteRemoteBucketURL) WithBasePath(bp string) *DeleteRemoteBucketURL {
    46  	o.SetBasePath(bp)
    47  	return o
    48  }
    49  
    50  // SetBasePath sets the base path for this url builder, only required when it's different from the
    51  // base path specified in the swagger spec.
    52  // When the value of the base path is an empty string
    53  func (o *DeleteRemoteBucketURL) SetBasePath(bp string) {
    54  	o._basePath = bp
    55  }
    56  
    57  // Build a url path and query string
    58  func (o *DeleteRemoteBucketURL) Build() (*url.URL, error) {
    59  	var _result url.URL
    60  
    61  	var _path = "/remote-buckets/{source-bucket-name}/{arn}"
    62  
    63  	arn := o.Arn
    64  	if arn != "" {
    65  		_path = strings.Replace(_path, "{arn}", arn, -1)
    66  	} else {
    67  		return nil, errors.New("arn is required on DeleteRemoteBucketURL")
    68  	}
    69  
    70  	sourceBucketName := o.SourceBucketName
    71  	if sourceBucketName != "" {
    72  		_path = strings.Replace(_path, "{source-bucket-name}", sourceBucketName, -1)
    73  	} else {
    74  		return nil, errors.New("sourceBucketName is required on DeleteRemoteBucketURL")
    75  	}
    76  
    77  	_basePath := o._basePath
    78  	if _basePath == "" {
    79  		_basePath = "/api/v1"
    80  	}
    81  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    82  
    83  	return &_result, nil
    84  }
    85  
    86  // Must is a helper function to panic when the url builder returns an error
    87  func (o *DeleteRemoteBucketURL) Must(u *url.URL, err error) *url.URL {
    88  	if err != nil {
    89  		panic(err)
    90  	}
    91  	if u == nil {
    92  		panic("url can't be nil")
    93  	}
    94  	return u
    95  }
    96  
    97  // String returns the string representation of the path with query string
    98  func (o *DeleteRemoteBucketURL) String() string {
    99  	return o.Must(o.Build()).String()
   100  }
   101  
   102  // BuildFull builds a full url with scheme, host, path and query string
   103  func (o *DeleteRemoteBucketURL) BuildFull(scheme, host string) (*url.URL, error) {
   104  	if scheme == "" {
   105  		return nil, errors.New("scheme is required for a full url on DeleteRemoteBucketURL")
   106  	}
   107  	if host == "" {
   108  		return nil, errors.New("host is required for a full url on DeleteRemoteBucketURL")
   109  	}
   110  
   111  	base, err := o.Build()
   112  	if err != nil {
   113  		return nil, err
   114  	}
   115  
   116  	base.Scheme = scheme
   117  	base.Host = host
   118  	return base, nil
   119  }
   120  
   121  // StringFull returns the string representation of a complete url
   122  func (o *DeleteRemoteBucketURL) StringFull(scheme, host string) string {
   123  	return o.Must(o.BuildFull(scheme, host)).String()
   124  }