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