fog-azure-rm 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/fog/azurerm/custom_fog_errors.rb +34 -0
- data/lib/fog/azurerm/utilities/general.rb +5 -2
- data/lib/fog/azurerm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c809af0240be64ebd6d2409f63ee1ba6d9477bcd0ad6fb09a4dbf28d919d2014
|
4
|
+
data.tar.gz: 83b01f0e0f6cbd07550cdc8e4077f0d8b2592177d1ecc56a97e6a5c9d9ce7ce0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cef6c46653c45ca8d6c2723351151007382878236b0fad39dc2362c007226384f51b6ada0eddb8729f458866862be06ac3e31967fdbda9c90e8b20eb122af906
|
7
|
+
data.tar.gz: 469dc5624979423be96e432deb666f1605b8bf5827f72a0b07664a14108ff050dca2a2ad1dbf9e69d7e24f7fa33d19c6e2dc4dd9273e7a3395dd9bff4854bd1b
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,40 @@ module Fog
|
|
6
6
|
def initialize(message, azure_exception)
|
7
7
|
super(azure_exception.request, azure_exception.response, azure_exception.body, "Exception in #{message}")
|
8
8
|
end
|
9
|
+
|
10
|
+
def print_subscription_limits_information
|
11
|
+
request_method = @request.method
|
12
|
+
subscription_id = @request.path_params['subscriptionId']
|
13
|
+
|
14
|
+
limit_value = remaining_subscription_request_limits(@response)
|
15
|
+
|
16
|
+
puts "Subscription: '#{subscription_id}'. Request Method: '#{request_method}'. \nLimit Value: #{limit_value['header']}: #{limit_value['value']}\n" unless limit_value.empty?
|
17
|
+
end
|
18
|
+
|
19
|
+
def remaining_subscription_request_limits(response)
|
20
|
+
limit = {}
|
21
|
+
# handles both read and write limits
|
22
|
+
if response.headers.key? 'x-ms-ratelimit-remaining-subscription-resource-requests'
|
23
|
+
limit['header'] = 'x-ms-ratelimit-remaining-subscription-resource-requests'
|
24
|
+
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-resource-requests']
|
25
|
+
|
26
|
+
# limit for collection API calls
|
27
|
+
elsif response.headers.key? 'x-ms-ratelimit-remaining-subscription-resource-entities-read'
|
28
|
+
limit['header'] = 'x-ms-ratelimit-remaining-subscription-resource-entities-read'
|
29
|
+
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-resource-entities-read']
|
30
|
+
|
31
|
+
# read requests limit
|
32
|
+
elsif response.headers.key? 'x-ms-ratelimit-remaining-subscription-reads'
|
33
|
+
limit['header'] = 'x-ms-ratelimit-remaining-subscription-reads'
|
34
|
+
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-reads']
|
35
|
+
|
36
|
+
# write requests limit
|
37
|
+
elsif response.headers.key? 'x-ms-ratelimit-remaining-subscription-writes'
|
38
|
+
limit['header'] = 'x-ms-ratelimit-remaining-subscription-writes'
|
39
|
+
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-writes']
|
40
|
+
end
|
41
|
+
limit
|
42
|
+
end
|
9
43
|
end
|
10
44
|
|
11
45
|
# This is a custom Fog exception inherited from Azure::Core::Http::HTTPError
|
@@ -50,8 +50,11 @@ end
|
|
50
50
|
|
51
51
|
def raise_azure_exception(exception, msg)
|
52
52
|
raise Fog::AzureRM::CustomAzureCoreHttpError.new(exception) if exception.is_a?(Azure::Core::Http::HTTPError)
|
53
|
-
raise
|
54
|
-
|
53
|
+
raise exception unless exception.is_a?(MsRestAzure::AzureOperationError)
|
54
|
+
|
55
|
+
azure_operation_error = Fog::AzureRM::CustomAzureOperationError.new(msg, exception)
|
56
|
+
azure_operation_error.print_subscription_limits_information if !azure_operation_error.request.nil? && !azure_operation_error.response.nil?
|
57
|
+
raise azure_operation_error
|
55
58
|
end
|
56
59
|
|
57
60
|
# Make sure if input_params(Hash) contains all keys present in required_params(Array)
|
data/lib/fog/azurerm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-azure-rm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
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: 2019-
|
21
|
+
date: 2019-04-30 00:00:00.000000000 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
name: rake
|