gitlab-fog-azure-rm 1.9.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/Gemfile +3 -0
  4. data/gitlab-fog-azure-rm.gemspec +1 -3
  5. data/lib/fog/azurerm/version.rb +1 -1
  6. data/vendor/azure-storage-ruby/.env_sample +8 -0
  7. data/vendor/azure-storage-ruby/.gitignore +35 -0
  8. data/vendor/azure-storage-ruby/.rubocop.yml +132 -0
  9. data/vendor/azure-storage-ruby/.travis.yml +23 -0
  10. data/vendor/azure-storage-ruby/BreakingChanges.md +34 -0
  11. data/vendor/azure-storage-ruby/CONTRIBUTING.md +74 -0
  12. data/vendor/azure-storage-ruby/ChangeLog.md +198 -0
  13. data/vendor/azure-storage-ruby/Gemfile +41 -0
  14. data/vendor/azure-storage-ruby/README.md +48 -0
  15. data/vendor/azure-storage-ruby/Rakefile +216 -0
  16. data/vendor/azure-storage-ruby/SECURITY.md +41 -0
  17. data/vendor/azure-storage-ruby/blob/BreakingChanges.md +10 -0
  18. data/vendor/azure-storage-ruby/blob/ChangeLog.md +33 -0
  19. data/vendor/azure-storage-ruby/blob/Gemfile +30 -0
  20. data/vendor/azure-storage-ruby/blob/LICENSE.txt +21 -0
  21. data/vendor/azure-storage-ruby/blob/README.md +188 -0
  22. data/vendor/azure-storage-ruby/blob/azure-storage-blob.gemspec +52 -0
  23. data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/append.rb +244 -0
  24. data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/autoload.rb +47 -0
  25. data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/blob.rb +932 -0
  26. data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/blob_service.rb +720 -0
  27. data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/block.rb +530 -0
  28. data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/container.rb +634 -0
  29. data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/default.rb +171 -0
  30. data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/page.rb +566 -0
  31. data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/serialization.rb +351 -0
  32. data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/version.rb +49 -0
  33. data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob.rb +26 -0
  34. data/vendor/azure-storage-ruby/common/BreakingChanges.md +8 -0
  35. data/vendor/azure-storage-ruby/common/ChangeLog.md +41 -0
  36. data/vendor/azure-storage-ruby/common/Gemfile +30 -0
  37. data/vendor/azure-storage-ruby/common/LICENSE.txt +21 -0
  38. data/vendor/azure-storage-ruby/common/README.md +146 -0
  39. data/vendor/azure-storage-ruby/common/azure-storage-common.gemspec +57 -0
  40. data/vendor/azure-storage-ruby/common/lib/azure/core/auth/authorizer.rb +36 -0
  41. data/vendor/azure-storage-ruby/common/lib/azure/core/auth/shared_key.rb +125 -0
  42. data/vendor/azure-storage-ruby/common/lib/azure/core/auth/shared_key_lite.rb +48 -0
  43. data/vendor/azure-storage-ruby/common/lib/azure/core/auth/signer.rb +51 -0
  44. data/vendor/azure-storage-ruby/common/lib/azure/core/default.rb +23 -0
  45. data/vendor/azure-storage-ruby/common/lib/azure/core/error.rb +21 -0
  46. data/vendor/azure-storage-ruby/common/lib/azure/core/filtered_service.rb +45 -0
  47. data/vendor/azure-storage-ruby/common/lib/azure/core/http/debug_filter.rb +36 -0
  48. data/vendor/azure-storage-ruby/common/lib/azure/core/http/http_error.rb +135 -0
  49. data/vendor/azure-storage-ruby/common/lib/azure/core/http/http_filter.rb +53 -0
  50. data/vendor/azure-storage-ruby/common/lib/azure/core/http/http_request.rb +195 -0
  51. data/vendor/azure-storage-ruby/common/lib/azure/core/http/http_response.rb +102 -0
  52. data/vendor/azure-storage-ruby/common/lib/azure/core/http/retry_policy.rb +84 -0
  53. data/vendor/azure-storage-ruby/common/lib/azure/core/http/signer_filter.rb +33 -0
  54. data/vendor/azure-storage-ruby/common/lib/azure/core/service.rb +46 -0
  55. data/vendor/azure-storage-ruby/common/lib/azure/core/signed_service.rb +45 -0
  56. data/vendor/azure-storage-ruby/common/lib/azure/core/utility.rb +244 -0
  57. data/vendor/azure-storage-ruby/common/lib/azure/core/version.rb +33 -0
  58. data/vendor/azure-storage-ruby/common/lib/azure/core.rb +48 -0
  59. data/vendor/azure-storage-ruby/common/lib/azure/http_response_helper.rb +38 -0
  60. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/autoload.rb +62 -0
  61. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/client.rb +162 -0
  62. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/client_options.rb +363 -0
  63. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/client_options_error.rb +41 -0
  64. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/configurable.rb +212 -0
  65. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/anonymous_signer.rb +43 -0
  66. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/shared_access_signature.rb +30 -0
  67. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/shared_access_signature_generator.rb +399 -0
  68. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/shared_access_signature_signer.rb +57 -0
  69. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/shared_key.rb +60 -0
  70. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/token_signer.rb +43 -0
  71. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/autoload.rb +53 -0
  72. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/error.rb +43 -0
  73. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/filter/exponential_retry_filter.rb +64 -0
  74. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/filter/linear_retry_filter.rb +55 -0
  75. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/filter/retry_filter.rb +300 -0
  76. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/http_client.rb +82 -0
  77. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/sr.rb +85 -0
  78. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/token_credential.rb +64 -0
  79. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/utility.rb +261 -0
  80. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core.rb +35 -0
  81. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/default.rb +868 -0
  82. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/access_policy.rb +37 -0
  83. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/cors.rb +38 -0
  84. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/cors_rule.rb +48 -0
  85. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/enumeration_results.rb +32 -0
  86. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/geo_replication.rb +40 -0
  87. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/logging.rb +47 -0
  88. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/metrics.rb +45 -0
  89. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/retention_policy.rb +37 -0
  90. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/serialization.rb +335 -0
  91. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/signed_identifier.rb +40 -0
  92. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/storage_service.rb +322 -0
  93. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/storage_service_properties.rb +48 -0
  94. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/storage_service_stats.rb +39 -0
  95. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/user_delegation_key.rb +50 -0
  96. data/vendor/azure-storage-ruby/common/lib/azure/storage/common/version.rb +49 -0
  97. data/vendor/azure-storage-ruby/common/lib/azure/storage/common.rb +26 -0
  98. metadata +95 -31
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ #-------------------------------------------------------------------------
4
+ # # Copyright (c) Microsoft and contributors. All rights reserved.
5
+ #
6
+ # The MIT License(MIT)
7
+
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files(the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions :
14
+
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+ #--------------------------------------------------------------------------
26
+ require "azure/core"
27
+
28
+ module Azure::Storage::Common::Core
29
+ class TokenCredential
30
+
31
+ # Public: Initializes an instance of [Azure::Storage::Common::Core::TokenCredential]
32
+ #
33
+ # ==== Attributes
34
+ #
35
+ # * +token+ - String. The initial access token.
36
+ #
37
+ def initialize(token)
38
+ @token = token
39
+ @mutex = Mutex.new
40
+ end
41
+
42
+ # Public: Gets the access token
43
+ #
44
+ # Note: Providing this getter under the protect of a mutex
45
+ #
46
+ def token
47
+ @mutex.synchronize do
48
+ @token
49
+ end
50
+ end
51
+
52
+ # Public: Renews the access token
53
+ #
54
+ # ==== Attributes
55
+ #
56
+ # * +new_token+ - String. The new access token.
57
+ #
58
+ def renew_token(new_token)
59
+ @mutex.synchronize do
60
+ @token = new_token
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,261 @@
1
+ # frozen_string_literal: true
2
+
3
+ #-------------------------------------------------------------------------
4
+ # # Copyright (c) Microsoft and contributors. All rights reserved.
5
+ #
6
+ # The MIT License(MIT)
7
+
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files(the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions :
14
+
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+ #--------------------------------------------------------------------------
26
+
27
+ require "ipaddr"
28
+ require "azure/storage/common/core/error"
29
+
30
+ if RUBY_VERSION.to_f < 2.0
31
+ begin
32
+ require "Win32/Console/ANSI" if RUBY_PLATFORM =~ /win32|mingw32/
33
+ rescue LoadError
34
+ puts "WARNING: Output will look weird on Windows unless"\
35
+ ' you install the "win32console" gem.'
36
+ end
37
+ end
38
+
39
+ module Azure::Storage::Common
40
+ module Error
41
+ # Azure Error
42
+ class Error < Azure::Core::Error
43
+ attr_reader :description
44
+ attr_reader :status_code
45
+ attr_reader :type
46
+
47
+ def initialize(type, status, description)
48
+ @type = type
49
+ @status_code = status
50
+ @description = description
51
+ super("#{type} (#{status_code}): #{description}")
52
+ end
53
+ end
54
+ end
55
+
56
+ module Core
57
+ module Utility
58
+ def random_string(str = "azure", no_of_char = 5)
59
+ str + (0...no_of_char).map { ("a".."z").to_a[rand(26)] }.join
60
+ end
61
+
62
+ def xml_content(xml, key, default = "")
63
+ content = default
64
+ node = xml.at_css(key)
65
+ content = node.text if node
66
+ content
67
+ end
68
+
69
+ def locate_file(name)
70
+ if File.exist? name
71
+ name
72
+ elsif File.exist?(File.join(ENV["HOME"], name))
73
+ File.join(ENV["HOME"], name)
74
+ else
75
+ Azure::Loggerx.error_with_exit "Unable to find #{name} file "
76
+ end
77
+ end
78
+
79
+ def export_der(cert, key, pass = nil, name = nil)
80
+ pkcs12 = OpenSSL::PKCS12.create(pass, name, key, cert)
81
+ Base64.encode64(pkcs12.to_der)
82
+ rescue Exception => e
83
+ puts e.message
84
+ abort
85
+ end
86
+
87
+ def export_fingerprint(certificate)
88
+ Digest::SHA1.hexdigest(certificate.to_der)
89
+ end
90
+
91
+ def enable_winrm?(winrm_transport)
92
+ (!winrm_transport.nil? && (winrm_transport.select { |x| x.downcase == "http" || x.downcase == "https" }.size > 0))
93
+ end
94
+
95
+ def get_certificate(private_key_file)
96
+ rsa = OpenSSL::PKey.read File.read(private_key_file)
97
+ cert = OpenSSL::X509::Certificate.new
98
+ cert.version = 2
99
+ cert.serial = 0
100
+ name = OpenSSL::X509::Name.new([["CN", "Azure Management Certificate"]])
101
+ cert.subject = cert.issuer = name
102
+ cert.not_before = Time.now
103
+ cert.not_after = cert.not_before + (60 * 60 * 24 * 365)
104
+ cert.public_key = rsa.public_key
105
+ cert.sign(rsa, OpenSSL::Digest::SHA1.new)
106
+ cert
107
+ end
108
+
109
+ def initialize_external_logger(logger)
110
+ Loggerx.initialize_external_logger(logger)
111
+ end
112
+
113
+ def parse_charset_from_content_type(content_type)
114
+ if (content_type && content_type.length > 0)
115
+ charset = content_type.split(";").delete_if { |attribute| !attribute.lstrip.start_with?("charset=") }.map { |x| x.lstrip }[0]
116
+ charset["charset=".length...charset.length] if charset
117
+ end
118
+ end
119
+ end
120
+
121
+ # Logger
122
+ module Logger
123
+ class << self
124
+ attr_accessor :logger
125
+
126
+ def info(msg)
127
+ if logger.nil?
128
+ puts msg.bold.white
129
+ else
130
+ logger.info(msg)
131
+ end
132
+ end
133
+
134
+ def error_with_exit(msg)
135
+ if logger.nil?
136
+ puts msg.bold.red
137
+ else
138
+ logger.error(msg)
139
+ end
140
+
141
+ raise msg.bold.red
142
+ end
143
+
144
+ def warn(msg)
145
+ if logger.nil?
146
+ puts msg.yellow
147
+ else
148
+ logger.warn(msg)
149
+ end
150
+
151
+ msg
152
+ end
153
+
154
+ def error(msg)
155
+ if logger.nil?
156
+ puts msg.bold.red
157
+ else
158
+ logger.error(msg)
159
+ end
160
+
161
+ msg
162
+ end
163
+
164
+ def exception_message(msg)
165
+ if logger.nil?
166
+ puts msg.bold.red
167
+ else
168
+ logger.warn(msg)
169
+ end
170
+
171
+ raise msg.bold.red
172
+ end
173
+
174
+ def success(msg)
175
+ msg_with_new_line = msg + "\n"
176
+ if logger.nil?
177
+ print msg_with_new_line.green
178
+ else
179
+ logger.info(msg)
180
+ end
181
+ end
182
+
183
+ def initialize_external_logger(logger)
184
+ @logger = logger
185
+ end
186
+ end
187
+ end
188
+ end
189
+ end
190
+
191
+ class String
192
+ { reset: 0,
193
+ bold: 1,
194
+ dark: 2,
195
+ underline: 4,
196
+ blink: 5,
197
+ orange: 6,
198
+ negative: 7,
199
+ black: 30,
200
+ red: 31,
201
+ green: 32,
202
+ yellow: 33,
203
+ blue: 34,
204
+ magenta: 35,
205
+ cyan: 36,
206
+ white: 37,
207
+ }.each do |key, value|
208
+ define_method key do
209
+ "\e[#{value}m" + self + "\e[0m"
210
+ end
211
+ end
212
+ end
213
+
214
+ # Code validate private/public IP acceptable ranges.
215
+ class IPAddr
216
+ PRIVATE_RANGES = [
217
+ IPAddr.new('10.0.0.0/8'),
218
+ IPAddr.new('172.16.0.0/12'),
219
+ IPAddr.new('192.168.0.0/16')
220
+ ]
221
+
222
+ def private?
223
+ return false unless self.ipv4?
224
+ PRIVATE_RANGES.each do |ipr|
225
+ return true if ipr.include?(self)
226
+ end
227
+ false
228
+ end
229
+
230
+ def public?
231
+ !private?
232
+ end
233
+
234
+ class << self
235
+ def validate_ip_and_prefix(ip, cidr)
236
+ if cidr.to_s.empty?
237
+ raise "Cidr is missing for IP '#{ip}'."
238
+ elsif valid?(ip)
239
+ raise "Ip address '#{ip}' is invalid."
240
+ elsif !IPAddr.new(ip).private?
241
+ raise "Ip Address #{ip} must be private."
242
+ end
243
+ end
244
+
245
+ def validate_address_space(ip)
246
+ if ip.split("/").size != 2
247
+ raise "Cidr is invalid for IP #{ip}."
248
+ elsif valid?(ip)
249
+ raise "Address space '#{ip}' is invalid."
250
+ end
251
+ end
252
+
253
+ def address_prefix(ip, cidr)
254
+ ip + "/" + cidr.to_s
255
+ end
256
+
257
+ def valid?(ip)
258
+ (IPAddr.new(ip) rescue nil).nil?
259
+ end
260
+ end
261
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ #-------------------------------------------------------------------------
4
+ # # Copyright (c) Microsoft and contributors. All rights reserved.
5
+ #
6
+ # The MIT License(MIT)
7
+
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files(the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions :
14
+
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+ #--------------------------------------------------------------------------
26
+
27
+ module Azure
28
+ module Storage
29
+ end
30
+ end
31
+
32
+ require "azure/storage/common/core/error"
33
+ require "azure/storage/common/default"
34
+ require "azure/storage/common/core/sr"
35
+ require "azure/storage/common/core/utility"