Class: CloudstackSpec::Resource::Account
- Defined in:
- lib/cloudstack_spec/resource/account.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #created? ⇒ Boolean
- #destroy? ⇒ Boolean
-
#exist? ⇒ Boolean
handle domain objects.
- #registerUserKeys ⇒ Object
Methods inherited from Base
#get_zone, #initialize, #inspect, #job_status?, #to_ary, #to_s
Constructor Details
This class inherits a constructor from CloudstackSpec::Resource::Base
Instance Method Details
#created? ⇒ Boolean
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cloudstack_spec/resource/account.rb', line 17 def created? if self.exist? puts " Account already exist" return true else account = @connection.create_account( accounttype: 0, email: '[email protected]', firstname: 'cloudstack_spec', lastname: 'cloudstack_spec', password: 'password', domainid: $domainid , username: @name) end end |
#destroy? ⇒ Boolean
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cloudstack_spec/resource/account.rb', line 33 def destroy? sleep(5) if self.exist? job = @connection.delete_account(id: account_id) return job_status?(job['jobid']) else puts " Account does not exist" return false end end |
#exist? ⇒ Boolean
handle domain objects.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/cloudstack_spec/resource/account.rb', line 5 def exist? begin if account.empty? return false else return true end rescue Exception => e return false end end |
#registerUserKeys ⇒ Object
45 46 47 48 49 50 |
# File 'lib/cloudstack_spec/resource/account.rb', line 45 def registerUserKeys keys = user_keys puts " apikey = #{keys['apikey']}" puts " secretkey = #{keys['secretkey']}" return true end |