azure_mgmt_resources_management 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-08-31-preview/generated/azure_mgmt_resources_management/management_groups_api.rb +7 -6
  3. data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management.rb +1 -1
  4. data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/management_groups.rb +28 -28
  5. data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/management_groups_api.rb +7 -6
  6. data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/{create_group_request.rb → create_management_group_request.rb} +4 -4
  7. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management.rb +56 -0
  8. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/entities.rb +257 -0
  9. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/management_group_subscriptions.rb +209 -0
  10. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/management_groups.rb +793 -0
  11. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/management_groups_api.rb +254 -0
  12. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/check_name_availability_request.rb +60 -0
  13. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/check_name_availability_result.rb +83 -0
  14. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_child_info.rb +131 -0
  15. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_details.rb +84 -0
  16. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_request.rb +153 -0
  17. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/create_parent_group_info.rb +72 -0
  18. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/entity_hierarchy_item.rb +118 -0
  19. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/entity_info.rb +121 -0
  20. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/entity_list_result.rb +99 -0
  21. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/entity_parent_group_info.rb +48 -0
  22. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/error_details.rb +69 -0
  23. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/error_response.rb +47 -0
  24. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/management_group.rb +150 -0
  25. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/management_group_child_info.rb +125 -0
  26. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/management_group_details.rb +81 -0
  27. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/management_group_info.rb +98 -0
  28. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/management_group_list_result.rb +99 -0
  29. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/operation.rb +59 -0
  30. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/operation_display_properties.rb +83 -0
  31. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/operation_list_result.rb +103 -0
  32. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/operation_results.rb +86 -0
  33. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/parent_group_info.rb +70 -0
  34. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/patch_management_group_request.rb +59 -0
  35. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/reason.rb +16 -0
  36. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/type.rb +15 -0
  37. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/module_definition.rb +9 -0
  38. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/operations.rb +219 -0
  39. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management.rb +58 -0
  40. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb +381 -0
  41. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/management_group_subscriptions.rb +202 -0
  42. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/management_groups.rb +799 -0
  43. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/management_groups_api.rb +401 -0
  44. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/check_name_availability_request.rb +60 -0
  45. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/check_name_availability_result.rb +83 -0
  46. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_child_info.rb +131 -0
  47. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_details.rb +84 -0
  48. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_request.rb +153 -0
  49. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/create_parent_group_info.rb +72 -0
  50. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/entity_hierarchy_item.rb +118 -0
  51. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/entity_info.rb +210 -0
  52. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/entity_list_result.rb +111 -0
  53. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/entity_parent_group_info.rb +48 -0
  54. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/error_details.rb +69 -0
  55. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/error_response.rb +47 -0
  56. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/management_group.rb +150 -0
  57. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/management_group_child_info.rb +125 -0
  58. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/management_group_details.rb +81 -0
  59. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/management_group_info.rb +98 -0
  60. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/management_group_list_result.rb +99 -0
  61. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/operation.rb +59 -0
  62. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/operation_display_properties.rb +83 -0
  63. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/operation_list_result.rb +103 -0
  64. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/operation_results.rb +86 -0
  65. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/parent_group_info.rb +70 -0
  66. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/patch_management_group_request.rb +59 -0
  67. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/reason.rb +16 -0
  68. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/status.rb +20 -0
  69. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/tenant_backfill_status_result.rb +63 -0
  70. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/type.rb +15 -0
  71. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/module_definition.rb +9 -0
  72. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/operations.rb +218 -0
  73. data/lib/azure_mgmt_resources_management.rb +3 -1
  74. data/lib/profiles/latest/modules/resourcesmanagement_profile_module.rb +99 -37
  75. data/lib/version.rb +1 -1
  76. metadata +72 -6
@@ -0,0 +1,209 @@
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::ResourcesManagement::Mgmt::V2018_01_01_preview
7
+ #
8
+ # The Azure Management Groups API enables consolidation of multiple
9
+ # subscriptions/resources into an organizational hierarchy and centrally
10
+ # manage access control, policies, alerting and reporting for those
11
+ # resources.
12
+ #
13
+ #
14
+ class ManagementGroupSubscriptions
15
+ include MsRestAzure
16
+
17
+ #
18
+ # Creates and initializes a new instance of the ManagementGroupSubscriptions class.
19
+ # @param client service class for accessing basic functionality.
20
+ #
21
+ def initialize(client)
22
+ @client = client
23
+ end
24
+
25
+ # @return [ManagementGroupsAPI] reference to the ManagementGroupsAPI
26
+ attr_reader :client
27
+
28
+ #
29
+ # Associates existing subscription with the management group.
30
+ #
31
+ #
32
+ # @param group_id [String] Management Group ID.
33
+ # @param subscription_id [String] Subscription ID.
34
+ # @param cache_control [String] Indicates that the request shouldn't utilize
35
+ # any caches.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ #
40
+ def create(group_id, subscription_id, cache_control:'no-cache', custom_headers:nil)
41
+ response = create_async(group_id, subscription_id, cache_control:cache_control, custom_headers:custom_headers).value!
42
+ nil
43
+ end
44
+
45
+ #
46
+ # Associates existing subscription with the management group.
47
+ #
48
+ #
49
+ # @param group_id [String] Management Group ID.
50
+ # @param subscription_id [String] Subscription ID.
51
+ # @param cache_control [String] Indicates that the request shouldn't utilize
52
+ # any caches.
53
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
54
+ # will be added to the HTTP request.
55
+ #
56
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
57
+ #
58
+ def create_with_http_info(group_id, subscription_id, cache_control:'no-cache', custom_headers:nil)
59
+ create_async(group_id, subscription_id, cache_control:cache_control, custom_headers:custom_headers).value!
60
+ end
61
+
62
+ #
63
+ # Associates existing subscription with the management group.
64
+ #
65
+ #
66
+ # @param group_id [String] Management Group ID.
67
+ # @param subscription_id [String] Subscription ID.
68
+ # @param cache_control [String] Indicates that the request shouldn't utilize
69
+ # any caches.
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def create_async(group_id, subscription_id, cache_control:'no-cache', custom_headers:nil)
76
+ fail ArgumentError, 'group_id is nil' if group_id.nil?
77
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
78
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
79
+
80
+
81
+ request_headers = {}
82
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
83
+
84
+ # Set Headers
85
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
86
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
87
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
88
+ path_template = 'providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}'
89
+
90
+ request_url = @base_url || @client.base_url
91
+
92
+ options = {
93
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
94
+ path_params: {'groupId' => group_id,'subscriptionId' => subscription_id},
95
+ query_params: {'api-version' => @client.api_version},
96
+ headers: request_headers.merge(custom_headers || {}),
97
+ base_url: request_url
98
+ }
99
+ promise = @client.make_request_async(:put, path_template, options)
100
+
101
+ promise = promise.then do |result|
102
+ http_response = result.response
103
+ status_code = http_response.status
104
+ response_content = http_response.body
105
+ unless status_code == 204
106
+ error_model = JSON.load(response_content)
107
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
108
+ end
109
+
110
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
111
+
112
+ result
113
+ end
114
+
115
+ promise.execute
116
+ end
117
+
118
+ #
119
+ # De-associates subscription from the management group.
120
+ #
121
+ #
122
+ # @param group_id [String] Management Group ID.
123
+ # @param subscription_id [String] Subscription ID.
124
+ # @param cache_control [String] Indicates that the request shouldn't utilize
125
+ # any caches.
126
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
127
+ # will be added to the HTTP request.
128
+ #
129
+ #
130
+ def delete(group_id, subscription_id, cache_control:'no-cache', custom_headers:nil)
131
+ response = delete_async(group_id, subscription_id, cache_control:cache_control, custom_headers:custom_headers).value!
132
+ nil
133
+ end
134
+
135
+ #
136
+ # De-associates subscription from the management group.
137
+ #
138
+ #
139
+ # @param group_id [String] Management Group ID.
140
+ # @param subscription_id [String] Subscription ID.
141
+ # @param cache_control [String] Indicates that the request shouldn't utilize
142
+ # any caches.
143
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
144
+ # will be added to the HTTP request.
145
+ #
146
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
147
+ #
148
+ def delete_with_http_info(group_id, subscription_id, cache_control:'no-cache', custom_headers:nil)
149
+ delete_async(group_id, subscription_id, cache_control:cache_control, custom_headers:custom_headers).value!
150
+ end
151
+
152
+ #
153
+ # De-associates subscription from the management group.
154
+ #
155
+ #
156
+ # @param group_id [String] Management Group ID.
157
+ # @param subscription_id [String] Subscription ID.
158
+ # @param cache_control [String] Indicates that the request shouldn't utilize
159
+ # any caches.
160
+ # @param [Hash{String => String}] A hash of custom headers that will be added
161
+ # to the HTTP request.
162
+ #
163
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
164
+ #
165
+ def delete_async(group_id, subscription_id, cache_control:'no-cache', custom_headers:nil)
166
+ fail ArgumentError, 'group_id is nil' if group_id.nil?
167
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
168
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
169
+
170
+
171
+ request_headers = {}
172
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
173
+
174
+ # Set Headers
175
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
176
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
177
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
178
+ path_template = 'providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}'
179
+
180
+ request_url = @base_url || @client.base_url
181
+
182
+ options = {
183
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
184
+ path_params: {'groupId' => group_id,'subscriptionId' => subscription_id},
185
+ query_params: {'api-version' => @client.api_version},
186
+ headers: request_headers.merge(custom_headers || {}),
187
+ base_url: request_url
188
+ }
189
+ promise = @client.make_request_async(:delete, path_template, options)
190
+
191
+ promise = promise.then do |result|
192
+ http_response = result.response
193
+ status_code = http_response.status
194
+ response_content = http_response.body
195
+ unless status_code == 204
196
+ error_model = JSON.load(response_content)
197
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
198
+ end
199
+
200
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
201
+
202
+ result
203
+ end
204
+
205
+ promise.execute
206
+ end
207
+
208
+ end
209
+ end
@@ -0,0 +1,793 @@
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::ResourcesManagement::Mgmt::V2018_01_01_preview
7
+ #
8
+ # The Azure Management Groups API enables consolidation of multiple
9
+ # subscriptions/resources into an organizational hierarchy and centrally
10
+ # manage access control, policies, alerting and reporting for those
11
+ # resources.
12
+ #
13
+ #
14
+ class ManagementGroups
15
+ include MsRestAzure
16
+
17
+ #
18
+ # Creates and initializes a new instance of the ManagementGroups class.
19
+ # @param client service class for accessing basic functionality.
20
+ #
21
+ def initialize(client)
22
+ @client = client
23
+ end
24
+
25
+ # @return [ManagementGroupsAPI] reference to the ManagementGroupsAPI
26
+ attr_reader :client
27
+
28
+ #
29
+ # List management groups for the authenticated user.
30
+ #
31
+ #
32
+ # @param cache_control [String] Indicates that the request shouldn't utilize
33
+ # any caches.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [Array<ManagementGroupInfo>] operation results.
38
+ #
39
+ def list(cache_control:'no-cache', custom_headers:nil)
40
+ first_page = list_as_lazy(cache_control:cache_control, custom_headers:custom_headers)
41
+ first_page.get_all_items
42
+ end
43
+
44
+ #
45
+ # List management groups for the authenticated user.
46
+ #
47
+ #
48
+ # @param cache_control [String] Indicates that the request shouldn't utilize
49
+ # any caches.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def list_with_http_info(cache_control:'no-cache', custom_headers:nil)
56
+ list_async(cache_control:cache_control, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # List management groups for the authenticated user.
61
+ #
62
+ #
63
+ # @param cache_control [String] Indicates that the request shouldn't utilize
64
+ # any caches.
65
+ # @param [Hash{String => String}] A hash of custom headers that will be added
66
+ # to the HTTP request.
67
+ #
68
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
69
+ #
70
+ def list_async(cache_control:'no-cache', custom_headers:nil)
71
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
72
+
73
+
74
+ request_headers = {}
75
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
76
+
77
+ # Set Headers
78
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
79
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
80
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
81
+ path_template = 'providers/Microsoft.Management/managementGroups'
82
+
83
+ request_url = @base_url || @client.base_url
84
+
85
+ options = {
86
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
87
+ query_params: {'api-version' => @client.api_version,'$skiptoken' => @client.skiptoken},
88
+ headers: request_headers.merge(custom_headers || {}),
89
+ base_url: request_url
90
+ }
91
+ promise = @client.make_request_async(:get, path_template, options)
92
+
93
+ promise = promise.then do |result|
94
+ http_response = result.response
95
+ status_code = http_response.status
96
+ response_content = http_response.body
97
+ unless status_code == 200
98
+ error_model = JSON.load(response_content)
99
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
100
+ end
101
+
102
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
103
+ # Deserialize Response
104
+ if status_code == 200
105
+ begin
106
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
107
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_01_01_preview::Models::ManagementGroupListResult.mapper()
108
+ result.body = @client.deserialize(result_mapper, parsed_response)
109
+ rescue Exception => e
110
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
111
+ end
112
+ end
113
+
114
+ result
115
+ end
116
+
117
+ promise.execute
118
+ end
119
+
120
+ #
121
+ # Get the details of the management group.
122
+ #
123
+ #
124
+ # @param group_id [String] Management Group ID.
125
+ # @param expand [Enum] The $expand=children query string parameter allows
126
+ # clients to request inclusion of children in the response payload. Possible
127
+ # values include: 'children'
128
+ # @param recurse [Boolean] The $recurse=true query string parameter allows
129
+ # clients to request inclusion of entire hierarchy in the response payload.
130
+ # Note that $expand=children must be passed up if $recurse is set to true.
131
+ # @param filter [String] A filter which allows the exclusion of subscriptions
132
+ # from results (i.e. '$filter=children.childType ne Subscription')
133
+ # @param cache_control [String] Indicates that the request shouldn't utilize
134
+ # any caches.
135
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
136
+ # will be added to the HTTP request.
137
+ #
138
+ # @return [ManagementGroup] operation results.
139
+ #
140
+ def get(group_id, expand:nil, recurse:nil, filter:nil, cache_control:'no-cache', custom_headers:nil)
141
+ response = get_async(group_id, expand:expand, recurse:recurse, filter:filter, cache_control:cache_control, custom_headers:custom_headers).value!
142
+ response.body unless response.nil?
143
+ end
144
+
145
+ #
146
+ # Get the details of the management group.
147
+ #
148
+ #
149
+ # @param group_id [String] Management Group ID.
150
+ # @param expand [Enum] The $expand=children query string parameter allows
151
+ # clients to request inclusion of children in the response payload. Possible
152
+ # values include: 'children'
153
+ # @param recurse [Boolean] The $recurse=true query string parameter allows
154
+ # clients to request inclusion of entire hierarchy in the response payload.
155
+ # Note that $expand=children must be passed up if $recurse is set to true.
156
+ # @param filter [String] A filter which allows the exclusion of subscriptions
157
+ # from results (i.e. '$filter=children.childType ne Subscription')
158
+ # @param cache_control [String] Indicates that the request shouldn't utilize
159
+ # any caches.
160
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
161
+ # will be added to the HTTP request.
162
+ #
163
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
164
+ #
165
+ def get_with_http_info(group_id, expand:nil, recurse:nil, filter:nil, cache_control:'no-cache', custom_headers:nil)
166
+ get_async(group_id, expand:expand, recurse:recurse, filter:filter, cache_control:cache_control, custom_headers:custom_headers).value!
167
+ end
168
+
169
+ #
170
+ # Get the details of the management group.
171
+ #
172
+ #
173
+ # @param group_id [String] Management Group ID.
174
+ # @param expand [Enum] The $expand=children query string parameter allows
175
+ # clients to request inclusion of children in the response payload. Possible
176
+ # values include: 'children'
177
+ # @param recurse [Boolean] The $recurse=true query string parameter allows
178
+ # clients to request inclusion of entire hierarchy in the response payload.
179
+ # Note that $expand=children must be passed up if $recurse is set to true.
180
+ # @param filter [String] A filter which allows the exclusion of subscriptions
181
+ # from results (i.e. '$filter=children.childType ne Subscription')
182
+ # @param cache_control [String] Indicates that the request shouldn't utilize
183
+ # any caches.
184
+ # @param [Hash{String => String}] A hash of custom headers that will be added
185
+ # to the HTTP request.
186
+ #
187
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
188
+ #
189
+ def get_async(group_id, expand:nil, recurse:nil, filter:nil, cache_control:'no-cache', custom_headers:nil)
190
+ fail ArgumentError, 'group_id is nil' if group_id.nil?
191
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
192
+
193
+
194
+ request_headers = {}
195
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
196
+
197
+ # Set Headers
198
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
199
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
200
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
201
+ path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
202
+
203
+ request_url = @base_url || @client.base_url
204
+
205
+ options = {
206
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
207
+ path_params: {'groupId' => group_id},
208
+ query_params: {'api-version' => @client.api_version,'$expand' => expand,'$recurse' => recurse,'$filter' => filter},
209
+ headers: request_headers.merge(custom_headers || {}),
210
+ base_url: request_url
211
+ }
212
+ promise = @client.make_request_async(:get, path_template, options)
213
+
214
+ promise = promise.then do |result|
215
+ http_response = result.response
216
+ status_code = http_response.status
217
+ response_content = http_response.body
218
+ unless status_code == 200
219
+ error_model = JSON.load(response_content)
220
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
221
+ end
222
+
223
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
224
+ # Deserialize Response
225
+ if status_code == 200
226
+ begin
227
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
228
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_01_01_preview::Models::ManagementGroup.mapper()
229
+ result.body = @client.deserialize(result_mapper, parsed_response)
230
+ rescue Exception => e
231
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
232
+ end
233
+ end
234
+
235
+ result
236
+ end
237
+
238
+ promise.execute
239
+ end
240
+
241
+ #
242
+ # Create or update a management group.
243
+ # If a management group is already created and a subsequent create request is
244
+ # issued with different properties, the management group properties will be
245
+ # updated.
246
+ #
247
+ #
248
+ # @param group_id [String] Management Group ID.
249
+ # @param cache_control [String] Indicates that the request shouldn't utilize
250
+ # any caches.
251
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
252
+ # will be added to the HTTP request.
253
+ #
254
+ # @return [Object] operation results.
255
+ #
256
+ def create_or_update(group_id, cache_control:'no-cache', custom_headers:nil)
257
+ response = create_or_update_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
258
+ response.body unless response.nil?
259
+ end
260
+
261
+ #
262
+ # @param group_id [String] Management Group ID.
263
+ # @param cache_control [String] Indicates that the request shouldn't utilize
264
+ # any caches.
265
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
266
+ # will be added to the HTTP request.
267
+ #
268
+ # @return [Concurrent::Promise] promise which provides async access to http
269
+ # response.
270
+ #
271
+ def create_or_update_async(group_id, cache_control:'no-cache', custom_headers:nil)
272
+ # Send request
273
+ promise = begin_create_or_update_async(group_id, cache_control:cache_control, custom_headers:custom_headers)
274
+
275
+ promise = promise.then do |response|
276
+ # Defining deserialization method.
277
+ deserialize_method = lambda do |parsed_response|
278
+ result_mapper = {
279
+ client_side_validation: true,
280
+ required: false,
281
+ serialized_name: 'parsed_response',
282
+ type: {
283
+ name: 'Object'
284
+ }
285
+ }
286
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
287
+ end
288
+
289
+ # Waiting for response.
290
+ @client.get_long_running_operation_result(response, deserialize_method)
291
+ end
292
+
293
+ promise
294
+ end
295
+
296
+ #
297
+ # Update a management group.
298
+ #
299
+ #
300
+ # @param group_id [String] Management Group ID.
301
+ # @param cache_control [String] Indicates that the request shouldn't utilize
302
+ # any caches.
303
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
304
+ # will be added to the HTTP request.
305
+ #
306
+ # @return [ManagementGroup] operation results.
307
+ #
308
+ def update(group_id, cache_control:'no-cache', custom_headers:nil)
309
+ response = update_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
310
+ response.body unless response.nil?
311
+ end
312
+
313
+ #
314
+ # Update a management group.
315
+ #
316
+ #
317
+ # @param group_id [String] Management Group ID.
318
+ # @param cache_control [String] Indicates that the request shouldn't utilize
319
+ # any caches.
320
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
321
+ # will be added to the HTTP request.
322
+ #
323
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
324
+ #
325
+ def update_with_http_info(group_id, cache_control:'no-cache', custom_headers:nil)
326
+ update_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
327
+ end
328
+
329
+ #
330
+ # Update a management group.
331
+ #
332
+ #
333
+ # @param group_id [String] Management Group ID.
334
+ # @param cache_control [String] Indicates that the request shouldn't utilize
335
+ # any caches.
336
+ # @param [Hash{String => String}] A hash of custom headers that will be added
337
+ # to the HTTP request.
338
+ #
339
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
340
+ #
341
+ def update_async(group_id, cache_control:'no-cache', custom_headers:nil)
342
+ fail ArgumentError, 'group_id is nil' if group_id.nil?
343
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
344
+ fail ArgumentError, '@client.patch_group_request is nil' if @client.patch_group_request.nil?
345
+
346
+
347
+ request_headers = {}
348
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
349
+
350
+ # Set Headers
351
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
352
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
353
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
354
+
355
+ # Serialize Request
356
+ request_mapper = Azure::ResourcesManagement::Mgmt::V2018_01_01_preview::Models::PatchManagementGroupRequest.mapper()
357
+ request_content = @client.serialize(request_mapper, @client.patch_group_request)
358
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
359
+
360
+ path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
361
+
362
+ request_url = @base_url || @client.base_url
363
+
364
+ options = {
365
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
366
+ path_params: {'groupId' => group_id},
367
+ query_params: {'api-version' => @client.api_version},
368
+ body: request_content,
369
+ headers: request_headers.merge(custom_headers || {}),
370
+ base_url: request_url
371
+ }
372
+ promise = @client.make_request_async(:patch, path_template, options)
373
+
374
+ promise = promise.then do |result|
375
+ http_response = result.response
376
+ status_code = http_response.status
377
+ response_content = http_response.body
378
+ unless status_code == 200
379
+ error_model = JSON.load(response_content)
380
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
381
+ end
382
+
383
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
384
+ # Deserialize Response
385
+ if status_code == 200
386
+ begin
387
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
388
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_01_01_preview::Models::ManagementGroup.mapper()
389
+ result.body = @client.deserialize(result_mapper, parsed_response)
390
+ rescue Exception => e
391
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
392
+ end
393
+ end
394
+
395
+ result
396
+ end
397
+
398
+ promise.execute
399
+ end
400
+
401
+ #
402
+ # Delete management group.
403
+ # If a management group contains child resources, the request will fail.
404
+ #
405
+ #
406
+ # @param group_id [String] Management Group ID.
407
+ # @param cache_control [String] Indicates that the request shouldn't utilize
408
+ # any caches.
409
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
410
+ # will be added to the HTTP request.
411
+ #
412
+ # @return [OperationResults] operation results.
413
+ #
414
+ def delete(group_id, cache_control:'no-cache', custom_headers:nil)
415
+ response = delete_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
416
+ response.body unless response.nil?
417
+ end
418
+
419
+ #
420
+ # @param group_id [String] Management Group ID.
421
+ # @param cache_control [String] Indicates that the request shouldn't utilize
422
+ # any caches.
423
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
424
+ # will be added to the HTTP request.
425
+ #
426
+ # @return [Concurrent::Promise] promise which provides async access to http
427
+ # response.
428
+ #
429
+ def delete_async(group_id, cache_control:'no-cache', custom_headers:nil)
430
+ # Send request
431
+ promise = begin_delete_async(group_id, cache_control:cache_control, custom_headers:custom_headers)
432
+
433
+ promise = promise.then do |response|
434
+ # Defining deserialization method.
435
+ deserialize_method = lambda do |parsed_response|
436
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_01_01_preview::Models::OperationResults.mapper()
437
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
438
+ end
439
+
440
+ # Waiting for response.
441
+ @client.get_long_running_operation_result(response, deserialize_method)
442
+ end
443
+
444
+ promise
445
+ end
446
+
447
+ #
448
+ # Create or update a management group.
449
+ # If a management group is already created and a subsequent create request is
450
+ # issued with different properties, the management group properties will be
451
+ # updated.
452
+ #
453
+ #
454
+ # @param group_id [String] Management Group ID.
455
+ # @param cache_control [String] Indicates that the request shouldn't utilize
456
+ # any caches.
457
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
458
+ # will be added to the HTTP request.
459
+ #
460
+ # @return [Object] operation results.
461
+ #
462
+ def begin_create_or_update(group_id, cache_control:'no-cache', custom_headers:nil)
463
+ response = begin_create_or_update_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
464
+ response.body unless response.nil?
465
+ end
466
+
467
+ #
468
+ # Create or update a management group.
469
+ # If a management group is already created and a subsequent create request is
470
+ # issued with different properties, the management group properties will be
471
+ # updated.
472
+ #
473
+ #
474
+ # @param group_id [String] Management Group ID.
475
+ # @param cache_control [String] Indicates that the request shouldn't utilize
476
+ # any caches.
477
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
478
+ # will be added to the HTTP request.
479
+ #
480
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
481
+ #
482
+ def begin_create_or_update_with_http_info(group_id, cache_control:'no-cache', custom_headers:nil)
483
+ begin_create_or_update_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
484
+ end
485
+
486
+ #
487
+ # Create or update a management group.
488
+ # If a management group is already created and a subsequent create request is
489
+ # issued with different properties, the management group properties will be
490
+ # updated.
491
+ #
492
+ #
493
+ # @param group_id [String] Management Group ID.
494
+ # @param cache_control [String] Indicates that the request shouldn't utilize
495
+ # any caches.
496
+ # @param [Hash{String => String}] A hash of custom headers that will be added
497
+ # to the HTTP request.
498
+ #
499
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
500
+ #
501
+ def begin_create_or_update_async(group_id, cache_control:'no-cache', custom_headers:nil)
502
+ fail ArgumentError, 'group_id is nil' if group_id.nil?
503
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
504
+ fail ArgumentError, '@client.create_management_group_request is nil' if @client.create_management_group_request.nil?
505
+
506
+
507
+ request_headers = {}
508
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
509
+
510
+ # Set Headers
511
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
512
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
513
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
514
+
515
+ # Serialize Request
516
+ request_mapper = Azure::ResourcesManagement::Mgmt::V2018_01_01_preview::Models::CreateManagementGroupRequest.mapper()
517
+ request_content = @client.serialize(request_mapper, @client.create_management_group_request)
518
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
519
+
520
+ path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
521
+
522
+ request_url = @base_url || @client.base_url
523
+
524
+ options = {
525
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
526
+ path_params: {'groupId' => group_id},
527
+ query_params: {'api-version' => @client.api_version},
528
+ body: request_content,
529
+ headers: request_headers.merge(custom_headers || {}),
530
+ base_url: request_url
531
+ }
532
+ promise = @client.make_request_async(:put, path_template, options)
533
+
534
+ promise = promise.then do |result|
535
+ http_response = result.response
536
+ status_code = http_response.status
537
+ response_content = http_response.body
538
+ unless status_code == 200 || status_code == 202
539
+ error_model = JSON.load(response_content)
540
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
541
+ end
542
+
543
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
544
+ # Deserialize Response
545
+ if status_code == 200
546
+ begin
547
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
548
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_01_01_preview::Models::ManagementGroup.mapper()
549
+ result.body = @client.deserialize(result_mapper, parsed_response)
550
+ rescue Exception => e
551
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
552
+ end
553
+ end
554
+ # Deserialize Response
555
+ if status_code == 202
556
+ begin
557
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
558
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_01_01_preview::Models::OperationResults.mapper()
559
+ result.body = @client.deserialize(result_mapper, parsed_response)
560
+ rescue Exception => e
561
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
562
+ end
563
+ end
564
+
565
+ result
566
+ end
567
+
568
+ promise.execute
569
+ end
570
+
571
+ #
572
+ # Delete management group.
573
+ # If a management group contains child resources, the request will fail.
574
+ #
575
+ #
576
+ # @param group_id [String] Management Group ID.
577
+ # @param cache_control [String] Indicates that the request shouldn't utilize
578
+ # any caches.
579
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
580
+ # will be added to the HTTP request.
581
+ #
582
+ # @return [OperationResults] operation results.
583
+ #
584
+ def begin_delete(group_id, cache_control:'no-cache', custom_headers:nil)
585
+ response = begin_delete_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
586
+ response.body unless response.nil?
587
+ end
588
+
589
+ #
590
+ # Delete management group.
591
+ # If a management group contains child resources, the request will fail.
592
+ #
593
+ #
594
+ # @param group_id [String] Management Group ID.
595
+ # @param cache_control [String] Indicates that the request shouldn't utilize
596
+ # any caches.
597
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
598
+ # will be added to the HTTP request.
599
+ #
600
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
601
+ #
602
+ def begin_delete_with_http_info(group_id, cache_control:'no-cache', custom_headers:nil)
603
+ begin_delete_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
604
+ end
605
+
606
+ #
607
+ # Delete management group.
608
+ # If a management group contains child resources, the request will fail.
609
+ #
610
+ #
611
+ # @param group_id [String] Management Group ID.
612
+ # @param cache_control [String] Indicates that the request shouldn't utilize
613
+ # any caches.
614
+ # @param [Hash{String => String}] A hash of custom headers that will be added
615
+ # to the HTTP request.
616
+ #
617
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
618
+ #
619
+ def begin_delete_async(group_id, cache_control:'no-cache', custom_headers:nil)
620
+ fail ArgumentError, 'group_id is nil' if group_id.nil?
621
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
622
+
623
+
624
+ request_headers = {}
625
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
626
+
627
+ # Set Headers
628
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
629
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
630
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
631
+ path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
632
+
633
+ request_url = @base_url || @client.base_url
634
+
635
+ options = {
636
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
637
+ path_params: {'groupId' => group_id},
638
+ query_params: {'api-version' => @client.api_version},
639
+ headers: request_headers.merge(custom_headers || {}),
640
+ base_url: request_url
641
+ }
642
+ promise = @client.make_request_async(:delete, path_template, options)
643
+
644
+ promise = promise.then do |result|
645
+ http_response = result.response
646
+ status_code = http_response.status
647
+ response_content = http_response.body
648
+ unless status_code == 202 || status_code == 204
649
+ error_model = JSON.load(response_content)
650
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
651
+ end
652
+
653
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
654
+ # Deserialize Response
655
+ if status_code == 202
656
+ begin
657
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
658
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_01_01_preview::Models::OperationResults.mapper()
659
+ result.body = @client.deserialize(result_mapper, parsed_response)
660
+ rescue Exception => e
661
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
662
+ end
663
+ end
664
+
665
+ result
666
+ end
667
+
668
+ promise.execute
669
+ end
670
+
671
+ #
672
+ # List management groups for the authenticated user.
673
+ #
674
+ #
675
+ # @param next_page_link [String] The NextLink from the previous successful call
676
+ # to List operation.
677
+ # @param cache_control [String] Indicates that the request shouldn't utilize
678
+ # any caches.
679
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
680
+ # will be added to the HTTP request.
681
+ #
682
+ # @return [ManagementGroupListResult] operation results.
683
+ #
684
+ def list_next(next_page_link, cache_control:'no-cache', custom_headers:nil)
685
+ response = list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers).value!
686
+ response.body unless response.nil?
687
+ end
688
+
689
+ #
690
+ # List management groups for the authenticated user.
691
+ #
692
+ #
693
+ # @param next_page_link [String] The NextLink from the previous successful call
694
+ # to List operation.
695
+ # @param cache_control [String] Indicates that the request shouldn't utilize
696
+ # any caches.
697
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
698
+ # will be added to the HTTP request.
699
+ #
700
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
701
+ #
702
+ def list_next_with_http_info(next_page_link, cache_control:'no-cache', custom_headers:nil)
703
+ list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers).value!
704
+ end
705
+
706
+ #
707
+ # List management groups for the authenticated user.
708
+ #
709
+ #
710
+ # @param next_page_link [String] The NextLink from the previous successful call
711
+ # to List operation.
712
+ # @param cache_control [String] Indicates that the request shouldn't utilize
713
+ # any caches.
714
+ # @param [Hash{String => String}] A hash of custom headers that will be added
715
+ # to the HTTP request.
716
+ #
717
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
718
+ #
719
+ def list_next_async(next_page_link, cache_control:'no-cache', custom_headers:nil)
720
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
721
+
722
+
723
+ request_headers = {}
724
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
725
+
726
+ # Set Headers
727
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
728
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
729
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
730
+ path_template = '{nextLink}'
731
+
732
+ request_url = @base_url || @client.base_url
733
+
734
+ options = {
735
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
736
+ skip_encoding_path_params: {'nextLink' => next_page_link},
737
+ headers: request_headers.merge(custom_headers || {}),
738
+ base_url: request_url
739
+ }
740
+ promise = @client.make_request_async(:get, path_template, options)
741
+
742
+ promise = promise.then do |result|
743
+ http_response = result.response
744
+ status_code = http_response.status
745
+ response_content = http_response.body
746
+ unless status_code == 200
747
+ error_model = JSON.load(response_content)
748
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
749
+ end
750
+
751
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
752
+ # Deserialize Response
753
+ if status_code == 200
754
+ begin
755
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
756
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_01_01_preview::Models::ManagementGroupListResult.mapper()
757
+ result.body = @client.deserialize(result_mapper, parsed_response)
758
+ rescue Exception => e
759
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
760
+ end
761
+ end
762
+
763
+ result
764
+ end
765
+
766
+ promise.execute
767
+ end
768
+
769
+ #
770
+ # List management groups for the authenticated user.
771
+ #
772
+ #
773
+ # @param cache_control [String] Indicates that the request shouldn't utilize
774
+ # any caches.
775
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
776
+ # will be added to the HTTP request.
777
+ #
778
+ # @return [ManagementGroupListResult] which provide lazy access to pages of the
779
+ # response.
780
+ #
781
+ def list_as_lazy(cache_control:'no-cache', custom_headers:nil)
782
+ response = list_async(cache_control:cache_control, custom_headers:custom_headers).value!
783
+ unless response.nil?
784
+ page = response.body
785
+ page.next_method = Proc.new do |next_page_link|
786
+ list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers)
787
+ end
788
+ page
789
+ end
790
+ end
791
+
792
+ end
793
+ end