Class: Fog::DNS::AzureRM::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/azurerm/dns.rb,
lib/fog/azurerm/requests/dns/get_zone.rb,
lib/fog/azurerm/requests/dns/list_zones.rb,
lib/fog/azurerm/requests/dns/delete_zone.rb,
lib/fog/azurerm/requests/dns/get_record_set.rb,
lib/fog/azurerm/requests/dns/list_record_sets.rb,
lib/fog/azurerm/requests/dns/check_zone_exists.rb,
lib/fog/azurerm/requests/dns/delete_record_set.rb,
lib/fog/azurerm/requests/dns/create_or_update_zone.rb,
lib/fog/azurerm/requests/dns/check_record_set_exists.rb,
lib/fog/azurerm/requests/dns/create_or_update_record_set.rb,
lib/fog/azurerm/requests/dns/get_records_from_record_set.rb

Overview

Mock class for DNS Request

Instance Method Summary collapse

Constructor Details

#initialize(_options = {}) ⇒ Mock

Returns a new instance of Mock.



34
35
# File 'lib/fog/azurerm/dns.rb', line 34

def initialize(_options = {})
end

Instance Method Details

#check_record_set_exists(_resource_group, _name) ⇒ Object



25
26
27
# File 'lib/fog/azurerm/requests/dns/check_record_set_exists.rb', line 25

def check_record_set_exists(_resource_group, _name)
  true
end

#check_zone_existsObject



27
28
29
30
# File 'lib/fog/azurerm/requests/dns/check_zone_exists.rb', line 27

def check_zone_exists(*)
  Fog::Logger.debug 'Zone name name is available.'
  true
end

#create_or_update_record_setObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fog/azurerm/requests/dns/create_or_update_record_set.rb', line 47

def create_or_update_record_set(*)
  {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/resource_group/providers/Microsoft.Network/dnszones/zone_name/record_type/name',
    'name' => 'name',
    'type' => 'Microsoft.Network/dnszones/record_type',
    'etag' => '7f159cb1-653d-4920-bc03-153c700412a2',
    'location' => 'global',
    'tags' => {},
    'properties' =>
      {
        'metadata' => {},
        'fqdn' => 'name.zone_name',
        'TTL' => 10,
        'ARecords' =>
          [
            {
              'ipv4Address' => '10.1.2.0'
            }
          ]
      }
  }
end

#create_or_update_zoneObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fog/azurerm/requests/dns/create_or_update_zone.rb', line 36

def create_or_update_zone(*)
  {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/resource_group/providers/Microsoft.Network/dnszones/name',
    'name' => name,
    'type' => 'Microsoft.Network/dnszones',
    'etag' => '00000002-0000-0000-76c2-f7ad90b5d101',
    'location' => 'global',
    'tags' => {},
    'properties' =>
      {
        'maxNumberOfRecordSets' => 5000,
        'nameServers' => %w(ns1-05.azure-dns.com. ns2-05.azure-dns.net. ns3-05.azure-dns.org. ns4-05.azure-dns.info.),
        'numberOfRecordSets' => 2,
        'parentResourceGroupName' => resource_group
      }
  }
end

#delete_record_setObject



21
22
23
24
# File 'lib/fog/azurerm/requests/dns/delete_record_set.rb', line 21

def delete_record_set(*)
  Fog::Logger.debug 'Record Set name deleted successfully.'
  true
end

#delete_zoneObject



21
22
23
24
# File 'lib/fog/azurerm/requests/dns/delete_zone.rb', line 21

def delete_zone(*)
  Fog::Logger.debug 'Zone deleted successfully.'
  true
end

#get_record_setObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fog/azurerm/requests/dns/get_record_set.rb', line 20

def get_record_set(*)
  {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/resource_group/providers/Microsoft.Network/dnszones/zone_name/record_type/name',
    'name' => 'name',
    'type' => 'Microsoft.Network/dnszones/record_type',
    'etag' => '3376a38f-a53f-4ed0-a2e7-dfaba67dbb40',
    'location' => 'global',
    'properties' =>
      {
        'metadata' => nil,
        'fqdn' => 'name.zone_name',
        'TTL' => 60,
        'ARecords' =>
          [
            {
              'ipv4Address' => '1.2.3.4'
            },
            {
              'ipv4Address' => '1.2.3.3'
            }
          ]
      }
  }
end

#get_records_from_record_setObject



26
27
28
# File 'lib/fog/azurerm/requests/dns/get_records_from_record_set.rb', line 26

def get_records_from_record_set(*)
  %w(1.2.3.4 1.2.3.5 1.2.3.6)
end

#get_zoneObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fog/azurerm/requests/dns/get_zone.rb', line 20

def get_zone(*)
  {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/resource_group/providers/Microsoft.Network/dnszones/zone_name',
    'name' => 'zone_name',
    'type' => 'Microsoft.Network/dnszones',
    'etag' => '00000003-0000-0000-bd66-02b337a4d101',
    'location' => 'global',
    'tags' => {},
    'properties' =>
      {
        'maxNumberOfRecordSets' => 100_00,
        'nameServers' => nil,
        'numberOfRecordSets' => 2,
        'parentResourceGroupName' => 'resource_group'
      },
    'resource_group' => 'resource_group'
  }
end

#list_record_setsObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fog/azurerm/requests/dns/list_record_sets.rb', line 20

def list_record_sets(*)
  [
    {
      'id' => '/subscriptions/########-####-####-####-############/resourceGroups/resource_group/providers/Microsoft.Network/dnszones/zone_name/A/test_record',
      'name' => 'test_record',
      'type' => 'Microsoft.Network/dnszones/A',
      'etag' => '7f159cb1-653d-4920-bc03-153c700412a2',
      'location' => 'global',
      'properties' =>
      {
        'metadata' => nil,
        'fqdn' => 'test_record.zone_name',
        'TTL' => 60,
        'ARecords' =>
        [
          {
            'ipv4Address' => '1.2.3.4'
          }
        ]
      }
    },
    {
      'id' => '/subscriptions/########-####-####-####-############/resourceGroups/resource_group/providers/Microsoft.Network/dnszones/zone_name/CNAME/test_record1',
      'name' => 'test_record1',
      'type' => 'Microsoft.Network/dnszones/CNAME',
      'etag' => 'cc5ceb6e-16ad-4a5f-bbd7-9bc31c12d0cf',
      'location' => 'global',
      'properties' =>
      {
        'metadata' => nil,
        'fqdn' => 'test_record1.zone_name',
        'TTL' => 60,
        'CNAMERecord' =>
        {
          'cname' => '1.2.3.4'
        }
      }
    }
  ]
end

#list_zonesObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fog/azurerm/requests/dns/list_zones.rb', line 33

def list_zones
  [
    {
      'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog_test_rg/providers/Microsoft.Network/dnszones/testfog1.com',
      'name' => 'testfog1.com',
      'type' => 'Microsoft.Network/dnszones',
      'etag' =>  '00000002-0000-0000-76c2-f7ad90b5d101',
      'location' => 'global',
      'tags' => {},
      'properties' =>
      {
        'maxNumberOfRecordSets' => 5000,
        'nameServers' =>
          %w(ns1-05.azure-dns.com. ns2-05.azure-dns.net. ns3-05.azure-dns.org. ns4-05.azure-dns.info.),
        'numberOfRecordSets' => 2,
        'parentResourceGroupName' => 'fog_test_rg'
      }
    },
    {
      'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog_test_rg/providers/Microsoft.Network/dnszones/testfog.com',
      'name' => 'testfog.com',
      'type' => 'Microsoft.Network/dnszones',
      'etag' => '00000002-0000-0000-4215-c21c8fb5d101',
      'location' => 'global',
      'tags' => {},
      'properties' =>
      {
        'maxNumberOfRecordSets' => 5000,
        'nameServers' =>
          %w(ns1-02.azure-dns.com. ns2-02.azure-dns.net. ns3-02.azure-dns.org. ns4-02.azure-dns.info.),
        'numberOfRecordSets' => 2,
        'parentResourceGroupName' => 'fog_test_rg'
      }
    }
  ]
end