client

package
v0.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Requester Requester
	// contains filtered or unexported fields
}

A Client knows how to talk to the the Ella Core API.

func New

func New(config *Config) (*Client, error)

func (*Client) CreateProfile

func (c *Client) CreateProfile(opts *CreateProfileOptions) error

func (*Client) CreateRoute

func (c *Client) CreateRoute(opts *CreateRouteOptions) error

func (*Client) CreateSubscriber

func (c *Client) CreateSubscriber(opts *CreateSubscriberOptions) error

func (*Client) CreateUser

func (c *Client) CreateUser(opts *CreateUserOptions) error

func (*Client) DeleteProfile

func (c *Client) DeleteProfile(opts *DeleteProfileOptions) error

func (*Client) DeleteRoute

func (c *Client) DeleteRoute(opts *DeleteRouteOptions) error

func (*Client) DeleteSubscriber

func (c *Client) DeleteSubscriber(opts *DeleteSubscriberOptions) error

func (*Client) DeleteUser

func (c *Client) DeleteUser(opts *DeleteUserOptions) error

func (*Client) GetMetrics

func (c *Client) GetMetrics() (map[string]float64, error)

GetMetrics retrieves the metrics from the server and returns a map where keys are metric names and values are their corresponding float values.

func (*Client) GetOperator

func (c *Client) GetOperator() (*Operator, error)

func (*Client) GetProfile

func (c *Client) GetProfile(opts *GetProfileOptions) (*Profile, error)

func (*Client) GetRadio

func (c *Client) GetRadio(opts *GetRadioOptions) (*Radio, error)

func (*Client) GetRoute

func (c *Client) GetRoute(opts *GetRouteOptions) (*Route, error)

func (*Client) GetStatus

func (c *Client) GetStatus() (*Status, error)

func (*Client) GetSubscriber

func (c *Client) GetSubscriber(opts *GetSubscriberOptions) (*Subscriber, error)

func (*Client) GetToken

func (c *Client) GetToken() string

func (*Client) ListProfiles

func (c *Client) ListProfiles() ([]*Profile, error)

func (*Client) ListRadios

func (c *Client) ListRadios() ([]*Radio, error)

func (*Client) ListRoutes

func (c *Client) ListRoutes() ([]*Route, error)

func (*Client) ListSubscribers

func (c *Client) ListSubscribers() ([]*Subscriber, error)

func (*Client) ListUsers

func (c *Client) ListUsers() ([]*User, error)

func (*Client) Login

func (c *Client) Login(opts *LoginOptions) error

Login authenticates the user with the provided email and password. It stores the token in the client for future requests.

func (*Client) UpdateOperatorID

func (c *Client) UpdateOperatorID(opts *UpdateOperatorIDOptions) error

func (*Client) UpdateOperatorSlice

func (c *Client) UpdateOperatorSlice(opts *UpdateOperatorSliceOptions) error

func (*Client) UpdateOperatorTracking

func (c *Client) UpdateOperatorTracking(opts *UpdateOperatorTrackingOptions) error

type Config

type Config struct {
	// BaseURL contains the base URL where Ella Core is expected to be.
	BaseURL string
	// TLSConfig is an optional TLS configuration.
	TLSConfig *tls.Config
}

Config allows the user to customize client behavior.

type ConnectionError

type ConnectionError struct {
	// contains filtered or unexported fields
}

ConnectionError represents a connection or communication error.

func (ConnectionError) Error

func (e ConnectionError) Error() string

func (ConnectionError) Unwrap

func (e ConnectionError) Unwrap() error

type CreateProfileOptions

type CreateProfileOptions struct {
	Name            string `json:"name"`
	UeIPPool        string `json:"ue-ip-pool"`
	DNS             string `json:"dns"`
	Mtu             int32  `json:"mtu"`
	BitrateUplink   string `json:"bitrate-uplink"`
	BitrateDownlink string `json:"bitrate-downlink"`
	Var5qi          int32  `json:"var5qi"`
	PriorityLevel   int32  `json:"priority-level"`
}

type CreateRouteOptions

type CreateRouteOptions struct {
	Destination string `json:"destination"`
	Gateway     string `json:"gateway"`
	Interface   string `json:"interface"`
	Metric      int    `json:"metric"`
}

type CreateSubscriberOptions

type CreateSubscriberOptions struct {
	Imsi           string `json:"imsi"`
	Key            string `json:"key"`
	SequenceNumber string `json:"sequenceNumber"`
	ProfileName    string `json:"profileName"`
	OPc            string `json:"opc,omitempty"`
}

type CreateUserOptions

type CreateUserOptions struct {
	Email    string `json:"email"`
	Role     string `json:"role"`
	Password string `json:"password"`
}

type DeleteProfileOptions

type DeleteProfileOptions struct {
	Name string `json:"name"`
}

type DeleteRouteOptions

type DeleteRouteOptions struct {
	ID int64 `json:"id"`
}

type DeleteSubscriberOptions

type DeleteSubscriberOptions struct {
	ID string `json:"id"`
}

type DeleteUserOptions

type DeleteUserOptions struct {
	Email string `json:"email"`
}

type GetOperatorHomeNetworkResponse

type GetOperatorHomeNetworkResponse struct {
	PublicKey string `json:"publicKey,omitempty"`
}

type GetOperatorIDResponse

type GetOperatorIDResponse struct {
	Mcc string `json:"mcc,omitempty"`
	Mnc string `json:"mnc,omitempty"`
}

type GetOperatorSliceResponse

type GetOperatorSliceResponse struct {
	Sst int `json:"sst,omitempty"`
	Sd  int `json:"sd,omitempty"`
}

type GetOperatorTrackingResponse

type GetOperatorTrackingResponse struct {
	SupportedTacs []string `json:"supportedTacs,omitempty"`
}

type GetProfileOptions

type GetProfileOptions struct {
	Name string `json:"name"`
}

type GetRadioOptions

type GetRadioOptions struct {
	Name string `json:"name"`
}

type GetRouteOptions

type GetRouteOptions struct {
	ID int64 `json:"id"`
}

type GetSubscriberOptions

type GetSubscriberOptions struct {
	ID string `json:"id"`
}

type LoginOptions

type LoginOptions struct {
	Email    string
	Password string
}

type LoginResponseResult

type LoginResponseResult struct {
	Token string `json:"token"`
}

type Operator

type Operator struct {
	ID          GetOperatorIDResponse          `json:"id,omitempty"`
	Slice       GetOperatorSliceResponse       `json:"slice,omitempty"`
	Tracking    GetOperatorTrackingResponse    `json:"tracking,omitempty"`
	HomeNetwork GetOperatorHomeNetworkResponse `json:"homeNetwork,omitempty"`
}

type PlmnID

type PlmnID struct {
	Mcc string `json:"mcc"`
	Mnc string `json:"mnc"`
}

type Profile

type Profile struct {
	Name            string `json:"name"`
	UeIPPool        string `json:"ue-ip-pool"`
	DNS             string `json:"dns"`
	Mtu             int32  `json:"mtu"`
	BitrateUplink   string `json:"bitrate-uplink"`
	BitrateDownlink string `json:"bitrate-downlink"`
	Var5qi          int32  `json:"var5qi"`
	PriorityLevel   int32  `json:"priority-level"`
}

type Radio

type Radio struct {
	Name          string         `json:"name"`
	ID            string         `json:"id"`
	Address       string         `json:"address"`
	SupportedTAIs []SupportedTAI `json:"supported_tais"`
}

type RequestError

type RequestError struct {
	// contains filtered or unexported fields
}

RequestError is returned when there's an error processing the request.

func (RequestError) Error

func (e RequestError) Error() string

type RequestOptions

type RequestOptions struct {
	Type    RequestType
	Method  string
	Path    string
	Query   url.Values
	Headers map[string]string
	Body    io.Reader
}

type RequestResponse

type RequestResponse struct {
	StatusCode int
	Headers    http.Header
	// Result can contain request specific JSON data. The result can be
	// unmarshalled into the expected type using the DecodeResult method.
	Result []byte
	// Body is only set for request type RawRequest.
	Body io.ReadCloser
}

func (*RequestResponse) DecodeResult

func (resp *RequestResponse) DecodeResult(result any) error

DecodeResult decodes the endpoint-specific result payload that is included as part of sync and async request responses.

type RequestType

type RequestType int
const (
	RawRequest RequestType = iota
	SyncRequest
)

type Requester

type Requester interface {
	// Do performs the HTTP transaction using the provided options.
	Do(ctx context.Context, opts *RequestOptions) (*RequestResponse, error)
}

type Route

type Route struct {
	ID          int64  `json:"id"`
	Destination string `json:"destination"`
	Gateway     string `json:"gateway"`
	Interface   string `json:"interface"`
	Metric      int    `json:"metric"`
}

type Snssai

type Snssai struct {
	Sst int32  `json:"sst"`
	Sd  string `json:"sd"`
}

type Status

type Status struct {
	Version     string `json:"version"`
	Initialized bool   `json:"initialized"`
}

type Subscriber

type Subscriber struct {
	Imsi           string `json:"imsi"`
	IPAddress      string `json:"ipAddress"`
	Opc            string `json:"opc"`
	SequenceNumber string `json:"sequenceNumber"`
	Key            string `json:"key"`
	ProfileName    string `json:"profileName"`
}

type SupportedTAI

type SupportedTAI struct {
	Tai     Tai      `json:"tai"`
	SNssais []Snssai `json:"snssais"`
}

type Tai

type Tai struct {
	PlmnID PlmnID `json:"plmnID"`
	Tac    string `json:"tac"`
}

type UpdateOperatorIDOptions

type UpdateOperatorIDOptions struct {
	Mcc string
	Mnc string
}

type UpdateOperatorSliceOptions

type UpdateOperatorSliceOptions struct {
	Sst int
	Sd  int
}

type UpdateOperatorTrackingOptions

type UpdateOperatorTrackingOptions struct {
	SupportedTacs []string
}

type User

type User struct {
	Email string `json:"email"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL