Class: Azure::PolicyInsights::Mgmt::V2019_10_01::PolicyEvents

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb

Overview

PolicyEvents

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ PolicyEvents

Creates and initializes a new instance of the PolicyEvents class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientPolicyInsightsClient (readonly)

Returns reference to the PolicyInsightsClient.

Returns:



22
23
24
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 22

def client
  @client
end

Instance Method Details

#list_query_results_for_management_group(management_group_name, query_options: nil, custom_headers: nil) ⇒ Array<PolicyEvent>

Queries policy events for the resources under the management group.

will be added to the HTTP request.

Parameters:

  • management_group_name (String)

    Management group name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (Array<PolicyEvent>)

    operation results.



34
35
36
37
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 34

def list_query_results_for_management_group(management_group_name, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_management_group_as_lazy(management_group_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_query_results_for_management_group_as_lazy(management_group_name, query_options: nil, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the resources under the management group.

will be added to the HTTP request.

response.

Parameters:

  • management_group_name (String)

    Management group name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (PolicyEventsQueryResults)

    which provide lazy access to pages of the



1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1789

def list_query_results_for_management_group_as_lazy(management_group_name, query_options:nil, custom_headers:nil)
  response = list_query_results_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_management_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_query_results_for_management_group_async(management_group_name, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

Queries policy events for the resources under the management group.

to the HTTP request.

Parameters:

  • management_group_name (String)

    Management group name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



63
64
65
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
119
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
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 63

def list_query_results_for_management_group_async(management_group_name, query_options:nil, custom_headers:nil)
  policy_events_resource = 'default'
  management_groups_namespace = 'Microsoft.Management'
  fail ArgumentError, 'management_group_name is nil' if management_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  order_by = nil
  select = nil
  from = nil
  to = nil
  filter = nil
  apply = nil
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  end

  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 = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyEventsResource' => policy_events_resource,'managementGroupsNamespace' => management_groups_namespace,'managementGroupName' => management_group_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$skiptoken' => skip_token},
      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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_management_group_next(next_page_link, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the resources under the management 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:

  • (PolicyEventsQueryResults)

    operation results.



1068
1069
1070
1071
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1068

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

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

Queries policy events for the resources under the management 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.



1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1097

def list_query_results_for_management_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(: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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_management_group_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the resources under the management 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.



1083
1084
1085
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1083

def list_query_results_for_management_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_query_results_for_management_group_with_http_info(management_group_name, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the resources under the management group.

will be added to the HTTP request.

Parameters:

  • management_group_name (String)

    Management group name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



49
50
51
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 49

def list_query_results_for_management_group_with_http_info(management_group_name, query_options:nil, custom_headers:nil)
  list_query_results_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
end

#list_query_results_for_policy_definition(subscription_id, policy_definition_name, query_options: nil, custom_headers: nil) ⇒ Array<PolicyEvent>

Queries policy events for the subscription level policy definition.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_definition_name (String)

    Policy definition name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (Array<PolicyEvent>)

    operation results.



675
676
677
678
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 675

def list_query_results_for_policy_definition(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_policy_definition_as_lazy(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_query_results_for_policy_definition_as_lazy(subscription_id, policy_definition_name, query_options: nil, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the subscription level policy definition.

will be added to the HTTP request.

response.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_definition_name (String)

    Policy definition name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (PolicyEventsQueryResults)

    which provide lazy access to pages of the



1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1902

def list_query_results_for_policy_definition_as_lazy(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
  response = list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_policy_definition_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

Queries policy events for the subscription level policy definition.

to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_definition_name (String)

    Policy definition name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
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
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 706

def list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
  policy_events_resource = 'default'
  fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  order_by = nil
  select = nil
  from = nil
  to = nil
  filter = nil
  apply = nil
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  end

  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/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyDefinitionName' => policy_definition_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$skiptoken' => skip_token},
      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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_policy_definition_next(next_page_link, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the subscription level policy definition.

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:

  • (PolicyEventsQueryResults)

    operation results.



1518
1519
1520
1521
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1518

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

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

Queries policy events for the subscription level policy definition.

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.



1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1547

def list_query_results_for_policy_definition_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(: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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_policy_definition_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the subscription level policy definition.

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.



1533
1534
1535
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1533

def list_query_results_for_policy_definition_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_policy_definition_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_query_results_for_policy_definition_with_http_info(subscription_id, policy_definition_name, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the subscription level policy definition.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_definition_name (String)

    Policy definition name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



691
692
693
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 691

def list_query_results_for_policy_definition_with_http_info(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
  list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
end

#list_query_results_for_policy_set_definition(subscription_id, policy_set_definition_name, query_options: nil, custom_headers: nil) ⇒ Array<PolicyEvent>

Queries policy events for the subscription level policy set definition.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_set_definition_name (String)

    Policy set definition name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (Array<PolicyEvent>)

    operation results.



545
546
547
548
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 545

def list_query_results_for_policy_set_definition(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_policy_set_definition_as_lazy(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_query_results_for_policy_set_definition_as_lazy(subscription_id, policy_set_definition_name, query_options: nil, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the subscription level policy set definition.

will be added to the HTTP request.

response.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_set_definition_name (String)

    Policy set definition name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (PolicyEventsQueryResults)

    which provide lazy access to pages of the



1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1879

def list_query_results_for_policy_set_definition_as_lazy(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
  response = list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_policy_set_definition_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

Queries policy events for the subscription level policy set definition.

to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_set_definition_name (String)

    Policy set definition name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 576

def list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
  policy_events_resource = 'default'
  fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  order_by = nil
  select = nil
  from = nil
  to = nil
  filter = nil
  apply = nil
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  end

  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/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policySetDefinitionName' => policy_set_definition_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$skiptoken' => skip_token},
      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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_policy_set_definition_next(next_page_link, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the subscription level policy set definition.

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:

  • (PolicyEventsQueryResults)

    operation results.



1428
1429
1430
1431
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1428

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

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

Queries policy events for the subscription level policy set definition.

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.



1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1457

def list_query_results_for_policy_set_definition_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(: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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_policy_set_definition_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the subscription level policy set definition.

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.



1443
1444
1445
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1443

def list_query_results_for_policy_set_definition_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_policy_set_definition_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_query_results_for_policy_set_definition_with_http_info(subscription_id, policy_set_definition_name, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the subscription level policy set definition.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_set_definition_name (String)

    Policy set definition name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



561
562
563
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 561

def list_query_results_for_policy_set_definition_with_http_info(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
  list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
end

#list_query_results_for_resource(resource_id, query_options: nil, custom_headers: nil) ⇒ Array<PolicyEvent>

Queries policy events for the resource.

will be added to the HTTP request.

Parameters:

  • resource_id (String)

    Resource ID.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (Array<PolicyEvent>)

    operation results.



414
415
416
417
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 414

def list_query_results_for_resource(resource_id, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_resource_as_lazy(resource_id, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_query_results_for_resource_as_lazy(resource_id, query_options: nil, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the resource.

will be added to the HTTP request.

response.

Parameters:

  • resource_id (String)

    Resource ID.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (PolicyEventsQueryResults)

    which provide lazy access to pages of the



1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1856

def list_query_results_for_resource_as_lazy(resource_id, query_options:nil, custom_headers:nil)
  response = list_query_results_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_resource_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_query_results_for_resource_async(resource_id, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

Queries policy events for the resource.

to the HTTP request.

Parameters:

  • resource_id (String)

    Resource ID.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
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
527
528
529
530
531
532
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 443

def list_query_results_for_resource_async(resource_id, query_options:nil, custom_headers:nil)
  policy_events_resource = 'default'
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  order_by = nil
  select = nil
  from = nil
  to = nil
  filter = nil
  apply = nil
  expand = nil
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    expand = query_options.Expand
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  end

  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 = '{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyEventsResource' => policy_events_resource},
      skip_encoding_path_params: {'resourceId' => resource_id},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$expand' => expand,'$skiptoken' => skip_token},
      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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_resource_group(subscription_id, resource_group_name, query_options: nil, custom_headers: nil) ⇒ Array<PolicyEvent>

Queries policy events for the resources under the resource group.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • resource_group_name (String)

    Resource group name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (Array<PolicyEvent>)

    operation results.



286
287
288
289
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 286

def list_query_results_for_resource_group(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_resource_group_as_lazy(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_query_results_for_resource_group_as_lazy(subscription_id, resource_group_name, query_options: nil, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the resources under the resource group.

will be added to the HTTP request.

response.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • resource_group_name (String)

    Resource group name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (PolicyEventsQueryResults)

    which provide lazy access to pages of the



1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1834

def list_query_results_for_resource_group_as_lazy(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
  response = list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

Queries policy events for the resources under the resource group.

to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • resource_group_name (String)

    Resource group name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
368
369
370
371
372
373
374
375
376
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
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 317

def list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
  policy_events_resource = 'default'
  fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  order_by = nil
  select = nil
  from = nil
  to = nil
  filter = nil
  apply = nil
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  end

  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.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$skiptoken' => skip_token},
      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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_resource_group_level_policy_assignment(subscription_id, resource_group_name, policy_assignment_name, query_options: nil, custom_headers: nil) ⇒ Array<PolicyEvent>

Queries policy events for the resource group level policy assignment.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • resource_group_name (String)

    Resource group name.

  • policy_assignment_name (String)

    Policy assignment name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (Array<PolicyEvent>)

    operation results.



936
937
938
939
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 936

def list_query_results_for_resource_group_level_policy_assignment(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_resource_group_level_policy_assignment_as_lazy(subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_query_results_for_resource_group_level_policy_assignment_as_lazy(subscription_id, resource_group_name, policy_assignment_name, query_options: nil, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the resource group level policy assignment.

will be added to the HTTP request.

response.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • resource_group_name (String)

    Resource group name.

  • policy_assignment_name (String)

    Policy assignment name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (PolicyEventsQueryResults)

    which provide lazy access to pages of the



1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1949

def list_query_results_for_resource_group_level_policy_assignment_as_lazy(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
  response = list_query_results_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_resource_group_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_query_results_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

Queries policy events for the resource group level policy assignment.

to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • resource_group_name (String)

    Resource group name.

  • policy_assignment_name (String)

    Policy assignment name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 969

def list_query_results_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
  policy_events_resource = 'default'
  fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  order_by = nil
  select = nil
  from = nil
  to = nil
  filter = nil
  apply = nil
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  end

  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/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$skiptoken' => skip_token},
      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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_resource_group_level_policy_assignment_next(next_page_link, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the resource group level policy assignment.

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:

  • (PolicyEventsQueryResults)

    operation results.



1698
1699
1700
1701
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1698

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

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

Queries policy events for the resource group level policy assignment.

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.



1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1727

def list_query_results_for_resource_group_level_policy_assignment_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(: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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_resource_group_level_policy_assignment_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the resource group level policy assignment.

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.



1713
1714
1715
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1713

def list_query_results_for_resource_group_level_policy_assignment_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_resource_group_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_query_results_for_resource_group_level_policy_assignment_with_http_info(subscription_id, resource_group_name, policy_assignment_name, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the resource group level policy assignment.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • resource_group_name (String)

    Resource group name.

  • policy_assignment_name (String)

    Policy assignment name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



953
954
955
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 953

def list_query_results_for_resource_group_level_policy_assignment_with_http_info(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
  list_query_results_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
end

#list_query_results_for_resource_group_next(next_page_link, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the resources under 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:

  • (PolicyEventsQueryResults)

    operation results.



1248
1249
1250
1251
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1248

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

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

Queries policy events for the resources under 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.



1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1277

def list_query_results_for_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(: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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_resource_group_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the resources under 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.



1263
1264
1265
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1263

def list_query_results_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_query_results_for_resource_group_with_http_info(subscription_id, resource_group_name, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the resources under the resource group.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • resource_group_name (String)

    Resource group name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



302
303
304
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 302

def list_query_results_for_resource_group_with_http_info(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
  list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
end

#list_query_results_for_resource_next(next_page_link, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the resource.

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:

  • (PolicyEventsQueryResults)

    operation results.



1338
1339
1340
1341
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1338

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

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

Queries policy events for the resource.

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.



1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1367

def list_query_results_for_resource_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(: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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_resource_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the resource.

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.



1353
1354
1355
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1353

def list_query_results_for_resource_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_query_results_for_resource_with_http_info(resource_id, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the resource.

will be added to the HTTP request.

Parameters:

  • resource_id (String)

    Resource ID.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



429
430
431
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 429

def list_query_results_for_resource_with_http_info(resource_id, query_options:nil, custom_headers:nil)
  list_query_results_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
end

#list_query_results_for_subscription(subscription_id, query_options: nil, custom_headers: nil) ⇒ Array<PolicyEvent>

Queries policy events for the resources under the subscription.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (Array<PolicyEvent>)

    operation results.



160
161
162
163
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 160

def list_query_results_for_subscription(subscription_id, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_subscription_as_lazy(subscription_id, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_query_results_for_subscription_as_lazy(subscription_id, query_options: nil, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the resources under the subscription.

will be added to the HTTP request.

response.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (PolicyEventsQueryResults)

    which provide lazy access to pages of the



1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1811

def list_query_results_for_subscription_as_lazy(subscription_id, query_options:nil, custom_headers:nil)
  response = list_query_results_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_query_results_for_subscription_async(subscription_id, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

Queries policy events for the resources under the subscription.

to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
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
268
269
270
271
272
273
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 189

def list_query_results_for_subscription_async(subscription_id, query_options:nil, custom_headers:nil)
  policy_events_resource = 'default'
  fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  order_by = nil
  select = nil
  from = nil
  to = nil
  filter = nil
  apply = nil
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  end

  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.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$skiptoken' => skip_token},
      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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_subscription_level_policy_assignment(subscription_id, policy_assignment_name, query_options: nil, custom_headers: nil) ⇒ Array<PolicyEvent>

Queries policy events for the subscription level policy assignment.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_assignment_name (String)

    Policy assignment name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (Array<PolicyEvent>)

    operation results.



805
806
807
808
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 805

def list_query_results_for_subscription_level_policy_assignment(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_subscription_level_policy_assignment_as_lazy(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_query_results_for_subscription_level_policy_assignment_as_lazy(subscription_id, policy_assignment_name, query_options: nil, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the subscription level policy assignment.

will be added to the HTTP request.

response.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_assignment_name (String)

    Policy assignment name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (PolicyEventsQueryResults)

    which provide lazy access to pages of the



1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1925

def list_query_results_for_subscription_level_policy_assignment_as_lazy(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
  response = list_query_results_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_subscription_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_query_results_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

Queries policy events for the subscription level policy assignment.

to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_assignment_name (String)

    Policy assignment name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
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
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 836

def list_query_results_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
  policy_events_resource = 'default'
  fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  order_by = nil
  select = nil
  from = nil
  to = nil
  filter = nil
  apply = nil
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  end

  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/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$skiptoken' => skip_token},
      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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_subscription_level_policy_assignment_next(next_page_link, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the subscription level policy assignment.

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:

  • (PolicyEventsQueryResults)

    operation results.



1608
1609
1610
1611
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1608

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

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

Queries policy events for the subscription level policy assignment.

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.



1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1637

def list_query_results_for_subscription_level_policy_assignment_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(: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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_subscription_level_policy_assignment_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the subscription level policy assignment.

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.



1623
1624
1625
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1623

def list_query_results_for_subscription_level_policy_assignment_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_subscription_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_query_results_for_subscription_level_policy_assignment_with_http_info(subscription_id, policy_assignment_name, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the subscription level policy assignment.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • policy_assignment_name (String)

    Policy assignment name.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



821
822
823
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 821

def list_query_results_for_subscription_level_policy_assignment_with_http_info(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
  list_query_results_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
end

#list_query_results_for_subscription_next(next_page_link, custom_headers: nil) ⇒ PolicyEventsQueryResults

Queries policy events for the resources under 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:

  • (PolicyEventsQueryResults)

    operation results.



1158
1159
1160
1161
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1158

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

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

Queries policy events for the resources under 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.



1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1187

def list_query_results_for_subscription_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(: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 == 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::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.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_query_results_for_subscription_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the resources under 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.



1173
1174
1175
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 1173

def list_query_results_for_subscription_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_query_results_for_subscription_with_http_info(subscription_id, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Queries policy events for the resources under the subscription.

will be added to the HTTP request.

Parameters:

  • subscription_id (String)

    Microsoft Azure subscription ID.

  • query_options (QueryOptions) (defaults to: nil)

    Additional parameters for the operation

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



175
176
177
# File 'lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb', line 175

def list_query_results_for_subscription_with_http_info(subscription_id, query_options:nil, custom_headers:nil)
  list_query_results_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
end