Class: OCCI::Backend::EC2::EC2

Inherits:
Object
  • Object
show all
Defined in:
lib/occi/backend/ec2/ec2.rb

Constant Summary

OPERATIONS =
{}

Instance Method Summary (collapse)

Constructor Details

- (EC2) initialize(access_key_id, secret_access_key)




134
135
136
137
138
139
# File 'lib/occi/backend/ec2/ec2.rb', line 134

def initialize(access_key_id, secret_access_key)
  # EC2 access key
  AWS.config(
      :access_key_id => access_key_id,
      :secret_access_key => secret_access_key)
end

Instance Method Details

- (Object) action_dummy(compute, parameters)




207
208
209
# File 'lib/occi/backend/ec2/ec2.rb', line 207

def action_dummy(compute, parameters)
  OCCI::Log.debug("Calling method for resource '#{resource.attributes['occi.core.title']}' with parameters: #{parameters.inspect}")
end

- (Object) register_existing_resources




178
179
180
# File 'lib/occi/backend/ec2/ec2.rb', line 178

def register_existing_resources

end

- (Object) register_templates



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/occi/backend/ec2/ec2.rb', line 141

def register_templates
  OCCI::Log.debug("Loading EC2 templates.")

  # import Compute Resource Templates from etc/ec2_templates/resource_templates.xml
  xml = XmlSimple.xml_in("etc/ec2_templates/resource_templates.xml")
  xml["instance"].each do |instance|
    term = instance["term"][0]
    scheme = "http://mycloud.org/templates/compute#"
    title = instance["title"][0]
    attributes = OCCI::Core::Attributes.new()
    actions = []
    entities = []
    related = [OCCI::Infrastructure::ResourceTemplate::MIXIN]
    mixin = OCCI::Core::Mixin.new(term, scheme, title, attributes, actions, related, entities)
    OCCI::CategoryRegistry.register(mixin)
  end

  ## import image templates
  # get the ec2 interface
  ec2 = OCCI::Backend::EC2.get_ec2_interface()
  # register each image
  ec2.images.each do |image|
    term = image.id
    scheme = "http://mycloud.org/templates/os#"
    title = image.name
    attributes = OCCI::Core::Attributes.new()
    actions = []
    entities = []
    related = [OCCI::Infrastructure::OSTemplate::MIXIN]
    mixin = OCCI::Core::Mixin.new(term, scheme, title, attributes, actions, related, entities)
    OCCI::CategoryRegistry.register(mixin)
  end
  OCCI::Log.debug("Finished loading EC2 templates.")
end

- (Object) resource_delete(resource)




198
199
200
# File 'lib/occi/backend/ec2/ec2.rb', line 198

def resource_delete(resource)
  OCCI::Log.debug("Deleting resource '#{resource.attributes['occi.core.title']}'...")
end

- (Object) resource_deploy(resource)




183
184
185
# File 'lib/occi/backend/ec2/ec2.rb', line 183

def resource_deploy(resource)
  OCCI::Log.debug("Deploying resource '#{resource.attributes['occi.core.title']}'...")
end

- (Object) resource_refresh(resource)




188
189
190
# File 'lib/occi/backend/ec2/ec2.rb', line 188

def resource_refresh(resource)
  OCCI::Log.debug("Refreshing resource '#{resource.attributes['occi.core.title']}'...")
end

- (Object) resource_update_state(resource)




193
194
195
# File 'lib/occi/backend/ec2/ec2.rb', line 193

def resource_update_state(resource)
  OCCI::Log.debug("Updating state of resource '#{resource.attributes['occi.core.title']}'...")
end