X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fclientapi%2Fr_i_c_subscription_client.go;fp=pkg%2Fclientapi%2Fr_i_c_subscription_client.go;h=91c32aa1d183af306955db7ec4fb3aa26f1b7b92;hb=3895a8c8775ef96652e6473414fdd7366c59f404;hp=0000000000000000000000000000000000000000;hpb=5120ec103eead26427b977f4b2456c2ce57b36ac;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/clientapi/r_i_c_subscription_client.go b/pkg/clientapi/r_i_c_subscription_client.go new file mode 100644 index 0000000..91c32aa --- /dev/null +++ b/pkg/clientapi/r_i_c_subscription_client.go @@ -0,0 +1,138 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clientapi + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + + strfmt "github.com/go-openapi/strfmt" + + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/common" + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/control" + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/policy" + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/report" +) + +// Default r i c subscription HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "hostname" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/ric/v1" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"http"} + +// NewHTTPClient creates a new r i c subscription HTTP client. +func NewHTTPClient(formats strfmt.Registry) *RICSubscription { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new r i c subscription HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *RICSubscription { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new r i c subscription client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *RICSubscription { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(RICSubscription) + cli.Transport = transport + + cli.Common = common.New(transport, formats) + + cli.Control = control.New(transport, formats) + + cli.Policy = policy.New(transport, formats) + + cli.Report = report.New(transport, formats) + + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// RICSubscription is a client for r i c subscription +type RICSubscription struct { + Common *common.Client + + Control *control.Client + + Policy *policy.Client + + Report *report.Client + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *RICSubscription) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + + c.Common.SetTransport(transport) + + c.Control.SetTransport(transport) + + c.Policy.SetTransport(transport) + + c.Report.SetTransport(transport) + +}