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
27	"github.com/go-openapi/swag"
28)
29
30// GetSilencesURL generates an URL for the get silences operation
31type GetSilencesURL struct {
32	Filter []string
33
34	_basePath string
35	// avoid unkeyed usage
36	_ struct{}
37}
38
39// WithBasePath sets the base path for this url builder, only required when it's different from the
40// base path specified in the swagger spec.
41// When the value of the base path is an empty string
42func (o *GetSilencesURL) WithBasePath(bp string) *GetSilencesURL {
43	o.SetBasePath(bp)
44	return o
45}
46
47// SetBasePath sets the base path for this url builder, only required when it's different from the
48// base path specified in the swagger spec.
49// When the value of the base path is an empty string
50func (o *GetSilencesURL) SetBasePath(bp string) {
51	o._basePath = bp
52}
53
54// Build a url path and query string
55func (o *GetSilencesURL) Build() (*url.URL, error) {
56	var _result url.URL
57
58	var _path = "/silences"
59
60	_basePath := o._basePath
61	_result.Path = golangswaggerpaths.Join(_basePath, _path)
62
63	qs := make(url.Values)
64
65	var filterIR []string
66	for _, filterI := range o.Filter {
67		filterIS := filterI
68		if filterIS != "" {
69			filterIR = append(filterIR, filterIS)
70		}
71	}
72
73	filter := swag.JoinByFormat(filterIR, "multi")
74
75	for _, qsv := range filter {
76		qs.Add("filter", qsv)
77	}
78
79	_result.RawQuery = qs.Encode()
80
81	return &_result, nil
82}
83
84// Must is a helper function to panic when the url builder returns an error
85func (o *GetSilencesURL) Must(u *url.URL, err error) *url.URL {
86	if err != nil {
87		panic(err)
88	}
89	if u == nil {
90		panic("url can't be nil")
91	}
92	return u
93}
94
95// String returns the string representation of the path with query string
96func (o *GetSilencesURL) String() string {
97	return o.Must(o.Build()).String()
98}
99
100// BuildFull builds a full url with scheme, host, path and query string
101func (o *GetSilencesURL) BuildFull(scheme, host string) (*url.URL, error) {
102	if scheme == "" {
103		return nil, errors.New("scheme is required for a full url on GetSilencesURL")
104	}
105	if host == "" {
106		return nil, errors.New("host is required for a full url on GetSilencesURL")
107	}
108
109	base, err := o.Build()
110	if err != nil {
111		return nil, err
112	}
113
114	base.Scheme = scheme
115	base.Host = host
116	return base, nil
117}
118
119// StringFull returns the string representation of a complete url
120func (o *GetSilencesURL) StringFull(scheme, host string) string {
121	return o.Must(o.BuildFull(scheme, host)).String()
122}
123