azure_mgmt_insights 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_insights.rb +5 -0
  4. data/lib/generated/azure_mgmt_insights.rb +77 -0
  5. data/lib/generated/azure_mgmt_insights/alert_rule_incidents.rb +121 -0
  6. data/lib/generated/azure_mgmt_insights/alert_rules.rb +410 -0
  7. data/lib/generated/azure_mgmt_insights/autoscale_settings.rb +521 -0
  8. data/lib/generated/azure_mgmt_insights/incidents.rb +117 -0
  9. data/lib/generated/azure_mgmt_insights/insights_management_client.rb +147 -0
  10. data/lib/generated/azure_mgmt_insights/log_profiles.rb +375 -0
  11. data/lib/generated/azure_mgmt_insights/models/alert_rule_resource.rb +156 -0
  12. data/lib/generated/azure_mgmt_insights/models/alert_rule_resource_collection.rb +53 -0
  13. data/lib/generated/azure_mgmt_insights/models/autoscale_notification.rb +77 -0
  14. data/lib/generated/azure_mgmt_insights/models/autoscale_profile.rb +100 -0
  15. data/lib/generated/azure_mgmt_insights/models/autoscale_setting_resource.rb +152 -0
  16. data/lib/generated/azure_mgmt_insights/models/autoscale_setting_resource_collection.rb +94 -0
  17. data/lib/generated/azure_mgmt_insights/models/comparison_operation_type.rb +20 -0
  18. data/lib/generated/azure_mgmt_insights/models/condition_operator.rb +18 -0
  19. data/lib/generated/azure_mgmt_insights/models/email_notification.rb +73 -0
  20. data/lib/generated/azure_mgmt_insights/models/incident.rb +92 -0
  21. data/lib/generated/azure_mgmt_insights/models/incident_list_result.rb +52 -0
  22. data/lib/generated/azure_mgmt_insights/models/location_threshold_rule_condition.rb +85 -0
  23. data/lib/generated/azure_mgmt_insights/models/log_profile_collection.rb +52 -0
  24. data/lib/generated/azure_mgmt_insights/models/log_profile_create_or_update_parameters.rb +99 -0
  25. data/lib/generated/azure_mgmt_insights/models/log_profile_resource.rb +143 -0
  26. data/lib/generated/azure_mgmt_insights/models/log_settings.rb +66 -0
  27. data/lib/generated/azure_mgmt_insights/models/management_event_aggregation_condition.rb +69 -0
  28. data/lib/generated/azure_mgmt_insights/models/management_event_rule_condition.rb +74 -0
  29. data/lib/generated/azure_mgmt_insights/models/metric_settings.rb +66 -0
  30. data/lib/generated/azure_mgmt_insights/models/metric_statistic_type.rb +18 -0
  31. data/lib/generated/azure_mgmt_insights/models/metric_trigger.rb +133 -0
  32. data/lib/generated/azure_mgmt_insights/models/recurrence.rb +61 -0
  33. data/lib/generated/azure_mgmt_insights/models/recurrence_frequency.rb +22 -0
  34. data/lib/generated/azure_mgmt_insights/models/recurrent_schedule.rb +101 -0
  35. data/lib/generated/azure_mgmt_insights/models/retention_policy.rb +55 -0
  36. data/lib/generated/azure_mgmt_insights/models/rule_action.rb +47 -0
  37. data/lib/generated/azure_mgmt_insights/models/rule_condition.rb +47 -0
  38. data/lib/generated/azure_mgmt_insights/models/rule_data_source.rb +46 -0
  39. data/lib/generated/azure_mgmt_insights/models/rule_email_action.rb +78 -0
  40. data/lib/generated/azure_mgmt_insights/models/rule_management_event_claims_data_source.rb +44 -0
  41. data/lib/generated/azure_mgmt_insights/models/rule_management_event_data_source.rb +151 -0
  42. data/lib/generated/azure_mgmt_insights/models/rule_metric_data_source.rb +70 -0
  43. data/lib/generated/azure_mgmt_insights/models/rule_webhook_action.rb +77 -0
  44. data/lib/generated/azure_mgmt_insights/models/scale_action.rb +85 -0
  45. data/lib/generated/azure_mgmt_insights/models/scale_capacity.rb +67 -0
  46. data/lib/generated/azure_mgmt_insights/models/scale_direction.rb +17 -0
  47. data/lib/generated/azure_mgmt_insights/models/scale_rule.rb +57 -0
  48. data/lib/generated/azure_mgmt_insights/models/service_diagnostic_settings_create_or_update_parameters.rb +101 -0
  49. data/lib/generated/azure_mgmt_insights/models/service_diagnostic_settings_resource.rb +144 -0
  50. data/lib/generated/azure_mgmt_insights/models/threshold_rule_condition.rb +111 -0
  51. data/lib/generated/azure_mgmt_insights/models/time_aggregation_operator.rb +19 -0
  52. data/lib/generated/azure_mgmt_insights/models/time_aggregation_type.rb +19 -0
  53. data/lib/generated/azure_mgmt_insights/models/time_window.rb +67 -0
  54. data/lib/generated/azure_mgmt_insights/models/webhook_notification.rb +61 -0
  55. data/lib/generated/azure_mgmt_insights/module_definition.rb +8 -0
  56. data/lib/generated/azure_mgmt_insights/service_diagnostic_settings_operations.rb +216 -0
  57. data/lib/generated/azure_mgmt_insights/version.rb +8 -0
  58. metadata +169 -0
@@ -0,0 +1,117 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Insights
7
+ #
8
+ # Composite Swagger for Insights Management Client
9
+ #
10
+ class Incidents
11
+ include Azure::ARM::Insights::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Incidents class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [InsightsManagementClient] reference to the InsightsManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets a list of incidents associated to an alert rule
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group.
29
+ # @param rule_name [String] The name of the rule.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [IncidentListResult] operation results.
34
+ #
35
+ def list_by_alert_rule(resource_group_name, rule_name, custom_headers = nil)
36
+ response = list_by_alert_rule_async(resource_group_name, rule_name, custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Gets a list of incidents associated to an alert rule
42
+ #
43
+ # @param resource_group_name [String] The name of the resource group.
44
+ # @param rule_name [String] The name of the rule.
45
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
46
+ # will be added to the HTTP request.
47
+ #
48
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
49
+ #
50
+ def list_by_alert_rule_with_http_info(resource_group_name, rule_name, custom_headers = nil)
51
+ list_by_alert_rule_async(resource_group_name, rule_name, custom_headers).value!
52
+ end
53
+
54
+ #
55
+ # Gets a list of incidents associated to an alert rule
56
+ #
57
+ # @param resource_group_name [String] The name of the resource group.
58
+ # @param rule_name [String] The name of the rule.
59
+ # @param [Hash{String => String}] A hash of custom headers that will be added
60
+ # to the HTTP request.
61
+ #
62
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
63
+ #
64
+ def list_by_alert_rule_async(resource_group_name, rule_name, custom_headers = nil)
65
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
66
+ fail ArgumentError, 'rule_name is nil' if rule_name.nil?
67
+ api_version = '2016-03-01'
68
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
69
+
70
+
71
+ request_headers = {}
72
+
73
+ # Set Headers
74
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
75
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
76
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents'
77
+
78
+ request_url = @base_url || @client.base_url
79
+
80
+ options = {
81
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
82
+ path_params: {'resourceGroupName' => resource_group_name,'ruleName' => rule_name,'subscriptionId' => @client.subscription_id},
83
+ query_params: {'api-version' => api_version},
84
+ headers: request_headers.merge(custom_headers || {}),
85
+ base_url: request_url
86
+ }
87
+ promise = @client.make_request_async(:get, path_template, options)
88
+
89
+ promise = promise.then do |result|
90
+ http_response = result.response
91
+ status_code = http_response.status
92
+ response_content = http_response.body
93
+ unless status_code == 200
94
+ error_model = JSON.load(response_content)
95
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
96
+ end
97
+
98
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
99
+ # Deserialize Response
100
+ if status_code == 200
101
+ begin
102
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
103
+ result_mapper = IncidentListResult.mapper()
104
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
105
+ rescue Exception => e
106
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
107
+ end
108
+ end
109
+
110
+ result
111
+ end
112
+
113
+ promise.execute
114
+ end
115
+
116
+ end
117
+ end
@@ -0,0 +1,147 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Insights
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class InsightsManagementClient < 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.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] Gets or sets the preferred language for the response.
24
+ attr_accessor :accept_language
25
+
26
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
27
+ # Running Operations. Default value is 30.
28
+ attr_accessor :long_running_operation_retry_timeout
29
+
30
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
31
+ # is generated and included in each request. Default is true.
32
+ attr_accessor :generate_client_request_id
33
+
34
+ # @return [AutoscaleSettings] autoscale_settings
35
+ attr_reader :autoscale_settings
36
+
37
+ # @return [ServiceDiagnosticSettingsOperations]
38
+ # service_diagnostic_settings_operations
39
+ attr_reader :service_diagnostic_settings_operations
40
+
41
+ # @return [AlertRuleIncidents] alert_rule_incidents
42
+ attr_reader :alert_rule_incidents
43
+
44
+ # @return [Incidents] incidents
45
+ attr_reader :incidents
46
+
47
+ # @return [AlertRules] alert_rules
48
+ attr_reader :alert_rules
49
+
50
+ # @return [LogProfiles] log_profiles
51
+ attr_reader :log_profiles
52
+
53
+ #
54
+ # Creates initializes a new instance of the InsightsManagementClient class.
55
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
56
+ # @param base_url [String] the base URI of the service.
57
+ # @param options [Array] filters to be applied to the HTTP requests.
58
+ #
59
+ def initialize(credentials, base_url = nil, options = nil)
60
+ super(credentials, options)
61
+ @base_url = base_url || 'https://management.azure.com'
62
+
63
+ fail ArgumentError, 'credentials is nil' if credentials.nil?
64
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
65
+ @credentials = credentials
66
+
67
+ @autoscale_settings = AutoscaleSettings.new(self)
68
+ @service_diagnostic_settings_operations = ServiceDiagnosticSettingsOperations.new(self)
69
+ @alert_rule_incidents = AlertRuleIncidents.new(self)
70
+ @incidents = Incidents.new(self)
71
+ @alert_rules = AlertRules.new(self)
72
+ @log_profiles = LogProfiles.new(self)
73
+ @accept_language = 'en-US'
74
+ @long_running_operation_retry_timeout = 30
75
+ @generate_client_request_id = true
76
+ add_telemetry
77
+ end
78
+
79
+ #
80
+ # Makes a request and returns the body of the response.
81
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
82
+ # @param path [String] the path, relative to {base_url}.
83
+ # @param options [Hash{String=>String}] specifying any request options like :body.
84
+ # @return [Hash{String=>String}] containing the body of the response.
85
+ # Example:
86
+ #
87
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
88
+ # path = "/path"
89
+ # options = {
90
+ # body: request_content,
91
+ # query_params: {'api-version' => '2016-02-01'}
92
+ # }
93
+ # result = @client.make_request(:put, path, options)
94
+ #
95
+ def make_request(method, path, options = {})
96
+ result = make_request_with_http_info(method, path, options)
97
+ result.body unless result.nil?
98
+ end
99
+
100
+ #
101
+ # Makes a request and returns the operation response.
102
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
103
+ # @param path [String] the path, relative to {base_url}.
104
+ # @param options [Hash{String=>String}] specifying any request options like :body.
105
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
106
+ #
107
+ def make_request_with_http_info(method, path, options = {})
108
+ result = make_request_async(method, path, options).value!
109
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
110
+ result
111
+ end
112
+
113
+ #
114
+ # Makes a request asynchronously.
115
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
116
+ # @param path [String] the path, relative to {base_url}.
117
+ # @param options [Hash{String=>String}] specifying any request options like :body.
118
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
119
+ #
120
+ def make_request_async(method, path, options = {})
121
+ fail ArgumentError, 'method is nil' if method.nil?
122
+ fail ArgumentError, 'path is nil' if path.nil?
123
+
124
+ request_url = options[:base_url] || @base_url
125
+
126
+ request_headers = @request_headers
127
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
128
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
129
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
130
+
131
+ super(request_url, method, path, options)
132
+ end
133
+
134
+
135
+ private
136
+ #
137
+ # Adds telemetry information.
138
+ #
139
+ def add_telemetry
140
+ sdk_information = 'azure_mgmt_insights'
141
+ if defined? Azure::ARM::Insights::VERSION
142
+ sdk_information = "#{sdk_information}/#{Azure::ARM::Insights::VERSION}"
143
+ end
144
+ add_user_agent_information(sdk_information)
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,375 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Insights
7
+ #
8
+ # Composite Swagger for Insights Management Client
9
+ #
10
+ class LogProfiles
11
+ include Azure::ARM::Insights::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the LogProfiles class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [InsightsManagementClient] reference to the InsightsManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Deletes the log profile.
27
+ #
28
+ # @param log_profile_name [String] The name of the log profile.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ #
33
+ def delete(log_profile_name, custom_headers = nil)
34
+ response = delete_async(log_profile_name, custom_headers).value!
35
+ nil
36
+ end
37
+
38
+ #
39
+ # Deletes the log profile.
40
+ #
41
+ # @param log_profile_name [String] The name of the log profile.
42
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
43
+ # will be added to the HTTP request.
44
+ #
45
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
46
+ #
47
+ def delete_with_http_info(log_profile_name, custom_headers = nil)
48
+ delete_async(log_profile_name, custom_headers).value!
49
+ end
50
+
51
+ #
52
+ # Deletes the log profile.
53
+ #
54
+ # @param log_profile_name [String] The name of the log profile.
55
+ # @param [Hash{String => String}] A hash of custom headers that will be added
56
+ # to the HTTP request.
57
+ #
58
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
59
+ #
60
+ def delete_async(log_profile_name, custom_headers = nil)
61
+ fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
62
+ api_version = '2016-03-01'
63
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
64
+
65
+
66
+ request_headers = {}
67
+
68
+ # Set Headers
69
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
70
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
71
+ path_template = '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'
72
+
73
+ request_url = @base_url || @client.base_url
74
+
75
+ options = {
76
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
77
+ path_params: {'logProfileName' => log_profile_name,'subscriptionId' => @client.subscription_id},
78
+ query_params: {'api-version' => api_version},
79
+ headers: request_headers.merge(custom_headers || {}),
80
+ base_url: request_url
81
+ }
82
+ promise = @client.make_request_async(:delete, path_template, options)
83
+
84
+ promise = promise.then do |result|
85
+ http_response = result.response
86
+ status_code = http_response.status
87
+ response_content = http_response.body
88
+ unless status_code == 200
89
+ error_model = JSON.load(response_content)
90
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
91
+ end
92
+
93
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
94
+
95
+ result
96
+ end
97
+
98
+ promise.execute
99
+ end
100
+
101
+ #
102
+ # Gets the log profile.
103
+ #
104
+ # @param log_profile_name [String] The name of the log profile.
105
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
106
+ # will be added to the HTTP request.
107
+ #
108
+ # @return [LogProfileResource] operation results.
109
+ #
110
+ def get(log_profile_name, custom_headers = nil)
111
+ response = get_async(log_profile_name, custom_headers).value!
112
+ response.body unless response.nil?
113
+ end
114
+
115
+ #
116
+ # Gets the log profile.
117
+ #
118
+ # @param log_profile_name [String] The name of the log profile.
119
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
120
+ # will be added to the HTTP request.
121
+ #
122
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
123
+ #
124
+ def get_with_http_info(log_profile_name, custom_headers = nil)
125
+ get_async(log_profile_name, custom_headers).value!
126
+ end
127
+
128
+ #
129
+ # Gets the log profile.
130
+ #
131
+ # @param log_profile_name [String] The name of the log profile.
132
+ # @param [Hash{String => String}] A hash of custom headers that will be added
133
+ # to the HTTP request.
134
+ #
135
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
136
+ #
137
+ def get_async(log_profile_name, custom_headers = nil)
138
+ fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
139
+ api_version = '2016-03-01'
140
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
141
+
142
+
143
+ request_headers = {}
144
+
145
+ # Set Headers
146
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
147
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
148
+ path_template = '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'
149
+
150
+ request_url = @base_url || @client.base_url
151
+
152
+ options = {
153
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
154
+ path_params: {'logProfileName' => log_profile_name,'subscriptionId' => @client.subscription_id},
155
+ query_params: {'api-version' => api_version},
156
+ headers: request_headers.merge(custom_headers || {}),
157
+ base_url: request_url
158
+ }
159
+ promise = @client.make_request_async(:get, path_template, options)
160
+
161
+ promise = promise.then do |result|
162
+ http_response = result.response
163
+ status_code = http_response.status
164
+ response_content = http_response.body
165
+ unless status_code == 200
166
+ error_model = JSON.load(response_content)
167
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
168
+ end
169
+
170
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
171
+ # Deserialize Response
172
+ if status_code == 200
173
+ begin
174
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
175
+ result_mapper = LogProfileResource.mapper()
176
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
177
+ rescue Exception => e
178
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
179
+ end
180
+ end
181
+
182
+ result
183
+ end
184
+
185
+ promise.execute
186
+ end
187
+
188
+ #
189
+ # Create or update the log profile.
190
+ #
191
+ # @param log_profile_name [String] The name of the log profile.
192
+ # @param parameters [LogProfileCreateOrUpdateParameters] Parameters supplied to
193
+ # the operation.
194
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
195
+ # will be added to the HTTP request.
196
+ #
197
+ # @return [LogProfileResource] operation results.
198
+ #
199
+ def create_or_update(log_profile_name, parameters, custom_headers = nil)
200
+ response = create_or_update_async(log_profile_name, parameters, custom_headers).value!
201
+ response.body unless response.nil?
202
+ end
203
+
204
+ #
205
+ # Create or update the log profile.
206
+ #
207
+ # @param log_profile_name [String] The name of the log profile.
208
+ # @param parameters [LogProfileCreateOrUpdateParameters] Parameters supplied to
209
+ # the operation.
210
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
211
+ # will be added to the HTTP request.
212
+ #
213
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
214
+ #
215
+ def create_or_update_with_http_info(log_profile_name, parameters, custom_headers = nil)
216
+ create_or_update_async(log_profile_name, parameters, custom_headers).value!
217
+ end
218
+
219
+ #
220
+ # Create or update the log profile.
221
+ #
222
+ # @param log_profile_name [String] The name of the log profile.
223
+ # @param parameters [LogProfileCreateOrUpdateParameters] Parameters supplied to
224
+ # the operation.
225
+ # @param [Hash{String => String}] A hash of custom headers that will be added
226
+ # to the HTTP request.
227
+ #
228
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
229
+ #
230
+ def create_or_update_async(log_profile_name, parameters, custom_headers = nil)
231
+ fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
232
+ api_version = '2016-03-01'
233
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
234
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
235
+
236
+
237
+ request_headers = {}
238
+
239
+ # Set Headers
240
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
241
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
242
+
243
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
244
+
245
+ # Serialize Request
246
+ request_mapper = LogProfileCreateOrUpdateParameters.mapper()
247
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
248
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
249
+
250
+ path_template = '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'
251
+
252
+ request_url = @base_url || @client.base_url
253
+
254
+ options = {
255
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
256
+ path_params: {'logProfileName' => log_profile_name,'subscriptionId' => @client.subscription_id},
257
+ query_params: {'api-version' => api_version},
258
+ body: request_content,
259
+ headers: request_headers.merge(custom_headers || {}),
260
+ base_url: request_url
261
+ }
262
+ promise = @client.make_request_async(:put, path_template, options)
263
+
264
+ promise = promise.then do |result|
265
+ http_response = result.response
266
+ status_code = http_response.status
267
+ response_content = http_response.body
268
+ unless status_code == 200
269
+ error_model = JSON.load(response_content)
270
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
271
+ end
272
+
273
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
274
+ # Deserialize Response
275
+ if status_code == 200
276
+ begin
277
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
278
+ result_mapper = LogProfileResource.mapper()
279
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
280
+ rescue Exception => e
281
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
282
+ end
283
+ end
284
+
285
+ result
286
+ end
287
+
288
+ promise.execute
289
+ end
290
+
291
+ #
292
+ # List the log profiles.
293
+ #
294
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
295
+ # will be added to the HTTP request.
296
+ #
297
+ # @return [LogProfileCollection] operation results.
298
+ #
299
+ def list(custom_headers = nil)
300
+ response = list_async(custom_headers).value!
301
+ response.body unless response.nil?
302
+ end
303
+
304
+ #
305
+ # List the log profiles.
306
+ #
307
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
308
+ # will be added to the HTTP request.
309
+ #
310
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
311
+ #
312
+ def list_with_http_info(custom_headers = nil)
313
+ list_async(custom_headers).value!
314
+ end
315
+
316
+ #
317
+ # List the log profiles.
318
+ #
319
+ # @param [Hash{String => String}] A hash of custom headers that will be added
320
+ # to the HTTP request.
321
+ #
322
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
323
+ #
324
+ def list_async(custom_headers = nil)
325
+ api_version = '2016-03-01'
326
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
327
+
328
+
329
+ request_headers = {}
330
+
331
+ # Set Headers
332
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
333
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
334
+ path_template = '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles'
335
+
336
+ request_url = @base_url || @client.base_url
337
+
338
+ options = {
339
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
340
+ path_params: {'subscriptionId' => @client.subscription_id},
341
+ query_params: {'api-version' => api_version},
342
+ headers: request_headers.merge(custom_headers || {}),
343
+ base_url: request_url
344
+ }
345
+ promise = @client.make_request_async(:get, path_template, options)
346
+
347
+ promise = promise.then do |result|
348
+ http_response = result.response
349
+ status_code = http_response.status
350
+ response_content = http_response.body
351
+ unless status_code == 200
352
+ error_model = JSON.load(response_content)
353
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
354
+ end
355
+
356
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
357
+ # Deserialize Response
358
+ if status_code == 200
359
+ begin
360
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
361
+ result_mapper = LogProfileCollection.mapper()
362
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
363
+ rescue Exception => e
364
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
365
+ end
366
+ end
367
+
368
+ result
369
+ end
370
+
371
+ promise.execute
372
+ end
373
+
374
+ end
375
+ end