github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/backups/backups_restore_status_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  // BackupsRestoreStatusURL generates an URL for the backups restore status operation
    27  type BackupsRestoreStatusURL struct {
    28  	Backend string
    29  	ID      string
    30  
    31  	_basePath string
    32  	// avoid unkeyed usage
    33  	_ struct{}
    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 *BackupsRestoreStatusURL) WithBasePath(bp string) *BackupsRestoreStatusURL {
    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 *BackupsRestoreStatusURL) SetBasePath(bp string) {
    48  	o._basePath = bp
    49  }
    50  
    51  // Build a url path and query string
    52  func (o *BackupsRestoreStatusURL) Build() (*url.URL, error) {
    53  	var _result url.URL
    54  
    55  	var _path = "/backups/{backend}/{id}/restore"
    56  
    57  	backend := o.Backend
    58  	if backend != "" {
    59  		_path = strings.Replace(_path, "{backend}", backend, -1)
    60  	} else {
    61  		return nil, errors.New("backend is required on BackupsRestoreStatusURL")
    62  	}
    63  
    64  	id := o.ID
    65  	if id != "" {
    66  		_path = strings.Replace(_path, "{id}", id, -1)
    67  	} else {
    68  		return nil, errors.New("id is required on BackupsRestoreStatusURL")
    69  	}
    70  
    71  	_basePath := o._basePath
    72  	if _basePath == "" {
    73  		_basePath = "/v1"
    74  	}
    75  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    76  
    77  	return &_result, nil
    78  }
    79  
    80  // Must is a helper function to panic when the url builder returns an error
    81  func (o *BackupsRestoreStatusURL) Must(u *url.URL, err error) *url.URL {
    82  	if err != nil {
    83  		panic(err)
    84  	}
    85  	if u == nil {
    86  		panic("url can't be nil")
    87  	}
    88  	return u
    89  }
    90  
    91  // String returns the string representation of the path with query string
    92  func (o *BackupsRestoreStatusURL) String() string {
    93  	return o.Must(o.Build()).String()
    94  }
    95  
    96  // BuildFull builds a full url with scheme, host, path and query string
    97  func (o *BackupsRestoreStatusURL) BuildFull(scheme, host string) (*url.URL, error) {
    98  	if scheme == "" {
    99  		return nil, errors.New("scheme is required for a full url on BackupsRestoreStatusURL")
   100  	}
   101  	if host == "" {
   102  		return nil, errors.New("host is required for a full url on BackupsRestoreStatusURL")
   103  	}
   104  
   105  	base, err := o.Build()
   106  	if err != nil {
   107  		return nil, err
   108  	}
   109  
   110  	base.Scheme = scheme
   111  	base.Host = host
   112  	return base, nil
   113  }
   114  
   115  // StringFull returns the string representation of a complete url
   116  func (o *BackupsRestoreStatusURL) StringFull(scheme, host string) string {
   117  	return o.Must(o.BuildFull(scheme, host)).String()
   118  }