Class: Fog::DNS::OpenStack::V1::Real

Inherits:
Object
  • Object
show all
Includes:
OpenStack::Core
Defined in:
lib/fog/dns/openstack/v1.rb,
lib/fog/dns/openstack/v1/requests/get_quota.rb,
lib/fog/dns/openstack/v1/requests/list_domains.rb,
lib/fog/dns/openstack/v1/requests/update_quota.rb

Instance Attribute Summary

Attributes included from OpenStack::Core

#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_cache_ttl, #openstack_domain_id, #openstack_domain_name, #openstack_identity_prefix, #openstack_project_domain, #openstack_project_domain_id, #openstack_project_id, #openstack_user_domain, #openstack_user_domain_id, #unscoped_token

Class Method Summary collapse

Instance Method Summary collapse

Methods included from OpenStack::Core

#credentials, #initialize_identity, #reload

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/fog/dns/openstack/v1.rb', line 105

def initialize(options = {})
  initialize_identity options

  @openstack_service_type           = options[:openstack_service_type] || ['dns']
  @openstack_service_name           = options[:openstack_service_name]

  @connection_options               = options[:connection_options] || {}

  authenticate
  set_api_path
  @persistent = options[:persistent] || false
  @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
end

Class Method Details

.not_found_classObject



101
102
103
# File 'lib/fog/dns/openstack/v1.rb', line 101

def self.not_found_class
  Fog::DNS::OpenStack::NotFound
end

Instance Method Details

#get_quota(project_id) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/dns/openstack/v1/requests/get_quota.rb', line 6

def get_quota(project_id)
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => "quotas/#{project_id}"
  )
end

#list_domains(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/fog/dns/openstack/v1/requests/list_domains.rb', line 6

def list_domains(options = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'domains',
    :query   => options
  )
end

#set_api_pathObject



119
120
121
122
123
# File 'lib/fog/dns/openstack/v1.rb', line 119

def set_api_path
  # version explicitly set to allow usage also in 'DEPRECATED' mitaka version,
  # where f.i. quota modification was not possible at the time of creation
  @path = '/v1' unless @path =~ /v1/
end

#update_quota(project_id, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/fog/dns/openstack/v1/requests/update_quota.rb', line 6

def update_quota(project_id, options = {})
  request(
    :body    => Fog::JSON.encode(options),
    :expects => 200,
    :method  => 'PUT',
    :path    => "quotas/#{project_id}"
  )
end