github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/schema/schema_objects_shards_get_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 schema
    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  // SchemaObjectsShardsGetURL generates an URL for the schema objects shards get operation
    27  type SchemaObjectsShardsGetURL struct {
    28  	ClassName string
    29  
    30  	Tenant *string
    31  
    32  	_basePath string
    33  	// avoid unkeyed usage
    34  	_ struct{}
    35  }
    36  
    37  // WithBasePath sets the base path for this url builder, only required when it's different from the
    38  // base path specified in the swagger spec.
    39  // When the value of the base path is an empty string
    40  func (o *SchemaObjectsShardsGetURL) WithBasePath(bp string) *SchemaObjectsShardsGetURL {
    41  	o.SetBasePath(bp)
    42  	return o
    43  }
    44  
    45  // SetBasePath sets the base path for this url builder, only required when it's different from the
    46  // base path specified in the swagger spec.
    47  // When the value of the base path is an empty string
    48  func (o *SchemaObjectsShardsGetURL) SetBasePath(bp string) {
    49  	o._basePath = bp
    50  }
    51  
    52  // Build a url path and query string
    53  func (o *SchemaObjectsShardsGetURL) Build() (*url.URL, error) {
    54  	var _result url.URL
    55  
    56  	var _path = "/schema/{className}/shards"
    57  
    58  	className := o.ClassName
    59  	if className != "" {
    60  		_path = strings.Replace(_path, "{className}", className, -1)
    61  	} else {
    62  		return nil, errors.New("className is required on SchemaObjectsShardsGetURL")
    63  	}
    64  
    65  	_basePath := o._basePath
    66  	if _basePath == "" {
    67  		_basePath = "/v1"
    68  	}
    69  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    70  
    71  	qs := make(url.Values)
    72  
    73  	var tenantQ string
    74  	if o.Tenant != nil {
    75  		tenantQ = *o.Tenant
    76  	}
    77  	if tenantQ != "" {
    78  		qs.Set("tenant", tenantQ)
    79  	}
    80  
    81  	_result.RawQuery = qs.Encode()
    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 *SchemaObjectsShardsGetURL) 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 *SchemaObjectsShardsGetURL) 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 *SchemaObjectsShardsGetURL) BuildFull(scheme, host string) (*url.URL, error) {
   104  	if scheme == "" {
   105  		return nil, errors.New("scheme is required for a full url on SchemaObjectsShardsGetURL")
   106  	}
   107  	if host == "" {
   108  		return nil, errors.New("host is required for a full url on SchemaObjectsShardsGetURL")
   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 *SchemaObjectsShardsGetURL) StringFull(scheme, host string) string {
   123  	return o.Must(o.BuildFull(scheme, host)).String()
   124  }