fog-azure-rm 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +2 -1
- data/fog-azure-rm.gemspec +11 -9
- data/lib/fog/azurerm.rb +1 -0
- data/lib/fog/azurerm/compute.rb +3 -3
- data/lib/fog/azurerm/config.rb +33 -0
- data/lib/fog/azurerm/credentials.rb +1 -1
- data/lib/fog/azurerm/dns.rb +2 -2
- data/lib/fog/azurerm/docs/storage.md +120 -66
- data/lib/fog/azurerm/models/application_gateway/gateway.rb +30 -31
- data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -4
- data/lib/fog/azurerm/models/compute/availability_sets.rb +4 -4
- data/lib/fog/azurerm/models/compute/server.rb +14 -14
- data/lib/fog/azurerm/models/compute/servers.rb +4 -4
- data/lib/fog/azurerm/models/compute/virtual_machine_extension.rb +3 -5
- data/lib/fog/azurerm/models/compute/virtual_machine_extensions.rb +5 -5
- data/lib/fog/azurerm/models/dns/record_sets.rb +4 -4
- data/lib/fog/azurerm/models/dns/zones.rb +4 -4
- data/lib/fog/azurerm/models/network/express_route_circuit.rb +2 -5
- data/lib/fog/azurerm/models/network/express_route_circuit_authorization.rb +1 -1
- data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +4 -4
- data/lib/fog/azurerm/models/network/express_route_circuit_peering.rb +3 -5
- data/lib/fog/azurerm/models/network/express_route_circuit_peerings.rb +4 -4
- data/lib/fog/azurerm/models/network/express_route_circuits.rb +4 -4
- data/lib/fog/azurerm/models/network/express_route_service_providers.rb +2 -2
- data/lib/fog/azurerm/models/network/load_balancers.rb +5 -5
- data/lib/fog/azurerm/models/network/local_network_gateway.rb +1 -1
- data/lib/fog/azurerm/models/network/local_network_gateways.rb +4 -4
- data/lib/fog/azurerm/models/network/network_interfaces.rb +5 -5
- data/lib/fog/azurerm/models/network/network_security_groups.rb +5 -5
- data/lib/fog/azurerm/models/network/network_security_rule.rb +3 -4
- data/lib/fog/azurerm/models/network/network_security_rules.rb +4 -4
- data/lib/fog/azurerm/models/network/public_ips.rb +4 -4
- data/lib/fog/azurerm/models/network/subnets.rb +4 -4
- data/lib/fog/azurerm/models/network/virtual_network_gateway.rb +6 -7
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connection.rb +5 -5
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +4 -4
- data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +4 -4
- data/lib/fog/azurerm/models/network/virtual_networks.rb +4 -4
- data/lib/fog/azurerm/models/resources/azure_resources.rb +2 -2
- data/lib/fog/azurerm/models/resources/deployments.rb +4 -4
- data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -4
- data/lib/fog/azurerm/models/sql/firewall_rule.rb +1 -1
- data/lib/fog/azurerm/models/sql/firewall_rules.rb +4 -4
- data/lib/fog/azurerm/models/sql/sql_database.rb +28 -24
- data/lib/fog/azurerm/models/sql/sql_databases.rb +5 -6
- data/lib/fog/azurerm/models/sql/sql_servers.rb +4 -4
- data/lib/fog/azurerm/models/storage/directories.rb +49 -24
- data/lib/fog/azurerm/models/storage/directory.rb +126 -40
- data/lib/fog/azurerm/models/storage/file.rb +226 -114
- data/lib/fog/azurerm/models/storage/files.rb +168 -13
- data/lib/fog/azurerm/models/storage/recovery_vault.rb +1 -1
- data/lib/fog/azurerm/models/storage/recovery_vaults.rb +4 -4
- data/lib/fog/azurerm/models/storage/storage_account.rb +5 -5
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -4
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb +1 -1
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_points.rb +4 -4
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +4 -4
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profiles.rb +4 -4
- data/lib/fog/azurerm/network.rb +1 -1
- data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +17 -13
- data/lib/fog/azurerm/requests/network/list_virtual_networks.rb +1 -1
- data/lib/fog/azurerm/requests/resources/create_deployment.rb +1 -1
- data/lib/fog/azurerm/requests/resources/create_resource_group.rb +1 -1
- data/lib/fog/azurerm/requests/resources/delete_deployment.rb +1 -1
- data/lib/fog/azurerm/requests/resources/delete_resource_group.rb +1 -1
- data/lib/fog/azurerm/requests/resources/get_deployment.rb +1 -1
- data/lib/fog/azurerm/requests/resources/get_resource_group.rb +1 -1
- data/lib/fog/azurerm/requests/resources/list_deployments.rb +1 -1
- data/lib/fog/azurerm/requests/resources/list_resource_groups.rb +1 -1
- data/lib/fog/azurerm/requests/resources/list_tagged_resources.rb +1 -1
- data/lib/fog/azurerm/requests/resources/tag_resource.rb +1 -1
- data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +3 -3
- data/lib/fog/azurerm/requests/sql/create_or_update_firewall_rule.rb +3 -3
- data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +3 -3
- data/lib/fog/azurerm/requests/sql/delete_database.rb +2 -2
- data/lib/fog/azurerm/requests/sql/delete_firewall_rule.rb +4 -4
- data/lib/fog/azurerm/requests/sql/delete_sql_server.rb +4 -4
- data/lib/fog/azurerm/requests/sql/get_database.rb +3 -3
- data/lib/fog/azurerm/requests/sql/get_firewall_rule.rb +3 -3
- data/lib/fog/azurerm/requests/sql/get_sql_server.rb +3 -3
- data/lib/fog/azurerm/requests/sql/list_databases.rb +3 -3
- data/lib/fog/azurerm/requests/sql/list_firewall_rules.rb +3 -3
- data/lib/fog/azurerm/requests/sql/list_sql_servers.rb +3 -3
- data/lib/fog/azurerm/requests/storage/acquire_blob_lease.rb +5 -2
- data/lib/fog/azurerm/requests/storage/acquire_container_lease.rb +5 -2
- data/lib/fog/azurerm/requests/storage/commit_blob_blocks.rb +30 -0
- data/lib/fog/azurerm/requests/storage/compare_container_blobs.rb +148 -0
- data/lib/fog/azurerm/requests/storage/copy_blob.rb +8 -8
- data/lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb +8 -8
- data/lib/fog/azurerm/requests/storage/create_block_blob.rb +108 -0
- data/lib/fog/azurerm/requests/storage/create_container.rb +12 -10
- data/lib/fog/azurerm/requests/storage/create_disk.rb +45 -19
- data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +2 -2
- data/lib/fog/azurerm/requests/storage/create_page_blob.rb +31 -0
- data/lib/fog/azurerm/requests/storage/create_storage_account.rb +2 -2
- data/lib/fog/azurerm/requests/storage/delete_blob.rb +10 -5
- data/lib/fog/azurerm/requests/storage/delete_container.rb +6 -2
- data/lib/fog/azurerm/requests/storage/delete_disk.rb +19 -16
- data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_backup_container.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_backup_item.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_backup_job_for_vm.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_blob.rb +163 -0
- data/lib/fog/azurerm/requests/storage/get_blob_http_url.rb +39 -0
- data/lib/fog/azurerm/requests/storage/get_blob_https_url.rb +39 -0
- data/lib/fog/azurerm/requests/storage/get_blob_properties.rb +37 -35
- data/lib/fog/azurerm/requests/storage/get_blob_url.rb +28 -0
- data/lib/fog/azurerm/requests/storage/get_container_acl.rb +30 -0
- data/lib/fog/azurerm/requests/storage/get_container_properties.rb +16 -12
- data/lib/fog/azurerm/requests/storage/get_container_url.rb +34 -0
- data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_storage_access_keys.rb +4 -3
- data/lib/fog/azurerm/requests/storage/get_storage_account.rb +2 -2
- data/lib/fog/azurerm/requests/storage/list_blobs.rb +110 -24
- data/lib/fog/azurerm/requests/storage/list_containers.rb +46 -23
- data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +2 -2
- data/lib/fog/azurerm/requests/storage/list_storage_account_for_rg.rb +2 -2
- data/lib/fog/azurerm/requests/storage/list_storage_accounts.rb +2 -2
- data/lib/fog/azurerm/requests/storage/multipart_save_block_blob.rb +110 -0
- data/lib/fog/azurerm/requests/storage/put_blob_block.rb +30 -0
- data/lib/fog/azurerm/requests/storage/{set_blob_metadata.rb → put_blob_metadata.rb} +7 -3
- data/lib/fog/azurerm/requests/storage/put_blob_pages.rb +30 -0
- data/lib/fog/azurerm/requests/storage/put_blob_properties.rb +31 -0
- data/lib/fog/azurerm/requests/storage/put_container_acl.rb +31 -0
- data/lib/fog/azurerm/requests/storage/{set_container_metadata.rb → put_container_metadata.rb} +7 -3
- data/lib/fog/azurerm/requests/storage/release_blob_lease.rb +4 -1
- data/lib/fog/azurerm/requests/storage/release_container_lease.rb +4 -1
- data/lib/fog/azurerm/requests/storage/save_page_blob.rb +111 -0
- data/lib/fog/azurerm/requests/storage/start_backup.rb +1 -1
- data/lib/fog/azurerm/requests/storage/wait_blob_copy_operation_to_finish.rb +56 -0
- data/lib/fog/azurerm/resources.rb +2 -2
- data/lib/fog/azurerm/storage.rb +33 -19
- data/lib/fog/azurerm/traffic_manager.rb +1 -1
- data/lib/fog/azurerm/utilities/general.rb +70 -3
- data/lib/fog/azurerm/version.rb +1 -1
- data/rake-script.sh +5 -2
- data/test/api_stub/models/application_gateway/gateway.rb +1 -1
- data/test/api_stub/models/compute/server.rb +1 -1
- data/test/api_stub/models/dns/record_set.rb +2 -2
- data/test/api_stub/models/dns/zone.rb +1 -1
- data/test/api_stub/models/network/express_route_circuit.rb +1 -1
- data/test/api_stub/models/network/express_route_circuit_authorization.rb +1 -1
- data/test/api_stub/models/network/express_route_circuit_peering.rb +1 -1
- data/test/api_stub/models/network/express_route_service_provider.rb +1 -1
- data/test/api_stub/models/network/load_balancer.rb +1 -1
- data/test/api_stub/models/network/network_interface.rb +1 -1
- data/test/api_stub/models/network/network_security_group.rb +1 -1
- data/test/api_stub/models/network/network_security_rule.rb +1 -1
- data/test/api_stub/models/network/public_ip.rb +1 -1
- data/test/api_stub/models/network/subnet.rb +1 -1
- data/test/api_stub/models/network/virtual_network.rb +1 -1
- data/test/api_stub/models/network/virtual_network_gateway.rb +1 -1
- data/test/api_stub/models/network/virtual_network_gateway_connection.rb +1 -1
- data/test/api_stub/models/resources/resource.rb +2 -2
- data/test/api_stub/models/resources/resource_group.rb +1 -1
- data/test/api_stub/models/storage/directory.rb +148 -62
- data/test/api_stub/models/storage/file.rb +122 -119
- data/test/api_stub/models/traffic_manager/traffic_manager_end_point.rb +1 -1
- data/test/api_stub/models/traffic_manager/traffic_manager_profile.rb +1 -1
- data/test/api_stub/requests/application_gateway/gateway.rb +2 -2
- data/test/api_stub/requests/compute/availability_set.rb +3 -3
- data/test/api_stub/requests/compute/virtual_machine.rb +9 -9
- data/test/api_stub/requests/dns/record_set.rb +3 -3
- data/test/api_stub/requests/dns/zone.rb +18 -18
- data/test/api_stub/requests/network/express_route_circuit.rb +2 -2
- data/test/api_stub/requests/network/express_route_circuit_authorization.rb +1 -1
- data/test/api_stub/requests/network/express_route_circuit_peering.rb +2 -2
- data/test/api_stub/requests/network/express_route_service_provider.rb +1 -1
- data/test/api_stub/requests/network/load_balancer.rb +2 -2
- data/test/api_stub/requests/network/network_interface.rb +4 -4
- data/test/api_stub/requests/network/network_security_group.rb +3 -3
- data/test/api_stub/requests/network/network_security_rule.rb +2 -2
- data/test/api_stub/requests/network/public_ip.rb +2 -2
- data/test/api_stub/requests/network/subnet.rb +2 -2
- data/test/api_stub/requests/network/virtual_network.rb +2 -2
- data/test/api_stub/requests/network/virtual_network_gateway.rb +2 -2
- data/test/api_stub/requests/network/virtual_network_gateway_connection.rb +3 -3
- data/test/api_stub/requests/resources/resource.rb +2 -2
- data/test/api_stub/requests/resources/resource_group.rb +2 -2
- data/test/api_stub/requests/storage/directory.rb +59 -65
- data/test/api_stub/requests/storage/file.rb +183 -113
- data/test/api_stub/requests/storage/storageaccount.rb +1 -1
- data/test/api_stub/requests/traffic_manager/traffic_manager_endpoint.rb +1 -1
- data/test/api_stub/requests/traffic_manager/traffic_manager_profile.rb +2 -2
- data/test/integration/Virtual_network_gateway_connection.rb +189 -182
- data/test/integration/application_gateway.rb +208 -183
- data/test/integration/availability_set.rb +44 -27
- data/test/integration/blob.rb +293 -169
- data/test/integration/container.rb +93 -42
- data/test/integration/data_disk.rb +57 -46
- data/test/integration/deployment.rb +40 -32
- data/test/integration/express_route_circuit.rb +86 -82
- data/test/integration/external_load_balancer.rb +108 -100
- data/test/integration/internal_load_balancer.rb +115 -106
- data/test/integration/local_network_gateway.rb +46 -39
- data/test/integration/network_interface.rb +119 -107
- data/test/integration/network_security_group.rb +86 -74
- data/test/integration/network_security_rule.rb +65 -57
- data/test/integration/public_ip.rb +50 -42
- data/test/integration/record_set.rb +90 -78
- data/test/integration/resource_group.rb +26 -14
- data/test/integration/resource_tag.rb +56 -45
- data/test/integration/server.rb +152 -135
- data/test/integration/server_custom_image.rb +85 -76
- data/test/integration/sql_server.rb +130 -117
- data/test/integration/storage_account.rb +82 -70
- data/test/integration/subnet.rb +87 -74
- data/test/integration/traffic_manager.rb +86 -74
- data/test/integration/virtual_machine_extension.rb +115 -106
- data/test/integration/virtual_network.rb +121 -100
- data/test/integration/virtual_network_gateway.rb +86 -79
- data/test/integration/virtual_network_gateway_connection_to_express_route.rb +94 -87
- data/test/integration/zone.rb +36 -28
- data/test/models/storage/test_directories.rb +26 -71
- data/test/models/storage/test_directory.rb +111 -58
- data/test/models/storage/test_file.rb +179 -143
- data/test/models/storage/test_files.rb +197 -30
- data/test/models/storage/test_storage_account.rb +1 -1
- data/test/requests/compute/test_attach_data_disk_to_vm.rb +15 -17
- data/test/requests/storage/test_acquire_blob_lease.rb +23 -4
- data/test/requests/storage/test_acquire_container_lease.rb +24 -5
- data/test/requests/storage/test_commit_blob_blocks.rb +34 -0
- data/test/requests/storage/test_compare_container_blobs.rb +36 -0
- data/test/requests/storage/test_copy_blob.rb +22 -3
- data/test/requests/storage/test_copy_blob_from_uri.rb +23 -4
- data/test/requests/storage/test_create_block_blob.rb +80 -0
- data/test/requests/storage/test_create_container.rb +18 -13
- data/test/requests/storage/test_create_disk.rb +57 -4
- data/test/requests/storage/test_create_page_blob.rb +34 -0
- data/test/requests/storage/test_delete_blob.rb +25 -5
- data/test/requests/storage/test_delete_container.rb +21 -9
- data/test/requests/storage/test_delete_disk.rb +14 -7
- data/test/requests/storage/test_get_blob.rb +141 -0
- data/test/requests/storage/test_get_blob_http_url.rb +30 -0
- data/test/requests/storage/test_get_blob_https_url.rb +30 -0
- data/test/requests/storage/test_get_blob_properties.rb +29 -7
- data/test/requests/storage/test_get_blob_url.rb +33 -0
- data/test/requests/storage/test_get_container_acl.rb +37 -0
- data/test/requests/storage/test_get_container_properties.rb +25 -11
- data/test/requests/storage/test_get_container_url.rb +33 -0
- data/test/requests/storage/test_list_blobs.rb +77 -0
- data/test/requests/storage/test_list_containers.rb +38 -7
- data/test/requests/storage/test_multipart_save_block_blob.rb +105 -0
- data/test/requests/storage/test_put_blob_block.rb +34 -0
- data/test/requests/storage/test_put_blob_metadata.rb +36 -0
- data/test/requests/storage/test_put_blob_pages.rb +34 -0
- data/test/requests/storage/test_put_blob_properties.rb +39 -0
- data/test/requests/storage/test_put_container_acl.rb +34 -0
- data/test/requests/storage/test_put_container_metadata.rb +36 -0
- data/test/requests/storage/test_release_blob_lease.rb +20 -2
- data/test/requests/storage/test_release_container_lease.rb +21 -3
- data/test/requests/storage/test_save_page_blob.rb +115 -0
- data/test/requests/storage/test_wait_blob_copy_operation_to_finish.rb +148 -0
- data/test/test_helper.rb +34 -21
- metadata +92 -46
- data/lib/fog/azurerm/requests/storage/check_blob_exist.rb +0 -25
- data/lib/fog/azurerm/requests/storage/compare_blob.rb +0 -73
- data/lib/fog/azurerm/requests/storage/download_blob_to_file.rb +0 -56
- data/lib/fog/azurerm/requests/storage/get_blob_metadata.rb +0 -59
- data/lib/fog/azurerm/requests/storage/get_container_access_control_list.rb +0 -30
- data/lib/fog/azurerm/requests/storage/get_container_metadata.rb +0 -32
- data/lib/fog/azurerm/requests/storage/set_blob_properties.rb +0 -26
- data/lib/fog/azurerm/requests/storage/upload_block_blob_from_file.rb +0 -60
- data/test/requests/storage/test_check_blob_exist.rb +0 -17
- data/test/requests/storage/test_compare_blob.rb +0 -17
- data/test/requests/storage/test_download_blob_to_file.rb +0 -25
- data/test/requests/storage/test_get_blob_metadata.rb +0 -18
- data/test/requests/storage/test_get_container_access_control_list.rb +0 -31
- data/test/requests/storage/test_get_container_metadata.rb +0 -18
- data/test/requests/storage/test_list_blobs_in_container.rb +0 -23
- data/test/requests/storage/test_set_blob_metadata.rb +0 -17
- data/test/requests/storage/test_set_blob_properties.rb +0 -16
- data/test/requests/storage/test_set_container_metadata.rb +0 -17
- data/test/requests/storage/test_upload_block_blob_from_file.rb +0 -23
@@ -3,22 +3,22 @@ module Fog
|
|
3
3
|
class AzureRM
|
4
4
|
# VirtualNetworkGateways collection class for Network Service
|
5
5
|
class VirtualNetworkGateways < Fog::Collection
|
6
|
-
model VirtualNetworkGateway
|
6
|
+
model Fog::Network::AzureRM::VirtualNetworkGateway
|
7
7
|
attribute :resource_group
|
8
8
|
|
9
9
|
def all
|
10
10
|
requires :resource_group
|
11
11
|
network_gateways = []
|
12
12
|
service.list_virtual_network_gateways(resource_group).each do |gateway|
|
13
|
-
network_gateways << VirtualNetworkGateway.parse(gateway)
|
13
|
+
network_gateways << Fog::Network::AzureRM::VirtualNetworkGateway.parse(gateway)
|
14
14
|
end
|
15
15
|
load(network_gateways)
|
16
16
|
end
|
17
17
|
|
18
18
|
def get(resource_group_name, name)
|
19
19
|
network_gateway = service.get_virtual_network_gateway(resource_group_name, name)
|
20
|
-
virtual_network_gateway = VirtualNetworkGateway.new(service: service)
|
21
|
-
virtual_network_gateway.merge_attributes(VirtualNetworkGateway.parse(network_gateway))
|
20
|
+
virtual_network_gateway = Fog::Network::AzureRM::VirtualNetworkGateway.new(service: service)
|
21
|
+
virtual_network_gateway.merge_attributes(Fog::Network::AzureRM::VirtualNetworkGateway.parse(network_gateway))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -4,22 +4,22 @@ module Fog
|
|
4
4
|
# This class is giving implementation of all/list, get and
|
5
5
|
# check name availability for virtual network.
|
6
6
|
class VirtualNetworks < Fog::Collection
|
7
|
-
model VirtualNetwork
|
7
|
+
model Fog::Network::AzureRM::VirtualNetwork
|
8
8
|
attribute :resource_group
|
9
9
|
|
10
10
|
def all
|
11
11
|
requires :resource_group
|
12
12
|
virtual_networks = []
|
13
13
|
service.list_virtual_networks(resource_group).each do |vnet|
|
14
|
-
virtual_networks << VirtualNetwork.parse(vnet)
|
14
|
+
virtual_networks << Fog::Network::AzureRM::VirtualNetwork.parse(vnet)
|
15
15
|
end
|
16
16
|
load(virtual_networks)
|
17
17
|
end
|
18
18
|
|
19
19
|
def get(resource_group_name, virtual_network_name)
|
20
20
|
virtual_network = service.get_virtual_network(resource_group_name, virtual_network_name)
|
21
|
-
|
22
|
-
|
21
|
+
virtual_network_fog = Fog::Network::AzureRM::VirtualNetwork.new(service: service)
|
22
|
+
virtual_network_fog.merge_attributes(Fog::Network::AzureRM::VirtualNetwork.parse(virtual_network))
|
23
23
|
end
|
24
24
|
|
25
25
|
def check_if_exists(resource_group, name)
|
@@ -5,13 +5,13 @@ module Fog
|
|
5
5
|
class AzureResources < Fog::Collection
|
6
6
|
attribute :tag_name
|
7
7
|
attribute :tag_value
|
8
|
-
model AzureResource
|
8
|
+
model Fog::Resources::AzureRM::AzureResource
|
9
9
|
|
10
10
|
def all
|
11
11
|
unless tag_name.nil? && tag_value.nil?
|
12
12
|
resources = []
|
13
13
|
service.list_tagged_resources(tag_name, tag_value).each do |resource|
|
14
|
-
resources << AzureResource.parse(resource)
|
14
|
+
resources << Fog::Resources::AzureRM::AzureResource.parse(resource)
|
15
15
|
end
|
16
16
|
resources.inspect
|
17
17
|
return load(resources)
|
@@ -4,21 +4,21 @@ module Fog
|
|
4
4
|
# Deployments collection class
|
5
5
|
class Deployments < Fog::Collection
|
6
6
|
attribute :resource_group
|
7
|
-
model Deployment
|
7
|
+
model Fog::Resources::AzureRM::Deployment
|
8
8
|
|
9
9
|
def all
|
10
10
|
requires :resource_group
|
11
11
|
deployments = []
|
12
12
|
service.list_deployments(resource_group).each do |deployment|
|
13
|
-
deployments << Deployment.parse(deployment)
|
13
|
+
deployments << Fog::Resources::AzureRM::Deployment.parse(deployment)
|
14
14
|
end
|
15
15
|
load(deployments)
|
16
16
|
end
|
17
17
|
|
18
18
|
def get(resource_group_name, deployment_name)
|
19
19
|
deployment = service.get_deployment(resource_group_name, deployment_name)
|
20
|
-
|
21
|
-
|
20
|
+
deployment_fog = Fog::Resources::AzureRM::Deployment.new(service: service)
|
21
|
+
deployment_fog.merge_attributes(Fog::Resources::AzureRM::Deployment.parse(deployment))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -4,20 +4,20 @@ module Fog
|
|
4
4
|
# This class is giving implementation of all/list, get and
|
5
5
|
# check name availability for resource groups.
|
6
6
|
class ResourceGroups < Fog::Collection
|
7
|
-
model ResourceGroup
|
7
|
+
model Fog::Resources::AzureRM::ResourceGroup
|
8
8
|
|
9
9
|
def all
|
10
10
|
resource_groups = []
|
11
11
|
service.list_resource_groups.each do |resource_group|
|
12
|
-
resource_groups.push(ResourceGroup.parse(resource_group))
|
12
|
+
resource_groups.push(Fog::Resources::AzureRM::ResourceGroup.parse(resource_group))
|
13
13
|
end
|
14
14
|
load(resource_groups)
|
15
15
|
end
|
16
16
|
|
17
17
|
def get(resource_group_name)
|
18
18
|
resource_group = service.get_resource_group(resource_group_name)
|
19
|
-
|
20
|
-
|
19
|
+
resource_group_fog = Fog::Resources::AzureRM::ResourceGroup.new(service: service)
|
20
|
+
resource_group_fog.merge_attributes(Fog::Resources::AzureRM::ResourceGroup.parse(resource_group))
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -28,7 +28,7 @@ module Fog
|
|
28
28
|
def save
|
29
29
|
requires :resource_group, :server_name, :name, :start_ip, :end_ip
|
30
30
|
firewall_rule = service.create_or_update_firewall_rule(firewall_params)
|
31
|
-
merge_attributes(FirewallRule.parse(firewall_rule))
|
31
|
+
merge_attributes(Fog::Sql::AzureRM::FirewallRule.parse(firewall_rule))
|
32
32
|
end
|
33
33
|
|
34
34
|
def destroy
|
@@ -5,22 +5,22 @@ module Fog
|
|
5
5
|
class FirewallRules < Fog::Collection
|
6
6
|
attribute :resource_group
|
7
7
|
attribute :server_name
|
8
|
-
model FirewallRule
|
8
|
+
model Fog::Sql::AzureRM::FirewallRule
|
9
9
|
|
10
10
|
def all
|
11
11
|
requires :resource_group, :server_name
|
12
12
|
|
13
13
|
firewall_rules = []
|
14
14
|
service.list_firewall_rules(resource_group, server_name).each do |firewall_rule|
|
15
|
-
firewall_rules << FirewallRule.parse(firewall_rule)
|
15
|
+
firewall_rules << Fog::Sql::AzureRM::FirewallRule.parse(firewall_rule)
|
16
16
|
end
|
17
17
|
load(firewall_rules)
|
18
18
|
end
|
19
19
|
|
20
20
|
def get(resource_group, server_name, rule_name)
|
21
21
|
firewall_rule = service.get_firewall_rule(resource_group, server_name, rule_name)
|
22
|
-
|
23
|
-
|
22
|
+
firewall_rule_fog = Fog::Sql::AzureRM::FirewallRule.new(service: service)
|
23
|
+
firewall_rule_fog.merge_attributes(Fog::Sql::AzureRM::FirewallRule.parse(firewall_rule))
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -27,30 +27,34 @@ module Fog
|
|
27
27
|
attribute :source_database_deletion_date
|
28
28
|
|
29
29
|
def self.parse(database)
|
30
|
-
{
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
30
|
+
sql_database = {}
|
31
|
+
sql_database['id'] = database['id'] unless database['id'].nil?
|
32
|
+
sql_database['type'] = database['type'] unless database['type'].nil?
|
33
|
+
sql_database['name'] = database['name'] unless database['name'].nil?
|
34
|
+
sql_database['location'] = database['location'] unless database['location'].nil?
|
35
|
+
sql_database['elastic_pool_name'] = database['elasticPoolName'] unless database['elasticPoolName'].nil?
|
36
|
+
unless database['id'].nil?
|
37
|
+
sql_database['server_name'] = get_server_name_from_id(database['id'])
|
38
|
+
sql_database['resource_group'] = get_resource_group_from_id(database['id'])
|
39
|
+
end
|
40
|
+
unless database['properties'].nil?
|
41
|
+
sql_database['edition'] = database['properties']['edition']
|
42
|
+
sql_database['collation'] = database['properties']['collation']
|
43
|
+
sql_database['create_mode'] = database['properties']['createMode']
|
44
|
+
sql_database['database_id'] = database['properties']['databaseId']
|
45
|
+
sql_database['creation_date'] = database['properties']['creationDate']
|
46
|
+
sql_database['max_size_bytes'] = database['properties']['maxSizeBytes']
|
47
|
+
sql_database['source_database_id'] = database['properties']['sourceDatabaseId']
|
48
|
+
sql_database['restore_point_in_time'] = database['properties']['restorePointInTime']
|
49
|
+
sql_database['earliest_restore_date'] = database['properties']['earliestRestoreDate']
|
50
|
+
sql_database['service_level_objective'] = database['properties']['serviceLevelObjective']
|
51
|
+
sql_database['default_secondary_location'] = database['properties']['defaultSecondaryLocation']
|
52
|
+
sql_database['source_database_deletion_date'] = database['properties']['sourceDatabaseDeletionDate']
|
53
|
+
sql_database['requested_service_objective_id'] = database['properties']['requestedServiceObjectiveId']
|
54
|
+
sql_database['requested_service_objective_name'] = database['properties']['requestedServiceObjectiveName']
|
55
|
+
sql_database['current_service_level_objective_id'] = database['properties']['currentServiceLevelObjectiveId']
|
56
|
+
end
|
57
|
+
sql_database
|
54
58
|
end
|
55
59
|
|
56
60
|
def save
|
@@ -5,23 +5,22 @@ module Fog
|
|
5
5
|
class SqlDatabases < Fog::Collection
|
6
6
|
attribute :resource_group
|
7
7
|
attribute :server_name
|
8
|
-
model SqlDatabase
|
8
|
+
model Fog::Sql::AzureRM::SqlDatabase
|
9
9
|
|
10
10
|
def all
|
11
|
-
requires :resource_group
|
12
|
-
requires :server_name
|
11
|
+
requires :resource_group, :server_name
|
13
12
|
|
14
13
|
databases = []
|
15
14
|
service.list_databases(resource_group, server_name).each do |database|
|
16
|
-
databases << SqlDatabase.parse(database)
|
15
|
+
databases << Fog::Sql::AzureRM::SqlDatabase.parse(database)
|
17
16
|
end
|
18
17
|
load(databases)
|
19
18
|
end
|
20
19
|
|
21
20
|
def get(resource_group, server_name, name)
|
22
21
|
database = service.get_database(resource_group, server_name, name)
|
23
|
-
|
24
|
-
|
22
|
+
database_fog = Fog::Sql::AzureRM::SqlDatabase.new(service: service)
|
23
|
+
database_fog.merge_attributes(Fog::Sql::AzureRM::SqlDatabase.parse(database))
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
@@ -4,22 +4,22 @@ module Fog
|
|
4
4
|
# Sql Server Collection for Server Service
|
5
5
|
class SqlServers < Fog::Collection
|
6
6
|
attribute :resource_group
|
7
|
-
model SqlServer
|
7
|
+
model Fog::Sql::AzureRM::SqlServer
|
8
8
|
|
9
9
|
def all
|
10
10
|
requires :resource_group
|
11
11
|
|
12
12
|
servers = []
|
13
13
|
service.list_sql_servers(resource_group).each do |server|
|
14
|
-
servers << SqlServer.parse(server)
|
14
|
+
servers << Fog::Sql::AzureRM::SqlServer.parse(server)
|
15
15
|
end
|
16
16
|
load(servers)
|
17
17
|
end
|
18
18
|
|
19
19
|
def get(resource_group, server_name)
|
20
20
|
server = service.get_sql_server(resource_group, server_name)
|
21
|
-
|
22
|
-
|
21
|
+
server_fog = Fog::Sql::AzureRM::SqlServer.new(service: service)
|
22
|
+
server_fog.merge_attributes(Fog::Sql::AzureRM::SqlServer.parse(server))
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -3,37 +3,62 @@ module Fog
|
|
3
3
|
class AzureRM
|
4
4
|
# This class is giving implementation of listing containers.
|
5
5
|
class Directories < Fog::Collection
|
6
|
-
model Directory
|
6
|
+
model Fog::Storage::AzureRM::Directory
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
# List all directories(containers) in the storage account.
|
9
|
+
#
|
10
|
+
# @return [Fog::Storage::AzureRM::Directories]
|
11
|
+
#
|
12
|
+
def all
|
13
|
+
containers = service.list_containers
|
14
|
+
data = []
|
15
|
+
containers.each do |container|
|
16
|
+
c = parse_storage_object(container)
|
17
|
+
c[:acl] = 'unknown'
|
18
|
+
data << c
|
14
19
|
end
|
15
|
-
load
|
20
|
+
load(data)
|
16
21
|
end
|
17
22
|
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
# Get a directory with files(blobs) under this directory.
|
24
|
+
# You can set max_keys to 1 if you do not want to return all files under this directory.
|
25
|
+
#
|
26
|
+
# @param identity [String] Name of directory
|
27
|
+
# @param options [Hash]
|
28
|
+
# @option options [String] max_keys or
|
29
|
+
# max_results Sets the maximum number of files to return.
|
30
|
+
# @option options [String] delimiter Sets to cause that the operation returns a BlobPrefix element in the response body that acts
|
31
|
+
# as a placeholder for all files whose names begin with the same substring up to the appearance
|
32
|
+
# of the delimiter character. The delimiter may be a single character or a string.
|
33
|
+
# @option options [String] marker Sets the identifier that specifies the portion of the list to be returned.
|
34
|
+
# @option options [String] prefix Sets filters the results to return only files whose name begins with the specified prefix.
|
35
|
+
#
|
36
|
+
# @return [Fog::Storage::AzureRM::Directory] A directory. Return nil if the directory does not exist.
|
37
|
+
#
|
38
|
+
def get(identity, options = {})
|
39
|
+
remap_attributes(options, max_keys: :max_results)
|
21
40
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
else
|
26
|
-
access_control_list.public_access_level
|
27
|
-
end
|
28
|
-
container
|
29
|
-
end
|
41
|
+
container = service.get_container_properties(identity)
|
42
|
+
data = parse_storage_object(container)
|
43
|
+
data[:acl] = 'unknown'
|
30
44
|
|
31
|
-
|
32
|
-
|
33
|
-
|
45
|
+
directory = new(key: identity, is_persisted: true)
|
46
|
+
directory.merge_attributes(data)
|
47
|
+
|
48
|
+
data = service.list_blobs(identity, options)
|
34
49
|
|
35
|
-
|
36
|
-
|
50
|
+
new_options = options.merge(next_marker: data[:next_marker])
|
51
|
+
directory.files.merge_attributes(new_options)
|
52
|
+
|
53
|
+
blobs = []
|
54
|
+
data[:blobs].each do |blob|
|
55
|
+
blobs << parse_storage_object(blob)
|
56
|
+
end
|
57
|
+
directory.files.load(blobs)
|
58
|
+
directory
|
59
|
+
rescue => error
|
60
|
+
return nil if error.message == 'NotFound'
|
61
|
+
raise error
|
37
62
|
end
|
38
63
|
end
|
39
64
|
end
|
@@ -3,61 +3,147 @@ module Fog
|
|
3
3
|
class AzureRM
|
4
4
|
# This class is giving implementation of create and delete a container.
|
5
5
|
class Directory < Fog::Model
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
attribute :
|
6
|
+
VALID_ACLS = ['container', 'blob', 'unknown', nil].freeze
|
7
|
+
|
8
|
+
attr_writer :acl
|
9
|
+
|
10
|
+
identity :key, aliases: %w(Name name)
|
11
|
+
attribute :etag, aliases: %w(Etag ETag)
|
12
|
+
attribute :last_modified, aliases: %w(Last-Modified LastModified), type: 'time'
|
13
|
+
attribute :lease_duration, aliases: %w(Lease-Duration LeaseDuration)
|
14
|
+
attribute :lease_state, aliases: %w(Lease-State LeaseState)
|
15
|
+
attribute :lease_status, aliases: %w(Lease-Status LeaseStatus)
|
16
|
+
|
12
17
|
attribute :metadata
|
13
|
-
attribute :public_access_level
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
# Set the the permission
|
20
|
+
#
|
21
|
+
# @param new_acl [String] permission. Options: container, blob or nil. unknown is for internal usage.
|
22
|
+
# container: Full public read access. Container and blob data can be read via anonymous request.
|
23
|
+
# Clients can enumerate blobs within the container via anonymous request, but cannot
|
24
|
+
# enumerate containers within the storage account.
|
25
|
+
# blob: Public read access for blobs only. Blob data within this container can be read via
|
26
|
+
# anonymous request, but container data is not available. Clients cannot enumerate blobs
|
27
|
+
# within the container via anonymous request.
|
28
|
+
# nil: No public read access. Container and blob data can be read by the account owner only.
|
29
|
+
# unknown: Internal usage in fog-azure-rm.
|
30
|
+
#
|
31
|
+
# @return [String] Permission.
|
32
|
+
#
|
33
|
+
# @exception ArgumentError Raised when new_acl is not 'container', 'blob', nil or 'unknown'.
|
34
|
+
#
|
35
|
+
# Reference: https://msdn.microsoft.com/en-us/library/azure/dd179391.aspx
|
36
|
+
#
|
37
|
+
def acl=(new_acl)
|
38
|
+
raise ArgumentError.new("acl must be one of [#{VALID_ACLS.join(', ')}nil]") unless VALID_ACLS.include?(new_acl)
|
19
39
|
|
20
|
-
|
40
|
+
attributes[:acl] = new_acl
|
41
|
+
end
|
21
42
|
|
22
|
-
|
43
|
+
# Get the the permission
|
44
|
+
#
|
45
|
+
# required attributes: key
|
46
|
+
#
|
47
|
+
# @return [String] Permission.
|
48
|
+
#
|
49
|
+
def acl
|
23
50
|
requires :key
|
24
|
-
|
51
|
+
|
52
|
+
return attributes[:acl] if attributes[:acl] != 'unknown' || !persisted?
|
53
|
+
|
54
|
+
data = service.get_container_acl(key)
|
55
|
+
attributes[:acl] = data[0]
|
25
56
|
end
|
26
57
|
|
27
|
-
|
58
|
+
# Destroy directory.
|
59
|
+
#
|
60
|
+
# required attributes: key
|
61
|
+
#
|
62
|
+
# @return [Boolean] True if successful
|
63
|
+
#
|
64
|
+
def destroy
|
28
65
|
requires :key
|
29
|
-
|
66
|
+
|
67
|
+
service.delete_container(key)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Get files under this directory.
|
71
|
+
# If you have set max_results or max_keys when getting this directory by directories.get,
|
72
|
+
# files may be incomplete. You need to use files.all to get all files under this directory.
|
73
|
+
#
|
74
|
+
# @return [Fog::Storage::AzureRM::Files] Files.
|
75
|
+
#
|
76
|
+
def files
|
77
|
+
@files ||= Fog::Storage::AzureRM::Files.new(directory: self, service: service)
|
30
78
|
end
|
31
79
|
|
32
|
-
|
80
|
+
# Set the container permission to public or private
|
81
|
+
#
|
82
|
+
# @param [Boolean] True: public(container); False: private(nil)
|
83
|
+
#
|
84
|
+
# @return [Boolean] True if public; Otherwise return false.
|
85
|
+
#
|
86
|
+
def public=(new_public)
|
87
|
+
attributes[:acl] = new_public ? 'container' : nil
|
88
|
+
new_public
|
89
|
+
end
|
90
|
+
|
91
|
+
# Get the public URL of the directory
|
92
|
+
#
|
93
|
+
# required attributes: key
|
94
|
+
#
|
95
|
+
# @param options [Hash]
|
96
|
+
# @option options [String] scheme Sets which URL to get, http or https. Options: https or http. Default is https.
|
97
|
+
#
|
98
|
+
# @return [String] A public URL.
|
99
|
+
#
|
100
|
+
def public_url(options = {})
|
33
101
|
requires :key
|
34
|
-
|
102
|
+
|
103
|
+
service.get_container_url(key, options) if acl == 'container'
|
35
104
|
end
|
36
105
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
106
|
+
# Create/Update the directory
|
107
|
+
#
|
108
|
+
# required attributes: key
|
109
|
+
#
|
110
|
+
# @param options [Hash]
|
111
|
+
# @option options [Boolean] is_create Sets whether to create or update the directory. Default is true(create).
|
112
|
+
# Will update metadata and acl when is_create is set to false.
|
113
|
+
#
|
114
|
+
# @return [Boolean] True if successful.
|
115
|
+
#
|
116
|
+
def save(options = {})
|
117
|
+
requires :key
|
118
|
+
|
119
|
+
is_create = options.delete(:is_create)
|
120
|
+
if is_create.nil? || is_create
|
121
|
+
options = {}
|
122
|
+
options[:public_access_level] = acl if acl != 'unknown'
|
123
|
+
options[:metadata] = metadata if metadata
|
124
|
+
|
125
|
+
container = service.create_container(key, options)
|
49
126
|
else
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
hash['last_modified'] = container.properties[:last_modified]
|
55
|
-
hash['etag'] = container.properties[:etag]
|
56
|
-
hash['lease_duration'] = container.properties[:lease_duration]
|
57
|
-
hash['lease_status'] = container.properties[:lease_status]
|
58
|
-
hash['lease_state'] = container.properties[:lease_state]
|
127
|
+
service.put_container_acl(key, acl) if acl != 'unknown'
|
128
|
+
service.put_container_metadata(key, metadata) if metadata
|
129
|
+
container = service.get_container_properties(key)
|
59
130
|
end
|
60
|
-
|
131
|
+
|
132
|
+
attributes[:is_persisted] = true
|
133
|
+
data = parse_storage_object(container)
|
134
|
+
merge_attributes(data)
|
135
|
+
|
136
|
+
true
|
137
|
+
end
|
138
|
+
|
139
|
+
# Check whether the directory is created.
|
140
|
+
#
|
141
|
+
# @return [Boolean] True if the file is created. Otherwise return false.
|
142
|
+
#
|
143
|
+
def persisted?
|
144
|
+
# is_persisted is true in case of directories.get or after #save
|
145
|
+
# last_modified is set in case of directories.all
|
146
|
+
attributes[:is_persisted] || !attributes[:last_modified].nil?
|
61
147
|
end
|
62
148
|
end
|
63
149
|
end
|