gitlab-fog-azure-rm 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +7 -0
  2. data/.arclint +8 -0
  3. data/.codeclimate.yml +17 -0
  4. data/.gitignore +6 -0
  5. data/.gitlab-ci.yml +17 -0
  6. data/.hound.yml +2 -0
  7. data/.rubocop.yml +5 -0
  8. data/.rubocop_todo.yml +274 -0
  9. data/.travis.yml +49 -0
  10. data/CHANGELOG.md +414 -0
  11. data/CONTRIBUTING.md +40 -0
  12. data/CONTRIBUTORS.md +12 -0
  13. data/Gemfile +3 -0
  14. data/LICENSE.md +20 -0
  15. data/README.md +100 -0
  16. data/gitlab-fog-azure-rm.gemspec +31 -0
  17. data/lib/fog/azurerm.rb +30 -0
  18. data/lib/fog/azurerm/async_response.rb +44 -0
  19. data/lib/fog/azurerm/config.rb +1 -0
  20. data/lib/fog/azurerm/constants.rb +72 -0
  21. data/lib/fog/azurerm/credentials.rb +40 -0
  22. data/lib/fog/azurerm/custom_fog_errors.rb +52 -0
  23. data/lib/fog/azurerm/docs/storage.md +398 -0
  24. data/lib/fog/azurerm/docs/structure.md +53 -0
  25. data/lib/fog/azurerm/models/resources/azure_resource.rb +25 -0
  26. data/lib/fog/azurerm/models/resources/azure_resources.rb +40 -0
  27. data/lib/fog/azurerm/models/resources/dependency.rb +27 -0
  28. data/lib/fog/azurerm/models/resources/deployment.rb +65 -0
  29. data/lib/fog/azurerm/models/resources/deployments.rb +30 -0
  30. data/lib/fog/azurerm/models/resources/provider.rb +27 -0
  31. data/lib/fog/azurerm/models/resources/provider_resource_type.rb +22 -0
  32. data/lib/fog/azurerm/models/resources/resource_group.rb +34 -0
  33. data/lib/fog/azurerm/models/resources/resource_groups.rb +29 -0
  34. data/lib/fog/azurerm/models/storage/directories.rb +75 -0
  35. data/lib/fog/azurerm/models/storage/directory.rb +151 -0
  36. data/lib/fog/azurerm/models/storage/file.rb +265 -0
  37. data/lib/fog/azurerm/models/storage/files.rb +183 -0
  38. data/lib/fog/azurerm/models/storage/kind.rb +12 -0
  39. data/lib/fog/azurerm/models/storage/sku_name.rb +15 -0
  40. data/lib/fog/azurerm/models/storage/sku_tier.rb +12 -0
  41. data/lib/fog/azurerm/models/storage/storage_account.rb +92 -0
  42. data/lib/fog/azurerm/models/storage/storage_accounts.rb +47 -0
  43. data/lib/fog/azurerm/requests/storage/acquire_blob_lease.rb +32 -0
  44. data/lib/fog/azurerm/requests/storage/acquire_container_lease.rb +32 -0
  45. data/lib/fog/azurerm/requests/storage/check_container_exists.rb +30 -0
  46. data/lib/fog/azurerm/requests/storage/commit_blob_blocks.rb +30 -0
  47. data/lib/fog/azurerm/requests/storage/compare_container_blobs.rb +148 -0
  48. data/lib/fog/azurerm/requests/storage/copy_blob.rb +30 -0
  49. data/lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb +30 -0
  50. data/lib/fog/azurerm/requests/storage/copy_object.rb +20 -0
  51. data/lib/fog/azurerm/requests/storage/create_block_blob.rb +108 -0
  52. data/lib/fog/azurerm/requests/storage/create_container.rb +40 -0
  53. data/lib/fog/azurerm/requests/storage/create_disk.rb +62 -0
  54. data/lib/fog/azurerm/requests/storage/create_page_blob.rb +31 -0
  55. data/lib/fog/azurerm/requests/storage/delete_blob.rb +32 -0
  56. data/lib/fog/azurerm/requests/storage/delete_blob_https_url.rb +39 -0
  57. data/lib/fog/azurerm/requests/storage/delete_container.rb +31 -0
  58. data/lib/fog/azurerm/requests/storage/delete_disk.rb +36 -0
  59. data/lib/fog/azurerm/requests/storage/delete_object_url.rb +30 -0
  60. data/lib/fog/azurerm/requests/storage/get_blob.rb +163 -0
  61. data/lib/fog/azurerm/requests/storage/get_blob_http_url.rb +39 -0
  62. data/lib/fog/azurerm/requests/storage/get_blob_https_url.rb +39 -0
  63. data/lib/fog/azurerm/requests/storage/get_blob_properties.rb +55 -0
  64. data/lib/fog/azurerm/requests/storage/get_blob_url.rb +28 -0
  65. data/lib/fog/azurerm/requests/storage/get_container_acl.rb +30 -0
  66. data/lib/fog/azurerm/requests/storage/get_container_properties.rb +41 -0
  67. data/lib/fog/azurerm/requests/storage/get_container_url.rb +34 -0
  68. data/lib/fog/azurerm/requests/storage/get_object_url.rb +21 -0
  69. data/lib/fog/azurerm/requests/storage/list_blobs.rb +168 -0
  70. data/lib/fog/azurerm/requests/storage/list_containers.rb +73 -0
  71. data/lib/fog/azurerm/requests/storage/multipart_save_block_blob.rb +110 -0
  72. data/lib/fog/azurerm/requests/storage/put_blob_block.rb +30 -0
  73. data/lib/fog/azurerm/requests/storage/put_blob_https_url.rb +39 -0
  74. data/lib/fog/azurerm/requests/storage/put_blob_metadata.rb +31 -0
  75. data/lib/fog/azurerm/requests/storage/put_blob_pages.rb +30 -0
  76. data/lib/fog/azurerm/requests/storage/put_blob_properties.rb +31 -0
  77. data/lib/fog/azurerm/requests/storage/put_container_acl.rb +31 -0
  78. data/lib/fog/azurerm/requests/storage/put_container_metadata.rb +31 -0
  79. data/lib/fog/azurerm/requests/storage/put_object_url.rb +30 -0
  80. data/lib/fog/azurerm/requests/storage/release_blob_lease.rb +30 -0
  81. data/lib/fog/azurerm/requests/storage/release_container_lease.rb +30 -0
  82. data/lib/fog/azurerm/requests/storage/save_page_blob.rb +111 -0
  83. data/lib/fog/azurerm/requests/storage/wait_blob_copy_operation_to_finish.rb +56 -0
  84. data/lib/fog/azurerm/storage.rb +126 -0
  85. data/lib/fog/azurerm/utilities/general.rb +186 -0
  86. data/lib/fog/azurerm/utilities/logger_messages.yml +19 -0
  87. data/lib/fog/azurerm/version.rb +5 -0
  88. data/rake-script.sh +10 -0
  89. data/rakefile +29 -0
  90. data/test/api_stub.rb +147 -0
  91. data/test/api_stub/models/storage/directory.rb +178 -0
  92. data/test/api_stub/models/storage/file.rb +181 -0
  93. data/test/api_stub/requests/storage/directory.rb +89 -0
  94. data/test/api_stub/requests/storage/file.rb +252 -0
  95. data/test/integration/README.md +14 -0
  96. data/test/integration/blob.rb +297 -0
  97. data/test/integration/container.rb +160 -0
  98. data/test/integration/credentials/azure.yml +5 -0
  99. data/test/integration/storage_account.rb +135 -0
  100. data/test/models/storage/test_directories.rb +74 -0
  101. data/test/models/storage/test_directory.rb +178 -0
  102. data/test/models/storage/test_file.rb +294 -0
  103. data/test/models/storage/test_files.rb +234 -0
  104. data/test/requests/storage/test_acquire_blob_lease.rb +36 -0
  105. data/test/requests/storage/test_acquire_container_lease.rb +36 -0
  106. data/test/requests/storage/test_check_container_exists.rb +18 -0
  107. data/test/requests/storage/test_commit_blob_blocks.rb +34 -0
  108. data/test/requests/storage/test_compare_container_blobs.rb +36 -0
  109. data/test/requests/storage/test_copy_blob.rb +39 -0
  110. data/test/requests/storage/test_copy_blob_from_uri.rb +36 -0
  111. data/test/requests/storage/test_create_block_blob.rb +80 -0
  112. data/test/requests/storage/test_create_container.rb +36 -0
  113. data/test/requests/storage/test_create_disk.rb +70 -0
  114. data/test/requests/storage/test_create_page_blob.rb +34 -0
  115. data/test/requests/storage/test_delete_blob.rb +42 -0
  116. data/test/requests/storage/test_delete_blob_https_url.rb +32 -0
  117. data/test/requests/storage/test_delete_container.rb +42 -0
  118. data/test/requests/storage/test_delete_disk.rb +30 -0
  119. data/test/requests/storage/test_get_blob.rb +141 -0
  120. data/test/requests/storage/test_get_blob_http_url.rb +30 -0
  121. data/test/requests/storage/test_get_blob_https_url.rb +32 -0
  122. data/test/requests/storage/test_get_blob_properties.rb +47 -0
  123. data/test/requests/storage/test_get_blob_url.rb +75 -0
  124. data/test/requests/storage/test_get_container_acl.rb +37 -0
  125. data/test/requests/storage/test_get_container_properties.rb +45 -0
  126. data/test/requests/storage/test_get_container_url.rb +33 -0
  127. data/test/requests/storage/test_list_blobs.rb +77 -0
  128. data/test/requests/storage/test_list_containers.rb +54 -0
  129. data/test/requests/storage/test_multipart_save_block_blob.rb +105 -0
  130. data/test/requests/storage/test_put_blob_block.rb +34 -0
  131. data/test/requests/storage/test_put_blob_https_url.rb +32 -0
  132. data/test/requests/storage/test_put_blob_metadata.rb +36 -0
  133. data/test/requests/storage/test_put_blob_pages.rb +34 -0
  134. data/test/requests/storage/test_put_blob_properties.rb +39 -0
  135. data/test/requests/storage/test_put_container_acl.rb +34 -0
  136. data/test/requests/storage/test_put_container_metadata.rb +36 -0
  137. data/test/requests/storage/test_release_blob_lease.rb +34 -0
  138. data/test/requests/storage/test_release_container_lease.rb +34 -0
  139. data/test/requests/storage/test_save_page_blob.rb +115 -0
  140. data/test/requests/storage/test_wait_blob_copy_operation_to_finish.rb +148 -0
  141. data/test/smoke_tests/compute/test_resource_group_smoke.rb +37 -0
  142. data/test/test_credentials.rb +63 -0
  143. data/test/test_helper.rb +846 -0
  144. metadata +352 -0
@@ -0,0 +1,37 @@
1
+ require 'fog/azurerm'
2
+ require 'minitest/autorun'
3
+ # Integration smoke test class to test resource group
4
+ class TestResourceGroupSmoke < MiniTest::Test
5
+ def setup
6
+ if !ENV['TENANT_ID'].nil? && !ENV['CLIENT_ID'].nil? && !ENV['CLIENT_SECRET'].nil? && !ENV['SUBSCRIPTION_ID'].nil?
7
+ @resource = Fog::Resources::AzureRM.new(
8
+ tenant_id: ENV['TENANT_ID'],
9
+ client_id: ENV['CLIENT_ID'],
10
+ client_secret: ENV['CLIENT_SECRET'],
11
+ subscription_id: ENV['SUBSCRIPTION_ID']
12
+ )
13
+ else
14
+ azure_credentials = YAML.load_file('../../integration/credentials/azure.yml')
15
+ @resource = Fog::Resources::AzureRM.new(
16
+ tenant_id: azure_credentials['tenant_id'],
17
+ client_id: azure_credentials['client_id'],
18
+ client_secret: azure_credentials['client_secret'],
19
+ subscription_id: azure_credentials['subscription_id']
20
+ )
21
+ end
22
+ time = Time.now.to_f.to_s
23
+ new_time = time.split(/\W+/).join
24
+ @resource_group_name = "fog-smoke-test-rg-#{new_time}"
25
+ end
26
+
27
+ def test_resource_group
28
+ puts 'In Smoke tests'
29
+ resource_group = @resource.resource_groups.create(name: @resource_group_name, location: 'eastus')
30
+ assert_instance_of Fog::Resources::AzureRM::ResourceGroup, resource_group
31
+
32
+ resource_group = @resource.resource_groups.get(@resource_group_name)
33
+ assert_instance_of Fog::Resources::AzureRM::ResourceGroup, resource_group
34
+
35
+ resource_group.destroy
36
+ end
37
+ end
@@ -0,0 +1,63 @@
1
+ require File.expand_path 'test_helper', __dir__
2
+
3
+ # Test class for Credentials Helper Class
4
+ class TestCredentials < Minitest::Test
5
+ def setup
6
+ @creds = credentials
7
+ end
8
+
9
+ def test_methods
10
+ methods = [
11
+ :get_credentials,
12
+ :get_token
13
+ ]
14
+ methods.each do |method|
15
+ assert Fog::Credentials::AzureRM.respond_to? method
16
+ end
17
+ end
18
+
19
+ def test_get_credentials_method_with_same_client
20
+ cred_obj_one = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
21
+ cred_obj_two = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
22
+ assert_equal cred_obj_one.object_id, cred_obj_two.object_id
23
+ end
24
+
25
+ def test_get_credentials_method_with_different_client
26
+ cred_obj_one = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
27
+ @creds[:client_id] = '<NEW-CLIENT-ID>'
28
+ cred_obj_two = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
29
+ refute_equal cred_obj_one.object_id, cred_obj_two.object_id
30
+ end
31
+
32
+ def test_get_token_method_with_default_environment
33
+ Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
34
+ token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
35
+ token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
36
+ assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
37
+ end
38
+ end
39
+
40
+ def test_get_token_method_with_china_environment
41
+ Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], ENVIRONMENT_AZURE_CHINA_CLOUD)
42
+ token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
43
+ token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
44
+ assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
45
+ end
46
+ end
47
+
48
+ def test_get_token_method_with_us_government_environment
49
+ Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], ENVIRONMENT_AZURE_US_GOVERNMENT)
50
+ token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
51
+ token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
52
+ assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
53
+ end
54
+ end
55
+
56
+ def test_get_token_method_with_german_environment
57
+ Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], ENVIRONMENT_AZURE_GERMAN_CLOUD)
58
+ token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
59
+ token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
60
+ assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,846 @@
1
+ if ENV['COVERAGE']
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter 'test'
5
+ command_name 'Minitest'
6
+ end
7
+ end
8
+
9
+ if ENV['CODECLIMATE_REPO_TOKEN']
10
+ require 'simplecov'
11
+ SimpleCov.start do
12
+ add_filter 'test'
13
+ command_name 'Minitest'
14
+ end
15
+ end
16
+
17
+ require 'minitest/autorun'
18
+ require 'azure/core/http/http_error'
19
+ require 'azure/core/http/http_response'
20
+ $LOAD_PATH.unshift(File.expand_path '../lib', __dir__)
21
+ require File.expand_path '../lib/fog/azurerm', __dir__
22
+ require File.expand_path './api_stub', __dir__
23
+ def credentials
24
+ {
25
+ tenant_id: '<TENANT-ID>',
26
+ client_id: '<CLIENT-ID>',
27
+ client_secret: '<CLIENT-SECRET>',
28
+ subscription_id: '<SUBSCRIPTION-ID>'
29
+ }
30
+ end
31
+
32
+ def storage_account_credentials
33
+ {
34
+ azure_storage_account_name: 'mockaccount',
35
+ azure_storage_access_key: 'YWNjZXNzLWtleQ=='
36
+ }
37
+ end
38
+
39
+ # Mock Class for Blob
40
+ class MockBlob
41
+ def initialize
42
+ @properties = {}
43
+ @metadata = {}
44
+ yield self if block_given?
45
+ end
46
+
47
+ attr_accessor :name
48
+ attr_accessor :snapshot
49
+ attr_accessor :properties
50
+ attr_accessor :metadata
51
+ end
52
+
53
+ # Mock Class for Response
54
+ class MockResponse
55
+ def initialize(code, body, headers)
56
+ @status = code
57
+ @body = body
58
+ @headers = headers
59
+ @headers.each do |k, v|
60
+ @headers[k] = [v] unless v.respond_to? 'first'
61
+ end
62
+ end
63
+ attr_accessor :status
64
+ attr_accessor :body
65
+ attr_accessor :headers
66
+ end
67
+
68
+ def mocked_storage_http_error
69
+ mocked_net_response = MockResponse.new 'mocked_code', 'mocked_body', a: 'a', b: 'b'
70
+ Azure::Core::Http::HttpResponse.new mocked_net_response, 'mocked_uri'
71
+ end
72
+
73
+ def mocked_storage_http_not_found_error
74
+ mocked_net_response = MockResponse.new '404', 'mocked_body', a: 'a', b: 'b'
75
+ Azure::Core::Http::HttpResponse.new mocked_net_response, 'mocked_uri'
76
+ end
77
+
78
+ def server(service)
79
+ Fog::Compute::AzureRM::Server.new(
80
+ name: 'fog-test-server',
81
+ location: 'West US',
82
+ resource_group: 'fog-test-rg',
83
+ vm_size: 'Basic_A0',
84
+ storage_account_name: 'shaffanstrg',
85
+ username: 'shaffan',
86
+ password: 'Confiz=123',
87
+ disable_password_authentication: false,
88
+ network_interface_card_ids: ['/subscriptions/########-####-####-####-############/resourceGroups/shaffanRG/providers/Microsoft.Network/networkInterfaces/testNIC'],
89
+ publisher: 'Canonical',
90
+ offer: 'UbuntuServer',
91
+ sku: '14.04.2-LTS',
92
+ version: 'latest',
93
+ platform: 'Windows',
94
+ service: service
95
+ )
96
+ end
97
+
98
+ def virtual_machine_extension(service)
99
+ Fog::Compute::AzureRM::VirtualMachineExtension.new(
100
+ name: 'fog-test-extension',
101
+ location: 'West US',
102
+ resource_group: 'fog-test-rg',
103
+ vm_name: 'fog-test-vm',
104
+ type: 'fog-test-extension-type',
105
+ publisher: 'fog-test-extension-publisher',
106
+ type_handler_version: 'fog-test-extension-version',
107
+ auto_upgrade_minor_version: 'fog-test-extension-upgrade',
108
+ settings: '{"Key" => "Value"}',
109
+ protected_settings: '{"Key" => "Value"}',
110
+ service: service
111
+ )
112
+ end
113
+
114
+ def availability_set(service)
115
+ Fog::Compute::AzureRM::AvailabilitySet.new(
116
+ name: 'availability-set',
117
+ location: 'West US',
118
+ resource_group: 'fog-test-rg',
119
+ use_managed_disk: false,
120
+ sku_name: 'Classic',
121
+ service: service
122
+ )
123
+ end
124
+
125
+ def resource_group(service)
126
+ Fog::Resources::AzureRM::ResourceGroup.new(
127
+ name: 'fog-test-rg',
128
+ location: 'West US',
129
+ service: service
130
+ )
131
+ end
132
+
133
+ def deployment(service)
134
+ Fog::Resources::AzureRM::Deployment.new(
135
+ name: 'fog-test-deployment',
136
+ resource_group: 'fog-test-rg',
137
+ template_link: 'https://test.com/template.json',
138
+ parameters_link: 'https://test.com/parameters.json',
139
+ service: service
140
+ )
141
+ end
142
+
143
+ def storage_account(service)
144
+ Fog::Storage::AzureRM::StorageAccount.new(
145
+ name: 'storage-account',
146
+ location: 'West US',
147
+ resource_group: 'fog-test-rg',
148
+ service: service
149
+ )
150
+ end
151
+
152
+ def standard_lrs(service)
153
+ Fog::Storage::AzureRM::StorageAccount.new(
154
+ name: 'storage-account',
155
+ location: 'West US',
156
+ resource_group: 'fog-test-rg',
157
+ sku_name: 'Other',
158
+ replication: 'LRS',
159
+ service: service
160
+ )
161
+ end
162
+
163
+ def standard_check_for_invalid_replications(service)
164
+ Fog::Storage::AzureRM::StorageAccount.new(
165
+ name: 'storage-account',
166
+ location: 'West US',
167
+ resource_group: 'fog-test-rg',
168
+ sku_name: 'Standard',
169
+ replication: 'HGDKS',
170
+ service: service
171
+ )
172
+ end
173
+
174
+ def premium_check_for_invalid_replications(service)
175
+ Fog::Storage::AzureRM::StorageAccount.new(
176
+ name: 'storage-account',
177
+ location: 'West US',
178
+ resource_group: 'fog-test-rg',
179
+ sku_name: 'Premium',
180
+ replication: 'HGDKS',
181
+ service: service
182
+ )
183
+ end
184
+
185
+ def directory(service)
186
+ Fog::Storage::AzureRM::Directory.new(
187
+ key: 'test_container',
188
+ acl: 'container',
189
+ etag: '0x8D29C92176C8352',
190
+ last_modified: Time.parse('Tue, 04 Aug 2015 06:01:08 GMT'),
191
+ lease_duration: nil,
192
+ lease_state: 'available',
193
+ lease_status: 'unlocked',
194
+ metadata: {
195
+ 'key1' => 'value1',
196
+ 'key2' => 'value2'
197
+ },
198
+ service: service,
199
+ collection: Fog::Storage::AzureRM::Directories.new(service: @service)
200
+ )
201
+ end
202
+
203
+ def file(service)
204
+ Fog::Storage::AzureRM::File.new(
205
+ key: 'test_blob',
206
+ directory: directory(service),
207
+ last_modified: Time.parse('Tue, 04 Aug 2015 06:01:08 GMT'),
208
+ etag: '0x8D29C92176C8352',
209
+ metadata: {
210
+ 'key1' => 'value1',
211
+ 'key2' => 'value2'
212
+ },
213
+ lease_status: 'unlocked',
214
+ lease_state: 'available',
215
+ lease_duration: nil,
216
+ content_length: 4_194_304,
217
+ content_type: 'application/octet-stream',
218
+ content_encoding: nil,
219
+ content_language: nil,
220
+ content_disposition: nil,
221
+ content_md5: 'tXAohIyxuu/t94Lp/ujeRw==',
222
+ cache_control: nil,
223
+ sequence_number: 0,
224
+ blob_type: 'BlockBlob',
225
+ copy_id: '095adc3b-e277-4c3d-97e0-0abca881f60c',
226
+ copy_status: 'success',
227
+ copy_source: 'https://testaccount.blob.core.windows.net/testblob/4m?snapshot=2016-02-04T08%3A35%3A50.3157696Z',
228
+ copy_progress: '4194304/4194304',
229
+ copy_completion_time: 'Thu, 04 Feb 2016 08:35:52 GMT',
230
+ copy_status_description: nil,
231
+ accept_ranges: 0,
232
+ service: service,
233
+ collection: Fog::Storage::AzureRM::Files.new(service: @service, directory: directory(service))
234
+ )
235
+ end
236
+
237
+ def storage_blob
238
+ mock_blob = MockBlob.new
239
+ mock_blob.name = 'test_blob'
240
+ mock_blob.properties = {
241
+ lease_status: 'unlocked',
242
+ lease_state: 'available',
243
+ lease_duration: nil,
244
+ content_length: 4_194_304,
245
+ content_type: 'application/octet-stream',
246
+ content_encoding: nil,
247
+ content_language: nil,
248
+ content_disposition: nil,
249
+ content_md5: 'tXAohIyxuu/t94Lp/ujeRw==',
250
+ cache_control: nil,
251
+ sequence_number: 0,
252
+ blob_type: 'PageBlob',
253
+ copy_id: '095adc3b-e277-4c3d-97e0-0abca881f60c',
254
+ copy_status: 'success',
255
+ copy_source: 'https://sa.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A50.3157696Z',
256
+ copy_progress: '4194304/4194304',
257
+ copy_completion_time: 'Thu, 04 Feb 2016 08:35:52 GMT',
258
+ copy_status_description: nil,
259
+ accept_ranges: 0,
260
+ last_modified: 'Tue, 04 Aug 2015 06:01:08 GMT',
261
+ etag: '"0x8D29C92176C8352"'
262
+ }
263
+ mock_blob.metadata = {
264
+ 'key1' => 'value1',
265
+ 'key2' => 'value2'
266
+ }
267
+ mock_blob
268
+ end
269
+
270
+ def public_ip(service)
271
+ Fog::Network::AzureRM::PublicIp.new(
272
+ name: 'fog-test-public-ip',
273
+ resource_group: 'fog-test-rg',
274
+ location: 'West US',
275
+ public_ip_allocation_method: 'Dynamic',
276
+ service: service
277
+ )
278
+ end
279
+
280
+ def subnet(service)
281
+ Fog::Network::AzureRM::Subnet.new(
282
+ name: 'fog-test-subnet',
283
+ resource_group: 'fog-test-rg',
284
+ virtual_network_name: 'vnet1',
285
+ address_prefix: '10.0.0.0/24',
286
+ network_security_group_id: '/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNSG1',
287
+ route_table_id: '/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/myRT1',
288
+ service: service
289
+ )
290
+ end
291
+
292
+ def virtual_network(service)
293
+ Fog::Network::AzureRM::VirtualNetwork.new(
294
+ name: 'fog-test-virtual-network',
295
+ location: 'westus',
296
+ resource_group: 'fog-test-rg',
297
+ subnets: [{
298
+ name: 'fog-test-subnet',
299
+ address_prefix: '10.1.0.0/24',
300
+ network_security_group_id: '/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNSG1',
301
+ route_table_id: '/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/myRT1'
302
+ }],
303
+ dns_servers: ['10.1.0.0', '10.2.0.0'],
304
+ address_prefixes: ['10.1.0.0/16', '10.2.0.0/16'],
305
+ service: service
306
+ )
307
+ end
308
+
309
+ def network_interface(service)
310
+ Fog::Network::AzureRM::NetworkInterface.new(
311
+ name: 'fog-test-network-interface',
312
+ location: 'West US',
313
+ resource_group: 'fog-test-rg',
314
+ subnet_id: '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/virtualNetworks/fog-test-virtual-network/subnets/fog-test-subnet',
315
+ public_ip_address_id: '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/publicIPAddresses/fog-test-public-ip',
316
+ network_security_group_id: '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/networkSecurityGroups/fog-test-nsg',
317
+ ip_configuration_name: 'fog-test-ip-configuration',
318
+ private_ip_allocation_method: 'fog-test-private-ip-allocation-method',
319
+ properties: nil,
320
+ service: service
321
+ )
322
+ end
323
+
324
+ def load_balancer(service)
325
+ Fog::Network::AzureRM::LoadBalancer.new(
326
+ name: 'lb',
327
+ resource_group: 'fogRM-rg',
328
+ location: 'westus',
329
+ frontend_ip_configurations:
330
+ [
331
+ {
332
+ name: 'fic',
333
+ private_ipallocation_method: 'Dynamic',
334
+ public_ipaddress_id: '/subscriptions/########-####-####-####-############/resourcegroups/fogRM-rg/providers/Microsoft.Network/publicIPAddresses/pip',
335
+ subnet_id: '/subscriptions/########-####-####-####-############/resourcegroups/fogRM-rg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/sb1'
336
+ }
337
+ ],
338
+ backend_address_pool_names:
339
+ [
340
+ 'pool1'
341
+ ],
342
+ load_balancing_rules:
343
+ [
344
+ {
345
+ name: 'lb_rule_1',
346
+ frontend_ip_configuration_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fic',
347
+ backend_address_pool_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/pool1',
348
+ protocol: 'Tcp',
349
+ frontend_port: '80',
350
+ backend_port: '8080',
351
+ enable_floating_ip: false,
352
+ idle_timeout_in_minutes: 4,
353
+ load_distribution: 'Default'
354
+ }
355
+ ],
356
+ inbound_nat_rules:
357
+ [
358
+ {
359
+ name: 'RDP-Traffic',
360
+ frontend_ip_configuration_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fic',
361
+ protocol: 'Tcp',
362
+ frontend_port: 3389,
363
+ backend_port: 3389
364
+ }
365
+ ],
366
+ probes:
367
+ [
368
+ {
369
+ name: 'probe1',
370
+ protocol: 'Tcp',
371
+ port: 8080,
372
+ request_path: 'myprobeapp1/myprobe1.svc',
373
+ interval_in_seconds: 5,
374
+ number_of_probes: 16
375
+ }
376
+ ],
377
+ inbound_nat_pools:
378
+ [
379
+ {
380
+ name: 'RDPForVMSS1',
381
+ protocol: 'Tcp',
382
+ frontend_port_range_start: 500,
383
+ frontend_port_range_end: 505,
384
+ backend_port: 3389
385
+ }
386
+ ],
387
+ service: service
388
+ )
389
+ end
390
+
391
+ def zone(service)
392
+ Fog::DNS::AzureRM::Zone.new(
393
+ name: 'fog-test-zone.com',
394
+ location: 'global',
395
+ id: '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/dnszones/fog-test-zone.com',
396
+ resource_group: 'fog-test-rg',
397
+ service: service
398
+ )
399
+ end
400
+
401
+ def record_set(service)
402
+ Fog::DNS::AzureRM::RecordSet.new(
403
+ name: 'fog-test-record_set',
404
+ resource_group: 'fog-test-rg',
405
+ zone_name: 'fog-test-zone.com',
406
+ records: %w(1.2.3.4 1.2.3.3),
407
+ type: 'A',
408
+ ttl: 60,
409
+ service: service
410
+ )
411
+ end
412
+
413
+ def record_set_cname(service)
414
+ Fog::DNS::AzureRM::RecordSet.new(
415
+ name: 'fog-test-record_set',
416
+ resource_group: 'fog-test-rg',
417
+ zone_name: 'fog-test-zone.com',
418
+ records: %w(1.2.3.4 1.2.3.3),
419
+ type: 'CNAME',
420
+ ttl: 60,
421
+ service: service
422
+ )
423
+ end
424
+
425
+ def network_security_group(service)
426
+ Fog::Network::AzureRM::NetworkSecurityGroup.new(
427
+ name: 'fog-test-nsg',
428
+ resource_group: 'fog-test-rg',
429
+ location: 'West US',
430
+ security_rules: [{
431
+ name: 'fog-test-rule',
432
+ protocol: 'tcp',
433
+ source_port_range: '22',
434
+ destination_port_range: '22',
435
+ source_address_prefix: '0.0.0.0/0',
436
+ destination_address_prefix: '0.0.0.0/0',
437
+ access: 'Allow',
438
+ priority: '100',
439
+ direction: 'Inbound'
440
+ }],
441
+ service: service
442
+ )
443
+ end
444
+
445
+ def network_security_rule(service)
446
+ Fog::Network::AzureRM::NetworkSecurityRule.new(
447
+ name: 'fog-test-nsr',
448
+ resource_group: 'fog-test-rg',
449
+ network_security_group_name: 'fog-test-nsr',
450
+ protocol: 'tcp',
451
+ source_port_range: '22',
452
+ destination_port_range: '22',
453
+ source_address_prefix: '0.0.0.0/0',
454
+ destination_address_prefix: '0.0.0.0/0',
455
+ access: 'Allow',
456
+ priority: '100',
457
+ direction: 'Inbound',
458
+ service: service
459
+ )
460
+ end
461
+
462
+ def gateway(service)
463
+ Fog::ApplicationGateway::AzureRM::Gateway.new(
464
+ name: 'gateway',
465
+ location: 'eastus',
466
+ resource_group: 'fogRM-rg',
467
+ sku_name: 'Standard_Medium',
468
+ sku_tier: 'Standard',
469
+ sku_capacity: '2',
470
+ gateway_ip_configurations:
471
+ [
472
+ {
473
+ name: 'gatewayIpConfigName',
474
+ subnet_id: '/subscriptions/########-####-####-####-############/resourcegroups/fogRM-rg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnetName'
475
+ }
476
+ ],
477
+ ssl_certificates:
478
+ [
479
+ {
480
+ name: 'certificate',
481
+ data: 'data',
482
+ password: '123',
483
+ public_cert_data: 'MIIDiDCCAnACCQCwYkR0Mxy+QTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCUEsxDzANBgNVBAgTBlB1bmphYjEPMA0GA1UEBxMGTGFob3JlMQ8wDQYDVQQKEwZDb25maXoxDDAKBgNVBAsTA0RldjEPMA0GA1UEAxMGaGFpZGVyMSQwIgYJKoZIhvcNAQkBFhVoYWlkZXIuYWxpQGNvbmZpei5jb20wHhcNMTYwMzAyMTE0NTM2WhcNMTcwMzAyMTE0NTM2WjCBhTELMAkGA1UEBhMCUEsxDzANBgNVBAgTBlB1bmphYjEPMA0GA1UEBxMGTGFob3JlMQ8wDQYDVQQKEwZDb25maXoxDDAKBgNVBAsTA0RldjEPMA0GA1UEAxMGaGFpZGVyMSQwIgYJKoZIhvcNAQkBFhVoYWlkZXIuYWxpQGNvbmZpei5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCuJrPbvOG+4oXQRamkOALlpdK98m+atJue9zOcCCagY8IJI4quYL13d8VItmrZf7erA+siqpYlWEuk1+lmmUY7T4AWAL8mXeR2vc7hWF601WDUjeVPK19+IcC8emMLOlBpvjXC9nbvADLQuR0PGitfjCqFoG66EOqJmLDNBsyHWmy+qhb8J4WXitruNAJDPe/20h6L23vD6z4tvwBjh4zkrfskGlKCNcAuvG1NI0FAS8261Jvs3lf+8oFyI+oSXGtknrkeQv3PbXyeEe3KO5a/M61Uebo04Uwd4yCvdu6H0sF+YYA4bfFdanuFmrZvf9cZSwknQid+vOdzyGkTHTPFAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBAKtPhYpfvn5OxP+BcChsWaQA4KZQj0THGdiAjHsvfjsgteFvhkzqZBkhKYtsAWV5tB5/GDl+o4c6PQJ2/TXhOJn3pSNaUzrCJIGtKS5DknbqTQxCwVlxyBtPHLAYWqKcPMlH282rw3VY0OYTL96XOgZ/WZjcN6A7ku+uWsNCql443FoWL+N3Gpaab45OyIluFUOH+yc0ToHNlP3iOpI3rVpi2xwmGrSyUKsGUma3nrBq7TWjkDE1E+oJoybaMNZzgXGIPSJC1HYIF1U8GSoFkZpAFxXecD0FinXWDRwUP6K54iti3i6a/Ox73WhwfI4mVCqsOy1WYWtKYhMVe6Kj4Nw='
484
+ }
485
+ ],
486
+ frontend_ip_configurations:
487
+ [
488
+ {
489
+ name: 'frontendIpConfig',
490
+ private_ip_allocation_method: 'Dynamic',
491
+ public_ip_address_id: '/subscriptions/########-####-####-####-############/resourcegroups/fogRM-rg/providers/Microsoft.Network/publicIPAddresses/publicIp',
492
+ private_ip_address: '10.0.1.5'
493
+ }
494
+ ],
495
+ frontend_ports:
496
+ [
497
+ {
498
+ name: 'frontendPort',
499
+ port: 443
500
+ }
501
+ ],
502
+ probes:
503
+ [
504
+ {
505
+ name: 'probe1',
506
+ protocol: 'tcp',
507
+ host: 'localhost',
508
+ path: '/usr/',
509
+ interval: 30,
510
+ timeout: 20,
511
+ unhealthy_threshold: 20
512
+ }
513
+ ],
514
+ backend_address_pools:
515
+ [
516
+ {
517
+ name: 'backendAddressPool',
518
+ ip_addresses: [
519
+ {
520
+ ipAddress: '10.0.1.6'
521
+ }
522
+ ]
523
+ }
524
+ ],
525
+ backend_http_settings_list:
526
+ [
527
+ {
528
+ name: 'gateway_settings',
529
+ port: 80,
530
+ protocol: 'Http',
531
+ cookie_based_affinity: 'Enabled',
532
+ request_timeout: '30',
533
+ probe: ''
534
+ }
535
+ ],
536
+ http_listeners:
537
+ [
538
+ {
539
+ name: 'gateway_listener',
540
+ frontend_ip_config_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/frontendIPConfigurations/frontend_ip_config',
541
+ frontend_port_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/frontendPorts/gateway_front_port',
542
+ protocol: 'Https',
543
+ host_name: '',
544
+ ssl_certificate_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/sslCertificates/ssl_certificate',
545
+ require_server_name_indication: 'false'
546
+ }
547
+ ],
548
+ url_path_maps:
549
+ [
550
+ {
551
+ name: 'map1',
552
+ default_backend_address_pool_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendAddressPools/AG-BackEndAddressPool',
553
+ default_backend_http_settings_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendHttpSettingsCollection/gateway_settings',
554
+ path_rules: [
555
+ {
556
+ backend_address_pool_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendAddressPools/AG-BackEndAddressPool',
557
+ backend_http_settings_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendHttpSettingsCollection/gateway_settings',
558
+ paths: [
559
+ %w(/usr /etc)
560
+ ]
561
+ }
562
+ ]
563
+ }
564
+ ],
565
+ request_routing_rules:
566
+ [
567
+ {
568
+ name: 'gateway_request_route_rule',
569
+ type: 'Basic',
570
+ http_listener_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/httpListeners/gateway_listener',
571
+ backend_address_pool_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendAddressPools/AG-BackEndAddressPool',
572
+ backend_http_settings_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendHttpSettingsCollection/gateway_settings',
573
+ url_path_map: ''
574
+ }
575
+ ],
576
+ service: service
577
+ )
578
+ end
579
+
580
+ def traffic_manager_end_point(service)
581
+ Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.new(
582
+ name: 'fog-test-end-point',
583
+ traffic_manager_profile_name: 'fog-test-profile',
584
+ resource_group: 'fog-test-rg',
585
+ type: 'external',
586
+ target: 'test.com',
587
+ endpoint_location: 'West US',
588
+ service: service
589
+ )
590
+ end
591
+
592
+ def traffic_manager_profile(service)
593
+ Fog::TrafficManager::AzureRM::TrafficManagerProfile.new(
594
+ name: 'fog-test-profile',
595
+ resource_group: 'fog-test-rg',
596
+ traffic_routing_method: 'Performance',
597
+ relative_name: 'fog-test-app',
598
+ ttl: '30',
599
+ protocol: 'http',
600
+ port: '80',
601
+ path: '/monitorpage.aspx',
602
+ service: service
603
+ )
604
+ end
605
+
606
+ def virtual_network_gateway(service)
607
+ Fog::Network::AzureRM::VirtualNetworkGateway.new(
608
+ name: 'testNetworkGateway',
609
+ location: 'eastus',
610
+ tags: {
611
+ key1: 'value1',
612
+ key2: 'value2'
613
+ },
614
+ resource_group: 'learn_fog',
615
+ sku_name: 'HighPerformance',
616
+ sku_tier: 'Standard',
617
+ sku_capacity: 100,
618
+ gateway_type: 'ExpressRoute',
619
+ enable_bgp: true,
620
+ gateway_size: 'Default',
621
+ vpn_client_address_pool: ['vpnClientAddressPoolPrefix'],
622
+ default_sites: ['mysite1'],
623
+ gateway_default_site: '/subscriptions/{subscription-id}/resourceGroups/fog-rg/providers/microsoft.network/localNetworkGateways/{local-network-gateway-name}',
624
+ service: service
625
+ )
626
+ end
627
+
628
+ def local_network_gateway(service)
629
+ Fog::Network::AzureRM::LocalNetworkGateway.new(
630
+ name: 'testLocalNetworkGateway',
631
+ location: 'eastus',
632
+ tags: {
633
+ key1: 'value1',
634
+ key2: 'value2'
635
+ },
636
+ resource_group: 'learn_fog',
637
+ gateway_ip_address: '192.168.1.1',
638
+ local_network_address_space_prefixes: [],
639
+ asn: 100,
640
+ bgp_peering_address: '192.168.1.2',
641
+ peer_weight: 3,
642
+ service: service
643
+ )
644
+ end
645
+
646
+ def express_route_circuit(service)
647
+ Fog::Network::AzureRM::ExpressRouteCircuit.new(
648
+ name: 'testCircuit',
649
+ location: 'eastus',
650
+ resource_group: 'HaiderRG',
651
+ tags: {
652
+ key1: 'value1'
653
+ },
654
+ sku_name: 'Standard_MeteredData',
655
+ sku_tier: 'Standard',
656
+ sku_family: 'MeteredData',
657
+ service_provider_name: 'Telenor',
658
+ peering_location: 'London',
659
+ bandwidth_in_mbps: 100,
660
+ peerings: [
661
+ {
662
+ name: 'AzurePublicPeering',
663
+ peering_type: 'AzurePublicPeering',
664
+ peer_asn: 100,
665
+ primary_peer_address_prefix: '192.168.1.0/30',
666
+ secondary_peer_address_prefix: '192.168.2.0/30',
667
+ vlan_id: 200
668
+ }
669
+ ],
670
+ service: service
671
+ )
672
+ end
673
+
674
+ def express_route_circuit_peering(service)
675
+ Fog::Network::AzureRM::ExpressRouteCircuitPeering.new(
676
+ name: 'AzurePublicPeering',
677
+ circuit_name: 'testCircuit',
678
+ resource_group: 'HaiderRG',
679
+ peering_type: 'AzurePublicPeering',
680
+ peer_asn: 100,
681
+ primary_peer_address_prefix: '192.168.1.0/30',
682
+ secondary_peer_address_prefix: '192.168.2.0/30',
683
+ vlan_id: 200,
684
+ service: service
685
+ )
686
+ end
687
+
688
+ def express_route_circuit_authorization(service)
689
+ Fog::Network::AzureRM::ExpressRouteCircuitAuthorization.new(
690
+ name: 'UniqueAuthorizationName',
691
+ circuit_name: 'testCircuit',
692
+ resource_group: 'HaiderRG',
693
+ authorization_use_status: 'Available',
694
+ authorization_name: 'circuit-auth-name',
695
+ service: service
696
+ )
697
+ end
698
+
699
+ def virtual_network_gateway_connection(service)
700
+ Fog::Network::AzureRM::VirtualNetworkGatewayConnection.new(
701
+ name: 'testNetworkGateway',
702
+ location: 'eastus',
703
+ tags: {
704
+ key1: 'value1',
705
+ key2: 'value2'
706
+ },
707
+ resource_group: 'learn_fog',
708
+ virtual_network_gateway1: {
709
+ name: 'firstgateway'
710
+ },
711
+ virtual_network_gateway2: {
712
+ name: 'secondgateway'
713
+ },
714
+ enable_bgp: true,
715
+ connection_type: 'VNet-to-VNet',
716
+ routing_weight: 2,
717
+ shared_key: 'shared_key',
718
+ service: service
719
+ )
720
+ end
721
+
722
+ def database(service)
723
+ Fog::Sql::AzureRM::SqlDatabase.new(
724
+ name: 'fog-test-zone.com',
725
+ id: '/subscriptions/########-####-####-####-############/resourceGroups/vm_custom_image/providers/Microsoft.Sql/servers/test-sql-server-confiz123/databases/confiztestdatab98',
726
+ resource_group: 'fog-test-rg',
727
+ server_name: 'fog-test-server-name',
728
+ location: 'eastus',
729
+ service: service
730
+ )
731
+ end
732
+
733
+ def databases(service)
734
+ Fog::Sql::AzureRM::SqlDatabases.new(
735
+ resource_group: 'fog-test-rg',
736
+ server_name: 'fog-test-server-name',
737
+ name: 'database-name',
738
+ location: 'eastus',
739
+ service: service
740
+ )
741
+ end
742
+
743
+ def sql_server(service)
744
+ Fog::Sql::AzureRM::SqlServer.new(
745
+ name: 'fog-test-zone.com',
746
+ id: '/subscriptions/########-####-####-####-############/resourceGroups/vm_custom_image/providers/Microsoft.Sql/servers/test-sql-server-confiz123',
747
+ resource_group: 'fog-test-rg',
748
+ location: 'eastus',
749
+ version: '2.0',
750
+ administrator_login: 'test-admin@3',
751
+ administrator_login_password: 'pass@swe',
752
+ service: service
753
+ )
754
+ end
755
+
756
+ def sql_servers(service)
757
+ Fog::Sql::AzureRM::SqlServers.new(
758
+ name: 'fog-test-zone.com',
759
+ id: '/subscriptions/########-####-####-####-############/resourceGroups/vm_custom_image/providers/Microsoft.Sql/servers/test-sql-server-confiz123',
760
+ resource_group: 'fog-test-rg',
761
+ location: 'eastus',
762
+ version: '2.0',
763
+ administrator_login: 'test-admin@3',
764
+ administrator_login_password: 'pass@swe',
765
+ service: service
766
+ )
767
+ end
768
+
769
+ def sql_server_firewall_rule(service)
770
+ Fog::Sql::AzureRM::FirewallRule.new(
771
+ name: 'fog-test-firewall-rule-name',
772
+ id: '/subscriptions/########-####-####-####-############/resourceGroups/vm_custom_image/providers/Microsoft.Sql/servers/test-sql-server-confiz123/firewallRules/rule-name',
773
+ resource_group: 'fog-test-rg',
774
+ server_name: 'server-name',
775
+ start_ip: '10.10.10.10',
776
+ end_ip: '10.10.10.10',
777
+ service: service
778
+ )
779
+ end
780
+
781
+ def sql_server_firewall_rules(service)
782
+ Fog::Sql::AzureRM::FirewallRules.new(
783
+ name: 'fog-test-firewall-rule-name',
784
+ id: '/subscriptions/########-####-####-####-############/resourceGroups/vm_custom_image/providers/Microsoft.Sql/servers/test-sql-server-confiz123/firewallRules/rule-name',
785
+ resource_group: 'fog-test-rg',
786
+ server_name: 'server-name',
787
+ start_ip: '10.10.10.10',
788
+ end_ip: '10.10.10.10',
789
+ service: service
790
+ )
791
+ end
792
+
793
+ def managed_disk(service)
794
+ Fog::Compute::AzureRM::ManagedDisk.new(
795
+ name: 'managed-disk',
796
+ location: 'East US',
797
+ resource_group_name: 'fog-test-rg',
798
+ account_type: 'Premium_LRS',
799
+ disk_size_gb: 1023,
800
+ creation_data: {
801
+ create_option: 'Empty'
802
+ },
803
+ service: service
804
+ )
805
+ end
806
+
807
+ def snapshot(service)
808
+ Fog::Compute::AzureRM::Snapshot.new(
809
+ name: 'snapshot',
810
+ location: 'East US',
811
+ resource_group_name: 'fog-test-rg',
812
+ account_type: 'Premium_LRS',
813
+ disk_size_gb: 1023,
814
+ creation_data: {
815
+ create_option: 'Copy',
816
+ source_uri: 'source uri on azure'
817
+ },
818
+ service: service
819
+ )
820
+ end
821
+
822
+ def key_vault(service)
823
+ Fog::KeyVault::AzureRM::Vault.new(
824
+ name: 'key-vault',
825
+ location: 'East US',
826
+ resource_group_name: 'fog-test-rg',
827
+ sku_family: 'A',
828
+ sku_name: 'Standard',
829
+ access_policies: [
830
+ {
831
+ tenant_id: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
832
+ object_id: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
833
+ permissions: {
834
+ keys: ['all'],
835
+ secrets: ['all']
836
+ }
837
+ }
838
+ ],
839
+ service: service
840
+ )
841
+ end
842
+
843
+ def create_mock_response
844
+ response_headers = { 'status' => HTTP_NOT_FOUND }
845
+ Faraday::Response.new(response_headers)
846
+ end