class Cloudkeeper::Aws::CoreConnector

Class implementing GRPC procedures

Constants

ERRORS

Attributes

cloud[RW]

Public Class Methods

new(cloud) click to toggle source
Calls superclass method
# File lib/cloudkeeper/aws/core_connector.rb, line 24
def initialize(cloud)
  @cloud = cloud
  super()
end

Public Instance Methods

add_appliance(appliance, _call) click to toggle source
# File lib/cloudkeeper/aws/core_connector.rb, line 49
def add_appliance(appliance, _call)
  logger.debug { "GRPC add appliance #{appliance.identifier}" }
  handle_error do
    register_appliance(appliance)
    Google::Protobuf::Empty.new
  end
end
appliances(image_list_identifier, _call) click to toggle source
# File lib/cloudkeeper/aws/core_connector.rb, line 94
def appliances(image_list_identifier, _call)
  logger.debug { "GRPC appliances for: #{image_list_identifier.image_list_identifier}" }
  handle_error { fetch_appliances(image_list_identifier).each }
end
handle_error() { || ... } click to toggle source
# File lib/cloudkeeper/aws/core_connector.rb, line 29
def handle_error
  yield
rescue Cloudkeeper::Aws::Errors::StandardError => e
  logger.error { "Error #{e.class} with message #{e.message}" }
  raise GRPC::BadStatus.new(ERRORS[e.class], e.message)
rescue ::StandardError => e
  logger.error { "Standard error #{e.class} with message #{e.message}" }
  raise GRPC::BadStatus.new(CloudkeeperGrpc::Constants::STATUS_CODE_UNKNOWN, e.message)
end
image_lists(_empty, _call) click to toggle source
# File lib/cloudkeeper/aws/core_connector.rb, line 89
def image_lists(_empty, _call)
  logger.debug { 'GRPC image lists' }
  handle_error { list_image_lists.each }
end
post_action(_empty, _call) click to toggle source
# File lib/cloudkeeper/aws/core_connector.rb, line 44
def post_action(_empty, _call)
  logger.debug { 'GRPC post action' }
  Google::Protobuf::Empty.new
end
pre_action(_empty, _call) click to toggle source
# File lib/cloudkeeper/aws/core_connector.rb, line 39
def pre_action(_empty, _call)
  logger.debug { 'GRPC pre action' }
  Google::Protobuf::Empty.new
end
remove_appliance(appliance, _call) click to toggle source
# File lib/cloudkeeper/aws/core_connector.rb, line 73
def remove_appliance(appliance, _call)
  logger.debug { "GRPC remove appliance #{appliance.identifier}" }
  handle_error do
    deregister_image(appliance)
    Google::Protobuf::Empty.new
  end
end
remove_expired_appliances(_empty, _call) click to toggle source
# File lib/cloudkeeper/aws/core_connector.rb, line 99
def remove_expired_appliances(_empty, _call)
  logger.debug { 'GRPC remove expired appliances' }
  handle_error do
    deregister_expired_appliances
    Google::Protobuf::Empty.new
  end
end
remove_image_list(image_list_identifier, _call) click to toggle source
# File lib/cloudkeeper/aws/core_connector.rb, line 81
def remove_image_list(image_list_identifier, _call)
  logger.debug { "GRPC remove image list with id: #{image_list_identifier.image_list_identifier}" }
  handle_error do
    deregister_image_list(image_list_identifier)
    Google::Protobuf::Empty.new
  end
end
update_appliance(appliance, _call) click to toggle source
# File lib/cloudkeeper/aws/core_connector.rb, line 57
def update_appliance(appliance, _call)
  logger.debug { "GRPC update appliance #{appliance.identifier}" }
  handle_error do
    modify_appliance(appliance)
    Google::Protobuf::Empty.new
  end
end
update_appliance_metadata(appliance, _call) click to toggle source
# File lib/cloudkeeper/aws/core_connector.rb, line 65
def update_appliance_metadata(appliance, _call)
  logger.debug { "GRPC update appliance metadata #{appliance.identifier}" }
  handle_error do
    change_tags(appliance)
    Google::Protobuf::Empty.new
  end
end