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

#online?Boolean

Returns:

  • (Boolean)


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

def online?
  running? && [self.created_at, self.started_at].compact.max < 70.seconds.ago
end

#running?Boolean

Returns:

  • (Boolean)


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

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