Class: Azure::Security::Mgmt::V2019_01_01::Alerts

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-01-01/generated/azure_mgmt_security/alerts.rb

Overview

API spec for Microsoft.Security (Azure Security Center) resource provider

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Alerts

Creates and initializes a new instance of the Alerts class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientSecurityCenter (readonly)

Returns reference to the SecurityCenter.

Returns:



22
23
24
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 22

def client
  @client
end

Instance Method Details

#get_resource_group_level_alerts(alert_name, resource_group_name, custom_headers: nil) ⇒ Alert

Get an alert that is associated a resource group or a resource in a resource group

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • resource_group_name (String)

    The name of the resource group within the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Alert)

    operation results.



540
541
542
543
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 540

def get_resource_group_level_alerts(alert_name, resource_group_name, custom_headers:nil)
  response = get_resource_group_level_alerts_async(alert_name, resource_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_resource_group_level_alerts_async(alert_name, resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Get an alert that is associated a resource group or a resource in a resource group

user’s subscription. The name is case insensitive. to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • resource_group_name (String)

    The name of the resource group within the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 573

def get_resource_group_level_alerts_async(alert_name, resource_group_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.nil?
  fail ArgumentError, 'alert_name is nil' if alert_name.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'ascLocation' => @client.asc_location,'alertName' => alert_name,'resourceGroupName' => resource_group_name},
      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, options)

  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 MsRestAzure::AzureOperationError.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::Security::Mgmt::V2019_01_01::Models::Alert.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_resource_group_level_alerts_with_http_info(alert_name, resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get an alert that is associated a resource group or a resource in a resource group

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • resource_group_name (String)

    The name of the resource group within the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



557
558
559
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 557

def get_resource_group_level_alerts_with_http_info(alert_name, resource_group_name, custom_headers:nil)
  get_resource_group_level_alerts_async(alert_name, resource_group_name, custom_headers:custom_headers).value!
end

#get_subscription_level_alert(alert_name, custom_headers: nil) ⇒ Alert

Get an alert that is associated with a subscription

will be added to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Alert)

    operation results.



445
446
447
448
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 445

def get_subscription_level_alert(alert_name, custom_headers:nil)
  response = get_subscription_level_alert_async(alert_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_subscription_level_alert_async(alert_name, custom_headers: nil) ⇒ Concurrent::Promise

Get an alert that is associated with a subscription

to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 472

def get_subscription_level_alert_async(alert_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.nil?
  fail ArgumentError, 'alert_name is nil' if alert_name.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.Security/locations/{ascLocation}/alerts/{alertName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'ascLocation' => @client.asc_location,'alertName' => alert_name},
      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, options)

  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 MsRestAzure::AzureOperationError.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::Security::Mgmt::V2019_01_01::Models::Alert.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_subscription_level_alert_with_http_info(alert_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get an alert that is associated with a subscription

will be added to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



459
460
461
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 459

def get_subscription_level_alert_with_http_info(alert_name, custom_headers:nil)
  get_subscription_level_alert_async(alert_name, custom_headers:custom_headers).value!
end

#list(filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ Array<Alert>

List all the alerts that are associated with the subscription

will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<Alert>)

    operation results.



35
36
37
38
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 35

def list(filter:nil, select:nil, expand:nil, custom_headers:nil)
  first_page = list_as_lazy(filter:filter, select:select, expand:expand, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_as_lazy(filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ AlertList

List all the alerts that are associated with the subscription

will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertList)

    which provide lazy access to pages of the response.



1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 1196

def list_as_lazy(filter:nil, select:nil, expand:nil, custom_headers:nil)
  response = list_async(filter:filter, select:select, expand:expand, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_async(filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ Concurrent::Promise

List all the alerts that are associated with the subscription

to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 66

def list_async(filter:nil, select:nil, expand:nil, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).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.Security/alerts'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version,'$filter' => filter,'$select' => select,'$expand' => expand},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  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 MsRestAzure::AzureOperationError.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::Security::Mgmt::V2019_01_01::Models::AlertList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group(resource_group_name, filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ Array<Alert>

List all the alerts that are associated with the resource group

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<Alert>)

    operation results.



133
134
135
136
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 133

def list_by_resource_group(resource_group_name, filter:nil, select:nil, expand:nil, custom_headers:nil)
  first_page = list_by_resource_group_as_lazy(resource_group_name, filter:filter, select:select, expand:expand, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_resource_group_as_lazy(resource_group_name, filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ AlertList

List all the alerts that are associated with the resource group

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertList)

    which provide lazy access to pages of the response.



1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 1220

def list_by_resource_group_as_lazy(resource_group_name, filter:nil, select:nil, expand:nil, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, filter:filter, select:select, expand:expand, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_resource_group_async(resource_group_name, filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ Concurrent::Promise

List all the alerts that are associated with the resource group

user’s subscription. The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 168

def list_by_resource_group_async(resource_group_name, filter:nil, select:nil, expand:nil, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
      query_params: {'api-version' => @client.api_version,'$filter' => filter,'$select' => select,'$expand' => expand},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  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 MsRestAzure::AzureOperationError.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::Security::Mgmt::V2019_01_01::Models::AlertList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_next(next_page_link, custom_headers: nil) ⇒ AlertList

List all the alerts that are associated with the resource group

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertList)

    operation results.



919
920
921
922
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 919

def list_by_resource_group_next(next_page_link, custom_headers:nil)
  response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_resource_group_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

List all the alerts that are associated with the resource group

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 948

def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  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 MsRestAzure::AzureOperationError.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::Security::Mgmt::V2019_01_01::Models::AlertList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all the alerts that are associated with the resource group

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



934
935
936
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 934

def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_resource_group_with_http_info(resource_group_name, filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all the alerts that are associated with the resource group

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



151
152
153
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 151

def list_by_resource_group_with_http_info(resource_group_name, filter:nil, select:nil, expand:nil, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, filter:filter, select:select, expand:expand, custom_headers:custom_headers).value!
end

#list_next(next_page_link, custom_headers: nil) ⇒ AlertList

List all the alerts that are associated with the subscription

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertList)

    operation results.



829
830
831
832
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 829

def list_next(next_page_link, custom_headers:nil)
  response = list_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

List all the alerts that are associated with the subscription

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 858

def list_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  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 MsRestAzure::AzureOperationError.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::Security::Mgmt::V2019_01_01::Models::AlertList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all the alerts that are associated with the subscription

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



844
845
846
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 844

def list_next_with_http_info(next_page_link, custom_headers:nil)
  list_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_resource_group_level_alerts_by_region(resource_group_name, filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ Array<Alert>

List all the alerts that are associated with the resource group that are stored in a specific location

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<Alert>)

    operation results.



340
341
342
343
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 340

def list_resource_group_level_alerts_by_region(resource_group_name, filter:nil, select:nil, expand:nil, custom_headers:nil)
  first_page = list_resource_group_level_alerts_by_region_as_lazy(resource_group_name, filter:filter, select:select, expand:expand, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_resource_group_level_alerts_by_region_as_lazy(resource_group_name, filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ AlertList

List all the alerts that are associated with the resource group that are stored in a specific location

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertList)

    which provide lazy access to pages of the response.



1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 1268

def list_resource_group_level_alerts_by_region_as_lazy(resource_group_name, filter:nil, select:nil, expand:nil, custom_headers:nil)
  response = list_resource_group_level_alerts_by_region_async(resource_group_name, filter:filter, select:select, expand:expand, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_resource_group_level_alerts_by_region_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_resource_group_level_alerts_by_region_async(resource_group_name, filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ Concurrent::Promise

List all the alerts that are associated with the resource group that are stored in a specific location

user’s subscription. The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
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
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 377

def list_resource_group_level_alerts_by_region_async(resource_group_name, filter:nil, select:nil, expand:nil, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'ascLocation' => @client.asc_location,'resourceGroupName' => resource_group_name},
      query_params: {'api-version' => @client.api_version,'$filter' => filter,'$select' => select,'$expand' => expand},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  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 MsRestAzure::AzureOperationError.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::Security::Mgmt::V2019_01_01::Models::AlertList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_resource_group_level_alerts_by_region_next(next_page_link, custom_headers: nil) ⇒ AlertList

List all the alerts that are associated with the resource group that are stored in a specific location

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertList)

    operation results.



1103
1104
1105
1106
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 1103

def list_resource_group_level_alerts_by_region_next(next_page_link, custom_headers:nil)
  response = list_resource_group_level_alerts_by_region_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_resource_group_level_alerts_by_region_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

List all the alerts that are associated with the resource group that are stored in a specific location

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 1134

def list_resource_group_level_alerts_by_region_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  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 MsRestAzure::AzureOperationError.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::Security::Mgmt::V2019_01_01::Models::AlertList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_resource_group_level_alerts_by_region_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all the alerts that are associated with the resource group that are stored in a specific location

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1119
1120
1121
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 1119

def list_resource_group_level_alerts_by_region_next_with_http_info(next_page_link, custom_headers:nil)
  list_resource_group_level_alerts_by_region_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_resource_group_level_alerts_by_region_with_http_info(resource_group_name, filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all the alerts that are associated with the resource group that are stored in a specific location

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



359
360
361
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 359

def list_resource_group_level_alerts_by_region_with_http_info(resource_group_name, filter:nil, select:nil, expand:nil, custom_headers:nil)
  list_resource_group_level_alerts_by_region_async(resource_group_name, filter:filter, select:select, expand:expand, custom_headers:custom_headers).value!
end

#list_subscription_level_alerts_by_region(filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ Array<Alert>

List all the alerts that are associated with the subscription that are stored in a specific location

will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<Alert>)

    operation results.



238
239
240
241
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 238

def list_subscription_level_alerts_by_region(filter:nil, select:nil, expand:nil, custom_headers:nil)
  first_page = list_subscription_level_alerts_by_region_as_lazy(filter:filter, select:select, expand:expand, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_subscription_level_alerts_by_region_as_lazy(filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ AlertList

List all the alerts that are associated with the subscription that are stored in a specific location

will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertList)

    which provide lazy access to pages of the response.



1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 1243

def list_subscription_level_alerts_by_region_as_lazy(filter:nil, select:nil, expand:nil, custom_headers:nil)
  response = list_subscription_level_alerts_by_region_async(filter:filter, select:select, expand:expand, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_subscription_level_alerts_by_region_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_subscription_level_alerts_by_region_async(filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ Concurrent::Promise

List all the alerts that are associated with the subscription that are stored in a specific location

to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 271

def list_subscription_level_alerts_by_region_async(filter:nil, select:nil, expand:nil, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.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.Security/locations/{ascLocation}/alerts'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'ascLocation' => @client.asc_location},
      query_params: {'api-version' => @client.api_version,'$filter' => filter,'$select' => select,'$expand' => expand},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  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 MsRestAzure::AzureOperationError.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::Security::Mgmt::V2019_01_01::Models::AlertList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_subscription_level_alerts_by_region_next(next_page_link, custom_headers: nil) ⇒ AlertList

List all the alerts that are associated with the subscription that are stored in a specific location

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertList)

    operation results.



1010
1011
1012
1013
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 1010

def list_subscription_level_alerts_by_region_next(next_page_link, custom_headers:nil)
  response = list_subscription_level_alerts_by_region_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_subscription_level_alerts_by_region_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

List all the alerts that are associated with the subscription that are stored in a specific location

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 1041

def list_subscription_level_alerts_by_region_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  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 MsRestAzure::AzureOperationError.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::Security::Mgmt::V2019_01_01::Models::AlertList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_subscription_level_alerts_by_region_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all the alerts that are associated with the subscription that are stored in a specific location

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1026
1027
1028
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 1026

def list_subscription_level_alerts_by_region_next_with_http_info(next_page_link, custom_headers:nil)
  list_subscription_level_alerts_by_region_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_subscription_level_alerts_by_region_with_http_info(filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all the alerts that are associated with the subscription that are stored in a specific location

will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



255
256
257
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 255

def list_subscription_level_alerts_by_region_with_http_info(filter:nil, select:nil, expand:nil, custom_headers:nil)
  list_subscription_level_alerts_by_region_async(filter:filter, select:select, expand:expand, custom_headers:custom_headers).value!
end

#list_with_http_info(filter: nil, select: nil, expand: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all the alerts that are associated with the subscription

will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    OData filter. Optional.

  • select (String) (defaults to: nil)

    OData select. Optional.

  • expand (String) (defaults to: nil)

    OData expand. Optional.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



51
52
53
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 51

def list_with_http_info(filter:nil, select:nil, expand:nil, custom_headers:nil)
  list_async(filter:filter, select:select, expand:expand, custom_headers:custom_headers).value!
end

#update_resource_group_level_alert_state(alert_name, alert_update_action_type, resource_group_name, custom_headers: nil) ⇒ Object

Update the alert’s state

Possible values include: ‘Dismiss’, ‘Reactivate’ user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • alert_update_action_type (Enum)

    Type of the action to do on the alert.

  • resource_group_name (String)

    The name of the resource group within the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



733
734
735
736
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 733

def update_resource_group_level_alert_state(alert_name, alert_update_action_type, resource_group_name, custom_headers:nil)
  response = update_resource_group_level_alert_state_async(alert_name, alert_update_action_type, resource_group_name, custom_headers:custom_headers).value!
  nil
end

#update_resource_group_level_alert_state_async(alert_name, alert_update_action_type, resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Update the alert’s state

Possible values include: ‘Dismiss’, ‘Reactivate’ user’s subscription. The name is case insensitive. to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • alert_update_action_type (Enum)

    Type of the action to do on the alert.

  • resource_group_name (String)

    The name of the resource group within the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 768

def update_resource_group_level_alert_state_async(alert_name, alert_update_action_type, resource_group_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.nil?
  fail ArgumentError, 'alert_name is nil' if alert_name.nil?
  fail ArgumentError, 'alert_update_action_type is nil' if alert_update_action_type.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/{alertUpdateActionType}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'ascLocation' => @client.asc_location,'alertName' => alert_name,'alertUpdateActionType' => alert_update_action_type,'resourceGroupName' => resource_group_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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?

    result
  end

  promise.execute
end

#update_resource_group_level_alert_state_with_http_info(alert_name, alert_update_action_type, resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Update the alert’s state

Possible values include: ‘Dismiss’, ‘Reactivate’ user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • alert_update_action_type (Enum)

    Type of the action to do on the alert.

  • resource_group_name (String)

    The name of the resource group within the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



751
752
753
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 751

def update_resource_group_level_alert_state_with_http_info(alert_name, alert_update_action_type, resource_group_name, custom_headers:nil)
  update_resource_group_level_alert_state_async(alert_name, alert_update_action_type, resource_group_name, custom_headers:custom_headers).value!
end

#update_subscription_level_alert_state(alert_name, alert_update_action_type, custom_headers: nil) ⇒ Object

Update the alert’s state

Possible values include: ‘Dismiss’, ‘Reactivate’ will be added to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • alert_update_action_type (Enum)

    Type of the action to do on the alert.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



643
644
645
646
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 643

def update_subscription_level_alert_state(alert_name, alert_update_action_type, custom_headers:nil)
  response = update_subscription_level_alert_state_async(alert_name, alert_update_action_type, custom_headers:custom_headers).value!
  nil
end

#update_subscription_level_alert_state_async(alert_name, alert_update_action_type, custom_headers: nil) ⇒ Concurrent::Promise

Update the alert’s state

Possible values include: ‘Dismiss’, ‘Reactivate’ to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • alert_update_action_type (Enum)

    Type of the action to do on the alert.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 674

def update_subscription_level_alert_state_async(alert_name, alert_update_action_type, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.nil?
  fail ArgumentError, 'alert_name is nil' if alert_name.nil?
  fail ArgumentError, 'alert_update_action_type is nil' if alert_update_action_type.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.Security/locations/{ascLocation}/alerts/{alertName}/{alertUpdateActionType}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'ascLocation' => @client.asc_location,'alertName' => alert_name,'alertUpdateActionType' => alert_update_action_type},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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?

    result
  end

  promise.execute
end

#update_subscription_level_alert_state_with_http_info(alert_name, alert_update_action_type, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Update the alert’s state

Possible values include: ‘Dismiss’, ‘Reactivate’ will be added to the HTTP request.

Parameters:

  • alert_name (String)

    Name of the alert object

  • alert_update_action_type (Enum)

    Type of the action to do on the alert.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



659
660
661
# File 'lib/2019-01-01/generated/azure_mgmt_security/alerts.rb', line 659

def update_subscription_level_alert_state_with_http_info(alert_name, alert_update_action_type, custom_headers:nil)
  update_subscription_level_alert_state_async(alert_name, alert_update_action_type, custom_headers:custom_headers).value!
end