2012-06-07 12:50:11 -04:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Ecloud
|
|
|
|
class Organization < Fog::Ecloud::Model
|
|
|
|
|
|
|
|
identity :href
|
|
|
|
|
|
|
|
ignore_attributes :xmlns, :xmlns_xsi, :xmlns_xsd, :xmlns_i
|
|
|
|
|
|
|
|
attribute :name, :aliases => :Name
|
|
|
|
attribute :type, :aliases => :Type
|
2012-11-27 19:57:16 -05:00
|
|
|
attribute :other_links, :aliases => :Links, :squash => :Link
|
2012-06-07 12:50:11 -04:00
|
|
|
|
|
|
|
def locations
|
2012-12-22 18:27:38 -05:00
|
|
|
@locations ||= Fog::Compute::Ecloud::Locations.new( :service => service, :href => href )
|
2012-06-07 12:50:11 -04:00
|
|
|
end
|
|
|
|
|
2012-12-22 18:27:38 -05:00
|
|
|
def environments
|
|
|
|
@environments ||= self.service.environments(:href => href)
|
2012-06-07 12:50:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def tags
|
2012-12-22 18:27:38 -05:00
|
|
|
@tags ||= self.service.tags(:href => "/cloudapi/ecloud/deviceTags/organizations/#{id}")
|
2012-06-07 12:50:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def admin
|
2012-12-22 18:27:38 -05:00
|
|
|
@admin ||= self.service.admin_organizations.new(:href => "/cloudapi/ecloud/admin/organizations/#{id}")
|
2012-06-07 12:50:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def users
|
2012-12-22 18:27:38 -05:00
|
|
|
@users ||= self.service.users(:href => "/cloudapi/ecloud/admin/users/organizations/#{id}")
|
2012-06-07 12:50:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def support_tickets(type = :open)
|
|
|
|
case type
|
|
|
|
when :open
|
2012-12-22 18:27:38 -05:00
|
|
|
@support_tickets ||= Fog::Compute::Ecloud::SupportTickets.new(:service => service, :href => "/cloudapi/ecloud/admin/tickets/organizations/#{id}/active")
|
2012-06-07 12:50:11 -04:00
|
|
|
when :closed
|
2012-12-22 18:27:38 -05:00
|
|
|
@support_tickets ||= Fog::Compute::Ecloud::SupportTickets.new(:service => service, :href => "/cloudapi/ecloud/admin/tickets/organizations/#{id}/closed")
|
2012-06-07 12:50:11 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit_authentication_levels(options = {})
|
|
|
|
options[:uri] = "/cloudapi/ecloud/admin/organizations/#{id}/authenticationLevels"
|
2012-12-22 18:27:38 -05:00
|
|
|
data = service.admin_edit_authentication_levels(options).body
|
|
|
|
level = Fog::Compute::Ecloud::AdminOrganizations.new(:service => service, :href => data[:href])[0]
|
2012-06-07 12:50:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def edit_password_complexity_rules(options = {})
|
|
|
|
options[:uri] = "/cloudapi/ecloud/admin/organizations/#{id}/passwordComplexityRules"
|
2012-12-22 18:27:38 -05:00
|
|
|
data = service.admin_edit_password_complexity_rules(options).body
|
|
|
|
level = Fog::Compute::Ecloud::PasswordComplexityRules.new(:service => service, :href => data[:href])[0]
|
2012-06-07 12:50:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def edit_login_banner(options = {})
|
|
|
|
options[:uri] = "/cloudapi/ecloud/admin/organizations/#{id}/loginBanner"
|
2012-12-22 18:27:38 -05:00
|
|
|
data = service.admin_edit_login_banner(options).body
|
|
|
|
banner = Fog::Compute::Ecloud::LoginBanners.new(:service => service, :href => data[:href])[0]
|
2012-06-07 12:50:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def enable_support_access(options = {})
|
|
|
|
options[:uri] = "/cloudapi/ecloud/admin/organizations/#{id}/action/enableSupportAccess"
|
2012-12-22 18:27:38 -05:00
|
|
|
service.admin_enable_support_access(options[:uri])
|
2012-06-07 12:50:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def disable_support_access(options = {})
|
|
|
|
options[:uri] = "/cloudapi/ecloud/admin/organizations/#{id}/action/disableSupportAccess"
|
2012-12-22 18:27:38 -05:00
|
|
|
service.admin_disable_support_access(options[:uri])
|
2012-06-07 12:50:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def id
|
|
|
|
href.scan(/\d+/)[0]
|
|
|
|
end
|
|
|
|
|
|
|
|
alias :vdcs :environments
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|