Class: Cloudkeeper::One::CoreConnector
Constant Summary
collapse
- STATUS_CODES =
Hash.new(CloudkeeperGrpc::Constants::STATUS_CODE_UNKNOWN).update(
Cloudkeeper::One::Errors::Actions::ListingError => CloudkeeperGrpc::Constants::STATUS_CODE_APPLIANCE_NOT_FOUND,
Cloudkeeper::One::Errors::Actions::UpdateError => CloudkeeperGrpc::Constants::STATUS_CODE_APPLIANCE_NOT_FOUND,
Cloudkeeper::One::Errors::NetworkConnectionError => CloudkeeperGrpc::Constants::STATUS_CODE_FAILED_APPLIANCE_TRANSFER,
Cloudkeeper::One::Errors::Opennebula::AuthenticationError => CloudkeeperGrpc::Constants::STATUS_CODE_UNAUTHENTICATED,
Cloudkeeper::One::Errors::Opennebula::UserNotAuthorizedError => CloudkeeperGrpc::Constants::STATUS_CODE_PERMISSION_DENIED,
Cloudkeeper::One::Errors::Opennebula::ResourceNotFoundError => CloudkeeperGrpc::Constants::STATUS_CODE_RESOURCE_NOT_FOUND,
Cloudkeeper::One::Errors::Actions::RegistrationError => CloudkeeperGrpc::Constants::STATUS_CODE_RESOURCE_NOT_FOUND,
Cloudkeeper::One::Errors::Opennebula::ResourceRetrievalError => CloudkeeperGrpc::Constants::STATUS_CODE_FAILED_RESOURCE_RETRIEVAL,
Cloudkeeper::One::Errors::Opennebula::ResourceStateError => CloudkeeperGrpc::Constants::STATUS_CODE_INVALID_RESOURCE_STATE,
Cloudkeeper::One::Errors::Opennebula::ApiCallTimeoutError => CloudkeeperGrpc::Constants::STATUS_CODE_INVALID_RESOURCE_STATE
).freeze
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#add_appliance(appliance, _call) ⇒ Object
-
#appliances(image_list_identifier, _call) ⇒ Object
-
#image_lists(_empty, _call) ⇒ Object
-
#initialize ⇒ CoreConnector
constructor
A new instance of CoreConnector.
-
#post_action(_empty, _call) ⇒ Object
-
#pre_action(_empty, _call) ⇒ Object
-
#remove_appliance(appliance, _call) ⇒ Object
-
#remove_expired_appliances(_empty, _call) ⇒ Object
-
#remove_image_list(image_list_identifier, _call) ⇒ Object
-
#update_appliance(appliance, _call) ⇒ Object
-
#update_appliance_metadata(appliance, _call) ⇒ Object
#list_appliances, #list_image_lists
#update_image, #update_metadata, #update_template
#prepare_template, #render_templates
#discard_appliance, #discard_expired, #discard_image_list, #discard_images, #discard_templates
#register_or_update_appliance
#download_image
Constructor Details
Returns a new instance of CoreConnector.
Instance Attribute Details
#datastore_handler ⇒ Object
Returns the value of attribute datastore_handler.
4
5
6
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 4
def datastore_handler
@datastore_handler
end
|
#image_handler ⇒ Object
Returns the value of attribute image_handler.
4
5
6
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 4
def image_handler
@image_handler
end
|
#template_handler ⇒ Object
Returns the value of attribute template_handler.
4
5
6
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 4
def template_handler
@template_handler
end
|
Instance Method Details
#add_appliance(appliance, _call) ⇒ Object
42
43
44
45
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 42
def add_appliance(appliance, _call)
logger.debug "Registering appliance #{appliance.identifier.inspect}"
call_backend { register_or_update_appliance appliance }
end
|
#appliances(image_list_identifier, _call) ⇒ Object
72
73
74
75
76
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 72
def appliances(image_list_identifier, _call)
logger.debug "Retrieving appliances from image list #{image_list_identifier.image_list_identifier.inspect} " \
'registered in OpenNebula'
call_backend(use_return_value: true) { list_appliances(image_list_identifier.image_list_identifier).each }
end
|
#image_lists(_empty, _call) ⇒ Object
67
68
69
70
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 67
def image_lists(_empty, _call)
logger.debug 'Retrieving image lists registered in OpenNebula'
call_backend(use_return_value: true) { list_image_lists.each }
end
|
#post_action(_empty, _call) ⇒ Object
37
38
39
40
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 37
def post_action(_empty, _call)
logger.debug 'Running \'post-action\'...'
Google::Protobuf::Empty.new
end
|
#pre_action(_empty, _call) ⇒ Object
32
33
34
35
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 32
def pre_action(_empty, _call)
logger.debug 'Running \'pre-action\'...'
Google::Protobuf::Empty.new
end
|
#remove_appliance(appliance, _call) ⇒ Object
57
58
59
60
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 57
def remove_appliance(appliance, _call)
logger.debug "Removing appliance #{appliance.identifier.inspect}"
call_backend { discard_appliance appliance.identifier }
end
|
#remove_expired_appliances(_empty, _call) ⇒ Object
78
79
80
81
82
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 78
def remove_expired_appliances(_empty, _call)
logger.debug 'Removing expired appliances'
call_backend { discard_expired }
end
|
#remove_image_list(image_list_identifier, _call) ⇒ Object
62
63
64
65
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 62
def remove_image_list(image_list_identifier, _call)
logger.debug "Removing appliances from image list #{image_list_identifier.image_list_identifier.inspect}"
call_backend { discard_image_list image_list_identifier.image_list_identifier }
end
|
#update_appliance(appliance, _call) ⇒ Object
47
48
49
50
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 47
def update_appliance(appliance, _call)
logger.debug "Updating appliance #{appliance.identifier.inspect}"
call_backend { register_or_update_appliance appliance }
end
|
52
53
54
55
|
# File 'lib/cloudkeeper/one/core_connector.rb', line 52
def update_appliance_metadata(appliance, _call)
logger.debug "Updating appliance metadata of #{appliance.identifier.inspect}"
call_backend { update_metadata appliance }
end
|