Class: Fog::Compute::Ecloud::Organization

Inherits:
Ecloud::Model show all
Defined in:
lib/fog/compute/ecloud/models/organization.rb

Instance Attribute Summary

Attributes inherited from Ecloud::Model

#loaded

Instance Method Summary collapse

Methods inherited from Ecloud::Model

#load_unless_loaded!

Instance Method Details

#adminObject



25
26
27
# File 'lib/fog/compute/ecloud/models/organization.rb', line 25

def admin
  @admin ||= self.service.admin_organizations.new(:href => "#{service.base_path}/admin/organizations/#{id}")
end

#disable_support_access(options = {}) ⇒ Object



78
79
80
81
# File 'lib/fog/compute/ecloud/models/organization.rb', line 78

def disable_support_access(options = {})
  options[:uri] = "#{service.base_path}/admin/organizations/#{id}/action/disableSupportAccess"
  service.admin_disable_support_access(options[:uri])
end

#edit_authentication_levels(options = {}) ⇒ Object



55
56
57
58
59
# File 'lib/fog/compute/ecloud/models/organization.rb', line 55

def edit_authentication_levels(options = {})
  options[:uri] = "#{service.base_path}/admin/organizations/#{id}/authenticationLevels"
  data = service.admin_edit_authentication_levels(options).body
  level = Fog::Compute::Ecloud::AdminOrganizations.new(:service => service, :href => data[:href])[0]
end

#edit_login_banner(options = {}) ⇒ Object



67
68
69
70
71
# File 'lib/fog/compute/ecloud/models/organization.rb', line 67

def (options = {})
  options[:uri] = "#{service.base_path}/admin/organizations/#{id}/loginBanner"
  data = service.(options).body
  banner = Fog::Compute::Ecloud::LoginBanners.new(:service => service, :href => data[:href])[0]
end

#edit_password_complexity_rules(options = {}) ⇒ Object



61
62
63
64
65
# File 'lib/fog/compute/ecloud/models/organization.rb', line 61

def edit_password_complexity_rules(options = {})
  options[:uri] = "#{service.base_path}/admin/organizations/#{id}/passwordComplexityRules"
  data = service.admin_edit_password_complexity_rules(options).body
  level = Fog::Compute::Ecloud::PasswordComplexityRules.new(:service => service, :href => data[:href])[0]
end

#enable_support_access(options = {}) ⇒ Object



73
74
75
76
# File 'lib/fog/compute/ecloud/models/organization.rb', line 73

def enable_support_access(options = {})
  options[:uri] = "#{service.base_path}/admin/organizations/#{id}/action/enableSupportAccess"
  service.admin_enable_support_access(options[:uri])
end

#environmentsObject Also known as: vdcs



17
18
19
# File 'lib/fog/compute/ecloud/models/organization.rb', line 17

def environments
  @environments ||= self.service.environments(:href => href)
end

#idObject



83
84
85
# File 'lib/fog/compute/ecloud/models/organization.rb', line 83

def id
  href.scan(/\d+/)[0]
end

#locationsObject



13
14
15
# File 'lib/fog/compute/ecloud/models/organization.rb', line 13

def locations
  @locations ||= Fog::Compute::Ecloud::Locations.new( :service => service, :href => href )
end

#reloadObject

Set instance variables for child collections/models to nil so that they will be reloaded correctly

Returns:

  • nothing



45
46
47
48
49
50
51
52
53
# File 'lib/fog/compute/ecloud/models/organization.rb', line 45

def reload
  @locations = nil
  @environments = nil
  @tags = nil
  @admin = nil
  @users = nil
  @support_tickets = nil
  super
end

#support_tickets(type = :open) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/fog/compute/ecloud/models/organization.rb', line 33

def support_tickets(type = :open)
  case type
  when :open
    @support_tickets ||= Fog::Compute::Ecloud::SupportTickets.new(:service => service, :href => "#{service.base_path}/admin/tickets/organizations/#{id}/active")
  when :closed
    @support_tickets ||= Fog::Compute::Ecloud::SupportTickets.new(:service => service, :href => "#{service.base_path}/admin/tickets/organizations/#{id}/closed")
  end
end

#tagsObject



21
22
23
# File 'lib/fog/compute/ecloud/models/organization.rb', line 21

def tags
  @tags ||= self.service.tags(:href => "#{service.base_path}/deviceTags/organizations/#{id}")
end

#usersObject



29
30
31
# File 'lib/fog/compute/ecloud/models/organization.rb', line 29

def users
  @users ||= self.service.users(:href => "#{service.base_path}/admin/users/organizations/#{id}")
end