fog-azure-rm 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/lib/fog/azurerm.rb +9 -0
  4. data/lib/fog/azurerm/constants.rb +8 -5
  5. data/lib/fog/azurerm/docs/application_gateway.md +3 -3
  6. data/lib/fog/azurerm/docs/compute.md +2 -2
  7. data/lib/fog/azurerm/docs/network.md +17 -17
  8. data/lib/fog/azurerm/models/compute/caching_types.rb +11 -0
  9. data/lib/fog/azurerm/models/compute/disk_create_option_types.rb +11 -0
  10. data/lib/fog/azurerm/models/compute/server.rb +18 -6
  11. data/lib/fog/azurerm/models/network/ipallocation_method.rb +10 -0
  12. data/lib/fog/azurerm/models/network/security_rule_access.rb +10 -0
  13. data/lib/fog/azurerm/models/network/security_rule_direction.rb +10 -0
  14. data/lib/fog/azurerm/models/network/security_rule_protocol.rb +11 -0
  15. data/lib/fog/azurerm/models/storage/kind.rb +10 -0
  16. data/lib/fog/azurerm/models/storage/sku_name.rb +13 -0
  17. data/lib/fog/azurerm/models/storage/sku_tier.rb +10 -0
  18. data/lib/fog/azurerm/version.rb +1 -1
  19. data/test/integration/Virtual_network_gateway_connection.rb +2 -2
  20. data/test/integration/application_gateway.rb +2 -2
  21. data/test/integration/blob.rb +2 -2
  22. data/test/integration/external_load_balancer.rb +2 -2
  23. data/test/integration/internal_load_balancer.rb +1 -1
  24. data/test/integration/network_security_group.rb +9 -9
  25. data/test/integration/network_security_rule.rb +3 -3
  26. data/test/integration/public_ip.rb +6 -2
  27. data/test/integration/resource_tag.rb +1 -1
  28. data/test/integration/server.rb +2 -2
  29. data/test/integration/server_custom_image.rb +1 -1
  30. data/test/integration/storage_account.rb +2 -2
  31. data/test/integration/virtual_machine_extension.rb +1 -1
  32. data/test/integration/virtual_network_gateway.rb +1 -1
  33. data/test/integration/virtual_network_gateway_connection_to_express_route.rb +1 -1
  34. data/test/requests/network/test_check_virtual_network_exists.rb +14 -6
  35. data/test/requests/network/test_create_network_interface.rb +4 -4
  36. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9275b47abecd0b5e94d23d9d6bfe5da9e72a71d8
4
- data.tar.gz: b5ac707f57edfdfdb065923d33cbfd9ee25a1893
3
+ metadata.gz: 4a229fc3ad67bc450669aaa95ef75aea77e1e886
4
+ data.tar.gz: 9b25636194beacdb451765b7894b0044282c7386
5
5
  SHA512:
6
- metadata.gz: d72f363cbe6f539b24421ef506116364530b5a5b37fc5b02b2beda1b10f9f68aea41949af8c228c6d7404aa64863975c6eb64365fb0509eea8263bed74edb961
7
- data.tar.gz: 06d603908a26eae9ac058f4d8630cc05e223a878c4be04ade2f7a784912846378f232d6fca3c001c4759b0e967f521896d59af51d2057f2a650decff30197661
6
+ metadata.gz: 2429b485a5d228cf42ce191ca4d5a048caac1082a50c774cdb0967f8d6a0c5413eeabc177de8669fdc50fc59ffa976e86d4339302a4600c05365340d29735fed
7
+ data.tar.gz: 5f7b8ac957e2c4c3c5dac39e6de606ff99fd01edf6bb245a2d1a687a83080128c8be5a0ea90488d0ecc892079b7d1330bf823cd8fbb66562ce4de1219944bb9b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.2.3
2
+
3
+ **Added:**
4
+ - Added Fog models for Azure SDK Enums
5
+
6
+ **Changed**
7
+ - Compute Service - Made 'password' attribute as optional to create linux virtual machine
8
+
1
9
  ## 0.2.2
2
10
 
3
11
  **Changed:**
data/lib/fog/azurerm.rb CHANGED
@@ -7,6 +7,15 @@ require 'fog/azurerm/utilities/general'
7
7
  require 'fog/azurerm/version'
8
8
  require 'fog/core'
9
9
  require 'fog/json'
10
+ require 'fog/azurerm/models/compute/caching_types'
11
+ require 'fog/azurerm/models/compute/disk_create_option_types'
12
+ require 'fog/azurerm/models/network/ipallocation_method'
13
+ require 'fog/azurerm/models/network/security_rule_access'
14
+ require 'fog/azurerm/models/network/security_rule_direction'
15
+ require 'fog/azurerm/models/network/security_rule_protocol'
16
+ require 'fog/azurerm/models/storage/sku_name'
17
+ require 'fog/azurerm/models/storage/sku_tier'
18
+ require 'fog/azurerm/models/storage/kind'
10
19
 
11
20
  module Fog
12
21
  # Autoload Module for Credentials
@@ -7,8 +7,8 @@ STANDARD_STORAGE = 'Standard'.freeze
7
7
  PREMIUM_STORAGE = 'Premium'.freeze
8
8
  ALLOWED_STANDARD_REPLICATION = %w(LRS ZRS GRS RAGRS).freeze
9
9
  API_VERSION = '2016-06-01'.freeze
10
- FAULT_DOMAIN_COUNT = 3.freeze
11
- UPDATE_DOMAIN_COUNT = 5.freeze
10
+ FAULT_DOMAIN_COUNT = 3
11
+ UPDATE_DOMAIN_COUNT = 5
12
12
  WINDOWS = 'windows'.freeze
13
13
  VPN = 'Vpn'.freeze
14
14
  MICROSOFT_PEERING = 'MicrosoftPeering'.freeze
@@ -28,13 +28,16 @@ ENVIRONMENT_AZURE_CHINA_CLOUD = 'AzureChinaCloud'.freeze
28
28
  ENVIRONMENT_AZURE_US_GOVERNMENT = 'AzureUSGovernment'.freeze
29
29
  ENVIRONMENT_AZURE_GERMAN_CLOUD = 'AzureGermanCloud'.freeze
30
30
 
31
+ PLATFORM_LINUX = 'linux'.freeze
32
+
31
33
  # State of the copy operation
32
- COPY_STATUS = {
34
+ COPY_STATUS =
35
+ {
33
36
  # The copy completed successfully.
34
37
  SUCCESS: 'success',
35
38
  # The copy is in progress
36
39
  PENDING: 'pending'
37
- }.freeze
40
+ }.freeze
38
41
 
39
42
  # https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx
40
43
  # The maximum size for a block blob created via Put Blob is 64 MB. But for better performance, this size should be 32 MB.
@@ -48,4 +51,4 @@ MAXIMUM_CHUNK_SIZE = 4 * 1024 * 1024
48
51
 
49
52
  # The hash value of 4MB empty content
50
53
  HASH_OF_4MB_EMPTY_CONTENT = 'b5cfa9d6c8febd618f91ac2843d50a1c'.freeze
51
- REST_CLIENT_API_VERSION = %w(2014-04-01-preview 2016-05-01).freeze
54
+ REST_CLIENT_API_VERSION = %w(2014-04-01-preview 2016-05-01).freeze
@@ -52,7 +52,7 @@ Create a new Application Gateway.
52
52
  [
53
53
  {
54
54
  name: 'frontendIpConfig',
55
- private_ip_allocation_method: 'Dynamic',
55
+ private_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic,
56
56
  public_ip_address_id: '/subscriptions/<Subscription_id>/resourcegroups/<Resource Group name>/providers/Microsoft.Network/publicIPAddresses/<Public IP Address Name>',
57
57
  private_ip_address: '10.0.1.5'
58
58
  }
@@ -120,7 +120,7 @@ There can be two ways of giving `frontend_ip_configurations` while creating appl
120
120
  [
121
121
  {
122
122
  name: 'frontendIpConfig',
123
- private_ip_allocation_method: 'Dynamic',
123
+ private_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic,
124
124
  public_ip_address_id: '/subscriptions/<Subscription_id>/resourcegroups/<Resource Group name>/providers/Microsoft.Network/publicIPAddresses/<Public IP Address Name>',
125
125
  private_ip_address: '10.0.1.5'
126
126
  }
@@ -132,7 +132,7 @@ There can be two ways of giving `frontend_ip_configurations` while creating appl
132
132
  [
133
133
  {
134
134
  name: 'frontendIpConfig',
135
- private_ip_allocation_method: 'Dynamic',
135
+ private_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic,
136
136
  subnet_id: '<Subnet ID',
137
137
  private_ip_address: '10.0.1.5'
138
138
  }
@@ -43,7 +43,7 @@ Create a new linux server
43
43
  vm_size: 'Basic_A0',
44
44
  storage_account_name: '<Storage Account Name>',
45
45
  username: '<Username for VM>',
46
- password: '<Password for VM>',
46
+ password: '<Password for VM>', # Optional, if 'platform' partameter is 'Linux'.
47
47
  disable_password_authentication: false,
48
48
  network_interface_card_id: '/subscriptions/{Subscription-Id}/resourceGroups/{Resource-Group-Name}/providers/Microsoft.Network/networkInterfaces/{Network-Interface-Id}',
49
49
  publisher: 'Canonical', # Not required if custom image is being used
@@ -53,7 +53,7 @@ Create a new linux server
53
53
  platform: 'Linux',
54
54
  vhd_path: '<Path of VHD>', # Optional, if you want to create the VM from a custom image.
55
55
  custom_data: 'echo customData', # Optional, if you want to add custom data in this VM.
56
- os_disk_caching: 'None/ReadOnly/ReadWrite' # Optional, can be one of None, ReadOnly, ReadWrite
56
+ os_disk_caching: Fog::Compute::AzureRM::CachingTypes::None # Optional, can be one of None, ReadOnly, ReadWrite
57
57
  )
58
58
  ```
59
59
 
@@ -253,7 +253,7 @@ Create a new network interface. Skip public_ip_address_id parameter to create ne
253
253
  subnet_id: '/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/virtualNetworks/<Virtual Network name>/subnets/<Subnet name>',
254
254
  public_ip_address_id: '/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/publicIPAddresses/<Public IP name>',
255
255
  ip_configuration_name: '<Ip Configuration Name>',
256
- private_ip_allocation_method: 'Dynamic'
256
+ private_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic
257
257
  )
258
258
  ```
259
259
 
@@ -333,7 +333,7 @@ Create a new public IP. The parameter, type can be Dynamic or Static.
333
333
  name: '<Public IP name>',
334
334
  resource_group: '<Resource Group name>',
335
335
  location: 'westus',
336
- public_ip_allocation_method: 'Static'
336
+ public_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Static
337
337
  )
338
338
  ```
339
339
 
@@ -404,14 +404,14 @@ Network security group requires a resource group to create.
404
404
  location: 'eastus',
405
405
  security_rules: [{
406
406
  name: '<Security Rule name>',
407
- protocol: 'tcp',
407
+ protocol: Fog::Network::AzureRM::SecurityRuleProtocol::Tcp,
408
408
  source_port_range: '22',
409
409
  destination_port_range: '22',
410
410
  source_address_prefix: '0.0.0.0/0',
411
411
  destination_address_prefix: '0.0.0.0/0',
412
- access: 'Allow',
412
+ access: Fog::Network::AzureRM::SecurityRuleAccess::Allow,
413
413
  priority: '100',
414
- direction: 'Inbound'
414
+ direction: Fog::Network::AzureRM::SecurityRuleDirection::Inbound
415
415
  }]
416
416
  )
417
417
  ```
@@ -448,14 +448,14 @@ You can update security rules by passing the modified attributes in the form of
448
448
  [
449
449
  {
450
450
  name: '<Security Rule name>',
451
- protocol: 'tcp',
451
+ protocol: Fog::Network::AzureRM::SecurityRuleProtocol::Tcp,
452
452
  source_port_range: '*',
453
453
  destination_port_range: '*',
454
454
  source_address_prefix: '0.0.0.0/0',
455
455
  destination_address_prefix: '0.0.0.0/0',
456
- access: 'Allow',
456
+ access: Fog::Network::AzureRM::SecurityRuleAccess::Allow,
457
457
  priority: '100',
458
- direction: 'Inbound'
458
+ direction: Fog::Network::AzureRM::SecurityRuleDirection::Inbound
459
459
  }
460
460
  ]
461
461
  )
@@ -471,14 +471,14 @@ Add array of security rules in the form of hash.
471
471
  [
472
472
  {
473
473
  name: '<Security Rule name>',
474
- protocol: 'tcp',
474
+ protocol: Fog::Network::AzureRM::SecurityRuleProtocol::Tcp,
475
475
  source_port_range: '3389',
476
476
  destination_port_range: '3389',
477
477
  source_address_prefix: '0.0.0.0/0',
478
478
  destination_address_prefix: '0.0.0.0/0',
479
- access: 'Allow',
479
+ access: Fog::Network::AzureRM::SecurityRuleAccess::Allow,
480
480
  priority: '102',
481
- direction: 'Inbound'
481
+ direction: Fog::Network::AzureRM::SecurityRuleDirection::Inbound
482
482
  }
483
483
  ]
484
484
  )
@@ -512,15 +512,15 @@ Network security rule requires a resource group and network security group to cr
512
512
  azure_network_service.network_security_rules.create(
513
513
  name: '<Security Rule name>',
514
514
  resource_group: '<Resource Group name>',
515
- protocol: 'tcp',
515
+ protocol: Fog::Network::AzureRM::SecurityRuleProtocol::Tcp,
516
516
  network_security_group_name: '<Network Security Group name>',
517
517
  source_port_range: '22',
518
518
  destination_port_range: '22',
519
519
  source_address_prefix: '0.0.0.0/0',
520
520
  destination_address_prefix: '0.0.0.0/0',
521
- access: 'Allow',
521
+ access: Fog::Network::AzureRM::SecurityRuleAccess::Allow,
522
522
  priority: '100',
523
- direction: 'Inbound'
523
+ direction: Fog::Network::AzureRM::SecurityRuleDirection::Inbound
524
524
  )
525
525
  ```
526
526
 
@@ -575,7 +575,7 @@ Create a new load balancer.
575
575
  [
576
576
  {
577
577
  name: 'fic',
578
- private_ipallocation_method: 'Dynamic',
578
+ private_ipallocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic,
579
579
  public_ipaddress_id: '/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/publicIPAddresses/<Public-IP-Name>'
580
580
  }
581
581
  ],
@@ -622,7 +622,7 @@ Create a new load balancer.
622
622
  [
623
623
  {
624
624
  name: 'LB-Frontend',
625
- private_ipallocation_method: 'Static',
625
+ private_ipallocation_method: Fog::Network::AzureRM::IPAllocationMethod::Static,
626
626
  private_ipaddress: '10.1.2.5',
627
627
  subnet_id: subnet.id
628
628
  }
@@ -736,7 +736,7 @@ Create a new Virtual Network Gateway.
736
736
  ip_configurations: [
737
737
  {
738
738
  name: 'default',
739
- private_ipallocation_method: 'Dynamic',
739
+ private_ipallocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic,
740
740
  public_ipaddress_id: '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Network/publicIPAddresses/{public_ip_name}',
741
741
  subnet_id: '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Network/virtualNetworks/{virtual_network_name}/subnets/{subnet_name}',
742
742
  private_ipaddress: nil
@@ -0,0 +1,11 @@
1
+ module Fog
2
+ module Compute
3
+ class AzureRM
4
+ module CachingTypes
5
+ None = 'None'.freeze
6
+ ReadOnly = 'ReadOnly'.freeze
7
+ ReadWrite = 'ReadWrite'.freeze
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Fog
2
+ module Compute
3
+ class AzureRM
4
+ module DiskCreateOptionTypes
5
+ FromImage = 'fromImage'.freeze
6
+ Empty = 'empty'.freeze
7
+ Attach = 'attach'.freeze
8
+ end
9
+ end
10
+ end
11
+ end
@@ -53,10 +53,12 @@ module Fog
53
53
  hash['custom_data'] = vm.os_profile.custom_data
54
54
  hash['data_disks'] = []
55
55
 
56
- vm.storage_profile.data_disks.each do |disk|
57
- data_disk = Fog::Storage::AzureRM::DataDisk.new
58
- hash['data_disks'] << data_disk.merge_attributes(Fog::Storage::AzureRM::DataDisk.parse(disk))
59
- end unless vm.storage_profile.data_disks.nil?
56
+ unless vm.storage_profile.data_disks.nil?
57
+ vm.storage_profile.data_disks.each do |disk|
58
+ data_disk = Fog::Storage::AzureRM::DataDisk.new
59
+ hash['data_disks'] << data_disk.merge_attributes(Fog::Storage::AzureRM::DataDisk.parse(disk))
60
+ end
61
+ end
60
62
 
61
63
  hash['disable_password_authentication'] = false
62
64
  hash['disable_password_authentication'] = vm.os_profile.linux_configuration.disable_password_authentication unless vm.os_profile.linux_configuration.nil?
@@ -72,9 +74,15 @@ module Fog
72
74
 
73
75
  def save
74
76
  requires :name, :location, :resource_group, :vm_size, :storage_account_name,
75
- :username, :password, :network_interface_card_id
76
- requires :disable_password_authentication if platform.casecmp('linux').zero?
77
+ :username, :network_interface_card_id
77
78
  requires :publisher, :offer, :sku, :version if vhd_path.nil?
79
+
80
+ if platform_is_linux?(platform)
81
+ requires :disable_password_authentication
82
+ else
83
+ requires :password
84
+ end
85
+
78
86
  ssh_key_path = "/home/#{username}/.ssh/authorized_keys" unless ssh_key_data.nil?
79
87
  vm = service.create_virtual_machine(virtual_machine_params(ssh_key_path))
80
88
  merge_attributes(Server.parse(vm))
@@ -128,6 +136,10 @@ module Fog
128
136
 
129
137
  private
130
138
 
139
+ def platform_is_linux?(platform)
140
+ platform.strip.casecmp(PLATFORM_LINUX).zero?
141
+ end
142
+
131
143
  def virtual_machine_params(ssh_key_path)
132
144
  {
133
145
  resource_group: resource_group,
@@ -0,0 +1,10 @@
1
+ module Fog
2
+ module Network
3
+ class AzureRM
4
+ module IPAllocationMethod
5
+ Static = 'Static'.freeze
6
+ Dynamic = 'Dynamic'.freeze
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Fog
2
+ module Network
3
+ class AzureRM
4
+ module SecurityRuleAccess
5
+ Allow = 'Allow'.freeze
6
+ Deny = 'Deny'.freeze
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Fog
2
+ module Network
3
+ class AzureRM
4
+ module SecurityRuleDirection
5
+ Inbound = 'Inbound'.freeze
6
+ Outbound = 'Outbound'.freeze
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ module Fog
2
+ module Network
3
+ class AzureRM
4
+ module SecurityRuleProtocol
5
+ Tcp = 'Tcp'.freeze
6
+ Udp = 'Udp'.freeze
7
+ Asterisk = '*'.freeze
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module Fog
2
+ module Storage
3
+ class AzureRM
4
+ module Kind
5
+ Storage = 'Storage'.freeze
6
+ BlobStorage = 'BlobStorage'.freeze
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ module Fog
2
+ module Storage
3
+ class AzureRM
4
+ module SkuName
5
+ StandardLRS = 'Standard_LRS'.freeze
6
+ StandardGRS = 'Standard_GRS'.freeze
7
+ StandardRAGRS = 'Standard_RAGRS'.freeze
8
+ StandardZRS = 'Standard_ZRS'.freeze
9
+ PremiumLRS = 'Premium_LRS'.freeze
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ module Fog
2
+ module Storage
3
+ class AzureRM
4
+ module SkuTier
5
+ Standard = 'Standard'.freeze
6
+ Premium = 'Premium'.freeze
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module AzureRM
3
- VERSION = '0.2.2'.freeze
3
+ VERSION = '0.2.3'.freeze
4
4
  end
5
5
  end
@@ -64,14 +64,14 @@ begin
64
64
  name: 'mypubip',
65
65
  resource_group: 'TestRG-GC',
66
66
  location: LOCATION,
67
- public_ip_allocation_method: 'Dynamic'
67
+ public_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic
68
68
  )
69
69
 
70
70
  network.public_ips.create(
71
71
  name: 'mypubip2',
72
72
  resource_group: 'TestRG-GC',
73
73
  location: LOCATION,
74
- public_ip_allocation_method: 'Dynamic'
74
+ public_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic
75
75
  )
76
76
 
77
77
  network.local_network_gateways.create(
@@ -68,7 +68,7 @@ begin
68
68
  name: public_ip_name,
69
69
  resource_group: resource_group_name,
70
70
  location: LOCATION,
71
- public_ip_allocation_method: 'Dynamic'
71
+ public_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic
72
72
  )
73
73
 
74
74
  ########################################################################################################################
@@ -98,7 +98,7 @@ begin
98
98
  frontend_ip_configurations: [
99
99
  {
100
100
  name: 'frontendIpConfig',
101
- private_ip_allocation_method: 'Dynamic',
101
+ private_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic,
102
102
  public_ip_address_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourcegroups/#{resource_group_name}/providers/Microsoft.Network/publicIPAddresses/#{public_ip_name}",
103
103
  private_ip_address: '10.0.1.5'
104
104
  }
@@ -224,7 +224,7 @@ begin
224
224
  end
225
225
 
226
226
  ########################################################################################################################
227
- ###################### Downlaod a small blob ######################
227
+ ###################### Download a small blob ######################
228
228
  ########################################################################################################################
229
229
 
230
230
  begin
@@ -239,7 +239,7 @@ begin
239
239
  end
240
240
 
241
241
  ########################################################################################################################
242
- ###################### Downlaod a large blob ######################
242
+ ###################### Download a large blob ######################
243
243
  ########################################################################################################################
244
244
 
245
245
  begin
@@ -51,7 +51,7 @@ begin
51
51
  name: 'mypubip',
52
52
  resource_group: 'TestRG-LB',
53
53
  location: LOCATION,
54
- public_ip_allocation_method: 'Dynamic'
54
+ public_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic
55
55
  )
56
56
 
57
57
  ########################################################################################################################
@@ -73,7 +73,7 @@ begin
73
73
  [
74
74
  {
75
75
  name: 'fic',
76
- private_ipallocation_method: 'Dynamic',
76
+ private_ipallocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic,
77
77
  public_ipaddress_id: pip.id
78
78
  }
79
79
  ],
@@ -59,7 +59,7 @@ begin
59
59
  [
60
60
  {
61
61
  name: 'LB-Frontend',
62
- private_ipallocation_method: 'Static',
62
+ private_ipallocation_method: Fog::Network::AzureRM::IPAllocationMethod::Static,
63
63
  private_ipaddress: '10.1.2.5',
64
64
  subnet_id: subnet.id
65
65
  }
@@ -49,14 +49,14 @@ begin
49
49
  location: LOCATION,
50
50
  security_rules: [{
51
51
  name: 'testRule',
52
- protocol: 'tcp',
52
+ protocol: Fog::Network::AzureRM::SecurityRuleProtocol::Tcp,
53
53
  source_port_range: '22',
54
54
  destination_port_range: '22',
55
55
  source_address_prefix: '0.0.0.0/0',
56
56
  destination_address_prefix: '0.0.0.0/0',
57
- access: 'Allow',
57
+ access: Fog::Network::AzureRM::SecurityRuleAccess::Allow,
58
58
  priority: '100',
59
- direction: 'Inbound'
59
+ direction: Fog::Network::AzureRM::SecurityRuleDirection::Inbound
60
60
  }]
61
61
  )
62
62
  puts "Created network security group: #{network_security_group.name}"
@@ -72,14 +72,14 @@ begin
72
72
  [
73
73
  {
74
74
  name: 'testRule',
75
- protocol: 'tcp',
75
+ protocol: Fog::Network::AzureRM::SecurityRuleProtocol::Tcp,
76
76
  source_port_range: '*',
77
77
  destination_port_range: '22',
78
78
  source_address_prefix: '0.0.0.0/0',
79
79
  destination_address_prefix: '0.0.0.0/0',
80
- access: 'Allow',
80
+ access: Fog::Network::AzureRM::SecurityRuleAccess::Allow,
81
81
  priority: '100',
82
- direction: 'Inbound'
82
+ direction: Fog::Network::AzureRM::SecurityRuleDirection::Inbound
83
83
  }
84
84
  ]
85
85
  )
@@ -103,14 +103,14 @@ begin
103
103
  [
104
104
  {
105
105
  name: 'testRule2',
106
- protocol: 'tcp',
106
+ protocol: Fog::Network::AzureRM::SecurityRuleProtocol::Tcp,
107
107
  source_port_range: '22',
108
108
  destination_port_range: '22',
109
109
  source_address_prefix: '0.0.0.0/0',
110
110
  destination_address_prefix: '0.0.0.0/0',
111
- access: 'Allow',
111
+ access: Fog::Network::AzureRM::SecurityRuleAccess::Allow,
112
112
  priority: '102',
113
- direction: 'Inbound'
113
+ direction: Fog::Network::AzureRM::SecurityRuleDirection::Inbound
114
114
  }
115
115
  ]
116
116
  )
@@ -56,15 +56,15 @@ begin
56
56
  network_security_rule = network.network_security_rules.create(
57
57
  name: 'testRule',
58
58
  resource_group: 'TestRG-NSR',
59
- protocol: 'tcp',
59
+ protocol: Fog::Network::AzureRM::SecurityRuleProtocol::Tcp,
60
60
  network_security_group_name: 'testGroup',
61
61
  source_port_range: '22',
62
62
  destination_port_range: '22',
63
63
  source_address_prefix: '0.0.0.0/0',
64
64
  destination_address_prefix: '0.0.0.0/0',
65
- access: 'Allow',
65
+ access: Fog::Network::AzureRM::SecurityRuleAccess::Allow,
66
66
  priority: '100',
67
- direction: 'Inbound'
67
+ direction: Fog::Network::AzureRM::SecurityRuleDirection::Inbound
68
68
  )
69
69
  puts "Created network security rule: #{network_security_rule.name}"
70
70
 
@@ -47,7 +47,7 @@ begin
47
47
  name: 'mypubip',
48
48
  resource_group: 'TestRG-PB',
49
49
  location: LOCATION,
50
- public_ip_allocation_method: 'Static'
50
+ public_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic
51
51
  )
52
52
  puts "Created public ip: #{public_ip.name}"
53
53
 
@@ -57,7 +57,11 @@ begin
57
57
 
58
58
  pubip = network.public_ips.get('TestRG-PB', 'mypubip')
59
59
  puts "Get public ip: #{pubip.name}"
60
- pubip.update(public_ip_allocation_method: 'Dynamic', idle_timeout_in_minutes: '10', domain_name_label: 'newdomainlabel')
60
+ pubip.update(
61
+ public_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic,
62
+ idle_timeout_in_minutes: '10',
63
+ domain_name_label: 'newdomainlabel'
64
+ )
61
65
  puts 'Updated public ip'
62
66
 
63
67
  ########################################################################################################################
@@ -36,7 +36,7 @@ begin
36
36
  name: 'mypubip',
37
37
  resource_group: 'TestRG-RT',
38
38
  location: LOCATION,
39
- public_ip_allocation_method: 'Static'
39
+ public_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Static
40
40
  ).id
41
41
 
42
42
  ########################################################################################################################
@@ -76,7 +76,7 @@ begin
76
76
  location: LOCATION,
77
77
  subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-VM/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/mysubnet",
78
78
  ip_configuration_name: 'testIpConfiguration',
79
- private_ip_allocation_method: 'Dynamic'
79
+ private_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic
80
80
  )
81
81
 
82
82
  ########################################################################################################################
@@ -106,7 +106,7 @@ begin
106
106
  version: 'latest',
107
107
  platform: 'linux',
108
108
  custom_data: 'echo customData',
109
- os_disk_caching: 'None'
109
+ os_disk_caching: Fog::Compute::AzureRM::CachingTypes::None
110
110
  )
111
111
  puts "Created virtual machine: #{virtual_machine.name}"
112
112
 
@@ -76,7 +76,7 @@ begin
76
76
  location: LOCATION,
77
77
  subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-CustomVM/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/mysubnet",
78
78
  ip_configuration_name: 'testIpConfiguration',
79
- private_ip_allocation_method: 'Dynamic'
79
+ private_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic
80
80
  )
81
81
 
82
82
  ########################################################################################################################
@@ -70,7 +70,7 @@ begin
70
70
  name: grs_storage_account,
71
71
  location: LOCATION,
72
72
  resource_group: 'TestRG-SA',
73
- sku_name: 'Standard',
73
+ sku_name: Fog::Storage::AzureRM::SkuTier::Standard,
74
74
  replication: 'GRS',
75
75
  encryption: true
76
76
  )
@@ -86,7 +86,7 @@ begin
86
86
  name: premium_storage_acc,
87
87
  location: LOCATION,
88
88
  resource_group: 'TestRG-SA',
89
- sku_name: 'Premium',
89
+ sku_name: Fog::Storage::AzureRM::SkuTier::Premium,
90
90
  replication: 'LRS'
91
91
  )
92
92
  puts "Created storage account for premium lrs replication: #{storage_account.name}"
@@ -75,7 +75,7 @@ begin
75
75
  location: LOCATION,
76
76
  subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-VME/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/mysubnet",
77
77
  ip_configuration_name: 'testIpConfiguration',
78
- private_ip_allocation_method: 'Dynamic'
78
+ private_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic
79
79
  )
80
80
 
81
81
  compute.servers.create(
@@ -50,7 +50,7 @@ begin
50
50
  name: 'mypubip',
51
51
  resource_group: 'TestRG-VNG',
52
52
  location: LOCATION,
53
- public_ip_allocation_method: 'Dynamic'
53
+ public_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic
54
54
  )
55
55
 
56
56
  ########################################################################################################################
@@ -50,7 +50,7 @@ begin
50
50
  name: 'mypubip',
51
51
  resource_group: 'TestRG-GCE',
52
52
  location: LOCATION,
53
- public_ip_allocation_method: 'Dynamic'
53
+ public_ip_allocation_method: Fog::Network::AzureRM::IPAllocationMethod::Dynamic
54
54
  )
55
55
 
56
56
  network.virtual_network_gateways.create(
@@ -15,16 +15,24 @@ class TestCheckVirtualNetworkExists < Minitest::Test
15
15
  end
16
16
 
17
17
  def test_check_virtual_network_exists_failure
18
- response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
19
- @virtual_networks.stub :get, response do
20
- assert !@service.check_virtual_network_exists('fog-test-rg', 'fog-test-virtual-network')
18
+ faraday_response = Faraday::Response.new(nil)
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, faraday_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) }
20
+
21
+ faraday_response.stub :status, '404' do
22
+ @virtual_networks.stub :get, response do
23
+ assert !@service.check_virtual_network_exists('fog-test-rg', 'fog-test-virtual-network')
24
+ end
21
25
  end
22
26
  end
23
27
 
24
28
  def test_check_virtual_network_exists_exception
25
- response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
26
- @virtual_networks.stub :get, response do
27
- assert_raises(RuntimeError) { @service.check_virtual_network_exists('fog-test-rg', 'fog-test-virtual-network') }
29
+ faraday_response = Faraday::Response.new(nil)
30
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, faraday_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
31
+
32
+ faraday_response.stub :status, '400' do
33
+ @virtual_networks.stub :get, response do
34
+ assert_raises(RuntimeError) { @service.check_virtual_network_exists('fog-test-rg', 'fog-test-virtual-network') }
35
+ end
28
36
  end
29
37
  end
30
38
  end
@@ -11,14 +11,14 @@ class TestCreateNetworkInterface < Minitest::Test
11
11
  def test_create_network_interface_success
12
12
  mocked_response = ApiStub::Requests::Network::NetworkInterface.create_network_interface_response(@network_client)
13
13
  @network_interfaces.stub :create_or_update, mocked_response do
14
- assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8'), mocked_response
14
+ assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2']), mocked_response
15
15
  end
16
16
  end
17
17
 
18
18
  def test_create_network_interface_without_public_ip_success
19
19
  mocked_response = ApiStub::Requests::Network::NetworkInterface.create_network_interface_response(@network_client)
20
20
  @network_interfaces.stub :create_or_update, mocked_response do
21
- assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', nil, 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8'), mocked_response
21
+ assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', nil, 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2']), mocked_response
22
22
  end
23
23
  end
24
24
 
@@ -26,7 +26,7 @@ class TestCreateNetworkInterface < Minitest::Test
26
26
  response = ApiStub::Requests::Network::NetworkInterface.create_network_interface_response(@network_client)
27
27
  @network_interfaces.stub :create_or_update, response do
28
28
  assert_raises ArgumentError do
29
- @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration')
29
+ @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration', ['id-1', 'id-2'], ['id-1', 'id-2'])
30
30
  end
31
31
  end
32
32
  end
@@ -35,7 +35,7 @@ class TestCreateNetworkInterface < Minitest::Test
35
35
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
36
36
  @network_interfaces.stub :create_or_update, response do
37
37
  assert_raises RuntimeError do
38
- @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8')
38
+ @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2'])
39
39
  end
40
40
  end
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-azure-rm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaffan Chaudhry
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2017-01-18 00:00:00.000000000 Z
17
+ date: 2017-01-20 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rake
@@ -321,6 +321,8 @@ files:
321
321
  - lib/fog/azurerm/models/application_gateway/url_path_map.rb
322
322
  - lib/fog/azurerm/models/compute/availability_set.rb
323
323
  - lib/fog/azurerm/models/compute/availability_sets.rb
324
+ - lib/fog/azurerm/models/compute/caching_types.rb
325
+ - lib/fog/azurerm/models/compute/disk_create_option_types.rb
324
326
  - lib/fog/azurerm/models/compute/server.rb
325
327
  - lib/fog/azurerm/models/compute/servers.rb
326
328
  - lib/fog/azurerm/models/compute/virtual_machine_extension.rb
@@ -343,6 +345,7 @@ files:
343
345
  - lib/fog/azurerm/models/network/frontend_ip_configuration.rb
344
346
  - lib/fog/azurerm/models/network/inbound_nat_pool.rb
345
347
  - lib/fog/azurerm/models/network/inbound_nat_rule.rb
348
+ - lib/fog/azurerm/models/network/ipallocation_method.rb
346
349
  - lib/fog/azurerm/models/network/load_balancer.rb
347
350
  - lib/fog/azurerm/models/network/load_balancers.rb
348
351
  - lib/fog/azurerm/models/network/load_balancing_rule.rb
@@ -358,6 +361,9 @@ files:
358
361
  - lib/fog/azurerm/models/network/probe.rb
359
362
  - lib/fog/azurerm/models/network/public_ip.rb
360
363
  - lib/fog/azurerm/models/network/public_ips.rb
364
+ - lib/fog/azurerm/models/network/security_rule_access.rb
365
+ - lib/fog/azurerm/models/network/security_rule_direction.rb
366
+ - lib/fog/azurerm/models/network/security_rule_protocol.rb
361
367
  - lib/fog/azurerm/models/network/subnet.rb
362
368
  - lib/fog/azurerm/models/network/subnets.rb
363
369
  - lib/fog/azurerm/models/network/virtual_network.rb
@@ -389,8 +395,11 @@ files:
389
395
  - lib/fog/azurerm/models/storage/directory.rb
390
396
  - lib/fog/azurerm/models/storage/file.rb
391
397
  - lib/fog/azurerm/models/storage/files.rb
398
+ - lib/fog/azurerm/models/storage/kind.rb
392
399
  - lib/fog/azurerm/models/storage/recovery_vault.rb
393
400
  - lib/fog/azurerm/models/storage/recovery_vaults.rb
401
+ - lib/fog/azurerm/models/storage/sku_name.rb
402
+ - lib/fog/azurerm/models/storage/sku_tier.rb
394
403
  - lib/fog/azurerm/models/storage/storage_account.rb
395
404
  - lib/fog/azurerm/models/storage/storage_accounts.rb
396
405
  - lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb