occi-api 4.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/.gitignore +15 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +43 -0
  4. data/.yardopts +1 -0
  5. data/AUTHORS +9 -0
  6. data/Gemfile +16 -0
  7. data/LICENSE +13 -0
  8. data/README.md +344 -0
  9. data/Rakefile +37 -0
  10. data/examples/dsl_example.rb +167 -0
  11. data/examples/x509auth_example.rb +161 -0
  12. data/ext/mkrf_conf.rb +34 -0
  13. data/features/cassettes/Create_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +288 -0
  14. data/features/cassettes/Delete_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +288 -0
  15. data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__application_json_200_.yml +333 -0
  16. data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__text_plain_200_.yml +529 -0
  17. data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__text_plain_200_action_.yml +288 -0
  18. data/features/cassettes/Miscellaneous_operation_on_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +288 -0
  19. data/features/cassettes/Read_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +288 -0
  20. data/features/cassettes/Update_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +288 -0
  21. data/features/common/step_definitions/common_steps.rb +32 -0
  22. data/features/occi/core/create/create.feature +18 -0
  23. data/features/occi/core/create/step_definitions/create_steps.rb +0 -0
  24. data/features/occi/core/delete/delete.feature +18 -0
  25. data/features/occi/core/delete/step_definitions/delete_steps.rb +0 -0
  26. data/features/occi/core/discovery_interface/discovery_interface.feature +37 -0
  27. data/features/occi/core/discovery_interface/step_definitions/discovery_interface_steps.rb +19 -0
  28. data/features/occi/core/miscellaneous/miscellaneous.feature +18 -0
  29. data/features/occi/core/miscellaneous/step_definitions/miscellaneous_steps.rb +0 -0
  30. data/features/occi/core/read/read.feature +18 -0
  31. data/features/occi/core/read/step_definitions/read_steps.rb +0 -0
  32. data/features/occi/core/update/step_definitions/update_steps.rb +0 -0
  33. data/features/occi/core/update/update.feature +18 -0
  34. data/features/occi/infrastructure/create/create.feature +18 -0
  35. data/features/occi/infrastructure/create/step_definitions/create_steps.rb +0 -0
  36. data/features/support/env.rb +16 -0
  37. data/lib/occi/api/client/client_amqp.rb +766 -0
  38. data/lib/occi/api/client/client_base.rb +689 -0
  39. data/lib/occi/api/client/client_http.rb +541 -0
  40. data/lib/occi/api/client/errors/authn_error.rb +7 -0
  41. data/lib/occi/api/client/errors.rb +1 -0
  42. data/lib/occi/api/client/http/authn_plugins/base.rb +27 -0
  43. data/lib/occi/api/client/http/authn_plugins/basic.rb +22 -0
  44. data/lib/occi/api/client/http/authn_plugins/digest.rb +22 -0
  45. data/lib/occi/api/client/http/authn_plugins/dummy.rb +13 -0
  46. data/lib/occi/api/client/http/authn_plugins/keystone.rb +61 -0
  47. data/lib/occi/api/client/http/authn_plugins/x509.rb +46 -0
  48. data/lib/occi/api/client/http/authn_plugins.rb +6 -0
  49. data/lib/occi/api/client/http/authn_utils.rb +87 -0
  50. data/lib/occi/api/client/http/httparty_fix.rb +53 -0
  51. data/lib/occi/api/client/http/net_http_fix.rb +21 -0
  52. data/lib/occi/api/dsl.rb +146 -0
  53. data/lib/occi/api/version.rb +5 -0
  54. data/lib/occi-api.rb +14 -0
  55. data/occi-api.gemspec +38 -0
  56. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/creates_a_new_compute_resource.yml +266 -0
  57. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/creates_a_new_network_resource.yml +266 -0
  58. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/creates_a_new_storage_resource.yml +266 -0
  59. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deletes_a_compute_resource.yml +266 -0
  60. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deletes_a_network_resource.yml +266 -0
  61. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deletes_a_storage_resource.yml +266 -0
  62. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deploys_an_instance_based_on_OVF_OVA_file.yml +266 -0
  63. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_compute_resources.yml +368 -0
  64. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_network_resources.yml +370 -0
  65. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_storage_resources.yml +430 -0
  66. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/establishes_connection.yml +266 -0
  67. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/finds_and_describes_scoped_os_tpl_mixin.yml +266 -0
  68. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/finds_and_describes_scoped_resource_tpl_mixin.yml +266 -0
  69. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/finds_and_describes_unscoped_mixin.yml +266 -0
  70. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_compute_resource_using_type_identifier.yml +266 -0
  71. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_compute_resource_using_type_name.yml +266 -0
  72. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_network_resource_using_type_identifier.yml +266 -0
  73. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_network_resource_using_type_name.yml +266 -0
  74. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_storage_resource_using_type_identifier.yml +266 -0
  75. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_storage_resource_using_type_name.yml +266 -0
  76. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_entity_type_identifiers.yml +266 -0
  77. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_entity_types.yml +266 -0
  78. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_link_type_identifiers.yml +266 -0
  79. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_link_types.yml +266 -0
  80. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_mixin_type_identifiers.yml +266 -0
  81. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_mixin_types.yml +266 -0
  82. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_mixins.yml +266 -0
  83. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_resource_type_identifiers.yml +266 -0
  84. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_resource_types.yml +266 -0
  85. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_compute_resources.yml +308 -0
  86. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_network_resources.yml +308 -0
  87. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_os_tpl_mixins.yml +266 -0
  88. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_resource_tpl_mixins.yml +266 -0
  89. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_storage_resources.yml +310 -0
  90. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/refreshes_its_model.yml +485 -0
  91. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/triggers_an_action_on_a_compute_resource.yml +266 -0
  92. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/triggers_an_action_on_a_network_resource.yml +266 -0
  93. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/triggers_an_action_on_a_storage_resource.yml +266 -0
  94. data/spec/occi/api/client/client_amqp_spec.rb +158 -0
  95. data/spec/occi/api/client/client_http_spec.rb +292 -0
  96. data/spec/occi/api/client/http/authn_utils_spec.rb +55 -0
  97. data/spec/occi/api/client/http/httparty_fix_spec.rb +0 -0
  98. data/spec/occi/api/client/http/net_http_fix_spec.rb +0 -0
  99. data/spec/occi/api/client/http/rocci-cred-cert.pem +3 -0
  100. data/spec/occi/api/client/http/rocci-cred-key-jruby.pem +3 -0
  101. data/spec/occi/api/client/http/rocci-cred-key.pem +3 -0
  102. data/spec/occi/api/client/http/rocci-cred.p12 +0 -0
  103. data/spec/occi/api/dsl_spec.rb +21 -0
  104. data/spec/spec_helper.rb +38 -0
  105. metadata +379 -0
@@ -0,0 +1,61 @@
1
+ module Occi::Api::Client
2
+ module Http
3
+ module AuthnPlugins
4
+
5
+ class Keystone < Base
6
+
7
+ def setup(options = {})
8
+ response = @env_ref.class.head @env_ref.endpoint
9
+ Occi::Log.debug response.inspect
10
+
11
+ return if response.success?
12
+ raise ::Occi::Api::Client::Errors::AuthnError, "Keystone AuthN failed with #{response.code.to_s}!" unless response.code == 401
13
+
14
+ unless response.headers['www-authenticate'] && response.headers['www-authenticate'].start_with?('Keystone')
15
+ raise ::Occi::Api::Client::Errors::AuthnError, "Target endpoint is probably not OpenStack!"
16
+ end
17
+
18
+ keystone_uri = /^Keystone uri='(.+)'$/.match(response.headers['www-authenticate'])[1]
19
+
20
+ raise ::Occi::Api::Client::Errors::AuthnError, "Unable to get Keystone's URL from the response!" unless keystone_uri
21
+
22
+ headers = @env_ref.class.headers.clone
23
+ headers['Content-Type'] = "application/json"
24
+ headers['Accept'] = headers['Content-Type']
25
+
26
+ response = @env_ref.class.post(keystone_uri + "/v2.0/tokens", :body => get_keystone_req, :headers => headers)
27
+ Occi::Log.debug response.inspect
28
+
29
+ if response.success?
30
+ @env_ref.class.headers['X-Auth-Token'] = response['access']['token']['id']
31
+ else
32
+ raise ::Occi::Api::Client::Errors::AuthnError, "Unable to get a token from Keystone!"
33
+ end
34
+ end
35
+
36
+ private
37
+
38
+ def get_keystone_req(json = true)
39
+ if @options[:original_type] == "x509"
40
+ body = { "auth" => { "voms" => true } }
41
+ elsif @options[:username] && @options[:password]
42
+ body = {
43
+ "auth" => {
44
+ "passwordCredentials" => {
45
+ "username" => @options[:username],
46
+ "password" => @options[:password]
47
+ }
48
+ }
49
+ }
50
+ else
51
+ raise ::Occi::Api::Client::Errors::AuthnError, "Unable to request a token from Keystone! Chosen AuthN not supported."
52
+ end
53
+
54
+ json ? body.to_json : body
55
+ end
56
+
57
+ end
58
+
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,46 @@
1
+ module Occi::Api::Client
2
+ module Http
3
+ module AuthnPlugins
4
+
5
+ class X509 < Base
6
+
7
+ def initialize(env_ref, options = {})
8
+ super env_ref, options
9
+ @fallbacks = %w(keystone)
10
+ end
11
+
12
+ def setup(options = {})
13
+ # set up pem and optionally pem_password and ssl_ca_path
14
+ raise ArgumentError, "Missing required option 'user_cert' for x509 auth!" unless @options[:user_cert]
15
+ raise ArgumentError, "The file specified in 'user_cert' does not exist!" unless File.exists? @options[:user_cert]
16
+
17
+ # handle PKCS#12 credentials before passing them
18
+ # to httparty
19
+ if /\A(.)+\.p12\z/ =~ @options[:user_cert]
20
+ pem_cert = ::Occi::Api::Client::AuthnUtils.extract_pem_from_pkcs12(@options[:user_cert], @options[:user_cert_password])
21
+ @env_ref.class.pem pem_cert, ''
22
+ else
23
+ # httparty will handle ordinary PEM formatted credentials
24
+ # TODO: Issue #49, check PEM credentials in jRuby
25
+ pem_cert = File.open(@options[:user_cert], 'rb').read
26
+ @env_ref.class.pem pem_cert, @options[:user_cert_password]
27
+ end
28
+
29
+ @env_ref.class.ssl_ca_path @options[:ca_path] if @options[:ca_path]
30
+ @env_ref.class.ssl_ca_file @options[:ca_file] if @options[:ca_file]
31
+
32
+ if @options[:voms]
33
+ cert_ary = ::Occi::Api::Client::AuthnUtils.certs_to_file_ary @options[:user_cert]
34
+
35
+ # remove the first cert since it was already used as pem_cert
36
+ # use the rest to establish the chain of trust
37
+ cert_ary.shift
38
+ @env_ref.class.ssl_extra_chain_cert cert_ary unless cert_ary.empty?
39
+ end
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,6 @@
1
+ require 'occi/api/client/http/authn_plugins/base'
2
+ require 'occi/api/client/http/authn_plugins/dummy'
3
+ require 'occi/api/client/http/authn_plugins/basic'
4
+ require 'occi/api/client/http/authn_plugins/digest'
5
+ require 'occi/api/client/http/authn_plugins/x509'
6
+ require 'occi/api/client/http/authn_plugins/keystone'
@@ -0,0 +1,87 @@
1
+ require 'openssl'
2
+
3
+ if defined? JRUBY_VERSION
4
+ require 'java'
5
+ end
6
+
7
+ module Occi
8
+ module Api
9
+ module Client
10
+
11
+ class AuthnUtils
12
+ CERT_REGEXP = /\n?(-----BEGIN CERTIFICATE-----\n.+?\n-----END CERTIFICATE-----)\n/m
13
+
14
+ # Reads credentials from a PKCS#12 compliant file. Returns
15
+ # X.509 certificate and decrypted private key in PEM
16
+ # formatted string.
17
+ #
18
+ # @example
19
+ # extract_pem_from_pkcs12 "~/.globus/usercert.p12", "123456"
20
+ # # => #<String>
21
+ #
22
+ # @param [String] Path to a PKCS#12 file with credentials
23
+ # @param [String] Password needed to unlock the PKCS#12 file
24
+ # @return [String] Decrypted credentials in a PEM formatted string
25
+ def self.extract_pem_from_pkcs12(path_to_p12_file, p12_password)
26
+ # decode certificate and its private key
27
+ pem_from_pkcs12 = ""
28
+ if defined? JRUBY_VERSION
29
+ # Java-based Ruby, read PKCS12 manually
30
+ # using KeyStore
31
+ keystore = Java::JavaSecurity::KeyStore.getInstance("PKCS12")
32
+ p12_input_stream = Java::JavaIo::FileInputStream.new(path_to_p12_file)
33
+ pass_char_array = Java::JavaLang::String.new(p12_password).to_char_array
34
+
35
+ # load and unlock PKCS#12 store
36
+ keystore.load p12_input_stream, pass_char_array
37
+
38
+ # read the first certificate and PK
39
+ cert = keystore.getCertificate("1")
40
+ pk = keystore.getKey("1", pass_char_array)
41
+
42
+ pem_from_pkcs12 << "-----BEGIN CERTIFICATE-----\n"
43
+ pem_from_pkcs12 << Java::JavaxXmlBind::DatatypeConverter.printBase64Binary(cert.getEncoded())
44
+ pem_from_pkcs12 << "\n-----END CERTIFICATE-----"
45
+
46
+ pem_from_pkcs12 << "\n"
47
+
48
+ pem_from_pkcs12 << "-----BEGIN PRIVATE KEY-----\n"
49
+ pem_from_pkcs12 << Java::JavaxXmlBind::DatatypeConverter.printBase64Binary(pk.getEncoded())
50
+ pem_from_pkcs12 << "\n-----END PRIVATE KEY-----"
51
+ else
52
+ # C-based Ruby, use OpenSSL::PKCS12
53
+ pkcs12 = OpenSSL::PKCS12.new(
54
+ File.open(
55
+ path_to_p12_file,
56
+ 'rb'
57
+ ),
58
+ p12_password
59
+ )
60
+
61
+ # store cert and private key in a single PEM formatted string
62
+ pem_from_pkcs12 << pkcs12.certificate.to_pem << pkcs12.key.to_pem
63
+ end
64
+
65
+ pem_from_pkcs12
66
+ end
67
+
68
+ # Reads X.509 certificates from a file to an array.
69
+ #
70
+ # @example
71
+ # certs_to_file_ary "~/.globus/usercert.pem"
72
+ # # => [#<String>, #<String>, ...]
73
+ #
74
+ # @param [String] Path to a PEM file containing certificates
75
+ # @return [Array<String>] An array of read certificates
76
+ def self.certs_to_file_ary(ca_file)
77
+ # TODO: read and separate multiple certificates
78
+ certs_str = File.open(ca_file).read
79
+
80
+ certs_ary = certs_str.scan(CERT_REGEXP)
81
+ certs_ary ? certs_ary.flatten : []
82
+ end
83
+ end
84
+
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,53 @@
1
+ module HTTParty
2
+ class ConnectionAdapter
3
+
4
+ private
5
+
6
+ def attach_ssl_certificates(http, options)
7
+ if http.use_ssl?
8
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
9
+
10
+ # Client certificate authentication
11
+ if options[:pem]
12
+ http.cert = OpenSSL::X509::Certificate.new(options[:pem])
13
+ http.key = OpenSSL::PKey::RSA.new(options[:pem], options[:pem_password])
14
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
15
+ end
16
+
17
+ # Set chain of client certificates
18
+ if options[:ssl_extra_chain_cert]
19
+ http.extra_chain_cert = []
20
+
21
+ options[:ssl_extra_chain_cert].each do |p_ca|
22
+ http.extra_chain_cert << OpenSSL::X509::Certificate.new(p_ca)
23
+ end
24
+ end
25
+
26
+ # SSL certificate authority file and/or directory
27
+ if options[:ssl_ca_file]
28
+ http.ca_file = options[:ssl_ca_file]
29
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
30
+ end
31
+
32
+ if options[:ssl_ca_path]
33
+ http.ca_path = options[:ssl_ca_path]
34
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
35
+ end
36
+
37
+ # This is only Ruby 1.9+
38
+ if options[:ssl_version] && http.respond_to?(:ssl_version=)
39
+ http.ssl_version = options[:ssl_version]
40
+ end
41
+ end
42
+ end
43
+
44
+ end
45
+
46
+ module ClassMethods
47
+
48
+ def ssl_extra_chain_cert(ary_of_certs)
49
+ default_options[:ssl_extra_chain_cert] = ary_of_certs
50
+ end
51
+
52
+ end
53
+ end
@@ -0,0 +1,21 @@
1
+ ##############################################################################
2
+ ## Net::HTTP hack allowing the use of X.509 proxy certificates.
3
+ ##############################################################################
4
+
5
+ module Net
6
+ class HTTP
7
+
8
+ if defined? SSL_ATTRIBUTES
9
+ # For Rubies 1.9.x
10
+ old_verbose, $VERBOSE = $VERBOSE, nil
11
+ SSL_ATTRIBUTES = SSL_ATTRIBUTES.concat %w(extra_chain_cert)
12
+ $VERBOSE = old_verbose
13
+
14
+ attr_accessor :extra_chain_cert
15
+ else
16
+ # For legacy Rubies 1.8.x
17
+ ssl_context_accessor :extra_chain_cert
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,146 @@
1
+ module Occi
2
+ module Api
3
+ module Dsl
4
+
5
+ def connect(protocol, *args)
6
+
7
+ case protocol
8
+ when :http
9
+ @client = Occi::Api::Client::ClientHttp.new(*args)
10
+ when :amqp
11
+ @client = Occi::Api::Client::ClientAmqp.new(*args)
12
+ else
13
+ raise "Protocol #{protocol.to_s} is not supported!"
14
+ end
15
+
16
+ true
17
+ end
18
+
19
+ def list(*args)
20
+ check
21
+
22
+ @client.list(*args)
23
+ end
24
+
25
+ def describe(*args)
26
+ check
27
+
28
+ @client.describe(*args)
29
+ end
30
+
31
+ def create(*args)
32
+ check
33
+
34
+ @client.create(*args)
35
+ end
36
+
37
+ def delete(*args)
38
+ check
39
+
40
+ @client.delete(*args)
41
+ end
42
+
43
+ def trigger(*args)
44
+ check
45
+
46
+ @client.trigger(*args)
47
+ end
48
+
49
+ def refresh
50
+ check
51
+
52
+ @client.refresh
53
+ end
54
+
55
+ def model
56
+ check
57
+
58
+ @client.model
59
+ end
60
+
61
+ ###
62
+
63
+ def resource_types
64
+ check
65
+
66
+ @client.get_resource_types
67
+ end
68
+
69
+ def resource_type_identifiers
70
+ check
71
+
72
+ @client.get_resource_type_identifiers
73
+ end
74
+
75
+ def mixin_type_identifiers
76
+ check
77
+
78
+ @client.get_mixin_type_identifiers
79
+ end
80
+
81
+ def mixin_types
82
+ check
83
+
84
+ @client.get_mixin_types
85
+ end
86
+
87
+ def entity_types
88
+ check
89
+
90
+ @client.get_entity_types
91
+ end
92
+
93
+ def entity_type_identifiers
94
+ check
95
+
96
+ @client.get_entity_type_identifiers
97
+ end
98
+
99
+ def entity_types_related_to(*args)
100
+ check
101
+
102
+ @client.get_entity_types_related_to(*args)
103
+ end
104
+
105
+ def link_types
106
+ check
107
+
108
+ @client.get_link_types
109
+ end
110
+
111
+ def link_type_identifiers
112
+ check
113
+
114
+ @client.get_link_type_identifiers
115
+ end
116
+
117
+ ###
118
+
119
+ def mixins(*args)
120
+ check
121
+
122
+ @client.get_mixins(*args)
123
+ end
124
+
125
+ def resource(*args)
126
+ check
127
+
128
+ @client.get_resource(*args)
129
+ end
130
+
131
+ def mixin(*args)
132
+ check
133
+
134
+ @client.find_mixin(*args)
135
+ end
136
+
137
+ private
138
+
139
+ def check
140
+ raise "You have to issue 'connect' first!" if @client.nil?
141
+ raise "Client is disconnected!" unless @client.connected
142
+ end
143
+
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,5 @@
1
+ module Occi
2
+ module Api
3
+ VERSION = "4.0.0.alpha.1" unless defined?(::Occi::Api::VERSION)
4
+ end
5
+ end
data/lib/occi-api.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'rubygems/package'
3
+
4
+ require 'occi-core'
5
+
6
+ module Occi::Api; end
7
+
8
+ require 'occi/api/version'
9
+ require 'occi/api/client/client_base'
10
+ require 'occi/api/client/errors'
11
+ require 'occi/api/client/http/authn_plugins'
12
+ require 'occi/api/client/client_http'
13
+ require 'occi/api/client/client_amqp'
14
+ require 'occi/api/dsl'
data/occi-api.gemspec ADDED
@@ -0,0 +1,38 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'occi/api/version'
6
+
7
+ Gem::Specification.new do |gem|
8
+ gem.name = "occi-api"
9
+ gem.version = Occi::Api::VERSION
10
+ gem.authors = ["Florian Feldhaus","Piotr Kasprzak", "Boris Parak"]
11
+ gem.email = ["florian.feldhaus@gwdg.de", "piotr.kasprzak@gwdg.de", "xparak@mail.muni.cz"]
12
+ gem.description = %q{OCCI is a collection of classes to simplify the implementation of the Open Cloud Computing API in Ruby}
13
+ gem.summary = %q{OCCI toolkit}
14
+ gem.homepage = 'https://github.com/gwdg/rOCCI-api'
15
+
16
+ gem.files = `git ls-files`.split("\n")
17
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ gem.require_paths = ["lib"]
19
+ gem.extensions = 'ext/mkrf_conf.rb'
20
+
21
+ gem.add_dependency 'occi-core'
22
+ gem.add_dependency 'httparty'
23
+ gem.add_dependency 'amqp'
24
+ gem.add_dependency 'json'
25
+
26
+ gem.add_development_dependency "rspec"
27
+ gem.add_development_dependency "rake"
28
+ gem.add_development_dependency "builder"
29
+ gem.add_development_dependency "simplecov"
30
+ gem.add_development_dependency "yard"
31
+ gem.add_development_dependency "yard-sinatra"
32
+ gem.add_development_dependency "yard-rspec"
33
+ gem.add_development_dependency "yard-cucumber"
34
+ gem.add_development_dependency "rspec-http"
35
+ gem.add_development_dependency "webmock", "~>1.9.3"
36
+
37
+ gem.required_ruby_version = ">= 1.8.7"
38
+ end