azure 0.6.4 → 0.7.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/.env_sample +11 -0
  3. data/.gitignore +4 -1
  4. data/.travis.yml +3 -1
  5. data/ChangeLog.txt +17 -1
  6. data/LICENSE.txt +202 -0
  7. data/README.md +58 -20
  8. data/Rakefile +27 -35
  9. data/azure.gemspec +17 -13
  10. data/bin/pfxer +35 -0
  11. data/lib/azure.rb +8 -0
  12. data/lib/azure/base_management/base_management_service.rb +24 -26
  13. data/lib/azure/base_management/management_http_request.rb +17 -14
  14. data/lib/azure/base_management/serialization.rb +1 -0
  15. data/lib/azure/blob/auth/shared_access_signature.rb +141 -0
  16. data/lib/azure/blob/blob_service.rb +221 -217
  17. data/lib/azure/cloud_service_management/cloud_service_management_service.rb +27 -30
  18. data/lib/azure/cloud_service_management/serialization.rb +1 -0
  19. data/lib/azure/core.rb +17 -15
  20. data/lib/azure/core/configuration.rb +7 -0
  21. data/lib/azure/core/http/http_error.rb +1 -1
  22. data/lib/azure/core/http/http_request.rb +4 -1
  23. data/lib/azure/core/utility.rb +16 -1
  24. data/lib/azure/queue/queue_service.rb +13 -13
  25. data/lib/azure/service/cors.rb +11 -0
  26. data/lib/azure/service/cors_rule.rb +15 -0
  27. data/lib/azure/service/serialization.rb +69 -10
  28. data/lib/azure/service/storage_service.rb +10 -6
  29. data/lib/azure/service/storage_service_properties.rb +8 -3
  30. data/lib/azure/service_bus/brokered_message.rb +1 -1
  31. data/lib/azure/service_bus/relay.rb +88 -0
  32. data/lib/azure/service_bus/serialization.rb +1 -0
  33. data/lib/azure/service_bus/service_bus_service.rb +70 -4
  34. data/lib/azure/sql_database_management/serialization.rb +1 -0
  35. data/lib/azure/sql_database_management/sql_database_management_service.rb +22 -22
  36. data/lib/azure/storage_management/serialization.rb +34 -14
  37. data/lib/azure/storage_management/storage_account.rb +9 -1
  38. data/lib/azure/storage_management/storage_management_service.rb +74 -32
  39. data/lib/azure/table/batch.rb +6 -6
  40. data/lib/azure/table/table_service.rb +13 -13
  41. data/lib/azure/version.rb +3 -3
  42. data/lib/azure/virtual_machine_image_management/serialization.rb +19 -0
  43. data/lib/azure/virtual_machine_image_management/virtual_machine_image.rb +1 -1
  44. data/lib/azure/virtual_machine_image_management/virtual_machine_image_management_service.rb +30 -7
  45. data/lib/azure/virtual_machine_management/serialization.rb +32 -12
  46. data/lib/azure/virtual_machine_management/virtual_machine.rb +1 -0
  47. data/lib/azure/virtual_machine_management/virtual_machine_management_service.rb +92 -81
  48. data/lib/azure/virtual_network_management/serialization.rb +12 -5
  49. data/lib/azure/virtual_network_management/virtual_network.rb +1 -0
  50. data/lib/azure/virtual_network_management/virtual_network_management_service.rb +11 -11
  51. data/test/fixtures/get_storage_account_properties.xml +6 -4
  52. data/test/fixtures/{list_images.xml → list_os_images.xml} +1 -1
  53. data/test/fixtures/list_storage_accounts.xml +2 -0
  54. data/test/fixtures/list_vm_images.xml +21 -0
  55. data/test/fixtures/metrics.xml +2 -2
  56. data/test/fixtures/sb_default_create_relay_response.xml +15 -0
  57. data/test/fixtures/storage_service_keys.xml +8 -0
  58. data/test/fixtures/storage_service_properties.xml +35 -3
  59. data/test/fixtures/updated_storage_accounts.xml +2 -0
  60. data/test/fixtures/virtual_machine.xml +3 -1
  61. data/test/integration/affinity_group/Affinity_test.rb +1 -1
  62. data/test/integration/affinity_group/Create_Affinity_test.rb +8 -7
  63. data/test/integration/affinity_group/Delete_Affinity_test.rb +3 -3
  64. data/test/integration/affinity_group/List_Affinity_test.rb +1 -1
  65. data/test/integration/affinity_group/Update_Affinity_test.rb +9 -8
  66. data/test/integration/cloud_service/Cloud_Create_test.rb +3 -2
  67. data/test/integration/cloud_service/Cloud_Delete_test.rb +5 -4
  68. data/test/integration/database/create_sql_server_firewall_test.rb +1 -1
  69. data/test/integration/database/create_sql_server_test.rb +1 -1
  70. data/test/integration/database/delete_sql_server_firewall_test.rb +1 -1
  71. data/test/integration/database/delete_sql_server_test.rb +1 -1
  72. data/test/integration/database/list_sql_server_firewall_test.rb +1 -1
  73. data/test/integration/database/list_sql_servers_test.rb +1 -1
  74. data/test/integration/database/reset_password_sql_server_test.rb +1 -1
  75. data/test/integration/service_bus/queues_test.rb +22 -22
  76. data/test/integration/service_bus/relay_test.rb +132 -0
  77. data/test/integration/storage_management/storage_management_test.rb +58 -33
  78. data/test/integration/test_helper.rb +11 -15
  79. data/test/integration/vm/VM_Create_test.rb +17 -18
  80. data/test/integration/vm/VM_Delete_test.rb +2 -4
  81. data/test/integration/vm/VM_Operations_test.rb +1 -2
  82. data/test/integration/vnet/Virtual_Network_Create_test.rb +9 -15
  83. data/test/integration/vnet/Virtual_Network_list_test.rb +4 -9
  84. data/test/support/name_generator.rb +8 -0
  85. data/test/support/virtual_network_helper.rb +2 -2
  86. data/test/test_helper.rb +13 -24
  87. data/test/unit/affinity_group/affinity_group_test.rb +10 -13
  88. data/test/unit/affinity_group/serialization_test.rb +7 -8
  89. data/test/unit/base_management/location_test.rb +1 -2
  90. data/test/unit/blob/auth/shared_access_signature_test.rb +71 -0
  91. data/test/unit/blob/blob_service_test.rb +393 -371
  92. data/test/unit/cloud_service_management/cloud_service_management_service_test.rb +16 -16
  93. data/test/unit/core/auth/shared_key_lite_test.rb +4 -4
  94. data/test/unit/core/auth/shared_key_test.rb +2 -2
  95. data/test/unit/core/http/http_error_test.rb +10 -5
  96. data/test/unit/core/http/http_request_test.rb +72 -25
  97. data/test/unit/database/serialization_test.rb +7 -7
  98. data/test/unit/database/sql_database_server_service_test.rb +43 -47
  99. data/test/unit/service/serialization_test.rb +40 -9
  100. data/test/unit/service/storage_service_test.rb +13 -11
  101. data/test/unit/storage_management/serialization_test.rb +26 -14
  102. data/test/unit/storage_management/storage_management_service_test.rb +48 -62
  103. data/test/unit/virtual_machine_image_management/serialization_test.rb +20 -5
  104. data/test/unit/virtual_machine_image_management/virtual_machine_image_management_service_test.rb +78 -29
  105. data/test/unit/virtual_machine_management/serialization_test.rb +112 -43
  106. data/test/unit/virtual_machine_management/virtual_machine_management_service_test.rb +123 -100
  107. data/test/unit/vnet/serialization_test.rb +7 -7
  108. data/test/unit/vnet/virtual_network_management_service_test.rb +1 -1
  109. metadata +70 -16
  110. data/test/fixtures/certificate.pem +0 -21
@@ -17,6 +17,7 @@ require 'azure/virtual_network_management/virtual_network'
17
17
  module Azure
18
18
  module VirtualNetworkManagement
19
19
  module Serialization
20
+ extend Azure::Core::Utility
20
21
  def self.virtual_network_from_xml(network_xml)
21
22
  virtual_networks = []
22
23
  virtual_network_services_xml = network_xml.css(
@@ -37,6 +38,10 @@ module Azure
37
38
  virtual_network_service_xml,
38
39
  'AffinityGroup'
39
40
  )
41
+ virtual_network.location = xml_content(
42
+ virtual_network_service_xml,
43
+ 'Location'
44
+ )
40
45
  virtual_network.state = xml_content(
41
46
  virtual_network_service_xml,
42
47
  'State'
@@ -70,7 +75,7 @@ module Azure
70
75
  end
71
76
 
72
77
  def self.virtual_network_to_xml(vnet_name,
73
- affinity_group,
78
+ location,
74
79
  address_spaces,
75
80
  options = {})
76
81
  options[:dns] ||= {}
@@ -104,6 +109,7 @@ module Azure
104
109
  }
105
110
  virtual_network_site(xml,
106
111
  vnet.name,
112
+ vnet.location,
107
113
  vnet.affinity_group,
108
114
  vnet.address_space,
109
115
  others)
@@ -111,7 +117,8 @@ module Azure
111
117
  end
112
118
  virtual_network_site(xml,
113
119
  vnet_name,
114
- affinity_group,
120
+ location,
121
+ nil,
115
122
  address_spaces,
116
123
  options)
117
124
  end
@@ -125,12 +132,14 @@ module Azure
125
132
 
126
133
  def self.virtual_network_site(xml,
127
134
  vnet_name,
135
+ location,
128
136
  affinity_group,
129
137
  address_spaces,
130
138
  options)
131
139
  xml.VirtualNetworkSite(
132
140
  'name' => vnet_name,
133
- 'AffinityGroup' => affinity_group
141
+ 'AffinityGroup' => affinity_group,
142
+ 'Location' => location
134
143
  ) do
135
144
  xml.DnsServersRef do
136
145
  options[:dns].each do |dns|
@@ -159,8 +168,6 @@ module Azure
159
168
  end
160
169
 
161
170
  def self.dns_server_to_xml(xml, dns_servers, new_dns_servers)
162
- dns_names = []
163
-
164
171
  dns_list = {}
165
172
  dns_list.merge!(merge_dns(new_dns_servers))
166
173
  dns_list.merge!(merge_dns(dns_servers))
@@ -31,6 +31,7 @@ module Azure
31
31
  attr_accessor :subnets
32
32
  attr_accessor :dns_servers
33
33
  attr_accessor :affinity_group
34
+ attr_accessor :location
34
35
  end
35
36
  end
36
37
  end
@@ -17,7 +17,7 @@ require 'azure/virtual_network_management/serialization'
17
17
  module Azure
18
18
  module VirtualNetworkManagement
19
19
  # VirtualNetworkManagementService
20
- class VirtualNetworkManagementService < BaseManagementService
20
+ class VirtualNetworkManagementService < BaseManagement::BaseManagementService
21
21
  def initialize
22
22
  super()
23
23
  end
@@ -25,13 +25,13 @@ module Azure
25
25
  # Public: Gets a list of virtual network services available under the
26
26
  # current subscription.
27
27
  #
28
- # See http://msdn.microsoft.com/en-us/library/windowsazure/jj157185.aspx
28
+ # See http://msdn.microsoft.com/en-us/library/azure/jj157185.aspx
29
29
  #
30
30
  # Returns an array of
31
31
  # Azure::VirtualNetworkServiceManagement::VirtualNetwork objects
32
32
  def list_virtual_networks
33
33
  request_path = '/services/networking/virtualnetwork'
34
- request = ManagementHttpRequest.new(:get, request_path, nil)
34
+ request = BaseManagement::ManagementHttpRequest.new(:get, request_path, nil)
35
35
  response = request.call
36
36
  Serialization.virtual_network_from_xml(response)
37
37
  end
@@ -54,7 +54,7 @@ module Azure
54
54
  # ==== Attributes
55
55
  #
56
56
  # * +vnet+ - String. The name of the virtual network.
57
- # * +affinity_group+ - String. The name of the affinity group.
57
+ # * +location+ - String. The location where the virtual network will be created.
58
58
  # * +address_space+ - Array. Contains a collection of Classless
59
59
  # Inter-Domain Routing (CIDR) identifiers that specify the address
60
60
  # space that you will use for your local network site
@@ -69,11 +69,11 @@ module Azure
69
69
  # * +dns_servers+ - Array. A hash of the name/value pairs.
70
70
  # Contains the name and IPv4 address of the DNS server. (optional)
71
71
  #
72
- # See http://msdn.microsoft.com/en-us/library/windowsazure/jj157181.aspx
72
+ # See http://msdn.microsoft.com/en-us/library/azure/jj157181.aspx
73
73
  #
74
74
  # Returns None
75
75
  def set_virtual_network(vnet,
76
- affinity_group,
76
+ location,
77
77
  address_space,
78
78
  options = {
79
79
  subnet: [],
@@ -81,12 +81,12 @@ module Azure
81
81
  })
82
82
  request_path = '/services/networking/media'
83
83
  body = Serialization.virtual_network_to_xml(vnet,
84
- affinity_group,
84
+ location,
85
85
  address_space,
86
86
  options)
87
- request = ManagementHttpRequest.new(:put, request_path, body)
87
+ request = BaseManagement::ManagementHttpRequest.new(:put, request_path, body)
88
88
  request.headers['Content-Type'] = 'text/plain'
89
- Loggerx.info "Creating virtual network #{vnet}."
89
+ Azure::Loggerx.info "Creating virtual network #{vnet}."
90
90
  request.call
91
91
  end
92
92
 
@@ -99,9 +99,9 @@ module Azure
99
99
  else
100
100
  body = File.read(file)
101
101
  end
102
- request = ManagementHttpRequest.new(:put, request_path, body)
102
+ request = BaseManagement::ManagementHttpRequest.new(:put, request_path, body)
103
103
  request.headers['Content-Type'] = 'text/plain'
104
- Loggerx.info 'Creating virtual network.'
104
+ Azure::Loggerx.info 'Creating virtual network.'
105
105
  request.call
106
106
  end
107
107
  end
@@ -14,11 +14,13 @@
14
14
  <Endpoint>http://storageacc.queue.core.windows.net/</Endpoint>
15
15
  <Endpoint>http://storageacc.table.core.windows.net/</Endpoint>
16
16
  </Endpoints>
17
- <GeoReplicationEnabled>false</GeoReplicationEnabled>
18
- <GeoPrimaryRegion>East US</GeoPrimaryRegion>
19
- <GeoSecondaryRegion/>
20
- <CreationTime>2013-12-03T19:39:33Z</CreationTime>
17
+ <GeoPrimaryRegion>West US</GeoPrimaryRegion>
18
+ <StatusOfPrimary>Available</StatusOfPrimary>
19
+ <GeoSecondaryRegion>East US</GeoSecondaryRegion>
20
+ <StatusOfSecondary>Available</StatusOfSecondary>
21
+ <CreationTime>2013-03-06T09:34:37Z</CreationTime>
21
22
  <CustomDomains/>
23
+ <AccountType>Standard_GRS</AccountType>
22
24
  </StorageServiceProperties>
23
25
  <ExtendedProperties>
24
26
  <ExtendedProperty>
@@ -59,7 +59,7 @@
59
59
  <Name>b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_2-LTS-amd64-server-20130325-en-us-30GB</Name>
60
60
  <OS>Linux</OS>
61
61
  <Eula>http://www.ubuntu.com/project/about-ubuntu/licensing;http://www.ubuntu.com/aboutus/privacypolicy;http://www.ubuntu.com/aboutus/privacypolicy</Eula>
62
- <Description>Ubuntu Server 12.04.2 LTS (amd64 20130325) for Windows Azure. Ubuntu Server is the world's most popular Linux for cloud environments. Updates and patches for Ubuntu 12.04.2 LTS will be available until 2017-04-26. Ubuntu Server is the perfect platform for all workloads from web applications to NoSQL databases and Hadoop. More information can be found at:
62
+ <Description>Ubuntu Server 12.04.2 LTS (amd64 20130325) for Microsoft Azure. Ubuntu Server is the world's most popular Linux for cloud environments. Updates and patches for Ubuntu 12.04.2 LTS will be available until 2017-04-26. Ubuntu Server is the perfect platform for all workloads from web applications to NoSQL databases and Hadoop. More information can be found at:
63
63
  http://www.ubuntu.com/business/server</Description>
64
64
  </OSImage>
65
65
  <OSImage>
@@ -19,6 +19,7 @@
19
19
  <StatusOfPrimary/>
20
20
  <GeoSecondaryRegion>East US</GeoSecondaryRegion>
21
21
  <StatusOfSecondary/>
22
+ <AccountType>Standard_GRS</AccountType>
22
23
  </StorageServiceProperties>
23
24
  <ExtendedProperties/>
24
25
  </StorageService>
@@ -40,6 +41,7 @@
40
41
  <StatusOfPrimary/>
41
42
  <GeoSecondaryRegion>East US</GeoSecondaryRegion>
42
43
  <StatusOfSecondary/>
44
+ <AccountType>Standard_GRS</AccountType>
43
45
  </StorageServiceProperties>
44
46
  <ExtendedProperties/>
45
47
  </StorageService>
@@ -0,0 +1,21 @@
1
+ <VMImages>
2
+ <VMImage>
3
+ <Name>Ansible-20140729-87566</Name>
4
+ <Label>Ansible image</Label>
5
+ <Category>User</Category>
6
+ <OSDiskConfiguration>
7
+ <Name>Ansible-20140729-87566-os-2014-07-29</Name>
8
+ <HostCaching>ReadWrite</HostCaching>
9
+ <OSState>Specialized</OSState>
10
+ <OS>Linux</OS>
11
+ <MediaLink>http://mystorage.blob.core.windows.net/vhds/Ansible-20140729-87566-os-2014-07-29.vhd</MediaLink>
12
+ <LogicalDiskSizeInGB>30</LogicalDiskSizeInGB>
13
+ </OSDiskConfiguration>
14
+ <DataDiskConfigurations />
15
+ <ServiceName>ansibles</ServiceName>
16
+ <DeploymentName>Ansible</DeploymentName>
17
+ <RoleName>Ansible</RoleName>
18
+ <Location>West US</Location>
19
+ <CreatedTime>2014-07-29T09:22:41.5598445Z</CreatedTime>
20
+ </VMImage>
21
+ </VMImages>
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0"?>
2
- <Metrics>
2
+ <HourMetrics>
3
3
  <Version>1.0</Version>
4
4
  <Enabled>true</Enabled>
5
5
  <IncludeAPIs>false</IncludeAPIs>
@@ -7,4 +7,4 @@
7
7
  <Enabled>true</Enabled>
8
8
  <Days>7</Days>
9
9
  </RetentionPolicy>
10
- </Metrics>
10
+ </HourMetrics>
@@ -0,0 +1,15 @@
1
+ <entry xmlns="http://www.w3.org/2005/Atom">
2
+ <id>https://gmonfort.servicebus.windows.net/gfyhfiwdqger</id>
3
+ <title type="text">gfyhfiwdqger</title>
4
+ <published>2012-06-06T05:00:06Z</published>
5
+ <updated>2012-06-06T05:00:06Z</updated>
6
+ <author><name>gmonfort</name></author>
7
+ <link rel="self" href="https://gmonfort.servicebus.windows.net/gfyhfiwdqg"/>
8
+ <content type="application/xml">
9
+ <RelayDescription xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
10
+ <RelayType>Http</RelayType>
11
+ <RequiresClientAuthorization>true</RequiresClientAuthorization>
12
+ <RequiresTransportSecurity>true</RequiresTransportSecurity>
13
+ </RelayDescription>
14
+ </content>
15
+ </entry>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <StorageService>
3
+ <Url>https://management.core.windows.net/268a3762-fce0-4cd3-a4ea-80e84bddff87/services/storageservices/mystorageaccount</Url>
4
+ <StorageServiceKeys>
5
+ <Primary>NUDgoUeopv3eacgEQYhLlPCq751UBzcfn9AR3YWHXJu4m+A==</Primary>
6
+ <Secondary>7M+cT1mt4YqJ7mQ5bK+/MZwk1tdwaKKivA0hg==</Secondary>
7
+ </StorageServiceKeys>
8
+ </StorageService>
@@ -1,5 +1,6 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <StorageServiceProperties>
3
+ <DefaultServiceVersion>2011-08-18</DefaultServiceVersion>
3
4
  <Logging>
4
5
  <Version>1.0</Version>
5
6
  <Delete>true</Delete>
@@ -10,7 +11,7 @@
10
11
  <Days>7</Days>
11
12
  </RetentionPolicy>
12
13
  </Logging>
13
- <Metrics>
14
+ <HourMetrics>
14
15
  <Version>1.0</Version>
15
16
  <Enabled>true</Enabled>
16
17
  <IncludeAPIs>false</IncludeAPIs>
@@ -18,6 +19,37 @@
18
19
  <Enabled>true</Enabled>
19
20
  <Days>7</Days>
20
21
  </RetentionPolicy>
21
- </Metrics>
22
- <DefaultServiceVersion>2011-08-18</DefaultServiceVersion>
22
+ </HourMetrics>
23
+ <MinuteMetrics>
24
+ <Version>1.0</Version>
25
+ <Enabled>true</Enabled>
26
+ <IncludeAPIs>false</IncludeAPIs>
27
+ <RetentionPolicy>
28
+ <Enabled>true</Enabled>
29
+ <Days>7</Days>
30
+ </RetentionPolicy>
31
+ </MinuteMetrics>
32
+ <Cors>
33
+ <CorsRule>
34
+ <AllowedOrigins>http://www.contoso.com,http://dummy.uri</AllowedOrigins>
35
+ <AllowedMethods>PUT,HEAD</AllowedMethods>
36
+ <MaxAgeInSeconds>5</MaxAgeInSeconds>
37
+ <ExposedHeaders>x-ms-*</ExposedHeaders>
38
+ <AllowedHeaders>x-ms-blob-content-type,x-ms-blob-content-disposition</AllowedHeaders>
39
+ </CorsRule>
40
+ <CorsRule>
41
+ <AllowedOrigins>*</AllowedOrigins>
42
+ <AllowedMethods>PUT,GET</AllowedMethods>
43
+ <MaxAgeInSeconds>5</MaxAgeInSeconds>
44
+ <ExposedHeaders>x-ms-*</ExposedHeaders>
45
+ <AllowedHeaders>x-ms-blob-content-type,x-ms-blob-content-disposition</AllowedHeaders>
46
+ </CorsRule>
47
+ <CorsRule>
48
+ <AllowedOrigins>http://www.contoso.com</AllowedOrigins>
49
+ <AllowedMethods>GET</AllowedMethods>
50
+ <MaxAgeInSeconds>5</MaxAgeInSeconds>
51
+ <ExposedHeaders>x-ms-*</ExposedHeaders>
52
+ <AllowedHeaders>x-ms-client-request-id</AllowedHeaders>
53
+ </CorsRule>
54
+ </Cors>
23
55
  </StorageServiceProperties>
@@ -18,6 +18,7 @@
18
18
  <StatusOfPrimary/>
19
19
  <GeoSecondaryRegion>East US</GeoSecondaryRegion>
20
20
  <StatusOfSecondary/>
21
+ <AccountType>Standard_GRS</AccountType>
21
22
  </StorageServiceProperties>
22
23
  <ExtendedProperties/>
23
24
  </StorageService>
@@ -38,6 +39,7 @@
38
39
  <StatusOfPrimary/>
39
40
  <GeoSecondaryRegion>East US</GeoSecondaryRegion>
40
41
  <StatusOfSecondary/>
42
+ <AccountType>Standard_GRS</AccountType>
41
43
  </StorageServiceProperties>
42
44
  <ExtendedProperties>
43
45
  <ExtendedProperty>
@@ -78,7 +78,9 @@ kZS1mYWNlNSI+DQogICAgPEluc3RhbmNlcyBjb3VudD0iMSIgLz4NCiAgPC9Sb2xlPg0KPC9TZXJ2aWN
78
78
  <Vip>137.117.17.187</Vip>
79
79
  </InputEndpoint>
80
80
  </InputEndpoints>
81
- <SubnetNames/>
81
+ <SubnetNames>
82
+ <SubnetName>test-subnet</SubnetName>
83
+ </SubnetNames>
82
84
  </ConfigurationSet>
83
85
  </ConfigurationSets>
84
86
  <AvailabilitySetName>vm-availability</AvailabilitySetName>
@@ -24,7 +24,7 @@ describe Azure::BaseManagementService do
24
24
  let(:options) { { description: 'Some Description' } }
25
25
 
26
26
  before do
27
- Loggerx.expects(:puts).returns(nil).at_least(0)
27
+ Azure::Loggerx.expects(:puts).returns(nil).at_least(0)
28
28
  end
29
29
 
30
30
  it 'get affinity group properties for an existing group' do
@@ -15,13 +15,14 @@
15
15
  require 'integration/test_helper'
16
16
 
17
17
  describe Azure::BaseManagementService do
18
+ include Azure::Core::Utility
18
19
 
19
20
  subject { Azure::BaseManagementService.new }
20
21
  let(:affinity_group_name) { random_string('affinity-group-', 10) }
21
- let(:location) { WindowsImageLocation }
22
+ let(:image_location) { WindowsImageLocation }
22
23
 
23
24
  before do
24
- Loggerx.expects(:puts).returns(nil).at_least(0)
25
+ Azure::Loggerx.expects(:puts).returns(nil).at_least(0)
25
26
  end
26
27
 
27
28
  let(:label) { 'Label Name' }
@@ -31,13 +32,13 @@ describe Azure::BaseManagementService do
31
32
 
32
33
  it 'create new affinity group with valid params' do
33
34
  subject.create_affinity_group(affinity_group_name,
34
- location,
35
+ image_location,
35
36
  label,
36
37
  options)
37
38
  affinity_group = subject.get_affinity_group(affinity_group_name)
38
39
  affinity_group.must_be_kind_of Azure::BaseManagement::AffinityGroup
39
40
  affinity_group.name.wont_be_nil
40
- affinity_group.location.must_equal location
41
+ affinity_group.location.must_equal image_location
41
42
  affinity_group.name.must_equal affinity_group_name
42
43
  affinity_group.label.must_equal label
43
44
  affinity_group.description.must_equal options[:description]
@@ -47,15 +48,15 @@ describe Azure::BaseManagementService do
47
48
  exception = assert_raises(RuntimeError) do
48
49
  subject.create_affinity_group(affinity_group_name, 'North West', label)
49
50
  end
50
- assert_match(/Allowed values are East Asia/i, exception.message)
51
+ assert_match(/Allowed values are Central US,South Central US,West US,East US,East US 2,North Europe,West Europe,Southeast Asia,East Asia,Japan West,Japan East,Brazil South/i, exception.message)
51
52
  end
52
53
 
53
54
  it 'create new affinity group without optional params' do
54
- subject.create_affinity_group(affinity_group_name, location, label)
55
+ subject.create_affinity_group(affinity_group_name, image_location, label)
55
56
  affinity_group = subject.get_affinity_group(affinity_group_name)
56
57
  affinity_group.must_be_kind_of Azure::BaseManagement::AffinityGroup
57
58
  affinity_group.name.wont_be_nil
58
- affinity_group.location.must_equal location
59
+ affinity_group.location.must_equal image_location
59
60
  affinity_group.name.must_equal affinity_group_name
60
61
  affinity_group.label.must_equal label
61
62
  end
@@ -17,18 +17,18 @@ require 'integration/test_helper'
17
17
  describe Azure::BaseManagementService do
18
18
 
19
19
  before do
20
- Loggerx.expects(:puts).returns(nil).at_least(0)
20
+ Azure::Loggerx.expects(:puts).returns(nil).at_least(0)
21
21
  end
22
22
 
23
23
  subject { Azure::BaseManagementService.new }
24
24
  let(:affinity_group_name) { AffinityGroupNameHelper.name }
25
- let(:location) { WindowsImageLocation }
25
+ let(:image_location) { WindowsImageLocation }
26
26
  let(:label) { 'Label Name' }
27
27
 
28
28
  describe '#delete_affinity_group' do
29
29
 
30
30
  it 'delete affinity group' do
31
- subject.create_affinity_group(affinity_group_name, location, label)
31
+ subject.create_affinity_group(affinity_group_name, image_location, label)
32
32
  subject.delete_affinity_group(affinity_group_name)
33
33
  affinity_list = subject.list_affinity_groups.select do |x|
34
34
  x.name == affinity_group_name
@@ -20,7 +20,7 @@ describe Azure::BaseManagementService do
20
20
  let(:affinity_group_name) { AffinityGroupNameHelper.name }
21
21
 
22
22
  before do
23
- Loggerx.expects(:puts).returns(nil).at_least(0)
23
+ Azure::Loggerx.expects(:puts).returns(nil).at_least(0)
24
24
  subject.create_affinity_group(affinity_group_name,
25
25
  WindowsImageLocation,
26
26
  'Label Name')
@@ -15,23 +15,24 @@
15
15
  require 'integration/test_helper'
16
16
 
17
17
  describe Azure::BaseManagementService do
18
- AffinityGroupName = random_string('affinity-group-', 10)
18
+ util = Class.new.extend(Azure::Core::Utility)
19
+ AffinityGroupName = util.random_string('affinity-group-', 10)
20
+
19
21
  Azure::BaseManagementService.new.create_affinity_group(
20
- AffinityGroupName,
21
- WindowsImageLocation,
22
- 'Label'
22
+ AffinityGroupName,
23
+ WindowsImageLocation,
24
+ 'Label'
23
25
  )
24
26
 
25
27
  before do
26
- Loggerx.expects(:puts).returns(nil).at_least(0)
28
+ Azure::Loggerx.expects(:puts).returns(nil).at_least(0)
27
29
  end
28
30
 
29
31
  subject { Azure::BaseManagementService.new }
30
32
  let(:affinity_group_name) { AffinityGroupName }
31
- let(:location) { 'Central US' }
32
33
 
33
34
  describe '#update_affinity_group' do
34
- let(:options) { { description: 'sample description' } }
35
+ let(:options) { {description: 'sample description'} }
35
36
 
36
37
  it 'update affinity group' do
37
38
  label = 'updated label'
@@ -61,7 +62,7 @@ describe Azure::BaseManagementService do
61
62
  end
62
63
 
63
64
  it 'error if description content exceeds allowed limit of 1024 chars' do
64
- options = { description: 'a' * 1025 }
65
+ options = {description: 'a' * 1025}
65
66
  exception = assert_raises(RuntimeError) do
66
67
  subject.update_affinity_group(affinity_group_name,
67
68
  'this is update operation',