azure_mgmt_subscriptions 0.18.0 → 0.18.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-06-01/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  3. data/lib/2017-11-01-preview/generated/azure_mgmt_subscriptions/subscription_definitions_client.rb +1 -1
  4. data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  5. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  6. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  7. data/lib/2019-06-01/generated/azure_mgmt_subscriptions.rb +43 -0
  8. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/location.rb +108 -0
  9. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/location_list_result.rb +55 -0
  10. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/managed_by_tenant.rb +47 -0
  11. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
  12. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation_display.rb +80 -0
  13. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +100 -0
  14. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/spending_limit.rb +17 -0
  15. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription.rb +145 -0
  16. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription_list_result.rb +98 -0
  17. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription_policies.rb +76 -0
  18. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription_state.rb +19 -0
  19. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/tenant_id_description.rb +61 -0
  20. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/tenant_list_result.rb +98 -0
  21. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
  22. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/operations.rb +222 -0
  23. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/subscription_client.rb +136 -0
  24. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/subscriptions.rb +409 -0
  25. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/tenants.rb +222 -0
  26. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions.rb +44 -0
  27. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/ad_principal.rb +47 -0
  28. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/canceled_subscription_id.rb +47 -0
  29. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/enabled_subscription_id.rb +47 -0
  30. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/error_response.rb +57 -0
  31. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/modern_csp_subscription_creation_parameters.rb +70 -0
  32. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/modern_subscription_creation_parameters.rb +117 -0
  33. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/offer_type.rb +16 -0
  34. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
  35. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/operation_display.rb +69 -0
  36. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +68 -0
  37. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/renamed_subscription_id.rb +47 -0
  38. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/subscription_creation_parameters.rb +115 -0
  39. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/subscription_creation_result.rb +47 -0
  40. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/subscription_name.rb +46 -0
  41. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
  42. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/operations.rb +110 -0
  43. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/subscription.rb +788 -0
  44. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +137 -0
  45. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/subscription_operation.rb +118 -0
  46. data/lib/2019-11-01/generated/azure_mgmt_subscriptions.rb +48 -0
  47. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/location.rb +109 -0
  48. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/location_list_result.rb +55 -0
  49. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/location_metadata.rb +129 -0
  50. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/managed_by_tenant.rb +47 -0
  51. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
  52. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/operation_display.rb +80 -0
  53. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +100 -0
  54. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/paired_region.rb +72 -0
  55. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/region_category.rb +16 -0
  56. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/region_type.rb +16 -0
  57. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/spending_limit.rb +17 -0
  58. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/subscription.rb +164 -0
  59. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/subscription_list_result.rb +98 -0
  60. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/subscription_policies.rb +76 -0
  61. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/subscription_state.rb +19 -0
  62. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/tenant_category.rb +17 -0
  63. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/tenant_id_description.rb +131 -0
  64. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/tenant_list_result.rb +98 -0
  65. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
  66. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/operations.rb +222 -0
  67. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/subscription_client.rb +136 -0
  68. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/subscriptions.rb +409 -0
  69. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/tenants.rb +222 -0
  70. data/lib/2020-09-01/generated/azure_mgmt_subscriptions.rb +46 -0
  71. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/alias_model.rb +429 -0
  72. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/canceled_subscription_id.rb +47 -0
  73. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/enabled_subscription_id.rb +47 -0
  74. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/error_response.rb +57 -0
  75. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/error_response_body.rb +48 -0
  76. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
  77. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/operation_display.rb +69 -0
  78. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +68 -0
  79. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/provisioning_state.rb +17 -0
  80. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_list_result.rb +68 -0
  81. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_request.rb +47 -0
  82. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_request_properties.rb +83 -0
  83. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_response.rb +83 -0
  84. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_response_properties.rb +59 -0
  85. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/renamed_subscription_id.rb +47 -0
  86. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/subscription_name.rb +46 -0
  87. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/workload.rb +16 -0
  88. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
  89. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/operations.rb +110 -0
  90. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/subscription.rb +304 -0
  91. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/subscription_client.rb +137 -0
  92. data/lib/azure_mgmt_subscriptions.rb +4 -0
  93. data/lib/profiles/latest/modules/subscriptions_profile_module.rb +121 -61
  94. data/lib/version.rb +1 -1
  95. metadata +89 -4
@@ -0,0 +1,304 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Subscriptions::Mgmt::V2020_09_01
7
+ #
8
+ # Subscription client provides an interface to create and manage Azure
9
+ # subscriptions programmatically.
10
+ #
11
+ class Subscription
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Subscription class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [SubscriptionClient] reference to the SubscriptionClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # The operation to cancel a subscription
27
+ #
28
+ # @param subscription_id [String] Subscription Id.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [CanceledSubscriptionId] operation results.
33
+ #
34
+ def cancel(subscription_id, custom_headers:nil)
35
+ response = cancel_async(subscription_id, custom_headers:custom_headers).value!
36
+ response.body unless response.nil?
37
+ end
38
+
39
+ #
40
+ # The operation to cancel a subscription
41
+ #
42
+ # @param subscription_id [String] Subscription Id.
43
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
44
+ # will be added to the HTTP request.
45
+ #
46
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
47
+ #
48
+ def cancel_with_http_info(subscription_id, custom_headers:nil)
49
+ cancel_async(subscription_id, custom_headers:custom_headers).value!
50
+ end
51
+
52
+ #
53
+ # The operation to cancel a subscription
54
+ #
55
+ # @param subscription_id [String] Subscription Id.
56
+ # @param [Hash{String => String}] A hash of custom headers that will be added
57
+ # to the HTTP request.
58
+ #
59
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
60
+ #
61
+ def cancel_async(subscription_id, custom_headers:nil)
62
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
63
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
64
+
65
+
66
+ request_headers = {}
67
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
68
+
69
+ # Set Headers
70
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
71
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
72
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel'
73
+
74
+ request_url = @base_url || @client.base_url
75
+
76
+ options = {
77
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
78
+ path_params: {'subscriptionId' => subscription_id},
79
+ query_params: {'api-version' => @client.api_version},
80
+ headers: request_headers.merge(custom_headers || {}),
81
+ base_url: request_url
82
+ }
83
+ promise = @client.make_request_async(:post, path_template, options)
84
+
85
+ promise = promise.then do |result|
86
+ http_response = result.response
87
+ status_code = http_response.status
88
+ response_content = http_response.body
89
+ unless status_code == 200
90
+ error_model = JSON.load(response_content)
91
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
92
+ end
93
+
94
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
95
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
96
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
97
+ # Deserialize Response
98
+ if status_code == 200
99
+ begin
100
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
101
+ result_mapper = Azure::Subscriptions::Mgmt::V2020_09_01::Models::CanceledSubscriptionId.mapper()
102
+ result.body = @client.deserialize(result_mapper, parsed_response)
103
+ rescue Exception => e
104
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
105
+ end
106
+ end
107
+
108
+ result
109
+ end
110
+
111
+ promise.execute
112
+ end
113
+
114
+ #
115
+ # The operation to rename a subscription
116
+ #
117
+ # @param subscription_id [String] Subscription Id.
118
+ # @param body [SubscriptionName] Subscription Name
119
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
120
+ # will be added to the HTTP request.
121
+ #
122
+ # @return [RenamedSubscriptionId] operation results.
123
+ #
124
+ def rename(subscription_id, body, custom_headers:nil)
125
+ response = rename_async(subscription_id, body, custom_headers:custom_headers).value!
126
+ response.body unless response.nil?
127
+ end
128
+
129
+ #
130
+ # The operation to rename a subscription
131
+ #
132
+ # @param subscription_id [String] Subscription Id.
133
+ # @param body [SubscriptionName] Subscription Name
134
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
135
+ # will be added to the HTTP request.
136
+ #
137
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
138
+ #
139
+ def rename_with_http_info(subscription_id, body, custom_headers:nil)
140
+ rename_async(subscription_id, body, custom_headers:custom_headers).value!
141
+ end
142
+
143
+ #
144
+ # The operation to rename a subscription
145
+ #
146
+ # @param subscription_id [String] Subscription Id.
147
+ # @param body [SubscriptionName] Subscription Name
148
+ # @param [Hash{String => String}] A hash of custom headers that will be added
149
+ # to the HTTP request.
150
+ #
151
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
152
+ #
153
+ def rename_async(subscription_id, body, custom_headers:nil)
154
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
155
+ fail ArgumentError, 'body is nil' if body.nil?
156
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
157
+
158
+
159
+ request_headers = {}
160
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
161
+
162
+ # Set Headers
163
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
164
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
165
+
166
+ # Serialize Request
167
+ request_mapper = Azure::Subscriptions::Mgmt::V2020_09_01::Models::SubscriptionName.mapper()
168
+ request_content = @client.serialize(request_mapper, body)
169
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
170
+
171
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename'
172
+
173
+ request_url = @base_url || @client.base_url
174
+
175
+ options = {
176
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
177
+ path_params: {'subscriptionId' => subscription_id},
178
+ query_params: {'api-version' => @client.api_version},
179
+ body: request_content,
180
+ headers: request_headers.merge(custom_headers || {}),
181
+ base_url: request_url
182
+ }
183
+ promise = @client.make_request_async(:post, path_template, options)
184
+
185
+ promise = promise.then do |result|
186
+ http_response = result.response
187
+ status_code = http_response.status
188
+ response_content = http_response.body
189
+ unless status_code == 200
190
+ error_model = JSON.load(response_content)
191
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
192
+ end
193
+
194
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
195
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
196
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
197
+ # Deserialize Response
198
+ if status_code == 200
199
+ begin
200
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
201
+ result_mapper = Azure::Subscriptions::Mgmt::V2020_09_01::Models::RenamedSubscriptionId.mapper()
202
+ result.body = @client.deserialize(result_mapper, parsed_response)
203
+ rescue Exception => e
204
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
205
+ end
206
+ end
207
+
208
+ result
209
+ end
210
+
211
+ promise.execute
212
+ end
213
+
214
+ #
215
+ # The operation to enable a subscription
216
+ #
217
+ # @param subscription_id [String] Subscription Id.
218
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
219
+ # will be added to the HTTP request.
220
+ #
221
+ # @return [EnabledSubscriptionId] operation results.
222
+ #
223
+ def enable(subscription_id, custom_headers:nil)
224
+ response = enable_async(subscription_id, custom_headers:custom_headers).value!
225
+ response.body unless response.nil?
226
+ end
227
+
228
+ #
229
+ # The operation to enable a subscription
230
+ #
231
+ # @param subscription_id [String] Subscription Id.
232
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
233
+ # will be added to the HTTP request.
234
+ #
235
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
236
+ #
237
+ def enable_with_http_info(subscription_id, custom_headers:nil)
238
+ enable_async(subscription_id, custom_headers:custom_headers).value!
239
+ end
240
+
241
+ #
242
+ # The operation to enable a subscription
243
+ #
244
+ # @param subscription_id [String] Subscription Id.
245
+ # @param [Hash{String => String}] A hash of custom headers that will be added
246
+ # to the HTTP request.
247
+ #
248
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
249
+ #
250
+ def enable_async(subscription_id, custom_headers:nil)
251
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
252
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
253
+
254
+
255
+ request_headers = {}
256
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
257
+
258
+ # Set Headers
259
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
260
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
261
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable'
262
+
263
+ request_url = @base_url || @client.base_url
264
+
265
+ options = {
266
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
267
+ path_params: {'subscriptionId' => subscription_id},
268
+ query_params: {'api-version' => @client.api_version},
269
+ headers: request_headers.merge(custom_headers || {}),
270
+ base_url: request_url
271
+ }
272
+ promise = @client.make_request_async(:post, path_template, options)
273
+
274
+ promise = promise.then do |result|
275
+ http_response = result.response
276
+ status_code = http_response.status
277
+ response_content = http_response.body
278
+ unless status_code == 200
279
+ error_model = JSON.load(response_content)
280
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
281
+ end
282
+
283
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
284
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
285
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
286
+ # Deserialize Response
287
+ if status_code == 200
288
+ begin
289
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
290
+ result_mapper = Azure::Subscriptions::Mgmt::V2020_09_01::Models::EnabledSubscriptionId.mapper()
291
+ result.body = @client.deserialize(result_mapper, parsed_response)
292
+ rescue Exception => e
293
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
294
+ end
295
+ end
296
+
297
+ result
298
+ end
299
+
300
+ promise.execute
301
+ end
302
+
303
+ end
304
+ end
@@ -0,0 +1,137 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Subscriptions::Mgmt::V2020_09_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class SubscriptionClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Version of the API to be used with the client request.
21
+ # Current version is 2020-09-01
22
+ attr_reader :api_version
23
+
24
+ # @return [String] The preferred language for the response.
25
+ attr_accessor :accept_language
26
+
27
+ # @return [Integer] The retry timeout in seconds for Long Running
28
+ # Operations. Default value is 30.
29
+ attr_accessor :long_running_operation_retry_timeout
30
+
31
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
32
+ # generated. When set to true a unique x-ms-client-request-id value is
33
+ # generated and included in each request. Default is true.
34
+ attr_accessor :generate_client_request_id
35
+
36
+ # @return [Subscription] subscription
37
+ attr_reader :subscription
38
+
39
+ # @return [Operations] operations
40
+ attr_reader :operations
41
+
42
+ # @return [AliasModel] alias_model
43
+ attr_reader :alias_model
44
+
45
+ #
46
+ # Creates initializes a new instance of the SubscriptionClient class.
47
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
48
+ # @param base_url [String] the base URI of the service.
49
+ # @param options [Array] filters to be applied to the HTTP requests.
50
+ #
51
+ def initialize(credentials = nil, base_url = nil, options = nil)
52
+ super(credentials, options)
53
+ @base_url = base_url || 'https://management.azure.com'
54
+
55
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
56
+ @credentials = credentials
57
+
58
+ @subscription = Subscription.new(self)
59
+ @operations = Operations.new(self)
60
+ @alias_model = AliasModel.new(self)
61
+ @api_version = '2020-09-01'
62
+ @accept_language = 'en-US'
63
+ @long_running_operation_retry_timeout = 30
64
+ @generate_client_request_id = true
65
+ add_telemetry
66
+ end
67
+
68
+ #
69
+ # Makes a request and returns the body of the response.
70
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
71
+ # @param path [String] the path, relative to {base_url}.
72
+ # @param options [Hash{String=>String}] specifying any request options like :body.
73
+ # @return [Hash{String=>String}] containing the body of the response.
74
+ # Example:
75
+ #
76
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
77
+ # path = "/path"
78
+ # options = {
79
+ # body: request_content,
80
+ # query_params: {'api-version' => '2016-02-01'}
81
+ # }
82
+ # result = @client.make_request(:put, path, options)
83
+ #
84
+ def make_request(method, path, options = {})
85
+ result = make_request_with_http_info(method, path, options)
86
+ result.body unless result.nil?
87
+ end
88
+
89
+ #
90
+ # Makes a request and returns the operation response.
91
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
92
+ # @param path [String] the path, relative to {base_url}.
93
+ # @param options [Hash{String=>String}] specifying any request options like :body.
94
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
95
+ #
96
+ def make_request_with_http_info(method, path, options = {})
97
+ result = make_request_async(method, path, options).value!
98
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
99
+ result
100
+ end
101
+
102
+ #
103
+ # Makes a request asynchronously.
104
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
105
+ # @param path [String] the path, relative to {base_url}.
106
+ # @param options [Hash{String=>String}] specifying any request options like :body.
107
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
108
+ #
109
+ def make_request_async(method, path, options = {})
110
+ fail ArgumentError, 'method is nil' if method.nil?
111
+ fail ArgumentError, 'path is nil' if path.nil?
112
+
113
+ request_url = options[:base_url] || @base_url
114
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
115
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
116
+ end
117
+
118
+ request_headers = @request_headers
119
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
120
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
121
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
122
+
123
+ super(request_url, method, path, options)
124
+ end
125
+
126
+
127
+ private
128
+ #
129
+ # Adds telemetry information.
130
+ #
131
+ def add_telemetry
132
+ sdk_information = 'azure_mgmt_subscriptions'
133
+ sdk_information = "#{sdk_information}/0.18.5"
134
+ add_user_agent_information(sdk_information)
135
+ end
136
+ end
137
+ end
@@ -2,10 +2,14 @@
2
2
  # Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  # Licensed under the MIT License. See License.txt in the project root for license information.
4
4
 
5
+ require '2019-11-01/generated/azure_mgmt_subscriptions'
5
6
  require '2018-03-01-preview/generated/azure_mgmt_subscriptions'
7
+ require '2020-09-01/generated/azure_mgmt_subscriptions'
8
+ require '2019-10-01-preview/generated/azure_mgmt_subscriptions'
6
9
  require '2018-11-01-preview/generated/azure_mgmt_subscriptions'
7
10
  require '2017-11-01-preview/generated/azure_mgmt_subscriptions'
8
11
  require '2016-06-01/generated/azure_mgmt_subscriptions'
12
+ require '2019-06-01/generated/azure_mgmt_subscriptions'
9
13
  require '2019-03-01-preview/generated/azure_mgmt_subscriptions'
10
14
  require 'profiles/latest/subscriptions_latest_profile_client'
11
15
  require 'profiles/v2017_03_09/subscriptions_v2017_03_09_profile_client'