57 lines
1.7 KiB
Ruby
57 lines
1.7 KiB
Ruby
require "db/mongo/models/deploy_env/cloud_deploy_env"
|
|
|
|
module Devops
|
|
module Model
|
|
class DeployEnvEc2 < CloudDeployEnv
|
|
|
|
=begin
|
|
@Deprecated
|
|
types :identifier => {:type => String, :empty => false},
|
|
:image => {:type => String, :empty => false},
|
|
:flavor => {:type => String, :empty => false},
|
|
:provider => {:type => String, :empty => false},
|
|
:expires => {:type => String, :empty => false, :nil => true},
|
|
:run_list => {:type => Array, :empty => true},
|
|
:users => {:type => Array, :empty => true},
|
|
:subnets => {:type => Array, :empty => true},
|
|
:groups => {:type => Array, :empty => false},
|
|
:stack_template => {:type => String, :empty => false, :nil => true}
|
|
=end
|
|
|
|
=begin
|
|
set_validators ::Validators::DeployEnv::RunList,
|
|
::Validators::DeployEnv::Expiration,
|
|
::Validators::DeployEnv::Users,
|
|
::Validators::DeployEnv::Flavor,
|
|
::Validators::DeployEnv::Image,
|
|
::Validators::DeployEnv::SubnetBelongsToProvider,
|
|
::Validators::DeployEnv::Groups,
|
|
::Validators::DeployEnv::StackTemplate
|
|
=end
|
|
|
|
def initialize d={}
|
|
super(d)
|
|
if self.subnets.size > 1
|
|
self.subnets = [ self.subnets[0] ]
|
|
end
|
|
end
|
|
|
|
def self.create hash
|
|
DeployEnvEc2.new(hash)
|
|
end
|
|
|
|
def subnets_filter
|
|
networks = provider_instance.networks
|
|
|
|
unless self.subnets.empty?
|
|
network = networks.detect {|n| n["name"] == self.subnets[0]}
|
|
if network
|
|
{"vpc-id" => network["vpcId"] }
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|