Module: MnoEnterprise::Concerns::Models::AppInstance

Extended by:
ActiveSupport::Concern
Included in:
AppInstance
Defined in:
lib/mno_enterprise/concerns/models/app_instance.rb

Overview

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

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#active?Boolean

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

Returns:

  • (Boolean)


88
89
90
# File 'lib/mno_enterprise/concerns/models/app_instance.rb', line 88

def active?
  ACTIVE_STATUSES.include?(self.status.to_sym)
end

#per_user_licence?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/mno_enterprise/concerns/models/app_instance.rb', line 92

def per_user_licence?
  self.per_user_licence
end

#running?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/mno_enterprise/concerns/models/app_instance.rb', line 100

def running?
  self.status == 'running'
end

#terminateObject

Instance methods

Send a request to terminate the AppInstance Alias of destroy TODO: specs



82
83
84
# File 'lib/mno_enterprise/concerns/models/app_instance.rb', line 82

def terminate
  self.destroy
end

#to_audit_eventObject



104
105
106
107
108
109
110
111
112
# 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?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/mno_enterprise/concerns/models/app_instance.rb', line 96

def under_free_trial?
  self.under_free_trial
end