Module ocs_rest_res_balance

This library module implements resource handling functions for a REST server in the ocs application.

Copyright © 2016 - 2026 SigScale Global Inc.

Description

This library module implements resource handling functions for a REST server in the ocs application.

Data Types

bucket_attributes()

bucket_attributes() = #{bucket_type := normal | session, from_bucket => [bucket_source()], reservations => reservations()}

bucket_source()

bucket_source() = #{id := string(), amount := pos_integer(), unit_size := pos_integer(), unit_price := pos_integer(), expire := pos_integer() | undefined}

bucket_status()

bucket_status() = active | expired | suspended

quantity()

quantity() = #quantity{amount = integer(), units = atom() | string()}

reservation()

reservation() = #{ts := pos_integer(), debit := non_neg_integer(), reserve := non_neg_integer(), service_id => non_neg_integer(), charging_key => non_neg_integer()}

reservations()

reservations() = #{SesssionID::list() => reservation()}

Function Index

content_types_accepted/0Provides list of resource representations accepted.
content_types_provided/0Provides list of resource representations available.
get_balance_log/2Body producing function for GET /ocs/v1/log/balance requests.
delete_bucket/1Respond to DELETE /balanceManagement/v1/bucket/{id} request to remove a Balance Bucket.
get_bucket/1Body producing function for GET /balanceManagement/v1/bucket/{id} requests.
head_bucket/0Body producing function for HEAD /balanceManagement/v1/bucket requests.
get_buckets/2Body producing function for GET /balanceManagement/v1/bucket/ requests.
get_balance_service/1Body producing function for GET /balanceManagement/v1/service/{id}/accumulatedBalance requests.
get_balance/1Body producing function for GET /balanceManagement/v1/product/{id}/accumulatedBalance request requests.
get_balance/2Body producing function for GET /balanceManagement/v1/product/{id}/accumulatedBalance with query request.
top_up_service/2Respond to POST /balanceManagement/v1/service/{id}/balanceTopup.
top_up/2Respond to POST /balanceManagement/v1/product/{id}/balanceTopup.
balance_adjustment/1Respond to POST /balanceManagement/v1/balanceAdjustment.
units/1*Return the type of units of the bucket.
type/1*Return the type of abmf logs.
bucket_status/1*CODEC for life cycle status of Bucket instance.
bucket/1CODEC for buckets.
adjustment/1CODEC for adjustments.
acc_balance/1CODEC for acc_balance.
quantity/1CODEC for quantity type.

Function Details

content_types_accepted/0

content_types_accepted() -> ContentTypes

Provides list of resource representations accepted.

content_types_provided/0

content_types_provided() -> ContentTypes

Provides list of resource representations available.

get_balance_log/2

get_balance_log(Query, Headers) -> Result

Body producing function for GET /ocs/v1/log/balance requests.

delete_bucket/1

delete_bucket(Id) -> Result

Respond to DELETE /balanceManagement/v1/bucket/{id} request to remove a Balance Bucket.

get_bucket/1

get_bucket(BucketId) -> Result

Body producing function for GET /balanceManagement/v1/bucket/{id} requests.

head_bucket/0

head_bucket() -> Result

Body producing function for HEAD /balanceManagement/v1/bucket requests.

get_buckets/2

get_buckets(Query, Headers) -> Result

Body producing function for GET /balanceManagement/v1/bucket/ requests.

get_balance_service/1

get_balance_service(Identity) -> Result

Body producing function for GET /balanceManagement/v1/service/{id}/accumulatedBalance requests.

get_balance/1

get_balance(ProdRef) -> Result

Body producing function for GET /balanceManagement/v1/product/{id}/accumulatedBalance request requests.

get_balance/2

get_balance(ProdRef, Query) -> Result

Body producing function for GET /balanceManagement/v1/product/{id}/accumulatedBalance with query request

top_up_service/2

top_up_service(Identity, RequestBody) -> Result

Respond to POST /balanceManagement/v1/service/{id}/balanceTopup.

top_up/2

top_up(Identity, RequestBody) -> Result

Respond to POST /balanceManagement/v1/product/{id}/balanceTopup.

balance_adjustment/1

balance_adjustment(RequestBody) -> Result

Respond to POST /balanceManagement/v1/balanceAdjustment.

units/1 *

units(Units) -> Units

Return the type of units of the bucket.

type/1 *

type(Type) -> Type

Return the type of abmf logs.

bucket_status/1 *

bucket_status(Status) -> Status

CODEC for life cycle status of Bucket instance.

bucket/1

bucket(Bucket) -> Bucket

CODEC for buckets

adjustment/1

adjustment(Adjustment) -> Adjustment

CODEC for adjustments

acc_balance/1

acc_balance(AccBalance) -> AccBalance

CODEC for acc_balance

quantity/1

quantity(Quantity) -> Quantity

CODEC for quantity type


Generated by EDoc