azure_mgmt_portal 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2015-08-01-preview/generated/azure_mgmt_portal.rb +40 -0
  4. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/dashboards.rb +830 -0
  5. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/models/dashboard.rb +140 -0
  6. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/models/dashboard_lens.rb +85 -0
  7. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/models/dashboard_list_result.rb +99 -0
  8. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/models/dashboard_parts.rb +66 -0
  9. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/models/dashboard_parts_position.rb +98 -0
  10. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/models/error_definition.rb +81 -0
  11. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/models/error_response.rb +47 -0
  12. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/models/patchable_dashboard.rb +93 -0
  13. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation.rb +71 -0
  14. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation_display.rb +79 -0
  15. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation_list.rb +99 -0
  16. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/module_definition.rb +9 -0
  17. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/operations.rb +219 -0
  18. data/lib/2015-08-01-preview/generated/azure_mgmt_portal/portal_client.rb +136 -0
  19. data/lib/2018-10-01-preview/generated/azure_mgmt_portal.rb +40 -0
  20. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/dashboards.rb +830 -0
  21. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/models/dashboard.rb +140 -0
  22. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/models/dashboard_lens.rb +85 -0
  23. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/models/dashboard_list_result.rb +99 -0
  24. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/models/dashboard_parts.rb +66 -0
  25. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/models/dashboard_parts_position.rb +98 -0
  26. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/models/error_definition.rb +81 -0
  27. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/models/error_response.rb +47 -0
  28. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/models/patchable_dashboard.rb +93 -0
  29. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation.rb +71 -0
  30. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation_display.rb +79 -0
  31. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation_list.rb +99 -0
  32. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/module_definition.rb +9 -0
  33. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/operations.rb +219 -0
  34. data/lib/2018-10-01-preview/generated/azure_mgmt_portal/portal_client.rb +136 -0
  35. data/lib/2019-01-01-preview/generated/azure_mgmt_portal.rb +40 -0
  36. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/dashboards.rb +830 -0
  37. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/models/dashboard.rb +140 -0
  38. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/models/dashboard_lens.rb +85 -0
  39. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/models/dashboard_list_result.rb +99 -0
  40. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/models/dashboard_parts.rb +66 -0
  41. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/models/dashboard_parts_position.rb +98 -0
  42. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/models/error_definition.rb +81 -0
  43. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/models/error_response.rb +47 -0
  44. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/models/patchable_dashboard.rb +93 -0
  45. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation.rb +71 -0
  46. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation_display.rb +79 -0
  47. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation_list.rb +99 -0
  48. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/module_definition.rb +9 -0
  49. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/operations.rb +219 -0
  50. data/lib/2019-01-01-preview/generated/azure_mgmt_portal/portal_client.rb +136 -0
  51. data/lib/azure_mgmt_portal.rb +7 -0
  52. data/lib/module_definition.rb +7 -0
  53. data/lib/version.rb +7 -0
  54. metadata +169 -0
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::Portal end
8
+ module Azure::Portal::Mgmt end
9
+ module Azure::Portal::Mgmt::V2015_08_01_preview end
@@ -0,0 +1,219 @@
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::Portal::Mgmt::V2015_08_01_preview
7
+ #
8
+ # Allows creation and deletion of Azure Shared Dashboards.
9
+ #
10
+ class Operations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Operations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [PortalClient] reference to the PortalClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # The Microsoft Portal operations API.
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [Array<ResourceProviderOperation>] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ first_page = list_as_lazy(custom_headers:custom_headers)
34
+ first_page.get_all_items
35
+ end
36
+
37
+ #
38
+ # The Microsoft Portal operations API.
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_with_http_info(custom_headers:nil)
46
+ list_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # The Microsoft Portal operations API.
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_async(custom_headers:nil)
58
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
59
+
60
+
61
+ request_headers = {}
62
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
63
+
64
+ # Set Headers
65
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
67
+ path_template = 'providers/Microsoft.Portal/operations'
68
+
69
+ request_url = @base_url || @client.base_url
70
+
71
+ options = {
72
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
73
+ query_params: {'api-version' => @client.api_version},
74
+ headers: request_headers.merge(custom_headers || {}),
75
+ base_url: request_url
76
+ }
77
+ promise = @client.make_request_async(:get, path_template, options)
78
+
79
+ promise = promise.then do |result|
80
+ http_response = result.response
81
+ status_code = http_response.status
82
+ response_content = http_response.body
83
+ unless status_code == 200
84
+ error_model = JSON.load(response_content)
85
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
86
+ end
87
+
88
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
89
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
90
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
91
+ # Deserialize Response
92
+ if status_code == 200
93
+ begin
94
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
95
+ result_mapper = Azure::Portal::Mgmt::V2015_08_01_preview::Models::ResourceProviderOperationList.mapper()
96
+ result.body = @client.deserialize(result_mapper, parsed_response)
97
+ rescue Exception => e
98
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
99
+ end
100
+ end
101
+
102
+ result
103
+ end
104
+
105
+ promise.execute
106
+ end
107
+
108
+ #
109
+ # The Microsoft Portal operations API.
110
+ #
111
+ # @param next_page_link [String] The NextLink from the previous successful call
112
+ # to List operation.
113
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
114
+ # will be added to the HTTP request.
115
+ #
116
+ # @return [ResourceProviderOperationList] operation results.
117
+ #
118
+ def list_next(next_page_link, custom_headers:nil)
119
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
120
+ response.body unless response.nil?
121
+ end
122
+
123
+ #
124
+ # The Microsoft Portal operations API.
125
+ #
126
+ # @param next_page_link [String] The NextLink from the previous successful call
127
+ # to List operation.
128
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
129
+ # will be added to the HTTP request.
130
+ #
131
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
132
+ #
133
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
134
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
135
+ end
136
+
137
+ #
138
+ # The Microsoft Portal operations API.
139
+ #
140
+ # @param next_page_link [String] The NextLink from the previous successful call
141
+ # to List operation.
142
+ # @param [Hash{String => String}] A hash of custom headers that will be added
143
+ # to the HTTP request.
144
+ #
145
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
146
+ #
147
+ def list_next_async(next_page_link, custom_headers:nil)
148
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
149
+
150
+
151
+ request_headers = {}
152
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
153
+
154
+ # Set Headers
155
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
156
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
157
+ path_template = '{nextLink}'
158
+
159
+ request_url = @base_url || @client.base_url
160
+
161
+ options = {
162
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
163
+ skip_encoding_path_params: {'nextLink' => next_page_link},
164
+ headers: request_headers.merge(custom_headers || {}),
165
+ base_url: request_url
166
+ }
167
+ promise = @client.make_request_async(:get, path_template, options)
168
+
169
+ promise = promise.then do |result|
170
+ http_response = result.response
171
+ status_code = http_response.status
172
+ response_content = http_response.body
173
+ unless status_code == 200
174
+ error_model = JSON.load(response_content)
175
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
176
+ end
177
+
178
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
179
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
180
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
181
+ # Deserialize Response
182
+ if status_code == 200
183
+ begin
184
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
185
+ result_mapper = Azure::Portal::Mgmt::V2015_08_01_preview::Models::ResourceProviderOperationList.mapper()
186
+ result.body = @client.deserialize(result_mapper, parsed_response)
187
+ rescue Exception => e
188
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
189
+ end
190
+ end
191
+
192
+ result
193
+ end
194
+
195
+ promise.execute
196
+ end
197
+
198
+ #
199
+ # The Microsoft Portal operations API.
200
+ #
201
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
202
+ # will be added to the HTTP request.
203
+ #
204
+ # @return [ResourceProviderOperationList] which provide lazy access to pages of
205
+ # the response.
206
+ #
207
+ def list_as_lazy(custom_headers:nil)
208
+ response = list_async(custom_headers:custom_headers).value!
209
+ unless response.nil?
210
+ page = response.body
211
+ page.next_method = Proc.new do |next_page_link|
212
+ list_next_async(next_page_link, custom_headers:custom_headers)
213
+ end
214
+ page
215
+ end
216
+ end
217
+
218
+ end
219
+ end
@@ -0,0 +1,136 @@
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::Portal::Mgmt::V2015_08_01_preview
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class PortalClient < 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] The Azure subscription ID. This is a GUID-formatted
21
+ # string (e.g. 00000000-0000-0000-0000-000000000000)
22
+ attr_accessor :subscription_id
23
+
24
+ # @return [String] The API version to be used with the HTTP request.
25
+ attr_reader :api_version
26
+
27
+ # @return [String] The preferred language for the response.
28
+ attr_accessor :accept_language
29
+
30
+ # @return [Integer] The retry timeout in seconds for Long Running
31
+ # Operations. Default value is 30.
32
+ attr_accessor :long_running_operation_retry_timeout
33
+
34
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
35
+ # generated. When set to true a unique x-ms-client-request-id value is
36
+ # generated and included in each request. Default is true.
37
+ attr_accessor :generate_client_request_id
38
+
39
+ # @return [Operations] operations
40
+ attr_reader :operations
41
+
42
+ # @return [Dashboards] dashboards
43
+ attr_reader :dashboards
44
+
45
+ #
46
+ # Creates initializes a new instance of the PortalClient 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
+ @operations = Operations.new(self)
59
+ @dashboards = Dashboards.new(self)
60
+ @api_version = '2015-08-01-preview'
61
+ @accept_language = 'en-US'
62
+ @long_running_operation_retry_timeout = 30
63
+ @generate_client_request_id = true
64
+ add_telemetry
65
+ end
66
+
67
+ #
68
+ # Makes a request and returns the body of the response.
69
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
70
+ # @param path [String] the path, relative to {base_url}.
71
+ # @param options [Hash{String=>String}] specifying any request options like :body.
72
+ # @return [Hash{String=>String}] containing the body of the response.
73
+ # Example:
74
+ #
75
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
76
+ # path = "/path"
77
+ # options = {
78
+ # body: request_content,
79
+ # query_params: {'api-version' => '2016-02-01'}
80
+ # }
81
+ # result = @client.make_request(:put, path, options)
82
+ #
83
+ def make_request(method, path, options = {})
84
+ result = make_request_with_http_info(method, path, options)
85
+ result.body unless result.nil?
86
+ end
87
+
88
+ #
89
+ # Makes a request and returns the operation response.
90
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
91
+ # @param path [String] the path, relative to {base_url}.
92
+ # @param options [Hash{String=>String}] specifying any request options like :body.
93
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
94
+ #
95
+ def make_request_with_http_info(method, path, options = {})
96
+ result = make_request_async(method, path, options).value!
97
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
98
+ result
99
+ end
100
+
101
+ #
102
+ # Makes a request asynchronously.
103
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
104
+ # @param path [String] the path, relative to {base_url}.
105
+ # @param options [Hash{String=>String}] specifying any request options like :body.
106
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
107
+ #
108
+ def make_request_async(method, path, options = {})
109
+ fail ArgumentError, 'method is nil' if method.nil?
110
+ fail ArgumentError, 'path is nil' if path.nil?
111
+
112
+ request_url = options[:base_url] || @base_url
113
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
114
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
115
+ end
116
+
117
+ request_headers = @request_headers
118
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
119
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
120
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
121
+
122
+ super(request_url, method, path, options)
123
+ end
124
+
125
+
126
+ private
127
+ #
128
+ # Adds telemetry information.
129
+ #
130
+ def add_telemetry
131
+ sdk_information = 'azure_mgmt_portal'
132
+ sdk_information = "#{sdk_information}/0.17.0"
133
+ add_user_agent_information(sdk_information)
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,40 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2018-10-01-preview/generated/azure_mgmt_portal/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Portal::Mgmt::V2018_10_01_preview
23
+ autoload :Operations, '2018-10-01-preview/generated/azure_mgmt_portal/operations.rb'
24
+ autoload :Dashboards, '2018-10-01-preview/generated/azure_mgmt_portal/dashboards.rb'
25
+ autoload :PortalClient, '2018-10-01-preview/generated/azure_mgmt_portal/portal_client.rb'
26
+
27
+ module Models
28
+ autoload :PatchableDashboard, '2018-10-01-preview/generated/azure_mgmt_portal/models/patchable_dashboard.rb'
29
+ autoload :ResourceProviderOperationDisplay, '2018-10-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation_display.rb'
30
+ autoload :DashboardParts, '2018-10-01-preview/generated/azure_mgmt_portal/models/dashboard_parts.rb'
31
+ autoload :ResourceProviderOperation, '2018-10-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation.rb'
32
+ autoload :Dashboard, '2018-10-01-preview/generated/azure_mgmt_portal/models/dashboard.rb'
33
+ autoload :ResourceProviderOperationList, '2018-10-01-preview/generated/azure_mgmt_portal/models/resource_provider_operation_list.rb'
34
+ autoload :DashboardPartsPosition, '2018-10-01-preview/generated/azure_mgmt_portal/models/dashboard_parts_position.rb'
35
+ autoload :ErrorDefinition, '2018-10-01-preview/generated/azure_mgmt_portal/models/error_definition.rb'
36
+ autoload :DashboardListResult, '2018-10-01-preview/generated/azure_mgmt_portal/models/dashboard_list_result.rb'
37
+ autoload :ErrorResponse, '2018-10-01-preview/generated/azure_mgmt_portal/models/error_response.rb'
38
+ autoload :DashboardLens, '2018-10-01-preview/generated/azure_mgmt_portal/models/dashboard_lens.rb'
39
+ end
40
+ end
@@ -0,0 +1,830 @@
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::Portal::Mgmt::V2018_10_01_preview
7
+ #
8
+ # Allows creation and deletion of Azure Shared Dashboards.
9
+ #
10
+ class Dashboards
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Dashboards class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [portalClient] reference to the portalClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Creates or updates a Dashboard.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group.
28
+ # @param dashboard_name [String] The name of the dashboard.
29
+ # @param dashboard [Dashboard] The parameters required to create or update a
30
+ # dashboard.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [Dashboard] operation results.
35
+ #
36
+ def create_or_update(resource_group_name, dashboard_name, dashboard, custom_headers:nil)
37
+ response = create_or_update_async(resource_group_name, dashboard_name, dashboard, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Creates or updates a Dashboard.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group.
45
+ # @param dashboard_name [String] The name of the dashboard.
46
+ # @param dashboard [Dashboard] The parameters required to create or update a
47
+ # dashboard.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def create_or_update_with_http_info(resource_group_name, dashboard_name, dashboard, custom_headers:nil)
54
+ create_or_update_async(resource_group_name, dashboard_name, dashboard, custom_headers:custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Creates or updates a Dashboard.
59
+ #
60
+ # @param resource_group_name [String] The name of the resource group.
61
+ # @param dashboard_name [String] The name of the dashboard.
62
+ # @param dashboard [Dashboard] The parameters required to create or update a
63
+ # dashboard.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def create_or_update_async(resource_group_name, dashboard_name, dashboard, custom_headers:nil)
70
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
71
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
72
+ fail ArgumentError, 'dashboard_name is nil' if dashboard_name.nil?
73
+ fail ArgumentError, "'dashboard_name' should satisfy the constraint - 'MaxLength': '64'" if !dashboard_name.nil? && dashboard_name.length > 64
74
+ fail ArgumentError, "'dashboard_name' should satisfy the constraint - 'MinLength': '3'" if !dashboard_name.nil? && dashboard_name.length < 3
75
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
76
+ fail ArgumentError, 'dashboard is nil' if dashboard.nil?
77
+
78
+
79
+ request_headers = {}
80
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
81
+
82
+ # Set Headers
83
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
84
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
85
+
86
+ # Serialize Request
87
+ request_mapper = Azure::Portal::Mgmt::V2018_10_01_preview::Models::Dashboard.mapper()
88
+ request_content = @client.serialize(request_mapper, dashboard)
89
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
90
+
91
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}'
92
+
93
+ request_url = @base_url || @client.base_url
94
+
95
+ options = {
96
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
97
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'dashboardName' => dashboard_name},
98
+ query_params: {'api-version' => @client.api_version},
99
+ body: request_content,
100
+ headers: request_headers.merge(custom_headers || {}),
101
+ base_url: request_url
102
+ }
103
+ promise = @client.make_request_async(:put, path_template, options)
104
+
105
+ promise = promise.then do |result|
106
+ http_response = result.response
107
+ status_code = http_response.status
108
+ response_content = http_response.body
109
+ unless status_code == 201 || status_code == 200
110
+ error_model = JSON.load(response_content)
111
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
112
+ end
113
+
114
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
115
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
116
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
117
+ # Deserialize Response
118
+ if status_code == 201
119
+ begin
120
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
121
+ result_mapper = Azure::Portal::Mgmt::V2018_10_01_preview::Models::Dashboard.mapper()
122
+ result.body = @client.deserialize(result_mapper, parsed_response)
123
+ rescue Exception => e
124
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
125
+ end
126
+ end
127
+ # Deserialize Response
128
+ if status_code == 200
129
+ begin
130
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
131
+ result_mapper = Azure::Portal::Mgmt::V2018_10_01_preview::Models::Dashboard.mapper()
132
+ result.body = @client.deserialize(result_mapper, parsed_response)
133
+ rescue Exception => e
134
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
135
+ end
136
+ end
137
+
138
+ result
139
+ end
140
+
141
+ promise.execute
142
+ end
143
+
144
+ #
145
+ # Deletes the Dashboard.
146
+ #
147
+ # @param resource_group_name [String] The name of the resource group.
148
+ # @param dashboard_name [String] The name of the dashboard.
149
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
150
+ # will be added to the HTTP request.
151
+ #
152
+ #
153
+ def delete(resource_group_name, dashboard_name, custom_headers:nil)
154
+ response = delete_async(resource_group_name, dashboard_name, custom_headers:custom_headers).value!
155
+ nil
156
+ end
157
+
158
+ #
159
+ # Deletes the Dashboard.
160
+ #
161
+ # @param resource_group_name [String] The name of the resource group.
162
+ # @param dashboard_name [String] The name of the dashboard.
163
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
164
+ # will be added to the HTTP request.
165
+ #
166
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
167
+ #
168
+ def delete_with_http_info(resource_group_name, dashboard_name, custom_headers:nil)
169
+ delete_async(resource_group_name, dashboard_name, custom_headers:custom_headers).value!
170
+ end
171
+
172
+ #
173
+ # Deletes the Dashboard.
174
+ #
175
+ # @param resource_group_name [String] The name of the resource group.
176
+ # @param dashboard_name [String] The name of the dashboard.
177
+ # @param [Hash{String => String}] A hash of custom headers that will be added
178
+ # to the HTTP request.
179
+ #
180
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
181
+ #
182
+ def delete_async(resource_group_name, dashboard_name, custom_headers:nil)
183
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
184
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
185
+ fail ArgumentError, 'dashboard_name is nil' if dashboard_name.nil?
186
+ fail ArgumentError, "'dashboard_name' should satisfy the constraint - 'MaxLength': '64'" if !dashboard_name.nil? && dashboard_name.length > 64
187
+ fail ArgumentError, "'dashboard_name' should satisfy the constraint - 'MinLength': '3'" if !dashboard_name.nil? && dashboard_name.length < 3
188
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
189
+
190
+
191
+ request_headers = {}
192
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
193
+
194
+ # Set Headers
195
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
196
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
197
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}'
198
+
199
+ request_url = @base_url || @client.base_url
200
+
201
+ options = {
202
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
203
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'dashboardName' => dashboard_name},
204
+ query_params: {'api-version' => @client.api_version},
205
+ headers: request_headers.merge(custom_headers || {}),
206
+ base_url: request_url
207
+ }
208
+ promise = @client.make_request_async(:delete, path_template, options)
209
+
210
+ promise = promise.then do |result|
211
+ http_response = result.response
212
+ status_code = http_response.status
213
+ response_content = http_response.body
214
+ unless status_code == 200 || status_code == 204
215
+ error_model = JSON.load(response_content)
216
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
217
+ end
218
+
219
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
220
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
221
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
222
+
223
+ result
224
+ end
225
+
226
+ promise.execute
227
+ end
228
+
229
+ #
230
+ # Gets the Dashboard.
231
+ #
232
+ # @param resource_group_name [String] The name of the resource group.
233
+ # @param dashboard_name [String] The name of the dashboard.
234
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
235
+ # will be added to the HTTP request.
236
+ #
237
+ # @return [Dashboard] operation results.
238
+ #
239
+ def get(resource_group_name, dashboard_name, custom_headers:nil)
240
+ response = get_async(resource_group_name, dashboard_name, custom_headers:custom_headers).value!
241
+ response.body unless response.nil?
242
+ end
243
+
244
+ #
245
+ # Gets the Dashboard.
246
+ #
247
+ # @param resource_group_name [String] The name of the resource group.
248
+ # @param dashboard_name [String] The name of the dashboard.
249
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
250
+ # will be added to the HTTP request.
251
+ #
252
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
253
+ #
254
+ def get_with_http_info(resource_group_name, dashboard_name, custom_headers:nil)
255
+ get_async(resource_group_name, dashboard_name, custom_headers:custom_headers).value!
256
+ end
257
+
258
+ #
259
+ # Gets the Dashboard.
260
+ #
261
+ # @param resource_group_name [String] The name of the resource group.
262
+ # @param dashboard_name [String] The name of the dashboard.
263
+ # @param [Hash{String => String}] A hash of custom headers that will be added
264
+ # to the HTTP request.
265
+ #
266
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
267
+ #
268
+ def get_async(resource_group_name, dashboard_name, custom_headers:nil)
269
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
270
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
271
+ fail ArgumentError, 'dashboard_name is nil' if dashboard_name.nil?
272
+ fail ArgumentError, "'dashboard_name' should satisfy the constraint - 'MaxLength': '64'" if !dashboard_name.nil? && dashboard_name.length > 64
273
+ fail ArgumentError, "'dashboard_name' should satisfy the constraint - 'MinLength': '3'" if !dashboard_name.nil? && dashboard_name.length < 3
274
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
275
+
276
+
277
+ request_headers = {}
278
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
279
+
280
+ # Set Headers
281
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
282
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
283
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}'
284
+
285
+ request_url = @base_url || @client.base_url
286
+
287
+ options = {
288
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
289
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'dashboardName' => dashboard_name},
290
+ query_params: {'api-version' => @client.api_version},
291
+ headers: request_headers.merge(custom_headers || {}),
292
+ base_url: request_url
293
+ }
294
+ promise = @client.make_request_async(:get, path_template, options)
295
+
296
+ promise = promise.then do |result|
297
+ http_response = result.response
298
+ status_code = http_response.status
299
+ response_content = http_response.body
300
+ unless status_code == 200
301
+ error_model = JSON.load(response_content)
302
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
303
+ end
304
+
305
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
306
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
307
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
308
+ # Deserialize Response
309
+ if status_code == 200
310
+ begin
311
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
312
+ result_mapper = Azure::Portal::Mgmt::V2018_10_01_preview::Models::Dashboard.mapper()
313
+ result.body = @client.deserialize(result_mapper, parsed_response)
314
+ rescue Exception => e
315
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
316
+ end
317
+ end
318
+
319
+ result
320
+ end
321
+
322
+ promise.execute
323
+ end
324
+
325
+ #
326
+ # Updates an existing Dashboard.
327
+ #
328
+ # @param resource_group_name [String] The name of the resource group.
329
+ # @param dashboard_name [String] The name of the dashboard.
330
+ # @param dashboard [PatchableDashboard] The updatable fields of a Dashboard.
331
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
332
+ # will be added to the HTTP request.
333
+ #
334
+ # @return [Dashboard] operation results.
335
+ #
336
+ def update(resource_group_name, dashboard_name, dashboard, custom_headers:nil)
337
+ response = update_async(resource_group_name, dashboard_name, dashboard, custom_headers:custom_headers).value!
338
+ response.body unless response.nil?
339
+ end
340
+
341
+ #
342
+ # Updates an existing Dashboard.
343
+ #
344
+ # @param resource_group_name [String] The name of the resource group.
345
+ # @param dashboard_name [String] The name of the dashboard.
346
+ # @param dashboard [PatchableDashboard] The updatable fields of a Dashboard.
347
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
348
+ # will be added to the HTTP request.
349
+ #
350
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
351
+ #
352
+ def update_with_http_info(resource_group_name, dashboard_name, dashboard, custom_headers:nil)
353
+ update_async(resource_group_name, dashboard_name, dashboard, custom_headers:custom_headers).value!
354
+ end
355
+
356
+ #
357
+ # Updates an existing Dashboard.
358
+ #
359
+ # @param resource_group_name [String] The name of the resource group.
360
+ # @param dashboard_name [String] The name of the dashboard.
361
+ # @param dashboard [PatchableDashboard] The updatable fields of a Dashboard.
362
+ # @param [Hash{String => String}] A hash of custom headers that will be added
363
+ # to the HTTP request.
364
+ #
365
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
366
+ #
367
+ def update_async(resource_group_name, dashboard_name, dashboard, custom_headers:nil)
368
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
369
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
370
+ fail ArgumentError, 'dashboard_name is nil' if dashboard_name.nil?
371
+ fail ArgumentError, "'dashboard_name' should satisfy the constraint - 'MaxLength': '64'" if !dashboard_name.nil? && dashboard_name.length > 64
372
+ fail ArgumentError, "'dashboard_name' should satisfy the constraint - 'MinLength': '3'" if !dashboard_name.nil? && dashboard_name.length < 3
373
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
374
+ fail ArgumentError, 'dashboard is nil' if dashboard.nil?
375
+
376
+
377
+ request_headers = {}
378
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
379
+
380
+ # Set Headers
381
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
382
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
383
+
384
+ # Serialize Request
385
+ request_mapper = Azure::Portal::Mgmt::V2018_10_01_preview::Models::PatchableDashboard.mapper()
386
+ request_content = @client.serialize(request_mapper, dashboard)
387
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
388
+
389
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}'
390
+
391
+ request_url = @base_url || @client.base_url
392
+
393
+ options = {
394
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
395
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'dashboardName' => dashboard_name},
396
+ query_params: {'api-version' => @client.api_version},
397
+ body: request_content,
398
+ headers: request_headers.merge(custom_headers || {}),
399
+ base_url: request_url
400
+ }
401
+ promise = @client.make_request_async(:patch, path_template, options)
402
+
403
+ promise = promise.then do |result|
404
+ http_response = result.response
405
+ status_code = http_response.status
406
+ response_content = http_response.body
407
+ unless status_code == 200
408
+ error_model = JSON.load(response_content)
409
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
410
+ end
411
+
412
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
413
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
414
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
415
+ # Deserialize Response
416
+ if status_code == 200
417
+ begin
418
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
419
+ result_mapper = Azure::Portal::Mgmt::V2018_10_01_preview::Models::Dashboard.mapper()
420
+ result.body = @client.deserialize(result_mapper, parsed_response)
421
+ rescue Exception => e
422
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
423
+ end
424
+ end
425
+
426
+ result
427
+ end
428
+
429
+ promise.execute
430
+ end
431
+
432
+ #
433
+ # Gets all the Dashboards within a resource group.
434
+ #
435
+ # @param resource_group_name [String] The name of the resource group.
436
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
437
+ # will be added to the HTTP request.
438
+ #
439
+ # @return [Array<Dashboard>] operation results.
440
+ #
441
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
442
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
443
+ first_page.get_all_items
444
+ end
445
+
446
+ #
447
+ # Gets all the Dashboards within a resource group.
448
+ #
449
+ # @param resource_group_name [String] The name of the resource group.
450
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
451
+ # will be added to the HTTP request.
452
+ #
453
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
454
+ #
455
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
456
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
457
+ end
458
+
459
+ #
460
+ # Gets all the Dashboards within a resource group.
461
+ #
462
+ # @param resource_group_name [String] The name of the resource group.
463
+ # @param [Hash{String => String}] A hash of custom headers that will be added
464
+ # to the HTTP request.
465
+ #
466
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
467
+ #
468
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
469
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
470
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
471
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
472
+
473
+
474
+ request_headers = {}
475
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
476
+
477
+ # Set Headers
478
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
479
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
480
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards'
481
+
482
+ request_url = @base_url || @client.base_url
483
+
484
+ options = {
485
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
486
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
487
+ query_params: {'api-version' => @client.api_version},
488
+ headers: request_headers.merge(custom_headers || {}),
489
+ base_url: request_url
490
+ }
491
+ promise = @client.make_request_async(:get, path_template, options)
492
+
493
+ promise = promise.then do |result|
494
+ http_response = result.response
495
+ status_code = http_response.status
496
+ response_content = http_response.body
497
+ unless status_code == 200
498
+ error_model = JSON.load(response_content)
499
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
500
+ end
501
+
502
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
503
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
504
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
505
+ # Deserialize Response
506
+ if status_code == 200
507
+ begin
508
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
509
+ result_mapper = Azure::Portal::Mgmt::V2018_10_01_preview::Models::DashboardListResult.mapper()
510
+ result.body = @client.deserialize(result_mapper, parsed_response)
511
+ rescue Exception => e
512
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
513
+ end
514
+ end
515
+
516
+ result
517
+ end
518
+
519
+ promise.execute
520
+ end
521
+
522
+ #
523
+ # Gets all the dashboards within a subscription.
524
+ #
525
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
526
+ # will be added to the HTTP request.
527
+ #
528
+ # @return [Array<Dashboard>] operation results.
529
+ #
530
+ def list_by_subscription(custom_headers:nil)
531
+ first_page = list_by_subscription_as_lazy(custom_headers:custom_headers)
532
+ first_page.get_all_items
533
+ end
534
+
535
+ #
536
+ # Gets all the dashboards within a subscription.
537
+ #
538
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
539
+ # will be added to the HTTP request.
540
+ #
541
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
542
+ #
543
+ def list_by_subscription_with_http_info(custom_headers:nil)
544
+ list_by_subscription_async(custom_headers:custom_headers).value!
545
+ end
546
+
547
+ #
548
+ # Gets all the dashboards within a subscription.
549
+ #
550
+ # @param [Hash{String => String}] A hash of custom headers that will be added
551
+ # to the HTTP request.
552
+ #
553
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
554
+ #
555
+ def list_by_subscription_async(custom_headers:nil)
556
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
557
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
558
+
559
+
560
+ request_headers = {}
561
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
562
+
563
+ # Set Headers
564
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
565
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
566
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Portal/dashboards'
567
+
568
+ request_url = @base_url || @client.base_url
569
+
570
+ options = {
571
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
572
+ path_params: {'subscriptionId' => @client.subscription_id},
573
+ query_params: {'api-version' => @client.api_version},
574
+ headers: request_headers.merge(custom_headers || {}),
575
+ base_url: request_url
576
+ }
577
+ promise = @client.make_request_async(:get, path_template, options)
578
+
579
+ promise = promise.then do |result|
580
+ http_response = result.response
581
+ status_code = http_response.status
582
+ response_content = http_response.body
583
+ unless status_code == 200
584
+ error_model = JSON.load(response_content)
585
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
586
+ end
587
+
588
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
589
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
590
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
591
+ # Deserialize Response
592
+ if status_code == 200
593
+ begin
594
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
595
+ result_mapper = Azure::Portal::Mgmt::V2018_10_01_preview::Models::DashboardListResult.mapper()
596
+ result.body = @client.deserialize(result_mapper, parsed_response)
597
+ rescue Exception => e
598
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
599
+ end
600
+ end
601
+
602
+ result
603
+ end
604
+
605
+ promise.execute
606
+ end
607
+
608
+ #
609
+ # Gets all the Dashboards within a resource group.
610
+ #
611
+ # @param next_page_link [String] The NextLink from the previous successful call
612
+ # to List operation.
613
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
614
+ # will be added to the HTTP request.
615
+ #
616
+ # @return [DashboardListResult] operation results.
617
+ #
618
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
619
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
620
+ response.body unless response.nil?
621
+ end
622
+
623
+ #
624
+ # Gets all the Dashboards within a resource group.
625
+ #
626
+ # @param next_page_link [String] The NextLink from the previous successful call
627
+ # to List operation.
628
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
629
+ # will be added to the HTTP request.
630
+ #
631
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
632
+ #
633
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
634
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
635
+ end
636
+
637
+ #
638
+ # Gets all the Dashboards within a resource group.
639
+ #
640
+ # @param next_page_link [String] The NextLink from the previous successful call
641
+ # to List operation.
642
+ # @param [Hash{String => String}] A hash of custom headers that will be added
643
+ # to the HTTP request.
644
+ #
645
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
646
+ #
647
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
648
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
649
+
650
+
651
+ request_headers = {}
652
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
653
+
654
+ # Set Headers
655
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
656
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
657
+ path_template = '{nextLink}'
658
+
659
+ request_url = @base_url || @client.base_url
660
+
661
+ options = {
662
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
663
+ skip_encoding_path_params: {'nextLink' => next_page_link},
664
+ headers: request_headers.merge(custom_headers || {}),
665
+ base_url: request_url
666
+ }
667
+ promise = @client.make_request_async(:get, path_template, options)
668
+
669
+ promise = promise.then do |result|
670
+ http_response = result.response
671
+ status_code = http_response.status
672
+ response_content = http_response.body
673
+ unless status_code == 200
674
+ error_model = JSON.load(response_content)
675
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
676
+ end
677
+
678
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
679
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
680
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
681
+ # Deserialize Response
682
+ if status_code == 200
683
+ begin
684
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
685
+ result_mapper = Azure::Portal::Mgmt::V2018_10_01_preview::Models::DashboardListResult.mapper()
686
+ result.body = @client.deserialize(result_mapper, parsed_response)
687
+ rescue Exception => e
688
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
689
+ end
690
+ end
691
+
692
+ result
693
+ end
694
+
695
+ promise.execute
696
+ end
697
+
698
+ #
699
+ # Gets all the dashboards within a subscription.
700
+ #
701
+ # @param next_page_link [String] The NextLink from the previous successful call
702
+ # to List operation.
703
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
704
+ # will be added to the HTTP request.
705
+ #
706
+ # @return [DashboardListResult] operation results.
707
+ #
708
+ def list_by_subscription_next(next_page_link, custom_headers:nil)
709
+ response = list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
710
+ response.body unless response.nil?
711
+ end
712
+
713
+ #
714
+ # Gets all the dashboards within a subscription.
715
+ #
716
+ # @param next_page_link [String] The NextLink from the previous successful call
717
+ # to List operation.
718
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
719
+ # will be added to the HTTP request.
720
+ #
721
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
722
+ #
723
+ def list_by_subscription_next_with_http_info(next_page_link, custom_headers:nil)
724
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
725
+ end
726
+
727
+ #
728
+ # Gets all the dashboards within a subscription.
729
+ #
730
+ # @param next_page_link [String] The NextLink from the previous successful call
731
+ # to List operation.
732
+ # @param [Hash{String => String}] A hash of custom headers that will be added
733
+ # to the HTTP request.
734
+ #
735
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
736
+ #
737
+ def list_by_subscription_next_async(next_page_link, custom_headers:nil)
738
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
739
+
740
+
741
+ request_headers = {}
742
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
743
+
744
+ # Set Headers
745
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
746
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
747
+ path_template = '{nextLink}'
748
+
749
+ request_url = @base_url || @client.base_url
750
+
751
+ options = {
752
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
753
+ skip_encoding_path_params: {'nextLink' => next_page_link},
754
+ headers: request_headers.merge(custom_headers || {}),
755
+ base_url: request_url
756
+ }
757
+ promise = @client.make_request_async(:get, path_template, options)
758
+
759
+ promise = promise.then do |result|
760
+ http_response = result.response
761
+ status_code = http_response.status
762
+ response_content = http_response.body
763
+ unless status_code == 200
764
+ error_model = JSON.load(response_content)
765
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
766
+ end
767
+
768
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
769
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
770
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
771
+ # Deserialize Response
772
+ if status_code == 200
773
+ begin
774
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
775
+ result_mapper = Azure::Portal::Mgmt::V2018_10_01_preview::Models::DashboardListResult.mapper()
776
+ result.body = @client.deserialize(result_mapper, parsed_response)
777
+ rescue Exception => e
778
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
779
+ end
780
+ end
781
+
782
+ result
783
+ end
784
+
785
+ promise.execute
786
+ end
787
+
788
+ #
789
+ # Gets all the Dashboards within a resource group.
790
+ #
791
+ # @param resource_group_name [String] The name of the resource group.
792
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
793
+ # will be added to the HTTP request.
794
+ #
795
+ # @return [DashboardListResult] which provide lazy access to pages of the
796
+ # response.
797
+ #
798
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
799
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
800
+ unless response.nil?
801
+ page = response.body
802
+ page.next_method = Proc.new do |next_page_link|
803
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
804
+ end
805
+ page
806
+ end
807
+ end
808
+
809
+ #
810
+ # Gets all the dashboards within a subscription.
811
+ #
812
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
813
+ # will be added to the HTTP request.
814
+ #
815
+ # @return [DashboardListResult] which provide lazy access to pages of the
816
+ # response.
817
+ #
818
+ def list_by_subscription_as_lazy(custom_headers:nil)
819
+ response = list_by_subscription_async(custom_headers:custom_headers).value!
820
+ unless response.nil?
821
+ page = response.body
822
+ page.next_method = Proc.new do |next_page_link|
823
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers)
824
+ end
825
+ page
826
+ end
827
+ end
828
+
829
+ end
830
+ end