fog-azure-rm 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -1
- data/README.md +0 -1
- data/fog-azure-rm.gemspec +4 -1
- data/lib/fog/azurerm.rb +7 -0
- data/lib/fog/azurerm/application_gateway.rb +10 -2
- data/lib/fog/azurerm/compute.rb +14 -4
- data/lib/fog/azurerm/config.rb +0 -51
- data/lib/fog/azurerm/constants.rb +51 -0
- data/lib/fog/azurerm/dns.rb +12 -4
- data/lib/fog/azurerm/docs/application_gateway.md +38 -4
- data/lib/fog/azurerm/docs/compute.md +23 -4
- data/lib/fog/azurerm/docs/dns.md +18 -4
- data/lib/fog/azurerm/docs/key_vault.md +88 -0
- data/lib/fog/azurerm/docs/network.md +98 -9
- data/lib/fog/azurerm/docs/resources.md +24 -4
- data/lib/fog/azurerm/docs/sql.md +5 -6
- data/lib/fog/azurerm/docs/storage.md +12 -0
- data/lib/fog/azurerm/docs/traffic_manager.md +22 -4
- data/lib/fog/azurerm/key_vault.rb +51 -0
- data/lib/fog/azurerm/models/application_gateway/backend_address_pool.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/backend_http_setting.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/frontend_ip_configuration.rb +4 -0
- data/lib/fog/azurerm/models/application_gateway/frontend_port.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/gateway.rb +2 -6
- data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -0
- data/lib/fog/azurerm/models/application_gateway/http_listener.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/ip_configuration.rb +3 -0
- data/lib/fog/azurerm/models/application_gateway/probe.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/request_routing_rule.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/ssl_certificate.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/url_path_map.rb +2 -0
- data/lib/fog/azurerm/models/compute/availability_sets.rb +4 -0
- data/lib/fog/azurerm/models/compute/servers.rb +4 -0
- data/lib/fog/azurerm/models/compute/virtual_machine_extensions.rb +4 -0
- data/lib/fog/azurerm/models/dns/record_sets.rb +4 -0
- data/lib/fog/azurerm/models/dns/zones.rb +2 -2
- data/lib/fog/azurerm/models/key_vault/access_policy_entry.rb +31 -0
- data/lib/fog/azurerm/models/key_vault/vault.rb +76 -0
- data/lib/fog/azurerm/models/key_vault/vaults.rb +27 -0
- data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +4 -0
- data/lib/fog/azurerm/models/network/express_route_circuits.rb +4 -0
- data/lib/fog/azurerm/models/network/load_balancers.rb +12 -2
- data/lib/fog/azurerm/models/network/local_network_gateways.rb +4 -0
- data/lib/fog/azurerm/models/network/network_interfaces.rb +4 -0
- data/lib/fog/azurerm/models/network/network_security_groups.rb +4 -0
- data/lib/fog/azurerm/models/network/network_security_rules.rb +4 -0
- data/lib/fog/azurerm/models/network/public_ips.rb +2 -9
- data/lib/fog/azurerm/models/network/subnets.rb +4 -0
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +4 -0
- data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +4 -0
- data/lib/fog/azurerm/models/network/virtual_networks.rb +9 -11
- data/lib/fog/azurerm/models/resources/azure_resources.rb +4 -0
- data/lib/fog/azurerm/models/resources/deployments.rb +4 -0
- data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -0
- data/lib/fog/azurerm/models/sql/firewall_rule.rb +5 -17
- data/lib/fog/azurerm/models/sql/firewall_rules.rb +4 -0
- data/lib/fog/azurerm/models/sql/sql_database.rb +4 -21
- data/lib/fog/azurerm/models/sql/sql_databases.rb +4 -0
- data/lib/fog/azurerm/models/sql/sql_server.rb +5 -18
- data/lib/fog/azurerm/models/sql/sql_servers.rb +4 -0
- data/lib/fog/azurerm/models/storage/directories.rb +4 -0
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -0
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_points.rb +4 -0
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profiles.rb +4 -0
- data/lib/fog/azurerm/network.rb +22 -4
- data/lib/fog/azurerm/requests/application_gateway/check_ag_exists.rb +31 -0
- data/lib/fog/azurerm/requests/application_gateway/create_or_update_application_gateway.rb +6 -0
- data/lib/fog/azurerm/requests/compute/check_availability_set_exists.rb +31 -0
- data/lib/fog/azurerm/requests/compute/check_vm_exists.rb +31 -0
- data/lib/fog/azurerm/requests/compute/check_vm_extension_exists.rb +31 -0
- data/lib/fog/azurerm/requests/dns/check_record_set_exists.rb +31 -0
- data/lib/fog/azurerm/requests/dns/{check_for_zone.rb → check_zone_exists.rb} +4 -2
- data/lib/fog/azurerm/requests/dns/list_record_sets.rb +1 -1
- data/lib/fog/azurerm/requests/dns/list_zones.rb +2 -2
- data/lib/fog/azurerm/requests/key_vault/check_vault_exists.rb +31 -0
- data/lib/fog/azurerm/requests/key_vault/create_or_update_vault.rb +105 -0
- data/lib/fog/azurerm/requests/key_vault/delete_vault.rb +28 -0
- data/lib/fog/azurerm/requests/key_vault/get_vault.rb +54 -0
- data/lib/fog/azurerm/requests/key_vault/list_vaults.rb +56 -0
- data/lib/fog/azurerm/requests/network/check_express_route_cir_auth_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_express_route_circuit_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_load_balancer_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_local_net_gateway_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_net_sec_group_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_net_sec_rule_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_network_interface_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/{check_for_public_ip.rb → check_public_ip_exists.rb} +12 -5
- data/lib/fog/azurerm/requests/network/check_subnet_exists.rb +32 -0
- data/lib/fog/azurerm/requests/network/{check_for_virtual_network.rb → check_virtual_network_exists.rb} +11 -6
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_connection_exists.rb +32 -0
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_exists.rb +32 -0
- data/lib/fog/azurerm/requests/network/list_load_balancers_in_subscription.rb +31 -0
- data/lib/fog/azurerm/requests/network/list_virtual_networks_in_subscription.rb +74 -0
- data/lib/fog/azurerm/requests/resources/check_azure_resource_exists.rb +40 -0
- data/lib/fog/azurerm/requests/resources/check_deployment_exists.rb +30 -0
- data/lib/fog/azurerm/requests/resources/check_resource_group_exists.rb +30 -0
- data/lib/fog/azurerm/requests/sql/check_database_exists.rb +21 -0
- data/lib/fog/azurerm/requests/sql/check_firewall_rule_exists.rb +21 -0
- data/lib/fog/azurerm/requests/sql/check_sql_server_exists.rb +21 -0
- data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +26 -32
- data/lib/fog/azurerm/requests/sql/create_or_update_firewall_rule.rb +8 -22
- data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +14 -24
- data/lib/fog/azurerm/requests/sql/delete_database.rb +2 -9
- data/lib/fog/azurerm/requests/sql/delete_firewall_rule.rb +2 -9
- data/lib/fog/azurerm/requests/sql/delete_sql_server.rb +3 -9
- data/lib/fog/azurerm/requests/sql/get_database.rb +4 -10
- data/lib/fog/azurerm/requests/sql/get_firewall_rule.rb +4 -10
- data/lib/fog/azurerm/requests/sql/get_sql_server.rb +3 -10
- data/lib/fog/azurerm/requests/sql/list_databases.rb +3 -10
- data/lib/fog/azurerm/requests/sql/list_firewall_rules.rb +4 -10
- data/lib/fog/azurerm/requests/sql/list_sql_servers.rb +3 -10
- data/lib/fog/azurerm/requests/storage/check_container_exists.rb +30 -0
- data/lib/fog/azurerm/requests/storage/check_storage_account_exists.rb +31 -0
- data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +1 -1
- data/lib/fog/azurerm/requests/storage/delete_recovery_vault.rb +1 -1
- data/lib/fog/azurerm/requests/storage/disable_backup_protection.rb +1 -1
- data/lib/fog/azurerm/requests/storage/enable_backup_protection.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_backup_container.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_backup_item.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +1 -1
- data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +1 -1
- data/lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb +1 -1
- data/lib/fog/azurerm/requests/storage/start_backup.rb +1 -1
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_endpoint_exists.rb +31 -0
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_profile_exists.rb +31 -0
- data/lib/fog/azurerm/resources.rb +10 -2
- data/lib/fog/azurerm/sql.rb +18 -10
- data/lib/fog/azurerm/storage.rb +4 -0
- data/lib/fog/azurerm/traffic_manager.rb +9 -2
- data/lib/fog/azurerm/version.rb +1 -1
- data/rake-script.sh +3 -10
- data/test/api_stub.rb +8 -0
- data/test/api_stub/models/key_vault/vault.rb +39 -0
- data/test/api_stub/models/sql/sql_database.rb +18 -16
- data/test/api_stub/models/sql/sql_firewall_rule.rb +12 -10
- data/test/api_stub/models/sql/sql_server.rb +12 -10
- data/test/api_stub/requests/key_vault/vault.rb +95 -0
- data/test/api_stub/requests/sql/database.rb +8 -6
- data/test/api_stub/requests/sql/firewall_rule.rb +8 -4
- data/test/api_stub/requests/sql/sql_server.rb +8 -4
- data/test/integration/Virtual_network_gateway_connection.rb +7 -0
- data/test/integration/application_gateway.rb +8 -0
- data/test/integration/availability_set.rb +13 -2
- data/test/integration/blob.rb +0 -6
- data/test/integration/container.rb +7 -0
- data/test/integration/deployment.rb +7 -0
- data/test/integration/express_route_circuit.rb +16 -0
- data/test/integration/external_load_balancer.rb +18 -0
- data/test/integration/key_vault.rb +98 -0
- data/test/integration/local_network_gateway.rb +8 -0
- data/test/integration/network_interface.rb +8 -0
- data/test/integration/network_security_group.rb +8 -0
- data/test/integration/network_security_rule.rb +8 -0
- data/test/integration/public_ip.rb +3 -2
- data/test/integration/record_set.rb +8 -0
- data/test/integration/resource_group.rb +12 -4
- data/test/integration/resource_tag.rb +7 -0
- data/test/integration/server.rb +8 -0
- data/test/integration/sql_server.rb +23 -3
- data/test/integration/storage_account.rb +8 -1
- data/test/integration/subnet.rb +7 -0
- data/test/integration/traffic_manager.rb +14 -0
- data/test/integration/virtual_machine_extension.rb +8 -0
- data/test/integration/virtual_network.rb +13 -4
- data/test/integration/virtual_network_gateway.rb +7 -0
- data/test/integration/zone.rb +8 -0
- data/test/models/application_gateway/test_gateway.rb +1 -0
- data/test/models/application_gateway/test_gateways.rb +14 -1
- data/test/models/compute/test_availability_sets.rb +14 -1
- data/test/models/compute/test_servers.rb +14 -1
- data/test/models/compute/test_virtual_machine_extensions.rb +14 -1
- data/test/models/dns/test_record_sets.rb +14 -1
- data/test/models/dns/test_zones.rb +7 -7
- data/test/models/key_vault/test_vault.rb +39 -0
- data/test/models/key_vault/test_vaults.rb +55 -0
- data/test/models/network/test_express_route_circuit_authorizations.rb +14 -1
- data/test/models/network/test_express_route_circuits.rb +14 -1
- data/test/models/network/test_load_balancers.rb +14 -1
- data/test/models/network/test_local_network_gateways.rb +14 -1
- data/test/models/network/test_network_interfaces.rb +14 -1
- data/test/models/network/test_network_security_groups.rb +14 -1
- data/test/models/network/test_network_security_rules.rb +14 -1
- data/test/models/network/test_public_ips.rb +6 -6
- data/test/models/network/test_subnets.rb +14 -1
- data/test/models/network/test_virtual_network_gateway_connections.rb +14 -1
- data/test/models/network/test_virtual_network_gateways.rb +14 -1
- data/test/models/network/test_virtual_networks.rb +20 -8
- data/test/models/resources/test_deployments.rb +14 -1
- data/test/models/resources/test_resource_groups.rb +14 -1
- data/test/models/resources/test_resources.rb +16 -3
- data/test/models/sql/test_database.rb +3 -4
- data/test/models/sql/test_databases.rb +5 -5
- data/test/models/sql/test_firewall_rule.rb +2 -1
- data/test/models/sql/test_firewall_rules.rb +3 -2
- data/test/models/sql/test_sql_server.rb +2 -1
- data/test/models/sql/test_sql_servers.rb +5 -5
- data/test/models/storage/test_directories.rb +14 -1
- data/test/models/storage/test_storage_accounts.rb +14 -1
- data/test/models/traffic_manager/test_traffic_manager_end_points.rb +14 -1
- data/test/models/traffic_manager/test_traffic_manager_profiles.rb +14 -1
- data/test/requests/application_gateway/test_check_ag_exists.rb +31 -0
- data/test/requests/compute/test_check_availability_set_exists.rb +31 -0
- data/test/requests/compute/test_check_vm_exists.rb +31 -0
- data/test/requests/compute/test_check_vm_extension_exists.rb +31 -0
- data/test/requests/dns/test_check_record_set_exists.rb +31 -0
- data/test/requests/dns/test_check_zone_exists.rb +35 -0
- data/test/requests/dns/test_list_record_sets.rb +35 -0
- data/test/requests/dns/{test_check_for_zone.rb → test_list_zones.rb} +10 -8
- data/test/requests/key_vault/test_check_vault_exists.rb +31 -0
- data/test/requests/key_vault/test_create_or_update_vault.rb +25 -0
- data/test/requests/key_vault/test_delete_vault.rb +23 -0
- data/test/requests/key_vault/test_get_vault.rb +24 -0
- data/test/requests/key_vault/test_list_vaults.rb +24 -0
- data/test/requests/network/test_check_express_route_cir_auth_exists.rb +31 -0
- data/test/requests/network/test_check_express_route_circuit_exists.rb +31 -0
- data/test/requests/network/test_check_load_balancer_exists.rb +31 -0
- data/test/requests/network/test_check_local_net_gateway_exists.rb +31 -0
- data/test/requests/network/test_check_net_sec_group_exists.rb +31 -0
- data/test/requests/network/test_check_net_sec_rule_exists.rb +31 -0
- data/test/requests/network/test_check_network_interface_exists.rb +31 -0
- data/test/requests/network/{test_check_for_public_ip.rb → test_check_public_ip_exists.rb} +8 -8
- data/test/requests/network/test_check_subnet_exists.rb +31 -0
- data/test/requests/network/{test_check_for_virtual_network.rb → test_check_virtual_network_exists.rb} +8 -8
- data/test/requests/network/test_check_vnet_gateway_connection_exists.rb +31 -0
- data/test/requests/network/test_check_vnet_gateway_exists.rb +31 -0
- data/test/requests/network/test_list_virtual_networks_in_subscription.rb +24 -0
- data/test/requests/resources/test_check_azure_resource_exists.rb +22 -0
- data/test/requests/resources/test_check_deployment_exists.rb +29 -0
- data/test/requests/resources/test_check_resource_group_exists.rb +29 -0
- data/test/requests/sql/test_create_or_update_database.rb +9 -12
- data/test/requests/sql/test_create_or_update_firewall_rule.rb +9 -11
- data/test/requests/sql/test_create_or_update_sql_server.rb +9 -12
- data/test/requests/sql/test_delete_database.rb +6 -17
- data/test/requests/sql/test_delete_firewall_rule.rb +6 -17
- data/test/requests/sql/test_delete_sql_server.rb +6 -17
- data/test/requests/sql/test_get_database.rb +7 -18
- data/test/requests/sql/test_get_firewall_rule.rb +7 -18
- data/test/requests/sql/test_get_sql_server.rb +7 -18
- data/test/requests/sql/test_list_databases.rb +7 -18
- data/test/requests/sql/test_list_firewall_rules.rb +7 -18
- data/test/requests/sql/test_list_sql_servers.rb +7 -18
- data/test/requests/storage/test_check_container_exists.rb +18 -0
- data/test/requests/storage/test_check_storage_account_exists.rb +32 -0
- data/test/requests/traffic_manager/test_check_traffic_manager_endpoint_exists.rb +31 -0
- data/test/requests/traffic_manager/test_check_traffic_manager_profile_exists.rb +31 -0
- data/test/test_helper.rb +39 -4
- metadata +125 -10
@@ -6,19 +6,23 @@ module Fog
|
|
6
6
|
requires :client_id
|
7
7
|
requires :client_secret
|
8
8
|
requires :subscription_id
|
9
|
+
recognizes :environment
|
9
10
|
|
10
11
|
request_path 'fog/azurerm/requests/resources'
|
11
12
|
request :create_resource_group
|
12
13
|
request :list_resource_groups
|
13
14
|
request :delete_resource_group
|
14
15
|
request :get_resource_group
|
16
|
+
request :check_resource_group_exists
|
15
17
|
request :create_deployment
|
16
18
|
request :delete_deployment
|
17
19
|
request :list_deployments
|
18
20
|
request :get_deployment
|
21
|
+
request :check_deployment_exists
|
19
22
|
request :delete_resource_tag
|
20
23
|
request :list_tagged_resources
|
21
24
|
request :tag_resource
|
25
|
+
request :check_azure_resource_exists
|
22
26
|
|
23
27
|
model_path 'fog/azurerm/models/resources'
|
24
28
|
model :resource_group
|
@@ -53,9 +57,13 @@ module Fog
|
|
53
57
|
raise e.message
|
54
58
|
end
|
55
59
|
|
56
|
-
|
57
|
-
|
60
|
+
options[:environment] = 'AzureCloud' if options[:environment].nil?
|
61
|
+
|
62
|
+
credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret], options[:environment])
|
63
|
+
telemetry = "fog-azure-rm/#{Fog::AzureRM::VERSION}"
|
64
|
+
@rmc = ::Azure::ARM::Resources::ResourceManagementClient.new(credentials, resource_manager_endpoint_url(options[:environment]))
|
58
65
|
@rmc.subscription_id = options[:subscription_id]
|
66
|
+
@rmc.add_user_agent_information(telemetry)
|
59
67
|
end
|
60
68
|
end
|
61
69
|
end
|
data/lib/fog/azurerm/sql.rb
CHANGED
@@ -6,22 +6,26 @@ module Fog
|
|
6
6
|
requires :client_id
|
7
7
|
requires :client_secret
|
8
8
|
requires :subscription_id
|
9
|
+
recognizes :environment
|
9
10
|
|
10
11
|
request_path 'fog/azurerm/requests/sql'
|
11
12
|
request :create_or_update_sql_server
|
12
13
|
request :delete_sql_server
|
13
14
|
request :get_sql_server
|
14
15
|
request :list_sql_servers
|
16
|
+
request :check_sql_server_exists
|
15
17
|
|
16
18
|
request :create_or_update_database
|
17
19
|
request :delete_database
|
18
20
|
request :get_database
|
19
21
|
request :list_databases
|
22
|
+
request :check_database_exists
|
20
23
|
|
21
24
|
request :create_or_update_firewall_rule
|
22
25
|
request :delete_firewall_rule
|
23
26
|
request :get_firewall_rule
|
24
27
|
request :list_firewall_rules
|
28
|
+
request :check_firewall_rule_exists
|
25
29
|
|
26
30
|
model_path 'fog/azurerm/models/sql'
|
27
31
|
model :sql_server
|
@@ -36,16 +40,20 @@ module Fog
|
|
36
40
|
# This class provides the actual implementation for service calls.
|
37
41
|
class Real
|
38
42
|
def initialize(options)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
)
|
43
|
+
begin
|
44
|
+
require 'azure_mgmt_sql'
|
45
|
+
rescue LoadError => e
|
46
|
+
retry if require('rubygems')
|
47
|
+
raise e.message
|
48
|
+
end
|
49
|
+
|
50
|
+
options[:environment] = 'AzureCloud' if options[:environment].nil?
|
51
|
+
|
52
|
+
credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret], options[:environment])
|
53
|
+
@sql_mgmt_client = ::Azure::ARM::SQL::SqlManagementClient.new(credentials, resource_manager_endpoint_url(options[:environment]))
|
54
|
+
@sql_mgmt_client.subscription_id = options[:subscription_id]
|
55
|
+
telemetry = "fog-azure-rm/#{Fog::AzureRM::VERSION}"
|
56
|
+
@sql_mgmt_client.add_user_agent_information(telemetry)
|
49
57
|
end
|
50
58
|
end
|
51
59
|
# This class provides the mock implementation for unit tests.
|
data/lib/fog/azurerm/storage.rb
CHANGED
@@ -24,6 +24,7 @@ module Fog
|
|
24
24
|
request :list_storage_account_for_rg
|
25
25
|
request :check_storage_account_name_availability
|
26
26
|
request :get_storage_access_keys
|
27
|
+
request :check_storage_account_exists
|
27
28
|
# Azure Storage Disk requests
|
28
29
|
request :delete_disk
|
29
30
|
request :create_disk
|
@@ -38,6 +39,7 @@ module Fog
|
|
38
39
|
request :get_container_acl
|
39
40
|
request :put_container_acl
|
40
41
|
request :get_container_url
|
42
|
+
request :check_container_exists
|
41
43
|
# Azure Storage Blob requests
|
42
44
|
request :list_blobs
|
43
45
|
request :put_blob_metadata
|
@@ -125,9 +127,11 @@ module Fog
|
|
125
127
|
@environment = options[:environment]
|
126
128
|
|
127
129
|
credentials = Fog::Credentials::AzureRM.get_credentials(@tenant_id, @client_id, @client_secret, @environment)
|
130
|
+
telemetry = "fog-azure-rm/#{Fog::AzureRM::VERSION}"
|
128
131
|
unless credentials.nil?
|
129
132
|
@storage_mgmt_client = ::Azure::ARM::Storage::StorageManagementClient.new(credentials, resource_manager_endpoint_url(@environment))
|
130
133
|
@storage_mgmt_client.subscription_id = @subscription_id
|
134
|
+
@storage_mgmt_client.add_user_agent_information(telemetry)
|
131
135
|
end
|
132
136
|
|
133
137
|
return unless @azure_storage_account_name != options[:azure_storage_account_name] ||
|
@@ -6,16 +6,19 @@ module Fog
|
|
6
6
|
requires :client_id
|
7
7
|
requires :client_secret
|
8
8
|
requires :subscription_id
|
9
|
+
recognizes :environment
|
9
10
|
|
10
11
|
request_path 'fog/azurerm/requests/traffic_manager'
|
11
12
|
request :create_or_update_traffic_manager_profile
|
12
13
|
request :delete_traffic_manager_profile
|
13
14
|
request :get_traffic_manager_profile
|
14
15
|
request :list_traffic_manager_profiles
|
16
|
+
request :check_traffic_manager_profile_exists
|
15
17
|
|
16
18
|
request :create_or_update_traffic_manager_endpoint
|
17
19
|
request :delete_traffic_manager_endpoint
|
18
20
|
request :get_traffic_manager_endpoint
|
21
|
+
request :check_traffic_manager_endpoint_exists
|
19
22
|
|
20
23
|
model_path 'fog/azurerm/models/traffic_manager'
|
21
24
|
model :traffic_manager_profile
|
@@ -34,9 +37,13 @@ module Fog
|
|
34
37
|
raise e.message
|
35
38
|
end
|
36
39
|
|
37
|
-
|
38
|
-
|
40
|
+
options[:environment] = 'AzureCloud' if options[:environment].nil?
|
41
|
+
|
42
|
+
credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret], options[:environment])
|
43
|
+
telemetry = "fog-azure-rm/#{Fog::AzureRM::VERSION}"
|
44
|
+
@traffic_mgmt_client = ::Azure::ARM::TrafficManager::TrafficManagerManagementClient.new(credentials, resource_manager_endpoint_url(options[:environment]))
|
39
45
|
@traffic_mgmt_client.subscription_id = options[:subscription_id]
|
46
|
+
@traffic_mgmt_client.add_user_agent_information(telemetry)
|
40
47
|
end
|
41
48
|
end
|
42
49
|
# This class provides the mock implementation for unit tests.
|
data/lib/fog/azurerm/version.rb
CHANGED
data/rake-script.sh
CHANGED
@@ -1,11 +1,4 @@
|
|
1
1
|
#!/bin/bash
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
export CODECLIMATE_REPO_TOKEN="b1401494baa004d90402414cb33a7fc6420fd3693e60c677a120ddefd7d84cfd"
|
6
|
-
codeclimate-test-reporter --directory /home/travis/build/fog/fog-azure-rm/coverage
|
7
|
-
else
|
8
|
-
rake cc_coverage
|
9
|
-
export CODECLIMATE_REPO_TOKEN="b1401494baa004d90402414cb33a7fc6420fd3693e60c677a120ddefd7d84cfd"
|
10
|
-
codeclimate-test-reporter --directory /home/travis/build/fog/fog-azure-rm/coverage
|
11
|
-
fi
|
2
|
+
rake cc_coverage
|
3
|
+
export CODECLIMATE_REPO_TOKEN="b1401494baa004d90402414cb33a7fc6420fd3693e60c677a120ddefd7d84cfd"
|
4
|
+
codeclimate-test-reporter
|
data/test/api_stub.rb
CHANGED
@@ -56,6 +56,10 @@ module ApiStub
|
|
56
56
|
autoload :SqlDatabase, File.expand_path('api_stub/models/sql/sql_database', __dir__)
|
57
57
|
autoload :SqlFirewallRule, File.expand_path('api_stub/models/sql/sql_firewall_rule', __dir__)
|
58
58
|
end
|
59
|
+
|
60
|
+
module KeyVault
|
61
|
+
autoload :Vault, File.expand_path('api_stub/models/key_vault/vault', __dir__)
|
62
|
+
end
|
59
63
|
end
|
60
64
|
|
61
65
|
module Requests
|
@@ -114,5 +118,9 @@ module ApiStub
|
|
114
118
|
autoload :SqlDatabase, File.expand_path('api_stub/requests/sql/database', __dir__)
|
115
119
|
autoload :FirewallRule, File.expand_path('api_stub/requests/sql/firewall_rule', __dir__)
|
116
120
|
end
|
121
|
+
|
122
|
+
module KeyVault
|
123
|
+
autoload :Vault, File.expand_path('api_stub/requests/key_vault/vault', __dir__)
|
124
|
+
end
|
117
125
|
end
|
118
126
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module ApiStub
|
2
|
+
module Models
|
3
|
+
module KeyVault
|
4
|
+
# Mock class for Vault Model
|
5
|
+
class Vault
|
6
|
+
def self.create_vault_response(key_vault_client)
|
7
|
+
vault = {
|
8
|
+
'id' => '/subscriptions/<AZURE_SUBSCRIPTION_ID>/resourceGroups/fog-test-rg/providers/Microsoft.KeyVault/vaults/fog-test-kv',
|
9
|
+
'name' => 'fog-test-kv',
|
10
|
+
'type' => 'Microsoft.KeyVault/vaults',
|
11
|
+
'location' => 'westus',
|
12
|
+
'tags' => {},
|
13
|
+
'properties' => {
|
14
|
+
'sku' => {
|
15
|
+
'family' => 'A',
|
16
|
+
'name' => 'standard'
|
17
|
+
},
|
18
|
+
'tenantId' => '<AZURE_TENANT_ID>',
|
19
|
+
'accessPolicies' => [
|
20
|
+
{
|
21
|
+
'tenantId' => '<AZURE_TENANT_ID>',
|
22
|
+
'objectId' => '<AZURE_OBJECT_ID>',
|
23
|
+
'permissions' => {
|
24
|
+
'keys' => ['all'],
|
25
|
+
'secrets' => ['all']
|
26
|
+
}
|
27
|
+
}
|
28
|
+
],
|
29
|
+
'enabledForDeployment' => false,
|
30
|
+
'vaultUri' => 'https://fog-test-kv.vault.azure.net/'
|
31
|
+
}
|
32
|
+
}
|
33
|
+
vault_mapper = Azure::ARM::KeyVault::Models::Vault.mapper
|
34
|
+
key_vault_client.deserialize(vault_mapper, vault, 'result.body')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -4,23 +4,25 @@ module ApiStub
|
|
4
4
|
# Mock class for Database
|
5
5
|
class SqlDatabase
|
6
6
|
# This class contain two mocks, for collection and for model
|
7
|
-
def self.create_database
|
8
|
-
{
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
7
|
+
def self.create_database(sql_manager_client)
|
8
|
+
database = '{
|
9
|
+
"id" : "/subscriptions/########-####-####-####-############/resourceGroups/{resource-group-name}/providers/Microsoft.Sql/servers/{test-sql-server-name}/databases/{database-name}",
|
10
|
+
"location" : "{database-location}",
|
11
|
+
"properties" : {
|
12
|
+
"createMode" : "{creation-mode}",
|
13
|
+
"sourceDatabaseId" : "{source-database-id}",
|
14
|
+
"edition" : "{database-edition}",
|
15
|
+
"collation" : "{collation-name}",
|
16
|
+
"maxSizeBytes" : "{max-database-size}",
|
17
|
+
"requestedServiceObjectiveId" : "{requested-service-id}",
|
18
|
+
"requestedServiceObjectiveName" : "{requested-service-id}",
|
19
|
+
"restorePointInTime" : "{restore-time}",
|
20
|
+
"sourceDatabaseDeletionDate" : "{source-deletion-date}",
|
21
|
+
"elasticPoolName" : "{elastic-pool-name}"
|
22
22
|
}
|
23
|
-
}
|
23
|
+
}'
|
24
|
+
database_mapper = Azure::ARM::SQL::Models::Database.mapper
|
25
|
+
sql_manager_client.deserialize(database_mapper, Fog::JSON.decode(database), 'result.body')
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
@@ -4,17 +4,19 @@ module ApiStub
|
|
4
4
|
# Mock class for Firewall Rule
|
5
5
|
class SqlFirewallRule
|
6
6
|
# This class contain mock
|
7
|
-
def self.create_firewall_rule
|
8
|
-
{
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
def self.create_firewall_rule(firewall_manager_client)
|
8
|
+
firewall_rule = '{
|
9
|
+
"id" : "/subscriptions/########-####-####-####-############/resourceGroups/{resource-group-name}/providers/Microsoft.Sql/servers/{server-name}/firewallRules/{rule-name}",
|
10
|
+
"name" : "{rule-name}",
|
11
|
+
"type" : "{rule-type}",
|
12
|
+
"location" : "{server-location}",
|
13
|
+
"properties" : {
|
14
|
+
"startIpAddress" : "{start-ip-address}",
|
15
|
+
"endIpAddress" : "{end-ip-address}"
|
16
16
|
}
|
17
|
-
}
|
17
|
+
}'
|
18
|
+
firewall_rule_mapper = Azure::ARM::SQL::Models::ServerFirewallRule.mapper
|
19
|
+
firewall_manager_client.deserialize(firewall_rule_mapper, Fog::JSON.decode(firewall_rule), 'result.body')
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -4,17 +4,19 @@ module ApiStub
|
|
4
4
|
# Mock class for Sql Server
|
5
5
|
class SqlServer
|
6
6
|
# This class contain two mocks, for collection and for model
|
7
|
-
def self.create_sql_server
|
8
|
-
{
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
def self.create_sql_server(server_manager_client)
|
8
|
+
sql_server = '{
|
9
|
+
"id" : "/subscriptions/########-####-####-####-############/resourceGroups/{resource-group-name}/providers/Microsoft.Sql/servers/{server-name}",
|
10
|
+
"name" : "server-name",
|
11
|
+
"location" : "{server-location}",
|
12
|
+
"properties" : {
|
13
|
+
"version" : "{server-version}",
|
14
|
+
"administratorLogin" : "{admin-name}",
|
15
|
+
"administratorLoginPassword" : "{admin-password}"
|
16
16
|
}
|
17
|
-
}
|
17
|
+
}'
|
18
|
+
server_mapper = Azure::ARM::SQL::Models::Server.mapper
|
19
|
+
server_manager_client.deserialize(server_mapper, Fog::JSON.decode(sql_server), 'result.body')
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
module ApiStub
|
2
|
+
module Requests
|
3
|
+
module KeyVault
|
4
|
+
# Mock class for Vault Requests
|
5
|
+
class Vault
|
6
|
+
def self.create_vault_response(key_vault_client)
|
7
|
+
response = '{
|
8
|
+
"id" : "/subscriptions/{AZURE_SUBSCRIPTION_ID}/resourceGroups/fog-test-rg/providers/Microsoft.KeyVault/vaults/fog-test-kv",
|
9
|
+
"name" : "fog-test-kv",
|
10
|
+
"type" : "Microsoft.KeyVault/vaults",
|
11
|
+
"location" : "westus",
|
12
|
+
"tags" : {},
|
13
|
+
"properties" : {
|
14
|
+
"sku" : {
|
15
|
+
"family" : "A",
|
16
|
+
"name" : "standard"
|
17
|
+
},
|
18
|
+
"tenantId" : "{AZURE_TENANT_ID}",
|
19
|
+
"accessPolicies" : [
|
20
|
+
{
|
21
|
+
"tenantId" : "{AZURE_TENANT_ID}",
|
22
|
+
"objectId" : "{AZURE_OBJECT_ID}",
|
23
|
+
"permissions" : {
|
24
|
+
"keys" : ["all"],
|
25
|
+
"secrets" : ["all"]
|
26
|
+
}
|
27
|
+
}
|
28
|
+
],
|
29
|
+
"enabledForDeployment" : false,
|
30
|
+
"vaultUri" : "https://fog-test-kv.vault.azure.net/"
|
31
|
+
}
|
32
|
+
}'
|
33
|
+
vault_mapper = Azure::ARM::KeyVault::Models::Vault.mapper
|
34
|
+
key_vault_client.deserialize(vault_mapper, Fog::JSON.decode(response), 'result.body')
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.vault_params
|
38
|
+
access_policies_arr = [
|
39
|
+
{
|
40
|
+
tenant_id: '{AZURE_TENANT_ID}',
|
41
|
+
object_id: '{AZURE_TENANT_ID}',
|
42
|
+
permissions: {
|
43
|
+
keys: ['all'],
|
44
|
+
secrets: ['all']
|
45
|
+
}
|
46
|
+
}
|
47
|
+
]
|
48
|
+
|
49
|
+
{
|
50
|
+
name: 'test-tmp',
|
51
|
+
resource_group: 'TestRG-KV',
|
52
|
+
location: 'eastus',
|
53
|
+
tenant_id: '{AZURE_TENANT_ID}',
|
54
|
+
sku_family: 'A',
|
55
|
+
sku_name: 'standard',
|
56
|
+
access_policies: access_policies_arr
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.list_vault_response(key_vault_client)
|
61
|
+
response = '{
|
62
|
+
"value": [{
|
63
|
+
"id" : "/subscriptions/{AZURE_SUBSCRIPTION_ID}/resourceGroups/fog-test-rg/providers/Microsoft.KeyVault/vaults/fog-test-kv",
|
64
|
+
"name" : "fog-test-kv",
|
65
|
+
"type" : "Microsoft.KeyVault/vaults",
|
66
|
+
"location" : "westus",
|
67
|
+
"tags" : {},
|
68
|
+
"properties" : {
|
69
|
+
"sku" : {
|
70
|
+
"family" : "A",
|
71
|
+
"name" : "standard"
|
72
|
+
},
|
73
|
+
"tenantId" : "{AZURE_TENANT_ID}",
|
74
|
+
"accessPolicies" : [
|
75
|
+
{
|
76
|
+
"tenantId" : "{AZURE_TENANT_ID}",
|
77
|
+
"objectId" : "{AZURE_OBJECT_ID}",
|
78
|
+
"permissions" : {
|
79
|
+
"keys" : ["all"],
|
80
|
+
"secrets" : ["all"]
|
81
|
+
}
|
82
|
+
}
|
83
|
+
],
|
84
|
+
"enabledForDeployment" : false,
|
85
|
+
"vaultUri" : "https://fog-test-kv.vault.azure.net/"
|
86
|
+
}
|
87
|
+
}]
|
88
|
+
}'
|
89
|
+
vaults_mapper = Azure::ARM::KeyVault::Models::VaultListResult.mapper
|
90
|
+
key_vault_client.deserialize(vaults_mapper, Fog::JSON.decode(response), 'result.body')
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|