github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/backups/backups_create_urlbuilder.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  // Code generated by go-swagger; DO NOT EDIT.
    13  
    14  package backups
    15  
    16  // This file was generated by the swagger tool.
    17  // Editing this file might prove futile when you re-run the generate command
    18  
    19  import (
    20  	"errors"
    21  	"net/url"
    22  	golangswaggerpaths "path"
    23  	"strings"
    24  )
    25  
    26  // BackupsCreateURL generates an URL for the backups create operation
    27  type BackupsCreateURL struct {
    28  	Backend string
    29  
    30  	_basePath string
    31  	// avoid unkeyed usage
    32  	_ struct{}
    33  }
    34  
    35  // WithBasePath sets the base path for this url builder, only required when it's different from the
    36  // base path specified in the swagger spec.
    37  // When the value of the base path is an empty string
    38  func (o *BackupsCreateURL) WithBasePath(bp string) *BackupsCreateURL {
    39  	o.SetBasePath(bp)
    40  	return o
    41  }
    42  
    43  // SetBasePath sets the base path for this url builder, only required when it's different from the
    44  // base path specified in the swagger spec.
    45  // When the value of the base path is an empty string
    46  func (o *BackupsCreateURL) SetBasePath(bp string) {
    47  	o._basePath = bp
    48  }
    49  
    50  // Build a url path and query string
    51  func (o *BackupsCreateURL) Build() (*url.URL, error) {
    52  	var _result url.URL
    53  
    54  	var _path = "/backups/{backend}"
    55  
    56  	backend := o.Backend
    57  	if backend != "" {
    58  		_path = strings.Replace(_path, "{backend}", backend, -1)
    59  	} else {
    60  		return nil, errors.New("backend is required on BackupsCreateURL")
    61  	}
    62  
    63  	_basePath := o._basePath
    64  	if _basePath == "" {
    65  		_basePath = "/v1"
    66  	}
    67  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    68  
    69  	return &_result, nil
    70  }
    71  
    72  // Must is a helper function to panic when the url builder returns an error
    73  func (o *BackupsCreateURL) Must(u *url.URL, err error) *url.URL {
    74  	if err != nil {
    75  		panic(err)
    76  	}
    77  	if u == nil {
    78  		panic("url can't be nil")
    79  	}
    80  	return u
    81  }
    82  
    83  // String returns the string representation of the path with query string
    84  func (o *BackupsCreateURL) String() string {
    85  	return o.Must(o.Build()).String()
    86  }
    87  
    88  // BuildFull builds a full url with scheme, host, path and query string
    89  func (o *BackupsCreateURL) BuildFull(scheme, host string) (*url.URL, error) {
    90  	if scheme == "" {
    91  		return nil, errors.New("scheme is required for a full url on BackupsCreateURL")
    92  	}
    93  	if host == "" {
    94  		return nil, errors.New("host is required for a full url on BackupsCreateURL")
    95  	}
    96  
    97  	base, err := o.Build()
    98  	if err != nil {
    99  		return nil, err
   100  	}
   101  
   102  	base.Scheme = scheme
   103  	base.Host = host
   104  	return base, nil
   105  }
   106  
   107  // StringFull returns the string representation of a complete url
   108  func (o *BackupsCreateURL) StringFull(scheme, host string) string {
   109  	return o.Must(o.BuildFull(scheme, host)).String()
   110  }