module MnoEnterprise::Concerns::Models::AppInstance

Schema Information

Endpoint:

- /v1/app_instances
- /v1/organizations/:organization_id/app_instances

id                   :integer         not null, primary key
uid                  :string(255)
name                 :string(255)
status               :string(255)
app_id               :integer
created_at           :datetime        not null
updated_at           :datetime        not null
started_at           :datetime
stack                :string(255)
owner_id             :integer
owner_type           :string(255)
terminated_at        :datetime
stopped_at           :datetime
billing_type         :string(255)
autostop_at          :datetime
autostop_interval    :integer
next_status          :string(255)
soa_enabled          :boolean         default(FALSE)

> to be confirmed

http_url
durations                :text
microsoft_licence_id :integer

Constants

ACTIVE_STATUSES
Constants
TERMINATION_STATUSES

Public Instance Methods

active?() click to toggle source

Return true if the instance can be considered active Route53 DNS propagation may take up to a minute, so we force a minimum of 60 seconds before considering the application online

# File lib/mno_enterprise/concerns/models/app_instance.rb, line 88
def active?
  ACTIVE_STATUSES.include?(self.status.to_sym)
end
per_user_licence?() click to toggle source
# File lib/mno_enterprise/concerns/models/app_instance.rb, line 92
def per_user_licence?
  self.per_user_licence
end
running?() click to toggle source
# File lib/mno_enterprise/concerns/models/app_instance.rb, line 100
def running?
  self.status == 'running'
end
terminate() click to toggle source
Instance methods
Send a request to terminate the AppInstance
Alias of destroy
TODO: specs
# File lib/mno_enterprise/concerns/models/app_instance.rb, line 82
def terminate
  self.destroy
end
to_audit_event() click to toggle source
# File lib/mno_enterprise/concerns/models/app_instance.rb, line 104
def to_audit_event
  {
    id: id,
    uid: uid,
    name: name,
    app_nid: app ? app.nid : nil,
    organization_id: owner_id || owner.id
  }
end
under_free_trial?() click to toggle source
# File lib/mno_enterprise/concerns/models/app_instance.rb, line 96
def under_free_trial?
  self.under_free_trial
end