mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[google|dns] Add examples
This commit is contained in:
parent
763c7f2e05
commit
56c3744a17
2 changed files with 47 additions and 0 deletions
8
lib/fog/google/examples/dns/project.rb
Normal file
8
lib/fog/google/examples/dns/project.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
def test
|
||||
connection = Fog::DNS::Google.new
|
||||
|
||||
puts 'Get the Project limits...'
|
||||
puts '-------------------------'
|
||||
connection.projects.get(Fog::DNS[:google].project)
|
||||
|
||||
end
|
39
lib/fog/google/examples/dns/zones.rb
Normal file
39
lib/fog/google/examples/dns/zones.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
def test
|
||||
connection = Fog::DNS::Google.new
|
||||
|
||||
puts 'Create a Zone...'
|
||||
puts '----------------'
|
||||
zone = connection.zones.create(name: 'mytestdomain', domain: 'example.org.', description: 'This is my test domain')
|
||||
|
||||
puts 'List all Zones...'
|
||||
puts '-----------------'
|
||||
connection.zones.all
|
||||
|
||||
puts 'Get the Zone...'
|
||||
puts '---------------'
|
||||
zone = connection.zones.get(zone.id)
|
||||
|
||||
puts 'Create an "A" Record...'
|
||||
puts '-----------------------'
|
||||
record = zone.records.create(name: 'test.example.org.', type: 'A', ttl: 3600, rrdatas: ['192.168.1.1'])
|
||||
|
||||
puts 'Get the Zone Resource Record Sets...'
|
||||
puts '------------------------------------'
|
||||
zone.records
|
||||
|
||||
puts 'Modify the "A" Record...'
|
||||
puts '------------------------'
|
||||
record.modify(ttl: 2600)
|
||||
|
||||
puts 'Delete the "A" Record...'
|
||||
puts '------------------------'
|
||||
record.destroy
|
||||
|
||||
puts 'Get the Zone Changes...'
|
||||
puts '-----------------------'
|
||||
zone.changes
|
||||
|
||||
puts 'Delete the Zone...'
|
||||
puts '------------------'
|
||||
zone.destroy
|
||||
end
|
Loading…
Add table
Reference in a new issue