Get interface for subscriptions
[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/control"
16         "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/policy"
17         "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/query"
18         "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/report"
19 )
20
21 // Default r i c subscription HTTP client.
22 var Default = NewHTTPClient(nil)
23
24 const (
25         // DefaultHost is the default Host
26         // found in Meta (info) section of spec file
27         DefaultHost string = "hostname"
28         // DefaultBasePath is the default BasePath
29         // found in Meta (info) section of spec file
30         DefaultBasePath string = "/ric/v1"
31 )
32
33 // DefaultSchemes are the default schemes found in Meta (info) section of spec file
34 var DefaultSchemes = []string{"http"}
35
36 // NewHTTPClient creates a new r i c subscription HTTP client.
37 func NewHTTPClient(formats strfmt.Registry) *RICSubscription {
38         return NewHTTPClientWithConfig(formats, nil)
39 }
40
41 // NewHTTPClientWithConfig creates a new r i c subscription HTTP client,
42 // using a customizable transport config.
43 func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *RICSubscription {
44         // ensure nullable parameters have default
45         if cfg == nil {
46                 cfg = DefaultTransportConfig()
47         }
48
49         // create transport and client
50         transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
51         return New(transport, formats)
52 }
53
54 // New creates a new r i c subscription client
55 func New(transport runtime.ClientTransport, formats strfmt.Registry) *RICSubscription {
56         // ensure nullable parameters have default
57         if formats == nil {
58                 formats = strfmt.Default
59         }
60
61         cli := new(RICSubscription)
62         cli.Transport = transport
63
64         cli.Common = common.New(transport, formats)
65
66         cli.Control = control.New(transport, formats)
67
68         cli.Policy = policy.New(transport, formats)
69
70         cli.Query = query.New(transport, formats)
71
72         cli.Report = report.New(transport, formats)
73
74         return cli
75 }
76
77 // DefaultTransportConfig creates a TransportConfig with the
78 // default settings taken from the meta section of the spec file.
79 func DefaultTransportConfig() *TransportConfig {
80         return &TransportConfig{
81                 Host:     DefaultHost,
82                 BasePath: DefaultBasePath,
83                 Schemes:  DefaultSchemes,
84         }
85 }
86
87 // TransportConfig contains the transport related info,
88 // found in the meta section of the spec file.
89 type TransportConfig struct {
90         Host     string
91         BasePath string
92         Schemes  []string
93 }
94
95 // WithHost overrides the default host,
96 // provided by the meta section of the spec file.
97 func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
98         cfg.Host = host
99         return cfg
100 }
101
102 // WithBasePath overrides the default basePath,
103 // provided by the meta section of the spec file.
104 func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
105         cfg.BasePath = basePath
106         return cfg
107 }
108
109 // WithSchemes overrides the default schemes,
110 // provided by the meta section of the spec file.
111 func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
112         cfg.Schemes = schemes
113         return cfg
114 }
115
116 // RICSubscription is a client for r i c subscription
117 type RICSubscription struct {
118         Common *common.Client
119
120         Control *control.Client
121
122         Policy *policy.Client
123
124         Query *query.Client
125
126         Report *report.Client
127
128         Transport runtime.ClientTransport
129 }
130
131 // SetTransport changes the transport on the client and all its subresources
132 func (c *RICSubscription) SetTransport(transport runtime.ClientTransport) {
133         c.Transport = transport
134
135         c.Common.SetTransport(transport)
136
137         c.Control.SetTransport(transport)
138
139         c.Policy.SetTransport(transport)
140
141         c.Query.SetTransport(transport)
142
143         c.Report.SetTransport(transport)
144
145 }