Class: Fog::DNS::Google::Real

Inherits:
Object
  • Object
show all
Includes:
Google::Shared
Defined in:
lib/fog/google/dns.rb,
lib/fog/google/requests/dns/get_managed_zone.rb,
lib/fog/google/requests/dns/list_managed_zones.rb,
lib/fog/google/requests/dns/create_managed_zone.rb,
lib/fog/google/requests/dns/delete_managed_zone.rb

Instance Attribute Summary collapse

Attributes included from Google::Shared

#api_url, #api_version, #project

Instance Method Summary collapse

Methods included from Google::Shared

#build_excon_response, #initialize_google_client, #new_pk12_google_client, #request, #shared_initialize

Constructor Details

#initialize(options) ⇒ Real

Returns a new instance of Real.



54
55
56
57
58
59
# File 'lib/fog/google/dns.rb', line 54

def initialize(options)
  shared_initialize(options[:google_project], GOOGLE_DNS_API_VERSION, GOOGLE_DNS_BASE_URL)
  options.merge!(:google_api_scope_url => GOOGLE_DNS_API_SCOPE_URLS.join(' '))
  @client = initialize_google_client(options)
  @dns = @client.discovered_api('dns', api_version)
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



51
52
53
# File 'lib/fog/google/dns.rb', line 51

def client
  @client
end

#dnsObject (readonly)

Returns the value of attribute dns.



52
53
54
# File 'lib/fog/google/dns.rb', line 52

def dns
  @dns
end

Instance Method Details

#create_managed_zone(zone_name, dns_name, descr = '') ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fog/google/requests/dns/create_managed_zone.rb', line 32

def create_managed_zone(zone_name, dns_name, descr='')
  api_method = @dns.managed_zones.create
  parameters = {
    'project' => @project,
  }

  body_object = {
	    'name' => zone_name,
	    'dnsName' => dns_name,
	  }
	  body_object['description'] = descr unless descr.nil?

  request(api_method, parameters, body_object)
end

#delete_managed_zone(zone_name_or_id) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/fog/google/requests/dns/delete_managed_zone.rb', line 27

def delete_managed_zone(zone_name_or_id)
  api_method = @dns.managed_zones.delete
  parameters = {
    'project' => @project,
	    'managedZone' => zone_name_or_id,
  }

  request(api_method, parameters)
end

#get_managed_zone(zone_name_or_id) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/fog/google/requests/dns/get_managed_zone.rb', line 19

def get_managed_zone(zone_name_or_id)
  api_method = @dns.managed_zones.get
  parameters = {
    'project' => @project,
	    'managedZone' => zone_name_or_id,
  }

  request(api_method, parameters)
end

#list_managed_zonesObject



15
16
17
18
19
20
21
22
# File 'lib/fog/google/requests/dns/list_managed_zones.rb', line 15

def list_managed_zones()
  api_method = @dns.managed_zones.list
  parameters = {
    'project' => @project,
  }

  request(api_method, parameters)
end