fog-azure-rm 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/.travis.yml +13 -8
  4. data/CHANGELOG.md +23 -10
  5. data/CONTRIBUTORS.md +2 -0
  6. data/lib/fog/azurerm/application_gateway.rb +4 -3
  7. data/lib/fog/azurerm/compute.rb +0 -1
  8. data/lib/fog/azurerm/dns.rb +0 -3
  9. data/lib/fog/azurerm/docs/application_gateway.md +72 -2
  10. data/lib/fog/azurerm/docs/compute.md +8 -5
  11. data/lib/fog/azurerm/docs/network.md +185 -6
  12. data/lib/fog/azurerm/docs/resources.md +2 -2
  13. data/lib/fog/azurerm/docs/storage.md +2 -2
  14. data/lib/fog/azurerm/docs/traffic_manager.md +23 -0
  15. data/lib/fog/azurerm/models/application_gateway/gateway.rb +180 -22
  16. data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -2
  17. data/lib/fog/azurerm/models/application_gateway/ip_configuration.rb +7 -2
  18. data/lib/fog/azurerm/models/compute/server.rb +5 -2
  19. data/lib/fog/azurerm/models/compute/servers.rb +4 -8
  20. data/lib/fog/azurerm/models/network/express_route_circuit_authorization.rb +58 -0
  21. data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +31 -0
  22. data/lib/fog/azurerm/models/network/load_balancers.rb +4 -2
  23. data/lib/fog/azurerm/models/network/local_network_gateway.rb +68 -0
  24. data/lib/fog/azurerm/models/network/local_network_gateways.rb +29 -0
  25. data/lib/fog/azurerm/models/network/public_ip.rb +16 -1
  26. data/lib/fog/azurerm/models/network/virtual_network_gateway_connection.rb +93 -0
  27. data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +29 -0
  28. data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +1 -1
  29. data/lib/fog/azurerm/models/resources/deployments.rb +4 -2
  30. data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -2
  31. data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -2
  32. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb +23 -6
  33. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +29 -3
  34. data/lib/fog/azurerm/network.rb +23 -3
  35. data/lib/fog/azurerm/requests/application_gateway/{create_application_gateway.rb → create_or_update_application_gateway.rb} +23 -63
  36. data/lib/fog/azurerm/requests/application_gateway/get_application_gateway.rb +159 -0
  37. data/lib/fog/azurerm/requests/application_gateway/update_sku_attributes.rb +28 -0
  38. data/lib/fog/azurerm/requests/application_gateway/update_subnet_id_in_gateway_ip_configuration.rb +29 -0
  39. data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +31 -20
  40. data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +1 -1
  41. data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +1 -1
  42. data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_authorization.rb +49 -0
  43. data/lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb +78 -0
  44. data/lib/fog/azurerm/requests/network/{create_public_ip.rb → create_or_update_public_ip.rb} +22 -8
  45. data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb +81 -0
  46. data/lib/fog/azurerm/requests/network/delete_express_route_circuit_authorization.rb +28 -0
  47. data/lib/fog/azurerm/requests/network/delete_local_network_gateway.rb +28 -0
  48. data/lib/fog/azurerm/requests/network/delete_virtual_network_gateway_connection.rb +28 -0
  49. data/lib/fog/azurerm/requests/network/get_connection_shared_key.rb +25 -0
  50. data/lib/fog/azurerm/requests/network/get_express_route_circuit_authorization.rb +34 -0
  51. data/lib/fog/azurerm/requests/network/get_load_balancer.rb +169 -0
  52. data/lib/fog/azurerm/requests/network/get_local_network_gateway.rb +46 -0
  53. data/lib/fog/azurerm/requests/network/get_virtual_network_gateway_connection.rb +46 -0
  54. data/lib/fog/azurerm/requests/network/list_express_route_circuit_authorizations.rb +36 -0
  55. data/lib/fog/azurerm/requests/network/list_local_network_gateways.rb +49 -0
  56. data/lib/fog/azurerm/requests/network/list_virtual_network_gateway_connections.rb +49 -0
  57. data/lib/fog/azurerm/requests/network/reset_connection_shared_key.rb +36 -0
  58. data/lib/fog/azurerm/requests/network/set_connection_shared_key.rb +36 -0
  59. data/lib/fog/azurerm/requests/resources/create_deployment.rb +5 -4
  60. data/lib/fog/azurerm/requests/resources/create_resource_group.rb +5 -4
  61. data/lib/fog/azurerm/requests/resources/delete_deployment.rb +5 -4
  62. data/lib/fog/azurerm/requests/resources/delete_resource_group.rb +5 -4
  63. data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +6 -4
  64. data/lib/fog/azurerm/requests/resources/get_deployment.rb +81 -0
  65. data/lib/fog/azurerm/requests/resources/get_resource_group.rb +47 -0
  66. data/lib/fog/azurerm/requests/resources/list_deployments.rb +5 -4
  67. data/lib/fog/azurerm/requests/resources/list_resource_groups.rb +6 -5
  68. data/lib/fog/azurerm/requests/resources/list_tagged_resources.rb +5 -4
  69. data/lib/fog/azurerm/requests/resources/tag_resource.rb +6 -4
  70. data/lib/fog/azurerm/requests/storage/get_storage_account.rb +36 -0
  71. data/lib/fog/azurerm/requests/traffic_manager/{create_traffic_manager_endpoint.rb → create_or_update_traffic_manager_endpoint.rb} +2 -2
  72. data/lib/fog/azurerm/requests/traffic_manager/{create_traffic_manager_profile.rb → create_or_update_traffic_manager_profile.rb} +6 -6
  73. data/lib/fog/azurerm/requests/traffic_manager/list_traffic_manager_profiles.rb +1 -1
  74. data/lib/fog/azurerm/resources.rb +2 -3
  75. data/lib/fog/azurerm/storage.rb +1 -1
  76. data/lib/fog/azurerm/traffic_manager.rb +2 -3
  77. data/lib/fog/azurerm/utilities/general.rb +5 -0
  78. data/lib/fog/azurerm/version.rb +1 -1
  79. data/lib/fog/azurerm.rb +34 -32
  80. data/test/api_stub/models/application_gateway/gateway.rb +29 -0
  81. data/test/api_stub/models/network/express_route_circuit_authorization.rb +22 -0
  82. data/test/api_stub/models/network/local_network_gateway.rb +31 -0
  83. data/test/api_stub/models/network/virtual_network_gateway_connection.rb +31 -0
  84. data/test/api_stub/requests/application_gateway/gateway.rb +30 -0
  85. data/test/api_stub/requests/compute/virtual_machine.rb +129 -2
  86. data/test/api_stub/requests/network/express_route_circuit_authorization.rb +31 -0
  87. data/test/api_stub/requests/network/local_network_gateway.rb +62 -0
  88. data/test/api_stub/requests/network/virtual_network_gateway_connection.rb +68 -0
  89. data/test/api_stub/requests/traffic_manager/traffic_manager_profile.rb +13 -0
  90. data/test/api_stub.rb +97 -48
  91. data/test/integration/Virtual_network_gateway_connection.rb +212 -0
  92. data/test/integration/application_gateway.rb +125 -54
  93. data/test/integration/deployment.rb +1 -1
  94. data/test/integration/express_route_circuit.rb +43 -4
  95. data/test/integration/external_load_balancer.rb +4 -4
  96. data/test/integration/internal_load_balancer.rb +4 -4
  97. data/test/integration/local_network_gateway.rb +76 -0
  98. data/test/integration/public_ip.rb +7 -0
  99. data/test/integration/server.rb +5 -4
  100. data/test/integration/storage_account.rb +5 -5
  101. data/test/integration/traffic_manager.rb +21 -0
  102. data/test/integration/virtual_network_gateway.rb +51 -22
  103. data/test/models/application_gateway/test_gateway.rb +56 -1
  104. data/test/models/application_gateway/test_gateways.rb +5 -5
  105. data/test/models/compute/test_servers.rb +6 -14
  106. data/test/models/network/test_express_route_circuit_authorization.rb +50 -0
  107. data/test/models/network/test_express_route_circuit_authorizations.rb +43 -0
  108. data/test/models/network/test_load_balancers.rb +6 -6
  109. data/test/models/network/test_local_network_gateway.rb +53 -0
  110. data/test/models/network/test_local_network_gateways.rb +42 -0
  111. data/test/models/network/test_public_ip.rb +16 -12
  112. data/test/models/network/test_virtual_network_gateway_connection.rb +59 -0
  113. data/test/models/network/test_virtual_network_gateway_connections.rb +42 -0
  114. data/test/models/resources/test_deployments.rb +5 -5
  115. data/test/models/resources/test_resource_groups.rb +5 -5
  116. data/test/models/storage/test_storage_accounts.rb +3 -3
  117. data/test/models/traffic_manager/test_traffic_manager_end_point.rb +1 -1
  118. data/test/models/traffic_manager/test_traffic_manager_profile.rb +11 -4
  119. data/test/requests/application_gateway/test_create_or_update_application_gateway.rb +35 -0
  120. data/test/requests/application_gateway/test_get_application_gateway.rb +24 -0
  121. data/test/requests/compute/test_create_virtual_machine.rb +17 -2
  122. data/test/requests/network/test_create_express_route_circuit_authorization.rb +35 -0
  123. data/test/requests/network/test_create_or_update_local_network_gateway.rb +36 -0
  124. data/test/requests/network/test_create_public_ip.rb +3 -3
  125. data/test/requests/network/test_create_virtual_network_gateway_connection.rb +36 -0
  126. data/test/requests/network/test_delete_express_route_circuit_authorization.rb +23 -0
  127. data/test/requests/network/test_delete_local_network_gateway.rb +23 -0
  128. data/test/requests/network/test_delete_virtual_network_gateway.rb +2 -2
  129. data/test/requests/network/test_delete_virtual_network_gateway_connection.rb +23 -0
  130. data/test/requests/network/test_get_connection_shared_key.rb +24 -0
  131. data/test/requests/network/test_get_express_route_circuit_authorization.rb +24 -0
  132. data/test/requests/network/test_get_load_balancer.rb +24 -0
  133. data/test/requests/network/test_get_local_network_gateway.rb +24 -0
  134. data/test/requests/network/test_get_virtual_network_gateway_connection.rb +24 -0
  135. data/test/requests/network/test_list_express_route_circuit_authorizations.rb +24 -0
  136. data/test/requests/network/test_list_local_network_gateways.rb +24 -0
  137. data/test/requests/network/test_list_virtual_network_gateway_connections.rb +24 -0
  138. data/test/requests/network/test_reset_connection_shared_key.rb +23 -0
  139. data/test/requests/network/test_set_connection_shared_key.rb +23 -0
  140. data/test/requests/network/test_update_public_ip.rb +34 -0
  141. data/test/requests/resources/test_create_deployment.rb +1 -1
  142. data/test/requests/resources/test_create_resource_group.rb +1 -1
  143. data/test/requests/resources/test_delete_deployment.rb +1 -1
  144. data/test/requests/resources/test_delete_resource_group.rb +1 -1
  145. data/test/requests/resources/test_delete_resource_tag.rb +1 -1
  146. data/test/requests/resources/test_get_deployment.rb +24 -0
  147. data/test/requests/resources/test_get_resource_group.rb +24 -0
  148. data/test/requests/resources/test_list_deployments.rb +1 -1
  149. data/test/requests/resources/test_list_resource_groups.rb +1 -1
  150. data/test/requests/resources/test_list_tagged_resources.rb +1 -1
  151. data/test/requests/resources/test_tag_resource.rb +1 -1
  152. data/test/requests/storage/test_get_storage_account.rb +25 -0
  153. data/test/requests/traffic_manager/test_create_traffic_manager_endpoint.rb +2 -2
  154. data/test/requests/traffic_manager/test_create_traffic_manager_profile.rb +3 -3
  155. data/test/requests/traffic_manager/test_update_traffic_manager_endpoint.rb +27 -0
  156. data/test/requests/traffic_manager/test_update_traffic_manager_profile.rb +27 -0
  157. data/test/test_helper.rb +52 -0
  158. metadata +73 -9
  159. data/lib/fog/azurerm/core.rb +0 -14
  160. data/test/requests/application_gateway/test_create_application_gateway.rb +0 -51
@@ -94,7 +94,8 @@ compute.servers.create(
94
94
  offer: 'UbuntuServer',
95
95
  sku: '14.04.2-LTS',
96
96
  version: 'latest',
97
- platform: 'linux'
97
+ platform: 'linux',
98
+ custom_data: 'echo customData'
98
99
  )
99
100
 
100
101
  ########################################################################################################################
@@ -134,8 +135,8 @@ nic.destroy
134
135
  vnet = network.virtual_networks.get('TestRG-VM', 'testVnet')
135
136
  vnet.destroy
136
137
 
137
- storage = storage.storage_accounts(resource_group: 'TestRG-VM').get('fogstorageac')
138
+ storage = storage.storage_accounts.get('TestRG-VM', 'fogstorageac')
138
139
  storage.destroy
139
140
 
140
- rg = rs.resource_groups.get('TestRG-VM')
141
- rg.destroy
141
+ resource_group = rs.resource_groups.get('TestRG-VM')
142
+ resource_group.destroy
@@ -75,16 +75,16 @@ storage.storage_accounts.create(
75
75
  ###################### Get and Delete Storage Account ######################
76
76
  ########################################################################################################################
77
77
 
78
- standard_storage_account = storage.storage_accounts(resource_group: 'TestRG-SA').get('fogstandardsalrs')
78
+ standard_storage_account = storage.storage_accounts.get('TestRG-SA', 'fogstandardsalrs')
79
79
  standard_storage_account.destroy
80
- standard_storage_account = storage.storage_accounts(resource_group: 'TestRG-SA').get('fogstandardsagrs')
80
+ standard_storage_account = storage.storage_accounts.get('TestRG-SA', 'fogstandardsagrs')
81
81
  standard_storage_account.destroy
82
- premium_storage_account = storage.storage_accounts(resource_group: 'TestRG-SA').get('fogpremiumsa')
82
+ premium_storage_account = storage.storage_accounts.get('TestRG-SA', 'fogpremiumsa')
83
83
  premium_storage_account.destroy
84
84
 
85
85
  ########################################################################################################################
86
86
  ###################### CleanUp ######################
87
87
  ########################################################################################################################
88
88
 
89
- rg = rs.resource_groups.get('TestRG-SA')
90
- rg.destroy
89
+ resource_group = rs.resource_groups.get('TestRG-SA')
90
+ resource_group.destroy
@@ -58,6 +58,16 @@ traffic_manager.traffic_manager_end_points.create(
58
58
  target: 'test-app.com',
59
59
  endpoint_location: 'eastus'
60
60
  )
61
+ ########################################################################################################################
62
+ ###################### Get and Update Traffic Manager Endpoint ######################
63
+ ########################################################################################################################
64
+
65
+ end_point = traffic_manager.traffic_manager_end_points.get('TestRG-TM', 'test-tmp', 'myendpoint', 'externalEndpoints')
66
+ end_point.update(
67
+ type: 'externalEndpoints',
68
+ target: 'test-app1.com',
69
+ endpoint_location: 'centralus'
70
+ )
61
71
 
62
72
  ########################################################################################################################
63
73
  ###################### Get and Destroy Traffic Manager Endpoint ######################
@@ -66,6 +76,17 @@ traffic_manager.traffic_manager_end_points.create(
66
76
  end_point = traffic_manager.traffic_manager_end_points.get('TestRG-TM', 'test-tmp', 'myendpoint', 'externalEndpoints')
67
77
  end_point.destroy
68
78
 
79
+ ########################################################################################################################
80
+ ###################### Get and Update Traffic Manager Profile ######################
81
+ ########################################################################################################################
82
+
83
+ traffic_manager_profile = traffic_manager.traffic_manager_profiles.get('TestRG-TM', 'test-tmp')
84
+ traffic_manager_profile.update(traffic_routing_method: 'Weighted',
85
+ ttl: '35',
86
+ protocol: 'https',
87
+ port: '90',
88
+ path: '/monitorpage1.aspx')
89
+
69
90
  ########################################################################################################################
70
91
  ###################### Get and Destroy Traffic Manager Profile ######################
71
92
  ########################################################################################################################
@@ -31,6 +31,42 @@ resource.resource_groups.create(
31
31
  location: 'eastus'
32
32
  )
33
33
 
34
+ network.virtual_networks.create(
35
+ name: 'testVnet',
36
+ location: 'eastus',
37
+ resource_group: 'TestRG-VNG',
38
+ network_address_list: '10.1.0.0/16,10.2.0.0/16'
39
+ )
40
+
41
+ network.subnets.create(
42
+ name: 'GatewaySubnet',
43
+ resource_group: 'TestRG-VNG',
44
+ virtual_network_name: 'testVnet',
45
+ address_prefix: '10.2.0.0/24'
46
+ )
47
+
48
+ network.public_ips.create(
49
+ name: 'mypubip',
50
+ resource_group: 'TestRG-VNG',
51
+ location: 'eastus',
52
+ public_ip_allocation_method: 'Dynamic'
53
+ )
54
+
55
+ network.local_network_gateways.create(
56
+ name: 'testlocalnetworkgateway',
57
+ location: 'eastus',
58
+ tags: {
59
+ key1: 'value1',
60
+ key2: 'value2'
61
+ },
62
+ resource_group: 'TestRG-VNG',
63
+ gateway_ip_address: '192.168.1.1',
64
+ local_network_address_space_prefixes: [],
65
+ asn: 100,
66
+ bgp_peering_address: '192.168.1.2',
67
+ peer_weight: 3
68
+ )
69
+
34
70
  ########################################################################################################################
35
71
  ###################### Create Virtual Network Gateway ######################
36
72
  ########################################################################################################################
@@ -46,16 +82,16 @@ network.virtual_network_gateways.create(
46
82
  {
47
83
  name: 'default',
48
84
  private_ipallocation_method: 'Dynamic',
49
- public_ipaddress_id: '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Network/publicIPAddresses/{public_ip_name}',
50
- subnet_id: '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Network/virtualNetworks/{virtual_network_name}/subnets/{subnet_name}',
85
+ public_ipaddress_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-VNG/providers/Microsoft.Network/publicIPAddresses/mypubip",
86
+ subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-VNG/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/GatewaySubnet",
51
87
  private_ipaddress: nil
52
88
  }
53
89
  ],
54
- resource_group: 'learn_fog',
90
+ resource_group: 'TestRG-VNG',
55
91
  sku_name: 'Standard',
56
92
  sku_tier: 'Standard',
57
93
  sku_capacity: 2,
58
- gateway_type: 'ExpressRoute',
94
+ gateway_type: 'vpn',
59
95
  enable_bgp: true,
60
96
  gateway_size: nil,
61
97
  asn: 100,
@@ -63,23 +99,7 @@ network.virtual_network_gateways.create(
63
99
  peer_weight: 3,
64
100
  vpn_type: 'RouteBased',
65
101
  vpn_client_address_pool: [],
66
- gateway_default_site: '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Network/localNetworkGateways/{local_network_gateway_name}',
67
- default_sites: [],
68
- vpn_client_configuration: {
69
- address_pool: ['192.168.0.4', '192.168.0.5'],
70
- root_certificates: [
71
- {
72
- name: 'root',
73
- public_cert_data: 'certificate data'
74
- }
75
- ],
76
- revoked_certificates: [
77
- {
78
- name: 'revoked',
79
- thumbprint: 'thumb print detail'
80
- }
81
- ]
82
- }
102
+ gateway_default_site: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-VNG/providers/Microsoft.Network/localNetworkGateways/testlocalnetworkgateway"
83
103
  )
84
104
 
85
105
  ########################################################################################################################
@@ -95,7 +115,16 @@ end
95
115
  ###################### Get Virtual Network Gateway and CleanUp ######################
96
116
  ########################################################################################################################
97
117
 
98
- network_gateway = network.virtual_network_gateways.get('learn_fog', 'testVNG')
118
+ network_gateway = network.virtual_network_gateways.get('TestRG-VNG', 'testnetworkgateway')
99
119
  puts network_gateway.name.to_s
100
120
 
101
121
  network_gateway.destroy
122
+
123
+ pubip = network.public_ips.get('TestRG-VNG', 'mypubip')
124
+ pubip.destroy
125
+
126
+ local_network_gateway = network.local_network_gateways.get('TestRG-VNG', 'testlocalnetworkgateway')
127
+ local_network_gateway.destroy
128
+
129
+ rg = resource.resource_groups.get('TestRG-VNG')
130
+ rg.destroy
@@ -7,6 +7,13 @@ class TestGateway < Minitest::Test
7
7
  @gateway = gateway(@service)
8
8
  @gateway_client = @service.instance_variable_get(:@network_client)
9
9
  @response = ApiStub::Models::ApplicationGateway::Gateway.create_application_gateway_response(@gateway_client)
10
+ gateways = Fog::ApplicationGateway::AzureRM::Gateways.new(resource_group: 'fog-test-rg', service: @service)
11
+ @service.stub :get_application_gateway, @response do
12
+ @gateway_obj = gateways.get('fog-test-rg', 'gateway')
13
+ end
14
+ @ssl_certifcate = ApiStub::Models::ApplicationGateway::Gateway.ssl_certifcate
15
+ @frontend_port = ApiStub::Models::ApplicationGateway::Gateway.frontend_port
16
+ @probe = ApiStub::Models::ApplicationGateway::Gateway.probe
10
17
  end
11
18
 
12
19
  def test_model_methods
@@ -44,11 +51,59 @@ class TestGateway < Minitest::Test
44
51
  end
45
52
 
46
53
  def test_save_method_response
47
- @service.stub :create_application_gateway, @response do
54
+ @service.stub :create_or_update_application_gateway, @response do
48
55
  assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateway.save
49
56
  end
50
57
  end
51
58
 
59
+ def test_update_sku
60
+ @service.stub :update_sku_attributes, @response do
61
+ assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateway_obj.update_sku('Standard_Medium', '2')
62
+ end
63
+ end
64
+
65
+ def test_update_gateway_ip_configuration
66
+ @service.stub :update_subnet_id_in_gateway_ip_configuration, @response do
67
+ assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateway_obj.update_gateway_ip_configuration('/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/vnet/subnets/GatewaySubnet')
68
+ end
69
+ end
70
+
71
+ def test_add_ssl_certificate
72
+ @service.stub :create_or_update_application_gateway, @response do
73
+ assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateway_obj.add_ssl_certificate(@ssl_certifcate)
74
+ end
75
+ end
76
+
77
+ def test_remove_ssl_certificate
78
+ @service.stub :create_or_update_application_gateway, @response do
79
+ assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateway_obj.remove_ssl_certificate(@ssl_certifcate)
80
+ end
81
+ end
82
+
83
+ def test_add_frontend_port
84
+ @service.stub :create_or_update_application_gateway, @response do
85
+ assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateway_obj.add_frontend_port(@frontend_port)
86
+ end
87
+ end
88
+
89
+ def test_remove_frontend_port
90
+ @service.stub :create_or_update_application_gateway, @response do
91
+ assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateway_obj.remove_frontend_port(@frontend_port)
92
+ end
93
+ end
94
+
95
+ def test_add_probe
96
+ @service.stub :create_or_update_application_gateway, @response do
97
+ assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateway_obj.add_probe(@probe)
98
+ end
99
+ end
100
+
101
+ def test_remove_probe
102
+ @service.stub :create_or_update_application_gateway, @response do
103
+ assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateway_obj.remove_probe(@probe)
104
+ end
105
+ end
106
+
52
107
  def test_destroy_method_response
53
108
  @service.stub :delete_application_gateway, true do
54
109
  assert @gateway.destroy
@@ -6,7 +6,7 @@ class TestGateways < Minitest::Test
6
6
  @service = Fog::ApplicationGateway::AzureRM.new(credentials)
7
7
  @gateways = Fog::ApplicationGateway::AzureRM::Gateways.new(resource_group: 'fog-test-rg', service: @service)
8
8
  @gateway_client = @service.instance_variable_get(:@network_client)
9
- @response = [ApiStub::Models::ApplicationGateway::Gateway.create_application_gateway_response(@gateway_client)]
9
+ @response = ApiStub::Models::ApplicationGateway::Gateway.create_application_gateway_response(@gateway_client)
10
10
  end
11
11
 
12
12
  def test_collection_methods
@@ -24,7 +24,8 @@ class TestGateways < Minitest::Test
24
24
  end
25
25
 
26
26
  def test_all_method_response
27
- @service.stub :list_application_gateways, @response do
27
+ response = [@response]
28
+ @service.stub :list_application_gateways, response do
28
29
  assert_instance_of Fog::ApplicationGateway::AzureRM::Gateways, @gateways.all
29
30
  assert @gateways.all.size >= 1
30
31
  @gateways.all.each do |application_gateway|
@@ -34,9 +35,8 @@ class TestGateways < Minitest::Test
34
35
  end
35
36
 
36
37
  def test_get_method_response
37
- @service.stub :list_application_gateways, @response do
38
- assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateways.get('gateway')
39
- assert @gateways.get('wrong-name').nil?, true
38
+ @service.stub :get_application_gateway, @response do
39
+ assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateways.get('fog-test-rg', 'gateway')
40
40
  end
41
41
  end
42
42
  end
@@ -6,14 +6,13 @@ class TestServers < Minitest::Test
6
6
  @service = Fog::Compute::AzureRM.new(credentials)
7
7
  @servers = Fog::Compute::AzureRM::Servers.new(resource_group: 'fog-test-rg', service: @service)
8
8
  @compute_client = @service.instance_variable_get(:@compute_mgmt_client)
9
- @response = [ApiStub::Models::Compute::Server.create_windows_virtual_machine_response(@compute_client)]
9
+ @response = ApiStub::Models::Compute::Server.create_windows_virtual_machine_response(@compute_client)
10
10
  end
11
11
 
12
12
  def test_collection_methods
13
13
  methods = [
14
14
  :all,
15
- :get,
16
- :get_from_remote
15
+ :get
17
16
  ]
18
17
  methods.each do |method|
19
18
  assert @servers.respond_to? method, true
@@ -25,7 +24,8 @@ class TestServers < Minitest::Test
25
24
  end
26
25
 
27
26
  def test_all_method_response
28
- @service.stub :list_virtual_machines, @response do
27
+ response = [@response]
28
+ @service.stub :list_virtual_machines, response do
29
29
  assert_instance_of Fog::Compute::AzureRM::Servers, @servers.all
30
30
  assert @servers.all.size >= 1
31
31
  @servers.all.each do |s|
@@ -35,16 +35,8 @@ class TestServers < Minitest::Test
35
35
  end
36
36
 
37
37
  def test_get_method_response
38
- @service.stub :list_virtual_machines, @response do
39
- assert_instance_of Fog::Compute::AzureRM::Server, @servers.get('fog-test-server')
40
- assert @servers.get('wrong-name').nil?, true
41
- end
42
- end
43
-
44
- def test_get_from_remote_method_response
45
- response = ApiStub::Models::Compute::Server.create_windows_virtual_machine_response(@compute_client)
46
- @service.stub :get_virtual_machine, response do
47
- assert_instance_of Fog::Compute::AzureRM::Server, @servers.get_from_remote('fog-test-rg', 'fog-test-server')
38
+ @service.stub :get_virtual_machine, @response do
39
+ assert_instance_of Fog::Compute::AzureRM::Server, @servers.get('fog-test-rg', 'fog-test-server')
48
40
  end
49
41
  end
50
42
  end
@@ -0,0 +1,50 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for ExpressRouteCircuitAuthorization Model
4
+ class TestExpressRouteCircuitAuthorization < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @circuit_authorization = express_route_circuit_authorization(@service)
8
+ @network_client = @service.instance_variable_get(:@network_client)
9
+ end
10
+
11
+ def test_model_methods
12
+ methods = [
13
+ :save,
14
+ :destroy
15
+ ]
16
+ methods.each do |method|
17
+ assert @circuit_authorization.respond_to? method
18
+ end
19
+ end
20
+
21
+ def test_model_attributes
22
+ attributes = [
23
+ :name,
24
+ :id,
25
+ :resource_group,
26
+ :authorization_name,
27
+ :authorization_key,
28
+ :authorization_status,
29
+ :provisioning_state,
30
+ :etag,
31
+ :circuit_name
32
+ ]
33
+ attributes.each do |attribute|
34
+ assert @circuit_authorization.respond_to? attribute
35
+ end
36
+ end
37
+
38
+ def test_save_method_response
39
+ response = ApiStub::Models::Network::ExpressRouteCircuitAuthorization.create_express_route_circuit_authorization_response(@network_client)
40
+ @service.stub :create_or_update_express_route_circuit_authorization, response do
41
+ assert_instance_of Fog::Network::AzureRM::ExpressRouteCircuitAuthorization, @circuit_authorization.save
42
+ end
43
+ end
44
+
45
+ def test_destroy_method_response
46
+ @service.stub :delete_express_route_circuit_authorization, true do
47
+ assert @circuit_authorization.destroy
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,43 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for ExpressRouteCircuitAuthorizations Collection
4
+ class TestExpressRouteCircuitAuthorizations < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @circuit_authorizations = Fog::Network::AzureRM::ExpressRouteCircuitAuthorizations.new(resource_group: 'fog-test-rg', circuit_name: 'testCircuit', service: @service)
8
+ @network_client = @service.instance_variable_get(:@network_client)
9
+ end
10
+
11
+ def test_collection_methods
12
+ methods = [
13
+ :all,
14
+ :get
15
+ ]
16
+ methods.each do |method|
17
+ assert @circuit_authorizations.respond_to? method
18
+ end
19
+ end
20
+
21
+ def test_collection_attributes
22
+ assert @circuit_authorizations.respond_to? :resource_group
23
+ assert @circuit_authorizations.respond_to? :circuit_name
24
+ end
25
+
26
+ def test_all_method_response
27
+ response = [ApiStub::Models::Network::ExpressRouteCircuitAuthorization.create_express_route_circuit_authorization_response(@network_client)]
28
+ @service.stub :list_express_route_circuit_authorizations, response do
29
+ assert_instance_of Fog::Network::AzureRM::ExpressRouteCircuitAuthorizations, @circuit_authorizations.all
30
+ assert @circuit_authorizations.all.size >= 1
31
+ @circuit_authorizations.all.each do |circuit_authorization|
32
+ assert_instance_of Fog::Network::AzureRM::ExpressRouteCircuitAuthorization, circuit_authorization
33
+ end
34
+ end
35
+ end
36
+
37
+ def test_get_method_response
38
+ response = ApiStub::Models::Network::ExpressRouteCircuitAuthorization.create_express_route_circuit_authorization_response(@network_client)
39
+ @service.stub :get_express_route_circuit_authorization, response do
40
+ assert_instance_of Fog::Network::AzureRM::ExpressRouteCircuitAuthorization, @circuit_authorizations.get('HaiderRG', 'testCircuit', 'auth-name')
41
+ end
42
+ end
43
+ end
@@ -5,8 +5,8 @@ class TestLoadBalancers < Minitest::Test
5
5
  def setup
6
6
  @service = Fog::Network::AzureRM.new(credentials)
7
7
  @load_balancers = Fog::Network::AzureRM::LoadBalancers.new(resource_group: 'fog-test-rg', service: @service)
8
- network_client = @service.instance_variable_get(:@network_client)
9
- @response = [ApiStub::Models::Network::LoadBalancer.create_load_balancer_response(network_client)]
8
+ @network_client = @service.instance_variable_get(:@network_client)
9
+ @response = ApiStub::Models::Network::LoadBalancer.create_load_balancer_response(@network_client)
10
10
  end
11
11
 
12
12
  def test_collection_methods
@@ -24,7 +24,8 @@ class TestLoadBalancers < Minitest::Test
24
24
  end
25
25
 
26
26
  def test_all_method_response
27
- @service.stub :list_load_balancers, @response do
27
+ response = [@response]
28
+ @service.stub :list_load_balancers, response do
28
29
  assert_instance_of Fog::Network::AzureRM::LoadBalancers, @load_balancers.all
29
30
  assert @load_balancers.all.size >= 1
30
31
  @load_balancers.all.each do |lb|
@@ -34,9 +35,8 @@ class TestLoadBalancers < Minitest::Test
34
35
  end
35
36
 
36
37
  def test_get_method_response
37
- @service.stub :list_load_balancers, @response do
38
- assert_instance_of Fog::Network::AzureRM::LoadBalancer, @load_balancers.get('mylb1')
39
- assert @load_balancers.get('wrong-name').nil?, true
38
+ @service.stub :get_load_balancer, @response do
39
+ assert_instance_of Fog::Network::AzureRM::LoadBalancer, @load_balancers.get('fog-test-rg', 'mylb1')
40
40
  end
41
41
  end
42
42
  end
@@ -0,0 +1,53 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for LocalNetworkGateway Model
4
+ class TestLocalNetworkGateway < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @local_network_gateway = local_network_gateway(@service)
8
+ network_client = @service.instance_variable_get(:@network_client)
9
+ @response = ApiStub::Models::Network::LocalNetworkGateway.create_local_network_gateway_response(network_client)
10
+ end
11
+
12
+ def test_model_methods
13
+ methods = [
14
+ :save,
15
+ :destroy
16
+ ]
17
+ methods.each do |method|
18
+ assert @local_network_gateway.respond_to? method
19
+ end
20
+ end
21
+
22
+ def test_model_attributes
23
+ attributes = [
24
+ :name,
25
+ :id,
26
+ :location,
27
+ :type,
28
+ :resource_group,
29
+ :tags,
30
+ :local_network_address_space_prefixes,
31
+ :gateway_ip_address,
32
+ :asn,
33
+ :bgp_peering_address,
34
+ :peer_weight,
35
+ :provisioning_state
36
+ ]
37
+ attributes.each do |attribute|
38
+ assert @local_network_gateway.respond_to? attribute
39
+ end
40
+ end
41
+
42
+ def test_save_method_response
43
+ @service.stub :create_or_update_local_network_gateway, @response do
44
+ assert_instance_of Fog::Network::AzureRM::LocalNetworkGateway, @local_network_gateway.save
45
+ end
46
+ end
47
+
48
+ def test_destroy_method_response
49
+ @service.stub :delete_local_network_gateway, true do
50
+ assert @local_network_gateway.destroy
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,42 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for LocalNetworkGateway Collection
4
+ class TestLocalNetworkGateways < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @local_network_gateways = Fog::Network::AzureRM::LocalNetworkGateways.new(resource_group: 'fog-rg', service: @service)
8
+ @network_client = @service.instance_variable_get(:@network_client)
9
+ @response = ApiStub::Models::Network::LocalNetworkGateway.create_local_network_gateway_response(@network_client)
10
+ end
11
+
12
+ def test_collection_methods
13
+ methods = [
14
+ :all,
15
+ :get
16
+ ]
17
+ methods.each do |method|
18
+ assert @local_network_gateways.respond_to? method
19
+ end
20
+ end
21
+
22
+ def test_collection_attributes
23
+ assert @local_network_gateways.respond_to? :resource_group
24
+ end
25
+
26
+ def test_all_method_response
27
+ response = [@response]
28
+ @service.stub :list_local_network_gateways, response do
29
+ assert_instance_of Fog::Network::AzureRM::LocalNetworkGateways, @local_network_gateways.all
30
+ assert @local_network_gateways.all.size >= 1
31
+ @local_network_gateways.all.each do |local_network_gateway|
32
+ assert_instance_of Fog::Network::AzureRM::LocalNetworkGateway, local_network_gateway
33
+ end
34
+ end
35
+ end
36
+
37
+ def test_get_method_response
38
+ @service.stub :get_local_network_gateway, @response do
39
+ assert_instance_of Fog::Network::AzureRM::LocalNetworkGateway, @local_network_gateways.get('fog-rg', 'mylocalgateway1')
40
+ end
41
+ end
42
+ end
@@ -4,20 +4,18 @@ require File.expand_path '../../test_helper', __dir__
4
4
  class TestPublicIp < Minitest::Test
5
5
  def setup
6
6
  @service = Fog::Network::AzureRM.new(credentials)
7
- network_client = @service.instance_variable_get(:@network_client)
7
+ @network_client = @service.instance_variable_get(:@network_client)
8
8
  @public_ip = public_ip(@service)
9
- @response = ApiStub::Models::Network::PublicIp.create_public_ip_response(network_client)
10
9
  end
11
10
 
12
11
  def test_model_methods
13
12
  methods = [
14
13
  :save,
15
- :destroy
14
+ :destroy,
15
+ :update
16
16
  ]
17
- @service.stub :create_public_ip, @response do
18
- methods.each do |method|
19
- assert @public_ip.respond_to? method
20
- end
17
+ methods.each do |method|
18
+ assert @public_ip.respond_to? method
21
19
  end
22
20
  end
23
21
 
@@ -35,19 +33,25 @@ class TestPublicIp < Minitest::Test
35
33
  :fqdn,
36
34
  :reverse_fqdn
37
35
  ]
38
- @service.stub :create_public_ip, @response do
39
- attributes.each do |attribute|
40
- assert @public_ip.respond_to? attribute
41
- end
36
+ attributes.each do |attribute|
37
+ assert @public_ip.respond_to? attribute
42
38
  end
43
39
  end
44
40
 
45
41
  def test_save_method_response
46
- @service.stub :create_public_ip, @response do
42
+ response = ApiStub::Models::Network::PublicIp.create_public_ip_response(@network_client)
43
+ @service.stub :create_or_update_public_ip, response do
47
44
  assert_instance_of Fog::Network::AzureRM::PublicIp, @public_ip.save
48
45
  end
49
46
  end
50
47
 
48
+ def test_update_method_response
49
+ response = ApiStub::Models::Network::PublicIp.create_public_ip_response(@network_client)
50
+ @service.stub :create_or_update_public_ip, response do
51
+ assert_instance_of Fog::Network::AzureRM::PublicIp, @public_ip.update({})
52
+ end
53
+ end
54
+
51
55
  def test_destroy_method_response
52
56
  response = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
53
57
  @service.stub :delete_public_ip, response do