Class: Azure::AlertsManagement::Mgmt::V2018_05_05_preview::SmartGroups
- Inherits:
-
Object
- Object
- Azure::AlertsManagement::Mgmt::V2018_05_05_preview::SmartGroups
- Includes:
- MsRestAzure
- Defined in:
- lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb
Overview
AlertsManagement Client
Instance Attribute Summary collapse
-
#client ⇒ AlertsManagementClient
readonly
Reference to the AlertsManagementClient.
Instance Method Summary collapse
-
#change_state(smart_group_id, new_state, custom_headers: nil) ⇒ SmartGroup
Change the state from unresolved to resolved and all the alerts within the smart group will also be resolved.
-
#change_state_async(smart_group_id, new_state, custom_headers: nil) ⇒ Concurrent::Promise
Change the state from unresolved to resolved and all the alerts within the smart group will also be resolved.
-
#change_state_with_http_info(smart_group_id, new_state, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Change the state from unresolved to resolved and all the alerts within the smart group will also be resolved.
-
#get_all(target_resource: nil, target_resource_group: nil, target_resource_type: nil, monitor_condition: nil, severity: nil, smart_group_state: nil, time_range: nil, page_count: nil, sort_by: nil, sort_order: nil, custom_headers: nil) ⇒ SmartGroupsList
Get all smartGroups within the subscription.
-
#get_all_async(target_resource: nil, target_resource_group: nil, target_resource_type: nil, monitor_condition: nil, severity: nil, smart_group_state: nil, time_range: nil, page_count: nil, sort_by: nil, sort_order: nil, custom_headers: nil) ⇒ Concurrent::Promise
Get all smartGroups within the subscription.
-
#get_all_with_http_info(target_resource: nil, target_resource_group: nil, target_resource_type: nil, monitor_condition: nil, severity: nil, smart_group_state: nil, time_range: nil, page_count: nil, sort_by: nil, sort_order: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Get all smartGroups within the subscription.
-
#get_by_id(smart_group_id, custom_headers: nil) ⇒ SmartGroup
Get information of smart alerts group.
-
#get_by_id_async(smart_group_id, custom_headers: nil) ⇒ Concurrent::Promise
Get information of smart alerts group.
-
#get_by_id_with_http_info(smart_group_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Get information of smart alerts group.
-
#get_history(smart_group_id, custom_headers: nil) ⇒ SmartGroupModification
Get the history of the changes of smart group.
-
#get_history_async(smart_group_id, custom_headers: nil) ⇒ Concurrent::Promise
Get the history of the changes of smart group.
-
#get_history_with_http_info(smart_group_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Get the history of the changes of smart group.
-
#initialize(client) ⇒ SmartGroups
constructor
Creates and initializes a new instance of the SmartGroups class.
Constructor Details
#initialize(client) ⇒ SmartGroups
Creates and initializes a new instance of the SmartGroups class.
17 18 19 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 17 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ AlertsManagementClient (readonly)
Returns reference to the AlertsManagementClient.
22 23 24 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 22 def client @client end |
Instance Method Details
#change_state(smart_group_id, new_state, custom_headers: nil) ⇒ SmartGroup
Change the state from unresolved to resolved and all the alerts within the smart group will also be resolved.
‘New’, ‘Acknowledged’, ‘Closed’ will be added to the HTTP request.
281 282 283 284 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 281 def change_state(smart_group_id, new_state, custom_headers:nil) response = change_state_async(smart_group_id, new_state, custom_headers:custom_headers).value! response.body unless response.nil? end |
#change_state_async(smart_group_id, new_state, custom_headers: nil) ⇒ Concurrent::Promise
Change the state from unresolved to resolved and all the alerts within the smart group will also be resolved.
‘New’, ‘Acknowledged’, ‘Closed’ to the HTTP request.
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 314 def change_state_async(smart_group_id, new_state, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'smart_group_id is nil' if smart_group_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'new_state is nil' if new_state.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId}/changeState' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'smartGroupId' => smart_group_id}, query_params: {'api-version' => @client.api_version,'newState' => new_state}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::SmartGroup.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#change_state_with_http_info(smart_group_id, new_state, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Change the state from unresolved to resolved and all the alerts within the smart group will also be resolved.
‘New’, ‘Acknowledged’, ‘Closed’ will be added to the HTTP request.
298 299 300 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 298 def change_state_with_http_info(smart_group_id, new_state, custom_headers:nil) change_state_async(smart_group_id, new_state, custom_headers:custom_headers).value! end |
#get_all(target_resource: nil, target_resource_group: nil, target_resource_type: nil, monitor_condition: nil, severity: nil, smart_group_state: nil, time_range: nil, page_count: nil, sort_by: nil, sort_order: nil, custom_headers: nil) ⇒ SmartGroupsList
Get all smartGroups within the subscription
List all the smartGroups within the specified subscription.
is the state of the alert at monitor service. Possible values include: ‘Fired’, ‘Resolved’ ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ include: ‘New’, ‘Acknowledged’, ‘Closed’ Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ field, default value is ‘lastModifiedDateTime’. Possible values include: ‘alertsCount’, ‘state’, ‘severity’, ‘startDateTime’, ‘lastModifiedDateTime’ descending, default value is ‘desc’ for time fields and ‘asc’ for others. Possible values include: ‘asc’, ‘desc’ will be added to the HTTP request.
53 54 55 56 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 53 def get_all(target_resource:nil, target_resource_group:nil, target_resource_type:nil, monitor_condition:nil, severity:nil, smart_group_state:nil, time_range:nil, page_count:nil, sort_by:nil, sort_order:nil, custom_headers:nil) response = get_all_async(target_resource:target_resource, target_resource_group:target_resource_group, target_resource_type:target_resource_type, monitor_condition:monitor_condition, severity:severity, smart_group_state:smart_group_state, time_range:time_range, page_count:page_count, sort_by:sort_by, sort_order:sort_order, custom_headers:custom_headers).value! response.body unless response.nil? end |
#get_all_async(target_resource: nil, target_resource_group: nil, target_resource_type: nil, monitor_condition: nil, severity: nil, smart_group_state: nil, time_range: nil, page_count: nil, sort_by: nil, sort_order: nil, custom_headers: nil) ⇒ Concurrent::Promise
Get all smartGroups within the subscription
List all the smartGroups within the specified subscription.
is the state of the alert at monitor service. Possible values include: ‘Fired’, ‘Resolved’ ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ include: ‘New’, ‘Acknowledged’, ‘Closed’ Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ field, default value is ‘lastModifiedDateTime’. Possible values include: ‘alertsCount’, ‘state’, ‘severity’, ‘startDateTime’, ‘lastModifiedDateTime’ descending, default value is ‘desc’ for time fields and ‘asc’ for others. Possible values include: ‘asc’, ‘desc’ to the HTTP request.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 120 def get_all_async(target_resource:nil, target_resource_group:nil, target_resource_type:nil, monitor_condition:nil, severity:nil, smart_group_state:nil, time_range:nil, page_count:nil, sort_by:nil, sort_order:nil, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id}, query_params: {'targetResource' => target_resource,'targetResourceGroup' => target_resource_group,'targetResourceType' => target_resource_type,'monitorService' => @client.monitor_service,'monitorCondition' => monitor_condition,'severity' => severity,'smartGroupState' => smart_group_state,'timeRange' => time_range,'pageCount' => page_count,'sortBy' => sort_by,'sortOrder' => sort_order,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::SmartGroupsList.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#get_all_with_http_info(target_resource: nil, target_resource_group: nil, target_resource_type: nil, monitor_condition: nil, severity: nil, smart_group_state: nil, time_range: nil, page_count: nil, sort_by: nil, sort_order: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Get all smartGroups within the subscription
List all the smartGroups within the specified subscription.
is the state of the alert at monitor service. Possible values include: ‘Fired’, ‘Resolved’ ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ include: ‘New’, ‘Acknowledged’, ‘Closed’ Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ field, default value is ‘lastModifiedDateTime’. Possible values include: ‘alertsCount’, ‘state’, ‘severity’, ‘startDateTime’, ‘lastModifiedDateTime’ descending, default value is ‘desc’ for time fields and ‘asc’ for others. Possible values include: ‘asc’, ‘desc’ will be added to the HTTP request.
87 88 89 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 87 def get_all_with_http_info(target_resource:nil, target_resource_group:nil, target_resource_type:nil, monitor_condition:nil, severity:nil, smart_group_state:nil, time_range:nil, page_count:nil, sort_by:nil, sort_order:nil, custom_headers:nil) get_all_async(target_resource:target_resource, target_resource_group:target_resource_group, target_resource_type:target_resource_type, monitor_condition:monitor_condition, severity:severity, smart_group_state:smart_group_state, time_range:time_range, page_count:page_count, sort_by:sort_by, sort_order:sort_order, custom_headers:custom_headers).value! end |
#get_by_id(smart_group_id, custom_headers: nil) ⇒ SmartGroup
Get information of smart alerts group.
Get details of smart group.
will be added to the HTTP request.
184 185 186 187 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 184 def get_by_id(smart_group_id, custom_headers:nil) response = get_by_id_async(smart_group_id, custom_headers:custom_headers).value! response.body unless response.nil? end |
#get_by_id_async(smart_group_id, custom_headers: nil) ⇒ Concurrent::Promise
Get information of smart alerts group.
Get details of smart group.
to the HTTP request.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 215 def get_by_id_async(smart_group_id, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'smart_group_id is nil' if smart_group_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId}' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'smartGroupId' => smart_group_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::SmartGroup.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#get_by_id_with_http_info(smart_group_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Get information of smart alerts group.
Get details of smart group.
will be added to the HTTP request.
200 201 202 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 200 def get_by_id_with_http_info(smart_group_id, custom_headers:nil) get_by_id_async(smart_group_id, custom_headers:custom_headers).value! end |
#get_history(smart_group_id, custom_headers: nil) ⇒ SmartGroupModification
Get the history of the changes of smart group.
will be added to the HTTP request.
378 379 380 381 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 378 def get_history(smart_group_id, custom_headers:nil) response = get_history_async(smart_group_id, custom_headers:custom_headers).value! response.body unless response.nil? end |
#get_history_async(smart_group_id, custom_headers: nil) ⇒ Concurrent::Promise
Get the history of the changes of smart group.
to the HTTP request.
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 405 def get_history_async(smart_group_id, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'smart_group_id is nil' if smart_group_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId}/history' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'smartGroupId' => smart_group_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::SmartGroupModification.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#get_history_with_http_info(smart_group_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Get the history of the changes of smart group.
will be added to the HTTP request.
392 393 394 |
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/smart_groups.rb', line 392 def get_history_with_http_info(smart_group_id, custom_headers:nil) get_history_async(smart_group_id, custom_headers:custom_headers).value! end |