Documentation

Server extends AbstractBillableCloudModel
in package
Uses HasFactory, Notifiable, PowerJoins, SoftDeletes

Table of Contents

table  = "cloud_os_compute__servers"
Table name, as constant, used to avoid table name duplication across the source code base.
table_network_relation  = "cloud_os_compute__servers_networks"
The table name for the many-to-many relation with the Networks
$activityLogName  : string
$billable_directly  : bool
$billable_hourly  : bool
$billable_hourly_cost  : float
$billable_monthly  : bool
$billable_monthly_cost  : float
$billable_multiplier  : float
$billable_one_time  : bool
$billable_one_time_cost  : float
$billable_per_usage  : bool
$billable_per_usage_cost  : float
$billable_upon_relation  : bool
$billable_upon_relation_class  : string
$billable_upon_relation_fk  : string
$deleted_at  : Carbon
$error_at  : Carbon
$external_id  : string
$id  : int
$is_billable  : bool
$openStackActivityLogName  : string
$price_list_expires_at  : int
$attributes  : array<string|int, mixed>
Default attributes
$casts  : array<string|int, string>
The attributes that should be casted
$fillable  : array<int, string>
The attributes that are mass assignable.
$table  : string
Table name
_isBillable()  : bool
The server is billable if either the is_billable parameter exists and is true, or if the status of the server is Deployed
_isBillableDirectly()  : bool
This function is used to determinate if a model is ready to be billed.
addons()  : MorphMany
backup()  : HasOne
backups()  : HasOne
belongsToDefaultDomain()  : bool
This function will return true if the model is under the default domain, false otherwise
billingEntries()  : MorphMany
flavor()  : BelongsTo
getActivitylogOptions()  : LogOptions
Specifies which model properties should be logged in the activy log
getBillableOwnerModel()  : Project
getCustomerProduct()  : CustomerProduct|null
getInvoiceItemDescription()  : string
image()  : BelongsTo
images()  : HasMany
isOwner()  : bool
isReadyToInsert()  : bool
Check if the model is consistent to be updated.
isReadyToUpdate()  : bool
Check if the model is consistent to be inserted and created
key_pair()  : BelongsTo
networks()  : BelongsToMany
price_list()  : BelongsTo
priceList()  : BelongsTo
priceListEntity()  : MorphOne
project()  : BelongsTo
promotionsCustomers()  : MorphMany
retrieveDomain()  : Domain|null
volumes()  : HasMany
_getUsage()  : float
Called by the custom attribute `usage`. This function must be overwritten by the class that should implement how usage is calculated
_isReadyToInsert()  : bool
Check if the model is consistent to be updated.
_isReadyToUpdate()  : bool
Check if the model is consistent to be inserted and created
billableHourly()  : Attribute
billableHourlyCost()  : Attribute
billableMonthly()  : Attribute
billableMonthlyCost()  : Attribute
billableMultiplier()  : Attribute
billableOneTime()  : Attribute
billableOneTimeCost()  : Attribute
billablePerUsage()  : Attribute
billablePerUsageCost()  : Attribute
billableUponRelation()  : Attribute
billableUponRelationClass()  : Attribute
billableUponRelationFk()  : Attribute
boot()  : void
Boot the model and register the events
bootIsBillable()  : void
newFactory()  : ServerFactory
Get the Factory Class
usage()  : Attribute
`usage` custom attribute (only getter).

Constants

table

Table name, as constant, used to avoid table name duplication across the source code base.

public mixed table = "cloud_os_compute__servers"
Tags
const

string

table_network_relation

The table name for the many-to-many relation with the Networks

public string table_network_relation = "cloud_os_compute__servers_networks"

Properties

$external_id

public string $external_id

$openStackActivityLogName

public static string $openStackActivityLogName = 'openstack'

$attributes

Default attributes

protected array<string|int, mixed> $attributes = ['is_billable' => false, 'billable_directly' => false, 'status' => \Athomos\Bennu\Modules\Cloud\OpenStack\Compute\Enums\ServerStatus::Created]

$casts

The attributes that should be casted

protected array<string|int, string> $casts = ['addresses' => 'array', 'status' => \Athomos\Bennu\Modules\Cloud\OpenStack\Compute\Enums\ServerStatus::class, 'auth_type' => \Athomos\Bennu\Modules\Cloud\OpenStack\Compute\Enums\ServerAuthType::class, 'is_billable' => 'boolean', 'billable_directly' => 'boolean']

$fillable

The attributes that are mass assignable.

protected array<int, string> $fillable = ['flavor_id', 'image_id', 'key_pair_id', 'name', 'private_net', 'auth_type', 'floating_ip', 'user_data']

$table

Table name

protected string $table = self::table

Methods

_isBillable()

The server is billable if either the is_billable parameter exists and is true, or if the status of the server is Deployed

public _isBillable([bool|null $originIsBillable = null ]) : bool
Parameters
$originIsBillable : bool|null = null
Return values
bool

_isBillableDirectly()

This function is used to determinate if a model is ready to be billed.

public _isBillableDirectly([bool $originIsBillableDirectly = null ]) : bool

Should be overwritten by models that needs a custom logic. If a model do not specialize this function the provided parameter will be returned, otherwise the attribute of the model. IMPORTANT!!! In the specialized version of this function always check the provided parameter, as in some cases a model may have been set on is_billable = false

Parameters
$originIsBillableDirectly : bool = null
Return values
bool

addons()

public addons() : MorphMany
Return values
MorphMany

backup()

public backup() : HasOne
Return values
HasOne

backups()

public backups() : HasOne
Return values
HasOne

belongsToDefaultDomain()

This function will return true if the model is under the default domain, false otherwise

public belongsToDefaultDomain() : bool
Tags
throws
NotImplementedException
Return values
bool

billingEntries()

public billingEntries() : MorphMany
Return values
MorphMany

flavor()

public flavor() : BelongsTo
Return values
BelongsTo

getActivitylogOptions()

Specifies which model properties should be logged in the activy log

public getActivitylogOptions() : LogOptions
Return values
LogOptions

getInvoiceItemDescription()

public getInvoiceItemDescription([array<string|int, mixed> $changes = [] ]) : string
Parameters
$changes : array<string|int, mixed> = []
Return values
string

image()

public image() : BelongsTo
Return values
BelongsTo

images()

public images() : HasMany
Return values
HasMany

isReadyToInsert()

Check if the model is consistent to be updated.

public isReadyToInsert() : bool
Tags
throws
ReporterException
Return values
bool

true if the model is ready to be updated. The return type is just for convenience cause the method throws an exception

isReadyToUpdate()

Check if the model is consistent to be inserted and created

public isReadyToUpdate() : bool
Tags
throws
ReporterException
Return values
bool

true if the model is ready to be updated. The return type is just for convenience cause the method throws an exception

key_pair()

public key_pair() : BelongsTo
Return values
BelongsTo

networks()

public networks() : BelongsToMany
Return values
BelongsToMany

price_list()

public price_list() : BelongsTo
Return values
BelongsTo

priceList()

public priceList() : BelongsTo
Return values
BelongsTo

priceListEntity()

public priceListEntity() : MorphOne
Return values
MorphOne

project()

public project() : BelongsTo
Return values
BelongsTo

promotionsCustomers()

public promotionsCustomers() : MorphMany
Return values
MorphMany

retrieveDomain()

public retrieveDomain() : Domain|null
Tags
inheritDoc
Return values
Domain|null

volumes()

public volumes() : HasMany
Return values
HasMany

_getUsage()

Called by the custom attribute `usage`. This function must be overwritten by the class that should implement how usage is calculated

protected _getUsage() : float
Return values
float

_isReadyToInsert()

Check if the model is consistent to be updated.

protected _isReadyToInsert() : bool
Tags
throws
ReporterException
Return values
bool

true if the model is ready to be updated. The return type is just for convenience cause the method throws an exception

_isReadyToUpdate()

Check if the model is consistent to be inserted and created

protected _isReadyToUpdate() : bool

The function will check if the server instance and related entity have the external_id Without external_id remote operations are not possible

Tags
throws
ReporterException
Return values
bool

true if the model is ready to be updated. The return type is just for convenience cause the method throws an exception

billableHourly()

protected billableHourly() : Attribute
Return values
Attribute

billableHourlyCost()

protected billableHourlyCost() : Attribute
Return values
Attribute

billableMonthly()

protected billableMonthly() : Attribute
Return values
Attribute

billableMonthlyCost()

protected billableMonthlyCost() : Attribute
Return values
Attribute

billableMultiplier()

protected billableMultiplier() : Attribute
Return values
Attribute

billableOneTime()

protected billableOneTime() : Attribute
Return values
Attribute

billableOneTimeCost()

protected billableOneTimeCost() : Attribute
Return values
Attribute

billablePerUsage()

protected billablePerUsage() : Attribute
Return values
Attribute

billablePerUsageCost()

protected billablePerUsageCost() : Attribute
Return values
Attribute

billableUponRelation()

protected billableUponRelation() : Attribute
Return values
Attribute

billableUponRelationClass()

protected billableUponRelationClass() : Attribute
Return values
Attribute

billableUponRelationFk()

protected billableUponRelationFk() : Attribute
Return values
Attribute

boot()

Boot the model and register the events

protected static boot() : void
Return values
void

usage()

`usage` custom attribute (only getter).

protected usage() : Attribute

It returns the current usage of the entity for billable purpose.

Return values
Attribute

float Usage

Search results