...

Source file src/github.com/sigstore/rekor/pkg/generated/restapi/operations/index/search_index_urlbuilder.go

Documentation: github.com/sigstore/rekor/pkg/generated/restapi/operations/index

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  //
     4  // Copyright 2021 The Sigstore Authors.
     5  //
     6  // Licensed under the Apache License, Version 2.0 (the "License");
     7  // you may not use this file except in compliance with the License.
     8  // You may obtain a copy of the License at
     9  //
    10  //     http://www.apache.org/licenses/LICENSE-2.0
    11  //
    12  // Unless required by applicable law or agreed to in writing, software
    13  // distributed under the License is distributed on an "AS IS" BASIS,
    14  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15  // See the License for the specific language governing permissions and
    16  // limitations under the License.
    17  //
    18  
    19  package index
    20  
    21  // This file was generated by the swagger tool.
    22  // Editing this file might prove futile when you re-run the generate command
    23  
    24  import (
    25  	"errors"
    26  	"net/url"
    27  	golangswaggerpaths "path"
    28  )
    29  
    30  // SearchIndexURL generates an URL for the search index operation
    31  type SearchIndexURL struct {
    32  	_basePath string
    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 *SearchIndexURL) WithBasePath(bp string) *SearchIndexURL {
    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 *SearchIndexURL) SetBasePath(bp string) {
    47  	o._basePath = bp
    48  }
    49  
    50  // Build a url path and query string
    51  func (o *SearchIndexURL) Build() (*url.URL, error) {
    52  	var _result url.URL
    53  
    54  	var _path = "/api/v1/index/retrieve"
    55  
    56  	_basePath := o._basePath
    57  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    58  
    59  	return &_result, nil
    60  }
    61  
    62  // Must is a helper function to panic when the url builder returns an error
    63  func (o *SearchIndexURL) Must(u *url.URL, err error) *url.URL {
    64  	if err != nil {
    65  		panic(err)
    66  	}
    67  	if u == nil {
    68  		panic("url can't be nil")
    69  	}
    70  	return u
    71  }
    72  
    73  // String returns the string representation of the path with query string
    74  func (o *SearchIndexURL) String() string {
    75  	return o.Must(o.Build()).String()
    76  }
    77  
    78  // BuildFull builds a full url with scheme, host, path and query string
    79  func (o *SearchIndexURL) BuildFull(scheme, host string) (*url.URL, error) {
    80  	if scheme == "" {
    81  		return nil, errors.New("scheme is required for a full url on SearchIndexURL")
    82  	}
    83  	if host == "" {
    84  		return nil, errors.New("host is required for a full url on SearchIndexURL")
    85  	}
    86  
    87  	base, err := o.Build()
    88  	if err != nil {
    89  		return nil, err
    90  	}
    91  
    92  	base.Scheme = scheme
    93  	base.Host = host
    94  	return base, nil
    95  }
    96  
    97  // StringFull returns the string representation of a complete url
    98  func (o *SearchIndexURL) StringFull(scheme, host string) string {
    99  	return o.Must(o.BuildFull(scheme, host)).String()
   100  }
   101  

View as plain text