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.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/.travis.yml +13 -8
- data/CHANGELOG.md +23 -10
- data/CONTRIBUTORS.md +2 -0
- data/lib/fog/azurerm/application_gateway.rb +4 -3
- data/lib/fog/azurerm/compute.rb +0 -1
- data/lib/fog/azurerm/dns.rb +0 -3
- data/lib/fog/azurerm/docs/application_gateway.md +72 -2
- data/lib/fog/azurerm/docs/compute.md +8 -5
- data/lib/fog/azurerm/docs/network.md +185 -6
- data/lib/fog/azurerm/docs/resources.md +2 -2
- data/lib/fog/azurerm/docs/storage.md +2 -2
- data/lib/fog/azurerm/docs/traffic_manager.md +23 -0
- data/lib/fog/azurerm/models/application_gateway/gateway.rb +180 -22
- data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -2
- data/lib/fog/azurerm/models/application_gateway/ip_configuration.rb +7 -2
- data/lib/fog/azurerm/models/compute/server.rb +5 -2
- data/lib/fog/azurerm/models/compute/servers.rb +4 -8
- data/lib/fog/azurerm/models/network/express_route_circuit_authorization.rb +58 -0
- data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +31 -0
- data/lib/fog/azurerm/models/network/load_balancers.rb +4 -2
- data/lib/fog/azurerm/models/network/local_network_gateway.rb +68 -0
- data/lib/fog/azurerm/models/network/local_network_gateways.rb +29 -0
- data/lib/fog/azurerm/models/network/public_ip.rb +16 -1
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connection.rb +93 -0
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +29 -0
- data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +1 -1
- data/lib/fog/azurerm/models/resources/deployments.rb +4 -2
- data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -2
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -2
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb +23 -6
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +29 -3
- data/lib/fog/azurerm/network.rb +23 -3
- data/lib/fog/azurerm/requests/application_gateway/{create_application_gateway.rb → create_or_update_application_gateway.rb} +23 -63
- data/lib/fog/azurerm/requests/application_gateway/get_application_gateway.rb +159 -0
- data/lib/fog/azurerm/requests/application_gateway/update_sku_attributes.rb +28 -0
- data/lib/fog/azurerm/requests/application_gateway/update_subnet_id_in_gateway_ip_configuration.rb +29 -0
- data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +31 -20
- data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +1 -1
- data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +1 -1
- data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_authorization.rb +49 -0
- data/lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb +78 -0
- data/lib/fog/azurerm/requests/network/{create_public_ip.rb → create_or_update_public_ip.rb} +22 -8
- data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb +81 -0
- data/lib/fog/azurerm/requests/network/delete_express_route_circuit_authorization.rb +28 -0
- data/lib/fog/azurerm/requests/network/delete_local_network_gateway.rb +28 -0
- data/lib/fog/azurerm/requests/network/delete_virtual_network_gateway_connection.rb +28 -0
- data/lib/fog/azurerm/requests/network/get_connection_shared_key.rb +25 -0
- data/lib/fog/azurerm/requests/network/get_express_route_circuit_authorization.rb +34 -0
- data/lib/fog/azurerm/requests/network/get_load_balancer.rb +169 -0
- data/lib/fog/azurerm/requests/network/get_local_network_gateway.rb +46 -0
- data/lib/fog/azurerm/requests/network/get_virtual_network_gateway_connection.rb +46 -0
- data/lib/fog/azurerm/requests/network/list_express_route_circuit_authorizations.rb +36 -0
- data/lib/fog/azurerm/requests/network/list_local_network_gateways.rb +49 -0
- data/lib/fog/azurerm/requests/network/list_virtual_network_gateway_connections.rb +49 -0
- data/lib/fog/azurerm/requests/network/reset_connection_shared_key.rb +36 -0
- data/lib/fog/azurerm/requests/network/set_connection_shared_key.rb +36 -0
- data/lib/fog/azurerm/requests/resources/create_deployment.rb +5 -4
- data/lib/fog/azurerm/requests/resources/create_resource_group.rb +5 -4
- data/lib/fog/azurerm/requests/resources/delete_deployment.rb +5 -4
- data/lib/fog/azurerm/requests/resources/delete_resource_group.rb +5 -4
- data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +6 -4
- data/lib/fog/azurerm/requests/resources/get_deployment.rb +81 -0
- data/lib/fog/azurerm/requests/resources/get_resource_group.rb +47 -0
- data/lib/fog/azurerm/requests/resources/list_deployments.rb +5 -4
- data/lib/fog/azurerm/requests/resources/list_resource_groups.rb +6 -5
- data/lib/fog/azurerm/requests/resources/list_tagged_resources.rb +5 -4
- data/lib/fog/azurerm/requests/resources/tag_resource.rb +6 -4
- data/lib/fog/azurerm/requests/storage/get_storage_account.rb +36 -0
- data/lib/fog/azurerm/requests/traffic_manager/{create_traffic_manager_endpoint.rb → create_or_update_traffic_manager_endpoint.rb} +2 -2
- data/lib/fog/azurerm/requests/traffic_manager/{create_traffic_manager_profile.rb → create_or_update_traffic_manager_profile.rb} +6 -6
- data/lib/fog/azurerm/requests/traffic_manager/list_traffic_manager_profiles.rb +1 -1
- data/lib/fog/azurerm/resources.rb +2 -3
- data/lib/fog/azurerm/storage.rb +1 -1
- data/lib/fog/azurerm/traffic_manager.rb +2 -3
- data/lib/fog/azurerm/utilities/general.rb +5 -0
- data/lib/fog/azurerm/version.rb +1 -1
- data/lib/fog/azurerm.rb +34 -32
- data/test/api_stub/models/application_gateway/gateway.rb +29 -0
- data/test/api_stub/models/network/express_route_circuit_authorization.rb +22 -0
- data/test/api_stub/models/network/local_network_gateway.rb +31 -0
- data/test/api_stub/models/network/virtual_network_gateway_connection.rb +31 -0
- data/test/api_stub/requests/application_gateway/gateway.rb +30 -0
- data/test/api_stub/requests/compute/virtual_machine.rb +129 -2
- data/test/api_stub/requests/network/express_route_circuit_authorization.rb +31 -0
- data/test/api_stub/requests/network/local_network_gateway.rb +62 -0
- data/test/api_stub/requests/network/virtual_network_gateway_connection.rb +68 -0
- data/test/api_stub/requests/traffic_manager/traffic_manager_profile.rb +13 -0
- data/test/api_stub.rb +97 -48
- data/test/integration/Virtual_network_gateway_connection.rb +212 -0
- data/test/integration/application_gateway.rb +125 -54
- data/test/integration/deployment.rb +1 -1
- data/test/integration/express_route_circuit.rb +43 -4
- data/test/integration/external_load_balancer.rb +4 -4
- data/test/integration/internal_load_balancer.rb +4 -4
- data/test/integration/local_network_gateway.rb +76 -0
- data/test/integration/public_ip.rb +7 -0
- data/test/integration/server.rb +5 -4
- data/test/integration/storage_account.rb +5 -5
- data/test/integration/traffic_manager.rb +21 -0
- data/test/integration/virtual_network_gateway.rb +51 -22
- data/test/models/application_gateway/test_gateway.rb +56 -1
- data/test/models/application_gateway/test_gateways.rb +5 -5
- data/test/models/compute/test_servers.rb +6 -14
- data/test/models/network/test_express_route_circuit_authorization.rb +50 -0
- data/test/models/network/test_express_route_circuit_authorizations.rb +43 -0
- data/test/models/network/test_load_balancers.rb +6 -6
- data/test/models/network/test_local_network_gateway.rb +53 -0
- data/test/models/network/test_local_network_gateways.rb +42 -0
- data/test/models/network/test_public_ip.rb +16 -12
- data/test/models/network/test_virtual_network_gateway_connection.rb +59 -0
- data/test/models/network/test_virtual_network_gateway_connections.rb +42 -0
- data/test/models/resources/test_deployments.rb +5 -5
- data/test/models/resources/test_resource_groups.rb +5 -5
- data/test/models/storage/test_storage_accounts.rb +3 -3
- data/test/models/traffic_manager/test_traffic_manager_end_point.rb +1 -1
- data/test/models/traffic_manager/test_traffic_manager_profile.rb +11 -4
- data/test/requests/application_gateway/test_create_or_update_application_gateway.rb +35 -0
- data/test/requests/application_gateway/test_get_application_gateway.rb +24 -0
- data/test/requests/compute/test_create_virtual_machine.rb +17 -2
- data/test/requests/network/test_create_express_route_circuit_authorization.rb +35 -0
- data/test/requests/network/test_create_or_update_local_network_gateway.rb +36 -0
- data/test/requests/network/test_create_public_ip.rb +3 -3
- data/test/requests/network/test_create_virtual_network_gateway_connection.rb +36 -0
- data/test/requests/network/test_delete_express_route_circuit_authorization.rb +23 -0
- data/test/requests/network/test_delete_local_network_gateway.rb +23 -0
- data/test/requests/network/test_delete_virtual_network_gateway.rb +2 -2
- data/test/requests/network/test_delete_virtual_network_gateway_connection.rb +23 -0
- data/test/requests/network/test_get_connection_shared_key.rb +24 -0
- data/test/requests/network/test_get_express_route_circuit_authorization.rb +24 -0
- data/test/requests/network/test_get_load_balancer.rb +24 -0
- data/test/requests/network/test_get_local_network_gateway.rb +24 -0
- data/test/requests/network/test_get_virtual_network_gateway_connection.rb +24 -0
- data/test/requests/network/test_list_express_route_circuit_authorizations.rb +24 -0
- data/test/requests/network/test_list_local_network_gateways.rb +24 -0
- data/test/requests/network/test_list_virtual_network_gateway_connections.rb +24 -0
- data/test/requests/network/test_reset_connection_shared_key.rb +23 -0
- data/test/requests/network/test_set_connection_shared_key.rb +23 -0
- data/test/requests/network/test_update_public_ip.rb +34 -0
- data/test/requests/resources/test_create_deployment.rb +1 -1
- data/test/requests/resources/test_create_resource_group.rb +1 -1
- data/test/requests/resources/test_delete_deployment.rb +1 -1
- data/test/requests/resources/test_delete_resource_group.rb +1 -1
- data/test/requests/resources/test_delete_resource_tag.rb +1 -1
- data/test/requests/resources/test_get_deployment.rb +24 -0
- data/test/requests/resources/test_get_resource_group.rb +24 -0
- data/test/requests/resources/test_list_deployments.rb +1 -1
- data/test/requests/resources/test_list_resource_groups.rb +1 -1
- data/test/requests/resources/test_list_tagged_resources.rb +1 -1
- data/test/requests/resources/test_tag_resource.rb +1 -1
- data/test/requests/storage/test_get_storage_account.rb +25 -0
- data/test/requests/traffic_manager/test_create_traffic_manager_endpoint.rb +2 -2
- data/test/requests/traffic_manager/test_create_traffic_manager_profile.rb +3 -3
- data/test/requests/traffic_manager/test_update_traffic_manager_endpoint.rb +27 -0
- data/test/requests/traffic_manager/test_update_traffic_manager_profile.rb +27 -0
- data/test/test_helper.rb +52 -0
- metadata +73 -9
- data/lib/fog/azurerm/core.rb +0 -14
- data/test/requests/application_gateway/test_create_application_gateway.rb +0 -51
@@ -39,62 +39,62 @@ module Fog
|
|
39
39
|
|
40
40
|
hash['gateway_ip_configurations'] = []
|
41
41
|
gateway.gateway_ipconfigurations.each do |ip_configuration|
|
42
|
-
gateway_ip_configuration =
|
43
|
-
hash['gateway_ip_configurations'] << gateway_ip_configuration.merge_attributes(
|
42
|
+
gateway_ip_configuration = IPConfiguration.new
|
43
|
+
hash['gateway_ip_configurations'] << gateway_ip_configuration.merge_attributes(IPConfiguration.parse(ip_configuration))
|
44
44
|
end unless gateway.gateway_ipconfigurations.nil?
|
45
45
|
|
46
46
|
hash['ssl_certificates'] = []
|
47
47
|
gateway.ssl_certificates.each do |certificate|
|
48
|
-
ssl_certificate =
|
49
|
-
hash['ssl_certificates'] << ssl_certificate.merge_attributes(
|
48
|
+
ssl_certificate = SslCertificate.new
|
49
|
+
hash['ssl_certificates'] << ssl_certificate.merge_attributes(SslCertificate.parse(certificate))
|
50
50
|
end unless gateway.ssl_certificates.nil?
|
51
51
|
|
52
52
|
hash['frontend_ip_configurations'] = []
|
53
53
|
gateway.frontend_ipconfigurations.each do |frontend_ip_config|
|
54
|
-
frontend_ip_configuration =
|
55
|
-
hash['frontend_ip_configurations'] << frontend_ip_configuration.merge_attributes(
|
54
|
+
frontend_ip_configuration = FrontendIPConfiguration.new
|
55
|
+
hash['frontend_ip_configurations'] << frontend_ip_configuration.merge_attributes(FrontendIPConfiguration.parse(frontend_ip_config))
|
56
56
|
end unless gateway.frontend_ipconfigurations.nil?
|
57
57
|
|
58
58
|
hash['frontend_ports'] = []
|
59
59
|
gateway.frontend_ports.each do |port|
|
60
|
-
frontend_port =
|
61
|
-
hash['frontend_ports'] << frontend_port.merge_attributes(
|
60
|
+
frontend_port = FrontendPort.new
|
61
|
+
hash['frontend_ports'] << frontend_port.merge_attributes(FrontendPort.parse(port))
|
62
62
|
end unless gateway.frontend_ports.nil?
|
63
63
|
|
64
64
|
hash['probes'] = []
|
65
65
|
gateway.probes.each do |probe|
|
66
|
-
gateway_probe =
|
67
|
-
hash['probes'] << gateway_probe.merge_attributes(
|
66
|
+
gateway_probe = Probe.new
|
67
|
+
hash['probes'] << gateway_probe.merge_attributes(Probe.parse(probe))
|
68
68
|
end unless gateway.probes.nil?
|
69
69
|
|
70
70
|
hash['backend_address_pools'] = []
|
71
71
|
gateway.backend_address_pools.each do |address|
|
72
|
-
backend_address_pool =
|
73
|
-
hash['backend_address_pools'] << backend_address_pool.merge_attributes(
|
72
|
+
backend_address_pool = BackendAddressPool.new
|
73
|
+
hash['backend_address_pools'] << backend_address_pool.merge_attributes(BackendAddressPool.parse(address))
|
74
74
|
end unless gateway.backend_address_pools.nil?
|
75
75
|
|
76
76
|
hash['backend_http_settings_list'] = []
|
77
77
|
gateway.backend_http_settings_collection.each do |http_setting|
|
78
|
-
backend_http_setting =
|
79
|
-
hash['backend_http_settings_list'] << backend_http_setting.merge_attributes(
|
78
|
+
backend_http_setting = BackendHttpSetting.new
|
79
|
+
hash['backend_http_settings_list'] << backend_http_setting.merge_attributes(BackendHttpSetting.parse(http_setting))
|
80
80
|
end unless gateway.backend_http_settings_collection.nil?
|
81
81
|
|
82
82
|
hash['http_listeners'] = []
|
83
83
|
gateway.http_listeners.each do |listener|
|
84
|
-
http_listener =
|
85
|
-
hash['http_listeners'] << http_listener.merge_attributes(
|
84
|
+
http_listener = HttpListener.new
|
85
|
+
hash['http_listeners'] << http_listener.merge_attributes(HttpListener.parse(listener))
|
86
86
|
end unless gateway.http_listeners.nil?
|
87
87
|
|
88
88
|
hash['url_path_maps'] = []
|
89
89
|
gateway.url_path_maps.each do |map|
|
90
|
-
url_path_map =
|
91
|
-
hash['url_path_maps'] << url_path_map.merge_attributes(
|
90
|
+
url_path_map = UrlPathMap.new
|
91
|
+
hash['url_path_maps'] << url_path_map.merge_attributes(UrlPathMap.parse(map))
|
92
92
|
end unless gateway.url_path_maps.nil?
|
93
93
|
|
94
94
|
hash['request_routing_rules'] = []
|
95
95
|
gateway.request_routing_rules.each do |rule|
|
96
|
-
request_routing_rule =
|
97
|
-
hash['request_routing_rules'] << request_routing_rule.merge_attributes(
|
96
|
+
request_routing_rule = RequestRoutingRule.new
|
97
|
+
hash['request_routing_rules'] << request_routing_rule.merge_attributes(RequestRoutingRule.parse(rule))
|
98
98
|
end unless gateway.request_routing_rules.nil?
|
99
99
|
hash
|
100
100
|
end
|
@@ -112,11 +112,32 @@ module Fog
|
|
112
112
|
validate_http_listeners(http_listeners) unless http_listeners.nil?
|
113
113
|
validate_url_path_maps(url_path_maps) unless url_path_maps.nil?
|
114
114
|
validate_request_routing_rules(request_routing_rules) unless request_routing_rules.nil?
|
115
|
-
|
116
|
-
gateway = service.
|
115
|
+
gateway_params = get_gateway_params
|
116
|
+
gateway = service.create_or_update_application_gateway(gateway_params)
|
117
117
|
merge_attributes(Fog::ApplicationGateway::AzureRM::Gateway.parse(gateway))
|
118
118
|
end
|
119
119
|
|
120
|
+
def get_gateway_params
|
121
|
+
{
|
122
|
+
name: name,
|
123
|
+
location: location,
|
124
|
+
resource_group: resource_group,
|
125
|
+
sku_name: sku_name,
|
126
|
+
sku_tier: sku_tier,
|
127
|
+
sku_capacity: sku_capacity,
|
128
|
+
gateway_ip_configurations: gateway_ip_configurations,
|
129
|
+
ssl_certificates: ssl_certificates,
|
130
|
+
frontend_ip_configurations: frontend_ip_configurations,
|
131
|
+
frontend_ports: frontend_ports,
|
132
|
+
probes: probes,
|
133
|
+
backend_address_pools: backend_address_pools,
|
134
|
+
backend_http_settings_list: backend_http_settings_list,
|
135
|
+
http_listeners: http_listeners,
|
136
|
+
url_path_maps: url_path_maps,
|
137
|
+
request_routing_rules: request_routing_rules
|
138
|
+
}
|
139
|
+
end
|
140
|
+
|
120
141
|
def validate_gateway_ip_configurations(gateway_ip_configurations)
|
121
142
|
if gateway_ip_configurations.is_a?(Array)
|
122
143
|
if gateway_ip_configurations.any?
|
@@ -443,6 +464,143 @@ module Fog
|
|
443
464
|
end
|
444
465
|
end
|
445
466
|
|
467
|
+
def serialize_sub_resources(gateway_params)
|
468
|
+
ip_configurations = []
|
469
|
+
gateway_params[:gateway_ip_configurations].each do |ip_configuration|
|
470
|
+
hash = {}
|
471
|
+
ip_configuration.attributes.each { |key, value| hash[key] = value }
|
472
|
+
ip_configurations << hash
|
473
|
+
end
|
474
|
+
gateway_params[:gateway_ip_configurations] = ip_configurations
|
475
|
+
ssl_certificates = []
|
476
|
+
gateway_params[:ssl_certificates].each do |ssl_certificate|
|
477
|
+
hash = {}
|
478
|
+
ssl_certificate.attributes.each { |key, value| hash[key] = value }
|
479
|
+
ssl_certificates << hash
|
480
|
+
end
|
481
|
+
gateway_params[:ssl_certificates] = ssl_certificates
|
482
|
+
frontend_ip_configurations = []
|
483
|
+
gateway_params[:frontend_ip_configurations].each do |frontend_ip_configuration|
|
484
|
+
hash = {}
|
485
|
+
frontend_ip_configuration.attributes.each { |key, value| hash[key] = value }
|
486
|
+
frontend_ip_configurations << hash
|
487
|
+
end
|
488
|
+
gateway_params[:frontend_ip_configurations] = frontend_ip_configurations
|
489
|
+
frontend_ports = []
|
490
|
+
gateway_params[:frontend_ports].each do |frontend_port|
|
491
|
+
hash = {}
|
492
|
+
frontend_port.attributes.each { |key, value| hash[key] = value }
|
493
|
+
frontend_ports << hash
|
494
|
+
end
|
495
|
+
gateway_params[:frontend_ports] = frontend_ports
|
496
|
+
probes = []
|
497
|
+
gateway_params[:probes].each do |probe|
|
498
|
+
hash = {}
|
499
|
+
probe.attributes.each { |key, value| hash[key] = value }
|
500
|
+
probes << hash
|
501
|
+
end
|
502
|
+
gateway_params[:probes] = probes
|
503
|
+
backend_address_pools = []
|
504
|
+
gateway_params[:backend_address_pools].each do |backend_address_pool|
|
505
|
+
hash = {}
|
506
|
+
backend_address_pool.attributes.each { |key, value| hash[key] = value }
|
507
|
+
backend_address_pools << hash
|
508
|
+
end
|
509
|
+
gateway_params[:backend_address_pools] = backend_address_pools
|
510
|
+
backend_address_ip_addresses = []
|
511
|
+
gateway_params[:backend_address_pools].each do |backend_address_pool|
|
512
|
+
backend_address_pool[:ip_addresses].each do |ip_address|
|
513
|
+
hash = {}
|
514
|
+
ip_address.instance_variables.each_with_object({}) { |instance_variable| hash[:ipAddress] = ip_address.instance_variable_get(instance_variable) }
|
515
|
+
backend_address_ip_addresses << hash
|
516
|
+
end
|
517
|
+
backend_address_pool[:ip_addresses] = backend_address_ip_addresses
|
518
|
+
end
|
519
|
+
backend_http_settings_list = []
|
520
|
+
gateway_params[:backend_http_settings_list].each do |backend_http_setting|
|
521
|
+
hash = {}
|
522
|
+
backend_http_setting.attributes.each { |key, value| hash[key] = value }
|
523
|
+
backend_http_settings_list << hash
|
524
|
+
end
|
525
|
+
gateway_params[:backend_http_settings_list] = backend_http_settings_list
|
526
|
+
http_listeners = []
|
527
|
+
gateway_params[:http_listeners].each do |http_listener|
|
528
|
+
hash = {}
|
529
|
+
http_listener.attributes.each { |key, value| hash[key] = value }
|
530
|
+
http_listeners << hash
|
531
|
+
end
|
532
|
+
gateway_params[:http_listeners] = http_listeners
|
533
|
+
url_path_maps = []
|
534
|
+
gateway_params[:url_path_maps].each do |url_path_map|
|
535
|
+
hash = {}
|
536
|
+
url_path_map.attributes.each { |key, value| hash[key] = value }
|
537
|
+
url_path_maps << hash
|
538
|
+
end
|
539
|
+
gateway_params[:url_path_maps] = url_path_maps
|
540
|
+
request_routing_rules = []
|
541
|
+
gateway_params[:request_routing_rules].each do |request_routing_rule|
|
542
|
+
hash = {}
|
543
|
+
request_routing_rule.attributes.each { |key, value| hash[key] = value }
|
544
|
+
request_routing_rules << hash
|
545
|
+
end
|
546
|
+
gateway_params[:request_routing_rules] = request_routing_rules
|
547
|
+
gateway_params
|
548
|
+
end
|
549
|
+
|
550
|
+
def update_sku(sku_name, sku_capacity = nil)
|
551
|
+
gateway_hash = serialize_sub_resources(get_gateway_params)
|
552
|
+
gateway = service.update_sku_attributes(gateway_hash, sku_name, sku_capacity)
|
553
|
+
merge_attributes(Fog::ApplicationGateway::AzureRM::Gateway.parse(gateway))
|
554
|
+
end
|
555
|
+
|
556
|
+
def update_gateway_ip_configuration(subnet_id)
|
557
|
+
gateway_hash = serialize_sub_resources(get_gateway_params)
|
558
|
+
gateway = service.update_subnet_id_in_gateway_ip_configuration(gateway_hash, subnet_id)
|
559
|
+
merge_attributes(Fog::ApplicationGateway::AzureRM::Gateway.parse(gateway))
|
560
|
+
end
|
561
|
+
|
562
|
+
def add_ssl_certificate(ssl_certificate_obj)
|
563
|
+
gateway_hash = serialize_sub_resources(get_gateway_params)
|
564
|
+
gateway_hash[:ssl_certificates] << ssl_certificate_obj
|
565
|
+
gateway = service.create_or_update_application_gateway(gateway_hash)
|
566
|
+
merge_attributes(Fog::ApplicationGateway::AzureRM::Gateway.parse(gateway))
|
567
|
+
end
|
568
|
+
|
569
|
+
def remove_ssl_certificate(ssl_certificate_obj)
|
570
|
+
gateway_hash = serialize_sub_resources(get_gateway_params)
|
571
|
+
gateway_hash[:ssl_certificates].delete(ssl_certificate_obj)
|
572
|
+
gateway = service.create_or_update_application_gateway(gateway_hash)
|
573
|
+
merge_attributes(Fog::ApplicationGateway::AzureRM::Gateway.parse(gateway))
|
574
|
+
end
|
575
|
+
|
576
|
+
def add_frontend_port(frontend_port_obj)
|
577
|
+
gateway_hash = serialize_sub_resources(get_gateway_params)
|
578
|
+
gateway_hash[:frontend_ports] << frontend_port_obj
|
579
|
+
gateway = service.create_or_update_application_gateway(gateway_hash)
|
580
|
+
merge_attributes(Fog::ApplicationGateway::AzureRM::Gateway.parse(gateway))
|
581
|
+
end
|
582
|
+
|
583
|
+
def remove_frontend_port(frontend_port_obj)
|
584
|
+
gateway_hash = serialize_sub_resources(get_gateway_params)
|
585
|
+
gateway_hash[:frontend_ports].delete(frontend_port_obj)
|
586
|
+
gateway = service.create_or_update_application_gateway(gateway_hash)
|
587
|
+
merge_attributes(Fog::ApplicationGateway::AzureRM::Gateway.parse(gateway))
|
588
|
+
end
|
589
|
+
|
590
|
+
def add_probe(probe_obj)
|
591
|
+
gateway_hash = serialize_sub_resources(get_gateway_params)
|
592
|
+
gateway_hash[:probes] << probe_obj
|
593
|
+
gateway = service.create_or_update_application_gateway(gateway_hash)
|
594
|
+
merge_attributes(Fog::ApplicationGateway::AzureRM::Gateway.parse(gateway))
|
595
|
+
end
|
596
|
+
|
597
|
+
def remove_probe(probe_obj)
|
598
|
+
gateway_hash = serialize_sub_resources(get_gateway_params)
|
599
|
+
gateway_hash[:probes].delete(probe_obj)
|
600
|
+
gateway = service.create_or_update_application_gateway(gateway_hash)
|
601
|
+
merge_attributes(Fog::ApplicationGateway::AzureRM::Gateway.parse(gateway))
|
602
|
+
end
|
603
|
+
|
446
604
|
def destroy
|
447
605
|
service.delete_application_gateway(resource_group, name)
|
448
606
|
end
|
@@ -18,8 +18,10 @@ module Fog
|
|
18
18
|
load(application_gateways)
|
19
19
|
end
|
20
20
|
|
21
|
-
def get(
|
22
|
-
|
21
|
+
def get(resource_group_name, application_gateway_name)
|
22
|
+
gateway = service.get_application_gateway(resource_group_name, application_gateway_name)
|
23
|
+
application_gateway = Fog::ApplicationGateway::AzureRM::Gateway.new(service: service)
|
24
|
+
application_gateway.merge_attributes(Fog::ApplicationGateway::AzureRM::Gateway.parse(gateway))
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -8,8 +8,13 @@ module Fog
|
|
8
8
|
|
9
9
|
def self.parse(gateway_ip_configuration)
|
10
10
|
hash = {}
|
11
|
-
|
12
|
-
|
11
|
+
if gateway_ip_configuration.is_a? Hash
|
12
|
+
hash['name'] = gateway_ip_configuration['name']
|
13
|
+
hash['subnet_id'] = gateway_ip_configuration['subnet']['id'] unless gateway_ip_configuration['subnet'].nil?
|
14
|
+
else
|
15
|
+
hash['name'] = gateway_ip_configuration.name
|
16
|
+
hash['subnet_id'] = gateway_ip_configuration.subnet.id unless gateway_ip_configuration.subnet.nil?
|
17
|
+
end
|
13
18
|
hash
|
14
19
|
end
|
15
20
|
end
|
@@ -28,6 +28,7 @@ module Fog
|
|
28
28
|
attribute :enable_automatic_updates
|
29
29
|
attribute :network_interface_card_id
|
30
30
|
attribute :availability_set_id
|
31
|
+
attribute :custom_data
|
31
32
|
|
32
33
|
def self.parse(vm)
|
33
34
|
hash = {}
|
@@ -43,6 +44,7 @@ module Fog
|
|
43
44
|
hash['sku'] = vm.storage_profile.image_reference.sku
|
44
45
|
hash['version'] = vm.storage_profile.image_reference.version
|
45
46
|
hash['username'] = vm.os_profile.admin_username
|
47
|
+
hash['custom_data'] = vm.os_profile.custom_data
|
46
48
|
hash['data_disks'] = []
|
47
49
|
|
48
50
|
vm.storage_profile.data_disks.each do |disk|
|
@@ -64,7 +66,7 @@ module Fog
|
|
64
66
|
def save
|
65
67
|
requires :name, :location, :resource_group, :vm_size, :storage_account_name,
|
66
68
|
:username, :password, :network_interface_card_id, :publisher, :offer, :sku, :version
|
67
|
-
requires :disable_password_authentication if platform.casecmp('linux')
|
69
|
+
requires :disable_password_authentication if platform.casecmp('linux').zero?
|
68
70
|
ssh_key_path = "/home/#{username}/.ssh/authorized_keys" unless ssh_key_data.nil?
|
69
71
|
virtual_machine_params = get_virtual_machine_params(ssh_key_path)
|
70
72
|
vm = service.create_virtual_machine(virtual_machine_params)
|
@@ -139,7 +141,8 @@ module Fog
|
|
139
141
|
version: version,
|
140
142
|
platform: platform,
|
141
143
|
provision_vm_agent: provision_vm_agent,
|
142
|
-
enable_automatic_updates: enable_automatic_updates
|
144
|
+
enable_automatic_updates: enable_automatic_updates,
|
145
|
+
custom_data: custom_data
|
143
146
|
}
|
144
147
|
end
|
145
148
|
end
|
@@ -19,14 +19,10 @@ module Fog
|
|
19
19
|
load(virtual_machines)
|
20
20
|
end
|
21
21
|
|
22
|
-
def get(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def get_from_remote(resource_group, name)
|
27
|
-
result_obj = service.get_virtual_machine(resource_group, name)
|
28
|
-
model_obj = Fog::Compute::AzureRM::Server.new
|
29
|
-
model_obj.merge_attributes(Fog::Compute::AzureRM::Server.parse(result_obj))
|
22
|
+
def get(resource_group_name, virtual_machine_name)
|
23
|
+
storage_account = service.get_virtual_machine(resource_group_name, virtual_machine_name)
|
24
|
+
storage_account_obj = Fog::Compute::AzureRM::Server.new(service: service)
|
25
|
+
storage_account_obj.merge_attributes(Fog::Compute::AzureRM::Server.parse(storage_account))
|
30
26
|
end
|
31
27
|
end
|
32
28
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Express Route Circuit Authorization model class for Network Service
|
5
|
+
class ExpressRouteCircuitAuthorization < Fog::Model
|
6
|
+
identity :name
|
7
|
+
attribute :id
|
8
|
+
attribute :resource_group
|
9
|
+
attribute :authorization_name
|
10
|
+
attribute :authorization_key
|
11
|
+
attribute :authorization_status
|
12
|
+
attribute :provisioning_state
|
13
|
+
attribute :etag
|
14
|
+
attribute :circuit_name
|
15
|
+
|
16
|
+
def self.parse(circuit_authorization)
|
17
|
+
circuit_auth_hash = {}
|
18
|
+
circuit_auth_hash['id'] = circuit_authorization.id
|
19
|
+
circuit_auth_hash['resource_group'] = get_resource_group_from_id(circuit_authorization.id)
|
20
|
+
circuit_auth_hash['circuit_name'] = get_circuit_name_from_id(circuit_authorization.id)
|
21
|
+
circuit_auth_hash['authorization_key'] = circuit_authorization.authorization_key
|
22
|
+
circuit_auth_hash['authorization_status'] = circuit_authorization.authorization_use_status
|
23
|
+
circuit_auth_hash['provisioning_state'] = circuit_authorization.provisioning_state
|
24
|
+
circuit_auth_hash['name'] = circuit_authorization.name
|
25
|
+
circuit_auth_hash['etag'] = circuit_authorization.etag
|
26
|
+
|
27
|
+
circuit_auth_hash
|
28
|
+
end
|
29
|
+
|
30
|
+
def save
|
31
|
+
requires :name, :resource_group, :circuit_name
|
32
|
+
circuit_authorization_parameters = express_route_circuit_authorization_params
|
33
|
+
circuit_authorization = service.create_or_update_express_route_circuit_authorization(circuit_authorization_parameters)
|
34
|
+
merge_attributes(ExpressRouteCircuitAuthorization.parse(circuit_authorization))
|
35
|
+
end
|
36
|
+
|
37
|
+
def destroy
|
38
|
+
service.delete_express_route_circuit_authorization(resource_group, circuit_name, name)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def express_route_circuit_authorization_params
|
44
|
+
{
|
45
|
+
name: name,
|
46
|
+
resource_group: resource_group,
|
47
|
+
circuit_name: circuit_name,
|
48
|
+
authorization_name: authorization_name,
|
49
|
+
authorization_key: authorization_key,
|
50
|
+
authorization_status: authorization_status,
|
51
|
+
provisioning_state: provisioning_state,
|
52
|
+
etag: etag
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/azurerm/models/network/express_route_circuit_authorization'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Network
|
6
|
+
class AzureRM
|
7
|
+
# ExpressRouteCircuitAuthorization collection class for Network Service
|
8
|
+
class ExpressRouteCircuitAuthorizations < Fog::Collection
|
9
|
+
model ExpressRouteCircuitAuthorization
|
10
|
+
attribute :resource_group
|
11
|
+
attribute :circuit_name
|
12
|
+
|
13
|
+
def all
|
14
|
+
requires :resource_group
|
15
|
+
requires :circuit_name
|
16
|
+
circuit_authorizations = []
|
17
|
+
service.list_express_route_circuit_authorizations(resource_group, circuit_name).each do |circuit_authorization|
|
18
|
+
circuit_authorizations << ExpressRouteCircuitAuthorization.parse(circuit_authorization)
|
19
|
+
end
|
20
|
+
load(circuit_authorizations)
|
21
|
+
end
|
22
|
+
|
23
|
+
def get(resource_group_name, circuit_name, authorization_name)
|
24
|
+
circuit_authorization = service.get_express_route_circuit_authorization(resource_group_name, circuit_name, authorization_name)
|
25
|
+
express_route_circuit_authorization = ExpressRouteCircuitAuthorization.new(service: service)
|
26
|
+
express_route_circuit_authorization.merge_attributes(ExpressRouteCircuitAuthorization.parse(circuit_authorization))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -18,8 +18,10 @@ module Fog
|
|
18
18
|
load(load_balancers)
|
19
19
|
end
|
20
20
|
|
21
|
-
def get(
|
22
|
-
|
21
|
+
def get(resource_group_name, load_balancer_name)
|
22
|
+
lb = service.get_load_balancer(resource_group_name, load_balancer_name)
|
23
|
+
load_balancer = Fog::Network::AzureRM::LoadBalancer.new(service: service)
|
24
|
+
load_balancer.merge_attributes(Fog::Network::AzureRM::LoadBalancer.parse(lb))
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# LocalNetworkGateway model class for Network Service
|
5
|
+
class LocalNetworkGateway < Fog::Model
|
6
|
+
identity :name
|
7
|
+
attribute :id
|
8
|
+
attribute :location
|
9
|
+
attribute :type
|
10
|
+
attribute :resource_group
|
11
|
+
attribute :tags
|
12
|
+
attribute :local_network_address_space_prefixes
|
13
|
+
attribute :gateway_ip_address
|
14
|
+
attribute :asn
|
15
|
+
attribute :bgp_peering_address
|
16
|
+
attribute :peer_weight
|
17
|
+
attribute :provisioning_state
|
18
|
+
|
19
|
+
def self.parse(local_network_gateway)
|
20
|
+
local_network_gateway_hash = {}
|
21
|
+
local_network_gateway_hash['id'] = local_network_gateway.id
|
22
|
+
local_network_gateway_hash['name'] = local_network_gateway.name
|
23
|
+
local_network_gateway_hash['location'] = local_network_gateway.location
|
24
|
+
local_network_gateway_hash['type'] = local_network_gateway.type
|
25
|
+
local_network_gateway_hash['resource_group'] = get_resource_group_from_id(local_network_gateway.id)
|
26
|
+
local_network_gateway_hash['tags'] = local_network_gateway.tags
|
27
|
+
local_network_address_space = local_network_gateway.local_network_address_space
|
28
|
+
local_network_gateway_hash['local_network_address_space_prefixes'] = local_network_address_space.address_prefixes unless local_network_address_space.nil?
|
29
|
+
local_network_gateway_hash['gateway_ip_address'] = local_network_gateway.gateway_ip_address
|
30
|
+
bgp_settings = local_network_gateway.bgp_settings
|
31
|
+
unless bgp_settings.nil?
|
32
|
+
local_network_gateway_hash['asn'] = bgp_settings.asn
|
33
|
+
local_network_gateway_hash['bgp_peering_address'] = bgp_settings.bgp_peering_address
|
34
|
+
local_network_gateway_hash['peer_weight'] = bgp_settings.peer_weight
|
35
|
+
end
|
36
|
+
local_network_gateway_hash['provisioning_state'] = local_network_gateway.provisioning_state
|
37
|
+
local_network_gateway_hash
|
38
|
+
end
|
39
|
+
|
40
|
+
def save
|
41
|
+
requires :name, :location, :resource_group, :local_network_address_space_prefixes, :gateway_ip_address, :asn, :bgp_peering_address, :peer_weight
|
42
|
+
local_network_gateway_params = local_network_gateway_parameters
|
43
|
+
local_network_gateway = service.create_or_update_local_network_gateway(local_network_gateway_params)
|
44
|
+
merge_attributes(LocalNetworkGateway.parse(local_network_gateway))
|
45
|
+
end
|
46
|
+
|
47
|
+
def destroy
|
48
|
+
service.delete_local_network_gateway(resource_group, name)
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def local_network_gateway_parameters
|
54
|
+
{
|
55
|
+
name: name,
|
56
|
+
location: location,
|
57
|
+
resource_group: resource_group,
|
58
|
+
local_network_address_space_prefixes: local_network_address_space_prefixes,
|
59
|
+
gateway_ip_address: gateway_ip_address,
|
60
|
+
asn: asn,
|
61
|
+
bgp_peering_address: bgp_peering_address,
|
62
|
+
peer_weight: peer_weight
|
63
|
+
}
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/azurerm/models/network/local_network_gateway'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Network
|
6
|
+
class AzureRM
|
7
|
+
# LocalNetworkGateways collection class for Network Service
|
8
|
+
class LocalNetworkGateways < Fog::Collection
|
9
|
+
model Fog::Network::AzureRM::LocalNetworkGateway
|
10
|
+
attribute :resource_group
|
11
|
+
|
12
|
+
def all
|
13
|
+
requires :resource_group
|
14
|
+
local_network_gateways = []
|
15
|
+
service.list_local_network_gateways(resource_group).each do |gateway|
|
16
|
+
local_network_gateways << LocalNetworkGateway.parse(gateway)
|
17
|
+
end
|
18
|
+
load(local_network_gateways)
|
19
|
+
end
|
20
|
+
|
21
|
+
def get(resource_group_name, name)
|
22
|
+
local_network_gateway = service.get_local_network_gateway(resource_group_name, name)
|
23
|
+
local_network_gateway_obj = LocalNetworkGateway.new(service: service)
|
24
|
+
local_network_gateway_obj.merge_attributes(LocalNetworkGateway.parse(local_network_gateway))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -40,13 +40,28 @@ module Fog
|
|
40
40
|
requires :public_ip_allocation_method
|
41
41
|
requires :location
|
42
42
|
requires :resource_group
|
43
|
-
public_ip = service.
|
43
|
+
public_ip = service.create_or_update_public_ip(resource_group, name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label)
|
44
44
|
merge_attributes(Fog::Network::AzureRM::PublicIp.parse(public_ip))
|
45
45
|
end
|
46
46
|
|
47
47
|
def destroy
|
48
48
|
service.delete_public_ip(resource_group, name)
|
49
49
|
end
|
50
|
+
|
51
|
+
def update(input_hash)
|
52
|
+
validate_input(input_hash)
|
53
|
+
merge_attributes(input_hash)
|
54
|
+
pip = service.create_or_update_public_ip(resource_group, name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label)
|
55
|
+
merge_attributes(Fog::Network::AzureRM::PublicIp.parse(pip))
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def validate_input(input_hash)
|
61
|
+
invalid_attr = [:resource_group, :name, :location, :id]
|
62
|
+
result = invalid_attr & input_hash.keys
|
63
|
+
raise 'Cannot modify the given attribute' unless result.empty?
|
64
|
+
end
|
50
65
|
end
|
51
66
|
end
|
52
67
|
end
|