2acd8c0846a1fc605056e8ba35b49fa6245b073b
[ric-plt/xapp-frame.git] / pkg / clientapi / r_i_c_subscription_client.go
1 // Code generated by go-swagger; DO NOT EDIT.
2
3 package clientapi
4
5 // This file was generated by the swagger tool.
6 // Editing this file might prove futile when you re-run the swagger generate command
7
8 import (
9         "github.com/go-openapi/runtime"
10         httptransport "github.com/go-openapi/runtime/client"
11
12         strfmt "github.com/go-openapi/strfmt"
13
14         "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/common"
15         "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/policy"
16         "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/query"
17         "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/report"
18 )
19
20 // Default r i c subscription HTTP client.
21 var Default = NewHTTPClient(nil)
22
23 const (
24         // DefaultHost is the default Host
25         // found in Meta (info) section of spec file
26         DefaultHost string = "hostname"
27         // DefaultBasePath is the default BasePath
28         // found in Meta (info) section of spec file
29         DefaultBasePath string = "/ric/v1"
30 )
31
32 // DefaultSchemes are the default schemes found in Meta (info) section of spec file
33 var DefaultSchemes = []string{"http"}
34
35 // NewHTTPClient creates a new r i c subscription HTTP client.
36 func NewHTTPClient(formats strfmt.Registry) *RICSubscription {
37         return NewHTTPClientWithConfig(formats, nil)
38 }
39
40 // NewHTTPClientWithConfig creates a new r i c subscription HTTP client,
41 // using a customizable transport config.
42 func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *RICSubscription {
43         // ensure nullable parameters have default
44         if cfg == nil {
45                 cfg = DefaultTransportConfig()
46         }
47
48         // create transport and client
49         transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
50         return New(transport, formats)
51 }
52
53 // New creates a new r i c subscription client
54 func New(transport runtime.ClientTransport, formats strfmt.Registry) *RICSubscription {
55         // ensure nullable parameters have default
56         if formats == nil {
57                 formats = strfmt.Default
58         }
59
60         cli := new(RICSubscription)
61         cli.Transport = transport
62
63         cli.Common = common.New(transport, formats)
64
65         cli.Policy = policy.New(transport, formats)
66
67         cli.Query = query.New(transport, formats)
68
69         cli.Report = report.New(transport, formats)
70
71         return cli
72 }
73
74 // DefaultTransportConfig creates a TransportConfig with the
75 // default settings taken from the meta section of the spec file.
76 func DefaultTransportConfig() *TransportConfig {
77         return &TransportConfig{
78                 Host:     DefaultHost,
79                 BasePath: DefaultBasePath,
80                 Schemes:  DefaultSchemes,
81         }
82 }
83
84 // TransportConfig contains the transport related info,
85 // found in the meta section of the spec file.
86 type TransportConfig struct {
87         Host     string
88         BasePath string
89         Schemes  []string
90 }
91
92 // WithHost overrides the default host,
93 // provided by the meta section of the spec file.
94 func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
95         cfg.Host = host
96         return cfg
97 }
98
99 // WithBasePath overrides the default basePath,
100 // provided by the meta section of the spec file.
101 func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
102         cfg.BasePath = basePath
103         return cfg
104 }
105
106 // WithSchemes overrides the default schemes,
107 // provided by the meta section of the spec file.
108 func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
109         cfg.Schemes = schemes
110         return cfg
111 }
112
113 // RICSubscription is a client for r i c subscription
114 type RICSubscription struct {
115         Common *common.Client
116
117         Policy *policy.Client
118
119         Query *query.Client
120
121         Report *report.Client
122
123         Transport runtime.ClientTransport
124 }
125
126 // SetTransport changes the transport on the client and all its subresources
127 func (c *RICSubscription) SetTransport(transport runtime.ClientTransport) {
128         c.Transport = transport
129
130         c.Common.SetTransport(transport)
131
132         c.Policy.SetTransport(transport)
133
134         c.Query.SetTransport(transport)
135
136         c.Report.SetTransport(transport)
137
138 }