gitlab-fog-azure-rm 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +12 -0
- data/.rubocop_todo.yml +1 -1
- data/gitlab-fog-azure-rm.gemspec +3 -2
- data/lib/fog/azurerm/docs/storage.md +1 -1
- data/lib/fog/azurerm/identity_encoding_filter.rb +12 -0
- data/lib/fog/azurerm/models/storage/directories.rb +6 -6
- data/lib/fog/azurerm/models/storage/directory.rb +4 -4
- data/lib/fog/azurerm/models/storage/file.rb +6 -3
- data/lib/fog/azurerm/models/storage/files.rb +8 -8
- data/lib/fog/azurerm/models/storage/storage_account.rb +4 -4
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +6 -6
- data/lib/fog/azurerm/requests/storage/acquire_blob_lease.rb +2 -2
- data/lib/fog/azurerm/requests/storage/acquire_container_lease.rb +2 -2
- data/lib/fog/azurerm/requests/storage/check_container_exists.rb +2 -2
- data/lib/fog/azurerm/requests/storage/commit_blob_blocks.rb +2 -2
- data/lib/fog/azurerm/requests/storage/compare_container_blobs.rb +2 -2
- data/lib/fog/azurerm/requests/storage/copy_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb +2 -2
- data/lib/fog/azurerm/requests/storage/copy_object.rb +2 -2
- data/lib/fog/azurerm/requests/storage/create_block_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/create_container.rb +2 -2
- data/lib/fog/azurerm/requests/storage/create_page_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/delete_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/delete_blob_https_url.rb +4 -4
- data/lib/fog/azurerm/requests/storage/delete_container.rb +2 -2
- data/lib/fog/azurerm/requests/storage/delete_object.rb +2 -2
- data/lib/fog/azurerm/requests/storage/delete_object_url.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_blob_http_url.rb +5 -5
- data/lib/fog/azurerm/requests/storage/get_blob_https_url.rb +6 -5
- data/lib/fog/azurerm/requests/storage/get_blob_properties.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_blob_url.rb +4 -4
- data/lib/fog/azurerm/requests/storage/get_container_acl.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_container_properties.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_container_url.rb +4 -4
- data/lib/fog/azurerm/requests/storage/get_object.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/azurerm/requests/storage/list_blobs.rb +2 -2
- data/lib/fog/azurerm/requests/storage/list_containers.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_blob_block.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_blob_http_url.rb +39 -0
- data/lib/fog/azurerm/requests/storage/put_blob_https_url.rb +4 -4
- data/lib/fog/azurerm/requests/storage/put_blob_metadata.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_blob_pages.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_blob_properties.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_container_acl.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_container_metadata.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_object_url.rb +2 -2
- data/lib/fog/azurerm/requests/storage/release_blob_lease.rb +2 -2
- data/lib/fog/azurerm/requests/storage/release_container_lease.rb +2 -2
- data/lib/fog/azurerm/requests/storage/save_page_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/wait_blob_copy_operation_to_finish.rb +2 -2
- data/lib/fog/azurerm/storage.rb +62 -9
- data/lib/fog/azurerm/utilities/general.rb +0 -5
- data/lib/fog/azurerm/version.rb +1 -1
- data/lib/fog/azurerm.rb +4 -5
- data/rakefile +4 -5
- data/test/api_stub/models/storage/directory.rb +1 -1
- data/test/api_stub/models/storage/file.rb +1 -1
- data/test/api_stub/requests/storage/directory.rb +1 -1
- data/test/api_stub/requests/storage/file.rb +4 -4
- data/test/integration/README.md +5 -7
- data/test/integration/blob.rb +28 -36
- data/test/integration/container.rb +8 -39
- data/test/integration/credentials/azure.yml +4 -5
- data/test/models/storage/test_directories.rb +5 -5
- data/test/models/storage/test_directory.rb +2 -2
- data/test/models/storage/test_file.rb +16 -4
- data/test/models/storage/test_files.rb +8 -8
- data/test/requests/storage/test_acquire_blob_lease.rb +2 -2
- data/test/requests/storage/test_acquire_container_lease.rb +2 -2
- data/test/requests/storage/test_check_container_exists.rb +1 -1
- data/test/requests/storage/test_commit_blob_blocks.rb +2 -2
- data/test/requests/storage/test_compare_container_blobs.rb +2 -2
- data/test/requests/storage/test_copy_blob.rb +2 -2
- data/test/requests/storage/test_copy_blob_from_uri.rb +2 -2
- data/test/requests/storage/test_create_block_blob.rb +2 -2
- data/test/requests/storage/test_create_container.rb +2 -2
- data/test/requests/storage/test_create_page_blob.rb +2 -2
- data/test/requests/storage/test_delete_blob.rb +2 -2
- data/test/requests/storage/test_delete_blob_https_url.rb +7 -10
- data/test/requests/storage/test_delete_container.rb +2 -2
- data/test/requests/storage/test_delete_object.rb +2 -2
- data/test/requests/storage/test_get_blob.rb +2 -2
- data/test/requests/storage/test_get_blob_encoding.rb +45 -0
- data/test/requests/storage/test_get_blob_http_url.rb +13 -9
- data/test/requests/storage/test_get_blob_https_url.rb +95 -13
- data/test/requests/storage/test_get_blob_properties.rb +2 -2
- data/test/requests/storage/test_get_blob_url.rb +15 -24
- data/test/requests/storage/test_get_container_acl.rb +2 -2
- data/test/requests/storage/test_get_container_properties.rb +2 -2
- data/test/requests/storage/test_get_container_url.rb +5 -8
- data/test/requests/storage/test_get_object.rb +2 -2
- data/test/requests/storage/test_list_blobs.rb +2 -2
- data/test/requests/storage/test_list_containers.rb +2 -2
- data/test/requests/storage/test_put_blob_block.rb +2 -2
- data/test/requests/storage/test_put_blob_http_url.rb +33 -0
- data/test/requests/storage/test_put_blob_https_url.rb +8 -11
- data/test/requests/storage/test_put_blob_metadata.rb +2 -2
- data/test/requests/storage/test_put_blob_pages.rb +2 -2
- data/test/requests/storage/test_put_blob_properties.rb +2 -2
- data/test/requests/storage/test_put_container_acl.rb +2 -2
- data/test/requests/storage/test_put_container_metadata.rb +2 -2
- data/test/requests/storage/test_release_blob_lease.rb +2 -2
- data/test/requests/storage/test_release_container_lease.rb +2 -2
- data/test/requests/storage/test_save_page_blob.rb +2 -2
- data/test/requests/storage/test_wait_blob_copy_operation_to_finish.rb +15 -6
- data/test/test_helper.rb +38 -690
- metadata +27 -20
- data/lib/fog/azurerm/models/resources/azure_resource.rb +0 -25
- data/lib/fog/azurerm/models/resources/azure_resources.rb +0 -40
- data/lib/fog/azurerm/models/resources/dependency.rb +0 -27
- data/lib/fog/azurerm/models/resources/deployment.rb +0 -65
- data/lib/fog/azurerm/models/resources/deployments.rb +0 -30
- data/lib/fog/azurerm/models/resources/provider.rb +0 -27
- data/lib/fog/azurerm/models/resources/provider_resource_type.rb +0 -22
- data/lib/fog/azurerm/models/resources/resource_group.rb +0 -34
- data/lib/fog/azurerm/models/resources/resource_groups.rb +0 -29
- data/test/integration/storage_account.rb +0 -135
- data/test/smoke_tests/compute/test_resource_group_smoke.rb +0 -37
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-fog-azure-rm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaffan Chaudhry
|
@@ -18,7 +18,7 @@ authors:
|
|
18
18
|
autorequire:
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
|
-
date:
|
21
|
+
date: 2024-03-16 00:00:00.000000000 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
name: codeclimate-test-reporter
|
@@ -90,6 +90,20 @@ dependencies:
|
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '0'
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: webrick
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '1.8'
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - "~>"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '1.8'
|
93
107
|
- !ruby/object:Gem::Dependency
|
94
108
|
name: azure-storage-blob
|
95
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,30 +136,30 @@ dependencies:
|
|
122
136
|
name: fog-core
|
123
137
|
requirement: !ruby/object:Gem::Requirement
|
124
138
|
requirements:
|
125
|
-
- -
|
139
|
+
- - "~>"
|
126
140
|
- !ruby/object:Gem::Version
|
127
|
-
version: 2.1
|
141
|
+
version: '2.1'
|
128
142
|
type: :runtime
|
129
143
|
prerelease: false
|
130
144
|
version_requirements: !ruby/object:Gem::Requirement
|
131
145
|
requirements:
|
132
|
-
- -
|
146
|
+
- - "~>"
|
133
147
|
- !ruby/object:Gem::Version
|
134
|
-
version: 2.1
|
148
|
+
version: '2.1'
|
135
149
|
- !ruby/object:Gem::Dependency
|
136
150
|
name: fog-json
|
137
151
|
requirement: !ruby/object:Gem::Requirement
|
138
152
|
requirements:
|
139
153
|
- - "~>"
|
140
154
|
- !ruby/object:Gem::Version
|
141
|
-
version: 1.2
|
155
|
+
version: '1.2'
|
142
156
|
type: :runtime
|
143
157
|
prerelease: false
|
144
158
|
version_requirements: !ruby/object:Gem::Requirement
|
145
159
|
requirements:
|
146
160
|
- - "~>"
|
147
161
|
- !ruby/object:Gem::Version
|
148
|
-
version: 1.2
|
162
|
+
version: '1.2'
|
149
163
|
- !ruby/object:Gem::Dependency
|
150
164
|
name: mime-types
|
151
165
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,15 +204,7 @@ files:
|
|
190
204
|
- lib/fog/azurerm/custom_fog_errors.rb
|
191
205
|
- lib/fog/azurerm/docs/storage.md
|
192
206
|
- lib/fog/azurerm/docs/structure.md
|
193
|
-
- lib/fog/azurerm/
|
194
|
-
- lib/fog/azurerm/models/resources/azure_resources.rb
|
195
|
-
- lib/fog/azurerm/models/resources/dependency.rb
|
196
|
-
- lib/fog/azurerm/models/resources/deployment.rb
|
197
|
-
- lib/fog/azurerm/models/resources/deployments.rb
|
198
|
-
- lib/fog/azurerm/models/resources/provider.rb
|
199
|
-
- lib/fog/azurerm/models/resources/provider_resource_type.rb
|
200
|
-
- lib/fog/azurerm/models/resources/resource_group.rb
|
201
|
-
- lib/fog/azurerm/models/resources/resource_groups.rb
|
207
|
+
- lib/fog/azurerm/identity_encoding_filter.rb
|
202
208
|
- lib/fog/azurerm/models/storage/directories.rb
|
203
209
|
- lib/fog/azurerm/models/storage/directory.rb
|
204
210
|
- lib/fog/azurerm/models/storage/file.rb
|
@@ -237,6 +243,7 @@ files:
|
|
237
243
|
- lib/fog/azurerm/requests/storage/list_blobs.rb
|
238
244
|
- lib/fog/azurerm/requests/storage/list_containers.rb
|
239
245
|
- lib/fog/azurerm/requests/storage/put_blob_block.rb
|
246
|
+
- lib/fog/azurerm/requests/storage/put_blob_http_url.rb
|
240
247
|
- lib/fog/azurerm/requests/storage/put_blob_https_url.rb
|
241
248
|
- lib/fog/azurerm/requests/storage/put_blob_metadata.rb
|
242
249
|
- lib/fog/azurerm/requests/storage/put_blob_pages.rb
|
@@ -263,7 +270,6 @@ files:
|
|
263
270
|
- test/integration/blob.rb
|
264
271
|
- test/integration/container.rb
|
265
272
|
- test/integration/credentials/azure.yml
|
266
|
-
- test/integration/storage_account.rb
|
267
273
|
- test/models/storage/test_directories.rb
|
268
274
|
- test/models/storage/test_directory.rb
|
269
275
|
- test/models/storage/test_file.rb
|
@@ -283,6 +289,7 @@ files:
|
|
283
289
|
- test/requests/storage/test_delete_container.rb
|
284
290
|
- test/requests/storage/test_delete_object.rb
|
285
291
|
- test/requests/storage/test_get_blob.rb
|
292
|
+
- test/requests/storage/test_get_blob_encoding.rb
|
286
293
|
- test/requests/storage/test_get_blob_http_url.rb
|
287
294
|
- test/requests/storage/test_get_blob_https_url.rb
|
288
295
|
- test/requests/storage/test_get_blob_properties.rb
|
@@ -294,6 +301,7 @@ files:
|
|
294
301
|
- test/requests/storage/test_list_blobs.rb
|
295
302
|
- test/requests/storage/test_list_containers.rb
|
296
303
|
- test/requests/storage/test_put_blob_block.rb
|
304
|
+
- test/requests/storage/test_put_blob_http_url.rb
|
297
305
|
- test/requests/storage/test_put_blob_https_url.rb
|
298
306
|
- test/requests/storage/test_put_blob_metadata.rb
|
299
307
|
- test/requests/storage/test_put_blob_pages.rb
|
@@ -304,7 +312,6 @@ files:
|
|
304
312
|
- test/requests/storage/test_release_container_lease.rb
|
305
313
|
- test/requests/storage/test_save_page_blob.rb
|
306
314
|
- test/requests/storage/test_wait_blob_copy_operation_to_finish.rb
|
307
|
-
- test/smoke_tests/compute/test_resource_group_smoke.rb
|
308
315
|
- test/test_helper.rb
|
309
316
|
homepage: https://gitlab.com/gitlab-org/gitlab-fog-azure-rm
|
310
317
|
licenses:
|
@@ -326,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
333
|
- !ruby/object:Gem::Version
|
327
334
|
version: '0'
|
328
335
|
requirements: []
|
329
|
-
rubygems_version: 3.
|
336
|
+
rubygems_version: 3.3.26
|
330
337
|
signing_key:
|
331
338
|
specification_version: 4
|
332
339
|
summary: Module for the 'fog' gem to support Azure Blob Storage with CarrierWave and
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Resources
|
3
|
-
class AzureRM
|
4
|
-
# This class is giving implementation of create/save and
|
5
|
-
# delete/destroy for resources.
|
6
|
-
class AzureResource < Fog::Model
|
7
|
-
attribute :id
|
8
|
-
attribute :name
|
9
|
-
attribute :type
|
10
|
-
attribute :location
|
11
|
-
attribute :tags
|
12
|
-
|
13
|
-
def self.parse(resource)
|
14
|
-
hash = {}
|
15
|
-
hash['id'] = resource.id
|
16
|
-
hash['name'] = resource.name
|
17
|
-
hash['type'] = resource.type
|
18
|
-
hash['location'] = resource.location
|
19
|
-
hash['tags'] = resource.tags
|
20
|
-
hash
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Resources
|
3
|
-
class AzureRM
|
4
|
-
# This class is giving implementation of all/list and get.
|
5
|
-
class AzureResources < Fog::Collection
|
6
|
-
attribute :tag_name
|
7
|
-
attribute :tag_value
|
8
|
-
model Fog::Resources::AzureRM::AzureResource
|
9
|
-
|
10
|
-
def all
|
11
|
-
unless tag_name.nil? && tag_value.nil?
|
12
|
-
resources = []
|
13
|
-
service.list_tagged_resources(tag_name, tag_value).each do |resource|
|
14
|
-
resources << Fog::Resources::AzureRM::AzureResource.parse(resource)
|
15
|
-
end
|
16
|
-
resources.inspect
|
17
|
-
return load(resources)
|
18
|
-
end
|
19
|
-
nil
|
20
|
-
end
|
21
|
-
|
22
|
-
def get(resource_id)
|
23
|
-
all.find { |f| f.id == resource_id }
|
24
|
-
end
|
25
|
-
|
26
|
-
def check_azure_resource_exists(resource_id, api_version)
|
27
|
-
service.check_azure_resource_exists(resource_id, api_version)
|
28
|
-
end
|
29
|
-
|
30
|
-
def list_resources_in_resource_group(resource_group_name)
|
31
|
-
resources = []
|
32
|
-
service.list_resources_in_resource_group(resource_group_name).each do |resource|
|
33
|
-
resources.push(Fog::Resources::AzureRM::AzureResource.parse(resource))
|
34
|
-
end
|
35
|
-
load(resources)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Resources
|
3
|
-
class AzureRM
|
4
|
-
# Dependency model class
|
5
|
-
class Dependency < Fog::Model
|
6
|
-
attribute :id
|
7
|
-
attribute :resource_name
|
8
|
-
attribute :resource_type
|
9
|
-
attribute :depends_on
|
10
|
-
|
11
|
-
def self.parse(dependency)
|
12
|
-
hash = {}
|
13
|
-
hash['id'] = dependency.id
|
14
|
-
hash['resource_name'] = dependency.resource_name
|
15
|
-
hash['resource_type'] = dependency.resource_type
|
16
|
-
|
17
|
-
hash['depends_on'] = []
|
18
|
-
dependency.depends_on.each do |sub_dependency|
|
19
|
-
dependency_obj = Fog::Resources::AzureRM::Dependency.new
|
20
|
-
hash['depends_on'] << dependency_obj.merge_attributes(Fog::Resources::AzureRM::Dependency.parse(sub_dependency))
|
21
|
-
end if dependency.respond_to?('depends_on')
|
22
|
-
hash
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Resources
|
3
|
-
class AzureRM
|
4
|
-
# This class is giving implementation of create/save and
|
5
|
-
# delete/destroy for Deployment model.
|
6
|
-
class Deployment < Fog::Model
|
7
|
-
identity :name
|
8
|
-
attribute :id
|
9
|
-
attribute :resource_group
|
10
|
-
attribute :correlation_id
|
11
|
-
attribute :timestamp
|
12
|
-
attribute :outputs
|
13
|
-
attribute :providers
|
14
|
-
attribute :dependencies
|
15
|
-
attribute :template_link
|
16
|
-
attribute :parameters_link
|
17
|
-
attribute :mode
|
18
|
-
attribute :debug_setting
|
19
|
-
attribute :content_version
|
20
|
-
attribute :provisioning_state
|
21
|
-
|
22
|
-
def self.parse(deployment)
|
23
|
-
hash = {}
|
24
|
-
hash['name'] = deployment.name
|
25
|
-
hash['id'] = deployment.id
|
26
|
-
hash['resource_group'] = get_resource_from_resource_id(deployment.id, RESOURCE_GROUP_NAME)
|
27
|
-
hash['correlation_id'] = deployment.properties.correlation_id
|
28
|
-
hash['timestamp'] = deployment.properties.timestamp
|
29
|
-
hash['outputs'] = deployment.properties.outputs
|
30
|
-
|
31
|
-
hash['providers'] = []
|
32
|
-
deployment.properties.providers.each do |provider|
|
33
|
-
provider_obj = Fog::Resources::AzureRM::Provider.new
|
34
|
-
hash['providers'] << provider_obj.merge_attributes(Fog::Resources::AzureRM::Provider.parse(provider))
|
35
|
-
end
|
36
|
-
|
37
|
-
hash['dependencies'] = []
|
38
|
-
deployment.properties.dependencies.each do |dependency|
|
39
|
-
dependency_obj = Fog::Resources::AzureRM::Dependency.new
|
40
|
-
hash['dependencies'] << dependency_obj.merge_attributes(Fog::Resources::AzureRM::Dependency.parse(dependency))
|
41
|
-
end
|
42
|
-
|
43
|
-
hash['template_link'] = deployment.properties.template_link.uri
|
44
|
-
hash['parameters_link'] = deployment.properties.parameters_link.uri
|
45
|
-
hash['content_version'] = deployment.properties.template_link.content_version
|
46
|
-
hash['mode'] = deployment.properties.mode
|
47
|
-
hash['debug_setting'] = deployment.properties.debug_setting.detail_level unless deployment.properties.debug_setting.nil?
|
48
|
-
hash['provisioning_state'] = deployment.properties.provisioning_state
|
49
|
-
hash
|
50
|
-
end
|
51
|
-
|
52
|
-
def save
|
53
|
-
requires :name, :resource_group, :template_link, :parameters_link
|
54
|
-
|
55
|
-
deployment = service.create_deployment(resource_group, name, template_link, parameters_link)
|
56
|
-
merge_attributes(Fog::Resources::AzureRM::Deployment.parse(deployment))
|
57
|
-
end
|
58
|
-
|
59
|
-
def destroy
|
60
|
-
service.delete_deployment(resource_group, name)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Resources
|
3
|
-
class AzureRM
|
4
|
-
# Deployments collection class
|
5
|
-
class Deployments < Fog::Collection
|
6
|
-
attribute :resource_group
|
7
|
-
model Fog::Resources::AzureRM::Deployment
|
8
|
-
|
9
|
-
def all
|
10
|
-
requires :resource_group
|
11
|
-
deployments = []
|
12
|
-
service.list_deployments(resource_group).each do |deployment|
|
13
|
-
deployments << Fog::Resources::AzureRM::Deployment.parse(deployment)
|
14
|
-
end
|
15
|
-
load(deployments)
|
16
|
-
end
|
17
|
-
|
18
|
-
def get(resource_group_name, deployment_name)
|
19
|
-
deployment = service.get_deployment(resource_group_name, deployment_name)
|
20
|
-
deployment_fog = Fog::Resources::AzureRM::Deployment.new(service: service)
|
21
|
-
deployment_fog.merge_attributes(Fog::Resources::AzureRM::Deployment.parse(deployment))
|
22
|
-
end
|
23
|
-
|
24
|
-
def check_deployment_exists(resource_group_name, deployment_name)
|
25
|
-
service.check_deployment_exists(resource_group_name, deployment_name)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Resources
|
3
|
-
class AzureRM
|
4
|
-
# Provider model class
|
5
|
-
class Provider < Fog::Model
|
6
|
-
attribute :id
|
7
|
-
attribute :namespace
|
8
|
-
attribute :registration_state
|
9
|
-
attribute :resource_types
|
10
|
-
|
11
|
-
def self.parse(provider)
|
12
|
-
hash = {}
|
13
|
-
hash['id'] = provider.id
|
14
|
-
hash['namespace'] = provider.namespace
|
15
|
-
hash['registration_state'] = provider.registration_state if provider.respond_to?('registration_state')
|
16
|
-
|
17
|
-
hash['resource_types'] = []
|
18
|
-
provider.resource_types.each do |provider_resource_type|
|
19
|
-
provider_resource_type_obj = Fog::Resources::AzureRM::ProviderResourceType.new
|
20
|
-
hash['resource_types'] << provider_resource_type_obj.merge_attributes(Fog::Resources::AzureRM::ProviderResourceType.parse(provider_resource_type))
|
21
|
-
end
|
22
|
-
hash
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Resources
|
3
|
-
class AzureRM
|
4
|
-
# ProviderResourceType model class
|
5
|
-
class ProviderResourceType < Fog::Model
|
6
|
-
attribute :resource_type
|
7
|
-
attribute :locations
|
8
|
-
attribute :api_versions
|
9
|
-
attribute :properties
|
10
|
-
|
11
|
-
def self.parse(provider_resource_type)
|
12
|
-
hash = {}
|
13
|
-
hash['resource_type'] = provider_resource_type.resource_type
|
14
|
-
hash['locations'] = provider_resource_type.locations
|
15
|
-
hash['api_versions'] = provider_resource_type.api_versions if provider_resource_type.respond_to?('api_versions')
|
16
|
-
hash['properties'] = provider_resource_type.properties if provider_resource_type.respond_to?('properties')
|
17
|
-
hash
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Resources
|
3
|
-
class AzureRM
|
4
|
-
# This class is giving implementation of create/save and
|
5
|
-
# delete/destroy for resource group.
|
6
|
-
class ResourceGroup < Fog::Model
|
7
|
-
identity :name
|
8
|
-
attribute :id
|
9
|
-
attribute :location
|
10
|
-
attribute :tags
|
11
|
-
|
12
|
-
def self.parse(resource_group)
|
13
|
-
hash = {}
|
14
|
-
hash['id'] = resource_group.id
|
15
|
-
hash['name'] = resource_group.name
|
16
|
-
hash['location'] = resource_group.location
|
17
|
-
hash['tags'] = resource_group.tags
|
18
|
-
hash
|
19
|
-
end
|
20
|
-
|
21
|
-
def save
|
22
|
-
requires :name
|
23
|
-
requires :location
|
24
|
-
resource_group = service.create_resource_group(name, location, tags)
|
25
|
-
merge_attributes(Fog::Resources::AzureRM::ResourceGroup.parse(resource_group))
|
26
|
-
end
|
27
|
-
|
28
|
-
def destroy
|
29
|
-
service.delete_resource_group(name)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Resources
|
3
|
-
class AzureRM
|
4
|
-
# This class is giving implementation of all/list, get and
|
5
|
-
# check name availability for resource groups.
|
6
|
-
class ResourceGroups < Fog::Collection
|
7
|
-
model Fog::Resources::AzureRM::ResourceGroup
|
8
|
-
|
9
|
-
def all
|
10
|
-
resource_groups = []
|
11
|
-
service.list_resource_groups.each do |resource_group|
|
12
|
-
resource_groups.push(Fog::Resources::AzureRM::ResourceGroup.parse(resource_group))
|
13
|
-
end
|
14
|
-
load(resource_groups)
|
15
|
-
end
|
16
|
-
|
17
|
-
def get(resource_group_name)
|
18
|
-
resource_group = service.get_resource_group(resource_group_name)
|
19
|
-
resource_group_fog = Fog::Resources::AzureRM::ResourceGroup.new(service: service)
|
20
|
-
resource_group_fog.merge_attributes(Fog::Resources::AzureRM::ResourceGroup.parse(resource_group))
|
21
|
-
end
|
22
|
-
|
23
|
-
def check_resource_group_exists(resource_group_name)
|
24
|
-
service.check_resource_group_exists(resource_group_name)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,135 +0,0 @@
|
|
1
|
-
require 'fog/azurerm'
|
2
|
-
require 'yaml'
|
3
|
-
|
4
|
-
########################################################################################################################
|
5
|
-
###################### Services object required by all actions ######################
|
6
|
-
###################### Keep it Uncommented! ######################
|
7
|
-
########################################################################################################################
|
8
|
-
|
9
|
-
azure_credentials = YAML.load_file(File.expand_path('credentials/azure.yml', __dir__))
|
10
|
-
|
11
|
-
rs = Fog::Resources::AzureRM.new(
|
12
|
-
tenant_id: azure_credentials['tenant_id'],
|
13
|
-
client_id: azure_credentials['client_id'],
|
14
|
-
client_secret: azure_credentials['client_secret'],
|
15
|
-
subscription_id: azure_credentials['subscription_id']
|
16
|
-
)
|
17
|
-
|
18
|
-
storage = Fog::Storage::AzureRM.new(
|
19
|
-
tenant_id: azure_credentials['tenant_id'],
|
20
|
-
client_id: azure_credentials['client_id'],
|
21
|
-
client_secret: azure_credentials['client_secret'],
|
22
|
-
subscription_id: azure_credentials['subscription_id'],
|
23
|
-
environment: azure_credentials['environment']
|
24
|
-
)
|
25
|
-
|
26
|
-
########################################################################################################################
|
27
|
-
###################### Resource names #####################
|
28
|
-
########################################################################################################################
|
29
|
-
|
30
|
-
time = current_time
|
31
|
-
resource_group_name = "TestRG-SA-#{time}"
|
32
|
-
storage_account_name = "teststorage#{time}"
|
33
|
-
lrs_storage_account = "lrs#{time}"
|
34
|
-
grs_storage_account = "grs#{time}"
|
35
|
-
premium_storage_acc = "premsa#{time}"
|
36
|
-
|
37
|
-
########################################################################################################################
|
38
|
-
###################### Prerequisites ######################
|
39
|
-
########################################################################################################################
|
40
|
-
|
41
|
-
begin
|
42
|
-
resource_group = rs.resource_groups.create(
|
43
|
-
name: resource_group_name,
|
44
|
-
location: LOCATION
|
45
|
-
)
|
46
|
-
|
47
|
-
########################################################################################################################
|
48
|
-
###################### Check Storage Account name Availability ######################
|
49
|
-
########################################################################################################################
|
50
|
-
|
51
|
-
storage_account_avail = storage.storage_accounts.check_name_availability(storage_account_name)
|
52
|
-
puts storage_account_avail ? 'Storage Account name available' : 'Storage Account name unavailable'
|
53
|
-
|
54
|
-
########################################################################################################################
|
55
|
-
###################### Check Subnet Exists? ######################
|
56
|
-
########################################################################################################################
|
57
|
-
|
58
|
-
flag = storage.storage_accounts.check_storage_account_exists(resource_group_name, lrs_storage_account)
|
59
|
-
puts "Storage Account doesn't exist." unless flag
|
60
|
-
|
61
|
-
########################################################################################################################
|
62
|
-
############### Create A Standard Storage Account of Replication: LRS (Locally-redundant storage) ###############
|
63
|
-
########################################################################################################################
|
64
|
-
|
65
|
-
tags = { key1: 'value1', key2: 'value2' }
|
66
|
-
|
67
|
-
storage_account = storage.storage_accounts.create(
|
68
|
-
name: lrs_storage_account,
|
69
|
-
location: LOCATION,
|
70
|
-
resource_group: resource_group_name,
|
71
|
-
tags: tags
|
72
|
-
)
|
73
|
-
puts "Created storage account for standard lrs replication: #{storage_account.name}"
|
74
|
-
|
75
|
-
########################################################################################################################
|
76
|
-
############### Create A Standard Storage Account of Replication: GRS (Geo-redundant storage) #################
|
77
|
-
########################################################################################################################
|
78
|
-
|
79
|
-
storage_account = storage.storage_accounts.create(
|
80
|
-
name: grs_storage_account,
|
81
|
-
location: LOCATION,
|
82
|
-
resource_group: resource_group_name,
|
83
|
-
sku_name: Fog::ARM::Storage::Models::SkuTier::Standard,
|
84
|
-
replication: 'GRS',
|
85
|
-
encryption: true,
|
86
|
-
tags: tags
|
87
|
-
)
|
88
|
-
puts "Created storage account for standard grs replication: #{storage_account.name}"
|
89
|
-
|
90
|
-
########################################################################################################################
|
91
|
-
########### Create A Premium(SSD) Storage Account of its only Replication: LRS (Locally-redundant storage) ##########
|
92
|
-
########################################################################################################################
|
93
|
-
|
94
|
-
storage_account = storage.storage_accounts.create(
|
95
|
-
name: premium_storage_acc,
|
96
|
-
location: LOCATION,
|
97
|
-
resource_group: resource_group_name,
|
98
|
-
sku_name: Fog::ARM::Storage::Models::SkuTier::Premium,
|
99
|
-
replication: 'LRS',
|
100
|
-
tags: tags
|
101
|
-
)
|
102
|
-
puts "Created storage account for premium lrs replication: #{storage_account.name}"
|
103
|
-
|
104
|
-
########################################################################################################################
|
105
|
-
###################### Get and Update Storage Account ######################
|
106
|
-
########################################################################################################################
|
107
|
-
|
108
|
-
premium_storage_account = storage.storage_accounts.get(resource_group_name, premium_storage_acc)
|
109
|
-
puts "Get storage account: #{premium_storage_account.name}"
|
110
|
-
premium_storage_account.update(encryption: true)
|
111
|
-
puts 'Updated encryption of storage account'
|
112
|
-
|
113
|
-
########################################################################################################################
|
114
|
-
###################### Get and Delete Storage Account ######################
|
115
|
-
########################################################################################################################
|
116
|
-
|
117
|
-
standard_storage_account = storage.storage_accounts.get(resource_group_name, lrs_storage_account)
|
118
|
-
puts "Deleted storage account for standard lrs replication: #{standard_storage_account.destroy}"
|
119
|
-
standard_storage_account = storage.storage_accounts.get(resource_group_name, grs_storage_account)
|
120
|
-
puts "Deleted storage account for standard grs replication: #{standard_storage_account.destroy}"
|
121
|
-
premium_storage_account = storage.storage_accounts.get(resource_group_name, premium_storage_acc)
|
122
|
-
puts "Deleted storage account for premium lrs replication: #{premium_storage_account.destroy}"
|
123
|
-
|
124
|
-
########################################################################################################################
|
125
|
-
###################### CleanUp ######################
|
126
|
-
########################################################################################################################
|
127
|
-
|
128
|
-
resource_group = rs.resource_groups.get(resource_group_name)
|
129
|
-
resource_group.destroy
|
130
|
-
|
131
|
-
puts 'Integration test for storage account ran successfully!'
|
132
|
-
rescue
|
133
|
-
puts 'Integration Test for storage account is failing'
|
134
|
-
resource_group.destroy unless resource_group.nil?
|
135
|
-
end
|
@@ -1,37 +0,0 @@
|
|
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
|