Sha256: 860cce2ac20fb32e55bed7927dd6e4ba0e1af4dcd20f0758e9d2b6f970c97895

Contents?: true

Size: 1.06 KB

Versions: 14

Compression:

Stored size: 1.06 KB

Contents

class Ey::Core::Client::DatabaseServerSnapshot < Ey::Core::Model
  extend Ey::Core::Associations

  identity :id

  attribute :deleted_at,     type: :time
  attribute :engine
  attribute :engine_version
  attribute :location
  attribute :provisioned_at, type: :time
  attribute :provisioned_id
  attribute :storage,        type: :integer

  has_one :provider
  has_one :database_server
  has_one :database_service

  attr_accessor :name

  def save
    if new_record?
      create_params = if collection.url
                        { "url" => collection.url }
                      elsif self.database_service
                        { "database_service" => self.database_service.identity }
                      else
                        requires_one :database_server, :database_service

                        { "database_service" => self.database_server.database_service.identity }
                      end

      connection.requests.new(
        connection.create_database_service_snapshot(create_params.merge("name" => self.name)).body["request"]
      )
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ey-pro-cli-0.0.17 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.16 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.15 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.14 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.13 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.12 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.11 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.10 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.9 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.8 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.7 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.6 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.5 lib/vendor/core/ey-core/models/database_server_snapshot.rb
ey-pro-cli-0.0.4 lib/vendor/core/ey-core/models/database_server_snapshot.rb