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

Inherits:
Object
  • Object
show all
Includes:
Google::Shared
Defined in:
lib/fog/google/requests/dns/get_change.rb,
lib/fog/google/dns.rb,
lib/fog/google/requests/dns/get_project.rb,
lib/fog/google/requests/dns/list_changes.rb,
lib/fog/google/requests/dns/create_change.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,
lib/fog/google/requests/dns/list_resource_record_sets.rb

Overview

Enumerates Resource Record Sets that have been created but not yet deleted.

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.



88
89
90
91
92
93
# File 'lib/fog/google/dns.rb', line 88

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.



85
86
87
# File 'lib/fog/google/dns.rb', line 85

def client
  @client
end

#dnsObject (readonly)

Returns the value of attribute dns.



86
87
88
# File 'lib/fog/google/dns.rb', line 86

def dns
  @dns
end

Instance Method Details

#create_change(zone_name_or_id, additions = [], deletions = []) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/google/requests/dns/create_change.rb', line 9

def create_change(zone_name_or_id, additions = [], deletions = [])
  api_method = @dns.changes.create
  parameters = {
    'project' => @project,
    'managedZone' => zone_name_or_id,
  }

  body = {
    'additions' => additions,
    'deletions' => deletions,
  }

  request(api_method, parameters, body)
end

#create_managed_zone(name, dns_name, description) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fog/google/requests/dns/create_managed_zone.rb', line 10

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

  body_object = {
    'name' => name,
    'dnsName' => dns_name,
    'description' => description,
  }

  request(api_method, parameters, body_object)
end

#delete_managed_zone(name_or_id) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/fog/google/requests/dns/delete_managed_zone.rb', line 9

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

  request(api_method, parameters)
end

#get_change(zone_name_or_id, identity) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/google/requests/dns/get_change.rb', line 9

def get_change(zone_name_or_id, identity)
  api_method = @dns.changes.get
  parameters = {
    'project' => @project,
    'managedZone' => zone_name_or_id,
    'changeId' => identity,
  }

  request(api_method, parameters)
end

#get_managed_zone(name_or_id) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/fog/google/requests/dns/get_managed_zone.rb', line 9

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

  request(api_method, parameters)
end

#get_project(identity) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/fog/google/requests/dns/get_project.rb', line 10

def get_project(identity)
  api_method = @dns.projects.get
  parameters = {
    :project => identity,
  }

  request(api_method, parameters)
end

#list_changes(zone_name_or_id) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/fog/google/requests/dns/list_changes.rb', line 9

def list_changes(zone_name_or_id)
  api_method = @dns.changes.list
  parameters = {
    'project' => @project,
    'managedZone' => zone_name_or_id,
  }

  request(api_method, parameters)
end

#list_managed_zonesObject



9
10
11
12
13
14
15
16
# File 'lib/fog/google/requests/dns/list_managed_zones.rb', line 9

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

  request(api_method, parameters)
end

#list_resource_record_sets(zone_name_or_id, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/google/requests/dns/list_resource_record_sets.rb', line 9

def list_resource_record_sets(zone_name_or_id, options = {})
  api_method = @dns.resource_record_sets.list
  parameters = {
    'project' => @project,
    'managedZone' => zone_name_or_id,
  }

  [:name, :type].reject{ |o| options[o].nil? }.each do |key|
    parameters[key] = options[key]
  end

  request(api_method, parameters)
end