1// Code generated by go-swagger; DO NOT EDIT. 2 3// Copyright Prometheus Team 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17package silence 18 19// This file was generated by the swagger tool. 20// Editing this file might prove futile when you re-run the generate command 21 22import ( 23 "errors" 24 "net/url" 25 golangswaggerpaths "path" 26 "strings" 27 28 "github.com/go-openapi/strfmt" 29) 30 31// DeleteSilenceURL generates an URL for the delete silence operation 32type DeleteSilenceURL struct { 33 SilenceID strfmt.UUID 34 35 _basePath string 36 // avoid unkeyed usage 37 _ struct{} 38} 39 40// WithBasePath sets the base path for this url builder, only required when it's different from the 41// base path specified in the swagger spec. 42// When the value of the base path is an empty string 43func (o *DeleteSilenceURL) WithBasePath(bp string) *DeleteSilenceURL { 44 o.SetBasePath(bp) 45 return o 46} 47 48// SetBasePath sets the base path for this url builder, only required when it's different from the 49// base path specified in the swagger spec. 50// When the value of the base path is an empty string 51func (o *DeleteSilenceURL) SetBasePath(bp string) { 52 o._basePath = bp 53} 54 55// Build a url path and query string 56func (o *DeleteSilenceURL) Build() (*url.URL, error) { 57 var _result url.URL 58 59 var _path = "/silence/{silenceID}" 60 61 silenceID := o.SilenceID.String() 62 if silenceID != "" { 63 _path = strings.Replace(_path, "{silenceID}", silenceID, -1) 64 } else { 65 return nil, errors.New("silenceId is required on DeleteSilenceURL") 66 } 67 68 _basePath := o._basePath 69 _result.Path = golangswaggerpaths.Join(_basePath, _path) 70 71 return &_result, nil 72} 73 74// Must is a helper function to panic when the url builder returns an error 75func (o *DeleteSilenceURL) Must(u *url.URL, err error) *url.URL { 76 if err != nil { 77 panic(err) 78 } 79 if u == nil { 80 panic("url can't be nil") 81 } 82 return u 83} 84 85// String returns the string representation of the path with query string 86func (o *DeleteSilenceURL) String() string { 87 return o.Must(o.Build()).String() 88} 89 90// BuildFull builds a full url with scheme, host, path and query string 91func (o *DeleteSilenceURL) BuildFull(scheme, host string) (*url.URL, error) { 92 if scheme == "" { 93 return nil, errors.New("scheme is required for a full url on DeleteSilenceURL") 94 } 95 if host == "" { 96 return nil, errors.New("host is required for a full url on DeleteSilenceURL") 97 } 98 99 base, err := o.Build() 100 if err != nil { 101 return nil, err 102 } 103 104 base.Scheme = scheme 105 base.Host = host 106 return base, nil 107} 108 109// StringFull returns the string representation of a complete url 110func (o *DeleteSilenceURL) StringFull(scheme, host string) string { 111 return o.Must(o.BuildFull(scheme, host)).String() 112} 113