azure_mgmt_policy_insights 0.17.4 → 0.17.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +20 -20
  3. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights.rb +0 -0
  4. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/column.rb +0 -0
  5. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operation.rb +0 -0
  6. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +0 -0
  7. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +0 -0
  8. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +0 -0
  9. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table.rb +0 -0
  10. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_columns.rb +0 -0
  11. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_metadata.rb +0 -0
  12. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +0 -0
  13. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table.rb +0 -0
  14. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_columns.rb +0 -0
  15. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_metadata.rb +0 -0
  16. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +0 -0
  17. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +0 -0
  18. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +0 -0
  19. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +0 -0
  20. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/module_definition.rb +0 -0
  21. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/operations.rb +2 -0
  22. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_events.rb +8 -0
  23. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  24. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_states.rb +8 -0
  25. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights.rb +0 -0
  26. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operation.rb +0 -0
  27. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +0 -0
  28. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +0 -0
  29. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +0 -0
  30. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +0 -0
  31. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +0 -0
  32. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +0 -0
  33. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +0 -0
  34. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +0 -0
  35. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +0 -0
  36. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +0 -0
  37. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/module_definition.rb +0 -0
  38. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/operations.rb +2 -0
  39. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_events.rb +10 -0
  40. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  41. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb +10 -0
  42. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights.rb +0 -0
  43. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operation.rb +0 -0
  44. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +0 -0
  45. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +0 -0
  46. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +0 -0
  47. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +0 -0
  48. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +0 -0
  49. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +0 -0
  50. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +0 -0
  51. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +0 -0
  52. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +0 -0
  53. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +0 -0
  54. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +0 -0
  55. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +0 -0
  56. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summarize_results.rb +0 -0
  57. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summary.rb +0 -0
  58. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summary_results.rb +0 -0
  59. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/module_definition.rb +0 -0
  60. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/operations.rb +2 -0
  61. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_events.rb +18 -0
  62. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  63. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_states.rb +34 -0
  64. data/lib/2018-04-04/generated/azure_mgmt_policy_insights.rb +0 -0
  65. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operation.rb +0 -0
  66. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operation_display.rb +0 -0
  67. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +0 -0
  68. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +0 -0
  69. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +0 -0
  70. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_event.rb +0 -0
  71. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +0 -0
  72. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_state.rb +0 -0
  73. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +0 -0
  74. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +0 -0
  75. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure.rb +0 -0
  76. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +0 -0
  77. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_options.rb +0 -0
  78. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summarize_results.rb +0 -0
  79. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summary.rb +0 -0
  80. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summary_results.rb +0 -0
  81. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/module_definition.rb +0 -0
  82. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/operations.rb +2 -0
  83. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_events.rb +18 -0
  84. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  85. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb +34 -0
  86. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights.rb +0 -0
  87. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/error_definition.rb +0 -0
  88. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/error_response.rb +0 -0
  89. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/expression_evaluation_details.rb +0 -0
  90. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/if_not_exists_evaluation_details.rb +0 -0
  91. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/operation.rb +0 -0
  92. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +0 -0
  93. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +0 -0
  94. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +0 -0
  95. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +0 -0
  96. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_details.rb +0 -0
  97. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_evaluation_details.rb +0 -0
  98. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +0 -0
  99. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +0 -0
  100. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +0 -0
  101. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_tracked_resource.rb +0 -0
  102. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_tracked_resources_query_results.rb +0 -0
  103. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +0 -0
  104. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +0 -0
  105. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +0 -0
  106. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation.rb +0 -0
  107. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployment.rb +0 -0
  108. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployment_summary.rb +0 -0
  109. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployments_list_result.rb +0 -0
  110. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_filters.rb +0 -0
  111. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_list_result.rb +0 -0
  112. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/summarize_results.rb +0 -0
  113. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/summary.rb +0 -0
  114. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/summary_results.rb +0 -0
  115. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/tracked_resource_modification_details.rb +0 -0
  116. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/typed_error_info.rb +0 -0
  117. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/module_definition.rb +0 -0
  118. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/operations.rb +2 -0
  119. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  120. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_states.rb +34 -0
  121. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_tracked_resources.rb +16 -0
  122. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb +64 -0
  123. data/lib/2019-10-01/generated/azure_mgmt_policy_insights.rb +55 -0
  124. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/compliance_detail.rb +57 -0
  125. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/error_definition.rb +115 -0
  126. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/error_response.rb +47 -0
  127. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/expression_evaluation_details.rb +103 -0
  128. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/if_not_exists_evaluation_details.rb +59 -0
  129. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
  130. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
  131. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +70 -0
  132. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +110 -0
  133. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +99 -0
  134. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_evaluation_details.rb +69 -0
  135. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_group_summary.rb +59 -0
  136. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_metadata.rb +168 -0
  137. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_metadata_collection.rb +101 -0
  138. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_state.rb +404 -0
  139. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +82 -0
  140. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
  141. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
  142. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +60 -0
  143. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/query_options.rb +123 -0
  144. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/slim_policy_metadata.rb +145 -0
  145. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/summarize_results.rb +83 -0
  146. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/summary.rb +91 -0
  147. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/summary_results.rb +140 -0
  148. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/typed_error_info.rb +59 -0
  149. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  150. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/operations.rb +109 -0
  151. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_insights_client.rb +136 -0
  152. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_metadata_operations.rb +316 -0
  153. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb +2025 -0
  154. data/lib/azure_mgmt_policy_insights.rb +3 -2
  155. data/lib/module_definition.rb +7 -7
  156. data/lib/profiles/latest/modules/policyinsights_profile_module.rb +39 -9
  157. data/lib/profiles/latest/policyinsights_latest_profile_client.rb +40 -40
  158. data/lib/profiles/latest/policyinsights_module_definition.rb +8 -8
  159. data/lib/version.rb +1 -1
  160. metadata +36 -5
@@ -0,0 +1,2025 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::PolicyInsights::Mgmt::V2019_10_01
7
+ #
8
+ # PolicyStates
9
+ #
10
+ class PolicyStates
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PolicyStates class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [PolicyInsightsClient] reference to the PolicyInsightsClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Queries policy states for the resources under the management group.
26
+ #
27
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
28
+ # under PolicyStates resource type. In a given time range, 'latest' represents
29
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
30
+ # Possible values include: 'default', 'latest'
31
+ # @param management_group_name [String] Management group name.
32
+ # @param query_options [QueryOptions] Additional parameters for the operation
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [PolicyStatesQueryResults] operation results.
37
+ #
38
+ def list_query_results_for_management_group(policy_states_resource, management_group_name, query_options:nil, custom_headers:nil)
39
+ response = list_query_results_for_management_group_async(policy_states_resource, management_group_name, query_options:query_options, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Queries policy states for the resources under the management group.
45
+ #
46
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
47
+ # under PolicyStates resource type. In a given time range, 'latest' represents
48
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
49
+ # Possible values include: 'default', 'latest'
50
+ # @param management_group_name [String] Management group name.
51
+ # @param query_options [QueryOptions] Additional parameters for the operation
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def list_query_results_for_management_group_with_http_info(policy_states_resource, management_group_name, query_options:nil, custom_headers:nil)
58
+ list_query_results_for_management_group_async(policy_states_resource, management_group_name, query_options:query_options, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Queries policy states for the resources under the management group.
63
+ #
64
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
65
+ # under PolicyStates resource type. In a given time range, 'latest' represents
66
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
67
+ # Possible values include: 'default', 'latest'
68
+ # @param management_group_name [String] Management group name.
69
+ # @param query_options [QueryOptions] Additional parameters for the operation
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def list_query_results_for_management_group_async(policy_states_resource, management_group_name, query_options:nil, custom_headers:nil)
76
+ fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil?
77
+ management_groups_namespace = 'Microsoft.Management'
78
+ fail ArgumentError, 'management_group_name is nil' if management_group_name.nil?
79
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
80
+
81
+ top = nil
82
+ order_by = nil
83
+ select = nil
84
+ from = nil
85
+ to = nil
86
+ filter = nil
87
+ apply = nil
88
+ unless query_options.nil?
89
+ top = query_options.Top
90
+ end
91
+ unless query_options.nil?
92
+ order_by = query_options.OrderBy
93
+ end
94
+ unless query_options.nil?
95
+ select = query_options.Select
96
+ end
97
+ unless query_options.nil?
98
+ from = query_options.From
99
+ end
100
+ unless query_options.nil?
101
+ to = query_options.To
102
+ end
103
+ unless query_options.nil?
104
+ filter = query_options.Filter
105
+ end
106
+ unless query_options.nil?
107
+ apply = query_options.Apply
108
+ end
109
+
110
+ request_headers = {}
111
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
112
+
113
+ # Set Headers
114
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
115
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
116
+ path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'
117
+
118
+ request_url = @base_url || @client.base_url
119
+
120
+ options = {
121
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
122
+ path_params: {'policyStatesResource' => policy_states_resource,'managementGroupsNamespace' => management_groups_namespace,'managementGroupName' => management_group_name},
123
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
124
+ headers: request_headers.merge(custom_headers || {}),
125
+ base_url: request_url
126
+ }
127
+ promise = @client.make_request_async(:post, path_template, options)
128
+
129
+ promise = promise.then do |result|
130
+ http_response = result.response
131
+ status_code = http_response.status
132
+ response_content = http_response.body
133
+ unless status_code == 200
134
+ error_model = JSON.load(response_content)
135
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
136
+ end
137
+
138
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
139
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
140
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
141
+ # Deserialize Response
142
+ if status_code == 200
143
+ begin
144
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
145
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyStatesQueryResults.mapper()
146
+ result.body = @client.deserialize(result_mapper, parsed_response)
147
+ rescue Exception => e
148
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
149
+ end
150
+ end
151
+
152
+ result
153
+ end
154
+
155
+ promise.execute
156
+ end
157
+
158
+ #
159
+ # Summarizes policy states for the resources under the management group.
160
+ #
161
+ # @param management_group_name [String] Management group name.
162
+ # @param query_options [QueryOptions] Additional parameters for the operation
163
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
164
+ # will be added to the HTTP request.
165
+ #
166
+ # @return [SummarizeResults] operation results.
167
+ #
168
+ def summarize_for_management_group(management_group_name, query_options:nil, custom_headers:nil)
169
+ response = summarize_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
170
+ response.body unless response.nil?
171
+ end
172
+
173
+ #
174
+ # Summarizes policy states for the resources under the management group.
175
+ #
176
+ # @param management_group_name [String] Management group name.
177
+ # @param query_options [QueryOptions] Additional parameters for the operation
178
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
179
+ # will be added to the HTTP request.
180
+ #
181
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
182
+ #
183
+ def summarize_for_management_group_with_http_info(management_group_name, query_options:nil, custom_headers:nil)
184
+ summarize_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
185
+ end
186
+
187
+ #
188
+ # Summarizes policy states for the resources under the management group.
189
+ #
190
+ # @param management_group_name [String] Management group name.
191
+ # @param query_options [QueryOptions] Additional parameters for the operation
192
+ # @param [Hash{String => String}] A hash of custom headers that will be added
193
+ # to the HTTP request.
194
+ #
195
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
196
+ #
197
+ def summarize_for_management_group_async(management_group_name, query_options:nil, custom_headers:nil)
198
+ policy_states_summary_resource = 'latest'
199
+ management_groups_namespace = 'Microsoft.Management'
200
+ fail ArgumentError, 'management_group_name is nil' if management_group_name.nil?
201
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
202
+
203
+ top = nil
204
+ from = nil
205
+ to = nil
206
+ filter = nil
207
+ unless query_options.nil?
208
+ top = query_options.Top
209
+ end
210
+ unless query_options.nil?
211
+ from = query_options.From
212
+ end
213
+ unless query_options.nil?
214
+ to = query_options.To
215
+ end
216
+ unless query_options.nil?
217
+ filter = query_options.Filter
218
+ end
219
+
220
+ request_headers = {}
221
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
222
+
223
+ # Set Headers
224
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
225
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
226
+ path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'
227
+
228
+ request_url = @base_url || @client.base_url
229
+
230
+ options = {
231
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
232
+ path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'managementGroupsNamespace' => management_groups_namespace,'managementGroupName' => management_group_name},
233
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
234
+ headers: request_headers.merge(custom_headers || {}),
235
+ base_url: request_url
236
+ }
237
+ promise = @client.make_request_async(:post, path_template, options)
238
+
239
+ promise = promise.then do |result|
240
+ http_response = result.response
241
+ status_code = http_response.status
242
+ response_content = http_response.body
243
+ unless status_code == 200
244
+ error_model = JSON.load(response_content)
245
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
246
+ end
247
+
248
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
249
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
250
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
251
+ # Deserialize Response
252
+ if status_code == 200
253
+ begin
254
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
255
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::SummarizeResults.mapper()
256
+ result.body = @client.deserialize(result_mapper, parsed_response)
257
+ rescue Exception => e
258
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
259
+ end
260
+ end
261
+
262
+ result
263
+ end
264
+
265
+ promise.execute
266
+ end
267
+
268
+ #
269
+ # Queries policy states for the resources under the subscription.
270
+ #
271
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
272
+ # under PolicyStates resource type. In a given time range, 'latest' represents
273
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
274
+ # Possible values include: 'default', 'latest'
275
+ # @param subscription_id [String] Microsoft Azure subscription ID.
276
+ # @param query_options [QueryOptions] Additional parameters for the operation
277
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
278
+ # will be added to the HTTP request.
279
+ #
280
+ # @return [PolicyStatesQueryResults] operation results.
281
+ #
282
+ def list_query_results_for_subscription(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil)
283
+ response = list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:query_options, custom_headers:custom_headers).value!
284
+ response.body unless response.nil?
285
+ end
286
+
287
+ #
288
+ # Queries policy states for the resources under the subscription.
289
+ #
290
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
291
+ # under PolicyStates resource type. In a given time range, 'latest' represents
292
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
293
+ # Possible values include: 'default', 'latest'
294
+ # @param subscription_id [String] Microsoft Azure subscription ID.
295
+ # @param query_options [QueryOptions] Additional parameters for the operation
296
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
297
+ # will be added to the HTTP request.
298
+ #
299
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
300
+ #
301
+ def list_query_results_for_subscription_with_http_info(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil)
302
+ list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:query_options, custom_headers:custom_headers).value!
303
+ end
304
+
305
+ #
306
+ # Queries policy states for the resources under the subscription.
307
+ #
308
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
309
+ # under PolicyStates resource type. In a given time range, 'latest' represents
310
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
311
+ # Possible values include: 'default', 'latest'
312
+ # @param subscription_id [String] Microsoft Azure subscription ID.
313
+ # @param query_options [QueryOptions] Additional parameters for the operation
314
+ # @param [Hash{String => String}] A hash of custom headers that will be added
315
+ # to the HTTP request.
316
+ #
317
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
318
+ #
319
+ def list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil)
320
+ fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil?
321
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
322
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
323
+
324
+ top = nil
325
+ order_by = nil
326
+ select = nil
327
+ from = nil
328
+ to = nil
329
+ filter = nil
330
+ apply = nil
331
+ unless query_options.nil?
332
+ top = query_options.Top
333
+ end
334
+ unless query_options.nil?
335
+ order_by = query_options.OrderBy
336
+ end
337
+ unless query_options.nil?
338
+ select = query_options.Select
339
+ end
340
+ unless query_options.nil?
341
+ from = query_options.From
342
+ end
343
+ unless query_options.nil?
344
+ to = query_options.To
345
+ end
346
+ unless query_options.nil?
347
+ filter = query_options.Filter
348
+ end
349
+ unless query_options.nil?
350
+ apply = query_options.Apply
351
+ end
352
+
353
+ request_headers = {}
354
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
355
+
356
+ # Set Headers
357
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
358
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
359
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'
360
+
361
+ request_url = @base_url || @client.base_url
362
+
363
+ options = {
364
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
365
+ path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id},
366
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
367
+ headers: request_headers.merge(custom_headers || {}),
368
+ base_url: request_url
369
+ }
370
+ promise = @client.make_request_async(:post, path_template, options)
371
+
372
+ promise = promise.then do |result|
373
+ http_response = result.response
374
+ status_code = http_response.status
375
+ response_content = http_response.body
376
+ unless status_code == 200
377
+ error_model = JSON.load(response_content)
378
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
379
+ end
380
+
381
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
382
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
383
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
384
+ # Deserialize Response
385
+ if status_code == 200
386
+ begin
387
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
388
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyStatesQueryResults.mapper()
389
+ result.body = @client.deserialize(result_mapper, parsed_response)
390
+ rescue Exception => e
391
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
392
+ end
393
+ end
394
+
395
+ result
396
+ end
397
+
398
+ promise.execute
399
+ end
400
+
401
+ #
402
+ # Summarizes policy states for the resources under the subscription.
403
+ #
404
+ # @param subscription_id [String] Microsoft Azure subscription ID.
405
+ # @param query_options [QueryOptions] Additional parameters for the operation
406
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
407
+ # will be added to the HTTP request.
408
+ #
409
+ # @return [SummarizeResults] operation results.
410
+ #
411
+ def summarize_for_subscription(subscription_id, query_options:nil, custom_headers:nil)
412
+ response = summarize_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
413
+ response.body unless response.nil?
414
+ end
415
+
416
+ #
417
+ # Summarizes policy states for the resources under the subscription.
418
+ #
419
+ # @param subscription_id [String] Microsoft Azure subscription ID.
420
+ # @param query_options [QueryOptions] Additional parameters for the operation
421
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
422
+ # will be added to the HTTP request.
423
+ #
424
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
425
+ #
426
+ def summarize_for_subscription_with_http_info(subscription_id, query_options:nil, custom_headers:nil)
427
+ summarize_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
428
+ end
429
+
430
+ #
431
+ # Summarizes policy states for the resources under the subscription.
432
+ #
433
+ # @param subscription_id [String] Microsoft Azure subscription ID.
434
+ # @param query_options [QueryOptions] Additional parameters for the operation
435
+ # @param [Hash{String => String}] A hash of custom headers that will be added
436
+ # to the HTTP request.
437
+ #
438
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
439
+ #
440
+ def summarize_for_subscription_async(subscription_id, query_options:nil, custom_headers:nil)
441
+ policy_states_summary_resource = 'latest'
442
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
443
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
444
+
445
+ top = nil
446
+ from = nil
447
+ to = nil
448
+ filter = nil
449
+ unless query_options.nil?
450
+ top = query_options.Top
451
+ end
452
+ unless query_options.nil?
453
+ from = query_options.From
454
+ end
455
+ unless query_options.nil?
456
+ to = query_options.To
457
+ end
458
+ unless query_options.nil?
459
+ filter = query_options.Filter
460
+ end
461
+
462
+ request_headers = {}
463
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
464
+
465
+ # Set Headers
466
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
467
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
468
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'
469
+
470
+ request_url = @base_url || @client.base_url
471
+
472
+ options = {
473
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
474
+ path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id},
475
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
476
+ headers: request_headers.merge(custom_headers || {}),
477
+ base_url: request_url
478
+ }
479
+ promise = @client.make_request_async(:post, path_template, options)
480
+
481
+ promise = promise.then do |result|
482
+ http_response = result.response
483
+ status_code = http_response.status
484
+ response_content = http_response.body
485
+ unless status_code == 200
486
+ error_model = JSON.load(response_content)
487
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
488
+ end
489
+
490
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
491
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
492
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
493
+ # Deserialize Response
494
+ if status_code == 200
495
+ begin
496
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
497
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::SummarizeResults.mapper()
498
+ result.body = @client.deserialize(result_mapper, parsed_response)
499
+ rescue Exception => e
500
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
501
+ end
502
+ end
503
+
504
+ result
505
+ end
506
+
507
+ promise.execute
508
+ end
509
+
510
+ #
511
+ # Queries policy states for the resources under the resource group.
512
+ #
513
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
514
+ # under PolicyStates resource type. In a given time range, 'latest' represents
515
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
516
+ # Possible values include: 'default', 'latest'
517
+ # @param subscription_id [String] Microsoft Azure subscription ID.
518
+ # @param resource_group_name [String] Resource group name.
519
+ # @param query_options [QueryOptions] Additional parameters for the operation
520
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
521
+ # will be added to the HTTP request.
522
+ #
523
+ # @return [PolicyStatesQueryResults] operation results.
524
+ #
525
+ def list_query_results_for_resource_group(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
526
+ response = list_query_results_for_resource_group_async(policy_states_resource, subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
527
+ response.body unless response.nil?
528
+ end
529
+
530
+ #
531
+ # Queries policy states for the resources under the resource group.
532
+ #
533
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
534
+ # under PolicyStates resource type. In a given time range, 'latest' represents
535
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
536
+ # Possible values include: 'default', 'latest'
537
+ # @param subscription_id [String] Microsoft Azure subscription ID.
538
+ # @param resource_group_name [String] Resource group name.
539
+ # @param query_options [QueryOptions] Additional parameters for the operation
540
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
541
+ # will be added to the HTTP request.
542
+ #
543
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
544
+ #
545
+ def list_query_results_for_resource_group_with_http_info(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
546
+ list_query_results_for_resource_group_async(policy_states_resource, subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
547
+ end
548
+
549
+ #
550
+ # Queries policy states for the resources under the resource group.
551
+ #
552
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
553
+ # under PolicyStates resource type. In a given time range, 'latest' represents
554
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
555
+ # Possible values include: 'default', 'latest'
556
+ # @param subscription_id [String] Microsoft Azure subscription ID.
557
+ # @param resource_group_name [String] Resource group name.
558
+ # @param query_options [QueryOptions] Additional parameters for the operation
559
+ # @param [Hash{String => String}] A hash of custom headers that will be added
560
+ # to the HTTP request.
561
+ #
562
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
563
+ #
564
+ def list_query_results_for_resource_group_async(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
565
+ fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil?
566
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
567
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
568
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
569
+
570
+ top = nil
571
+ order_by = nil
572
+ select = nil
573
+ from = nil
574
+ to = nil
575
+ filter = nil
576
+ apply = nil
577
+ unless query_options.nil?
578
+ top = query_options.Top
579
+ end
580
+ unless query_options.nil?
581
+ order_by = query_options.OrderBy
582
+ end
583
+ unless query_options.nil?
584
+ select = query_options.Select
585
+ end
586
+ unless query_options.nil?
587
+ from = query_options.From
588
+ end
589
+ unless query_options.nil?
590
+ to = query_options.To
591
+ end
592
+ unless query_options.nil?
593
+ filter = query_options.Filter
594
+ end
595
+ unless query_options.nil?
596
+ apply = query_options.Apply
597
+ end
598
+
599
+ request_headers = {}
600
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
601
+
602
+ # Set Headers
603
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
604
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
605
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'
606
+
607
+ request_url = @base_url || @client.base_url
608
+
609
+ options = {
610
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
611
+ path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name},
612
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
613
+ headers: request_headers.merge(custom_headers || {}),
614
+ base_url: request_url
615
+ }
616
+ promise = @client.make_request_async(:post, path_template, options)
617
+
618
+ promise = promise.then do |result|
619
+ http_response = result.response
620
+ status_code = http_response.status
621
+ response_content = http_response.body
622
+ unless status_code == 200
623
+ error_model = JSON.load(response_content)
624
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
625
+ end
626
+
627
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
628
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
629
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
630
+ # Deserialize Response
631
+ if status_code == 200
632
+ begin
633
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
634
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyStatesQueryResults.mapper()
635
+ result.body = @client.deserialize(result_mapper, parsed_response)
636
+ rescue Exception => e
637
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
638
+ end
639
+ end
640
+
641
+ result
642
+ end
643
+
644
+ promise.execute
645
+ end
646
+
647
+ #
648
+ # Summarizes policy states for the resources under the resource group.
649
+ #
650
+ # @param subscription_id [String] Microsoft Azure subscription ID.
651
+ # @param resource_group_name [String] Resource group name.
652
+ # @param query_options [QueryOptions] Additional parameters for the operation
653
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
654
+ # will be added to the HTTP request.
655
+ #
656
+ # @return [SummarizeResults] operation results.
657
+ #
658
+ def summarize_for_resource_group(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
659
+ response = summarize_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
660
+ response.body unless response.nil?
661
+ end
662
+
663
+ #
664
+ # Summarizes policy states for the resources under the resource group.
665
+ #
666
+ # @param subscription_id [String] Microsoft Azure subscription ID.
667
+ # @param resource_group_name [String] Resource group name.
668
+ # @param query_options [QueryOptions] Additional parameters for the operation
669
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
670
+ # will be added to the HTTP request.
671
+ #
672
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
673
+ #
674
+ def summarize_for_resource_group_with_http_info(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
675
+ summarize_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
676
+ end
677
+
678
+ #
679
+ # Summarizes policy states for the resources under the resource group.
680
+ #
681
+ # @param subscription_id [String] Microsoft Azure subscription ID.
682
+ # @param resource_group_name [String] Resource group name.
683
+ # @param query_options [QueryOptions] Additional parameters for the operation
684
+ # @param [Hash{String => String}] A hash of custom headers that will be added
685
+ # to the HTTP request.
686
+ #
687
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
688
+ #
689
+ def summarize_for_resource_group_async(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
690
+ policy_states_summary_resource = 'latest'
691
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
692
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
693
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
694
+
695
+ top = nil
696
+ from = nil
697
+ to = nil
698
+ filter = nil
699
+ unless query_options.nil?
700
+ top = query_options.Top
701
+ end
702
+ unless query_options.nil?
703
+ from = query_options.From
704
+ end
705
+ unless query_options.nil?
706
+ to = query_options.To
707
+ end
708
+ unless query_options.nil?
709
+ filter = query_options.Filter
710
+ end
711
+
712
+ request_headers = {}
713
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
714
+
715
+ # Set Headers
716
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
717
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
718
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'
719
+
720
+ request_url = @base_url || @client.base_url
721
+
722
+ options = {
723
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
724
+ path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name},
725
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
726
+ headers: request_headers.merge(custom_headers || {}),
727
+ base_url: request_url
728
+ }
729
+ promise = @client.make_request_async(:post, path_template, options)
730
+
731
+ promise = promise.then do |result|
732
+ http_response = result.response
733
+ status_code = http_response.status
734
+ response_content = http_response.body
735
+ unless status_code == 200
736
+ error_model = JSON.load(response_content)
737
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
738
+ end
739
+
740
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
741
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
742
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
743
+ # Deserialize Response
744
+ if status_code == 200
745
+ begin
746
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
747
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::SummarizeResults.mapper()
748
+ result.body = @client.deserialize(result_mapper, parsed_response)
749
+ rescue Exception => e
750
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
751
+ end
752
+ end
753
+
754
+ result
755
+ end
756
+
757
+ promise.execute
758
+ end
759
+
760
+ #
761
+ # Queries policy states for the resource.
762
+ #
763
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
764
+ # under PolicyStates resource type. In a given time range, 'latest' represents
765
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
766
+ # Possible values include: 'default', 'latest'
767
+ # @param resource_id [String] Resource ID.
768
+ # @param query_options [QueryOptions] Additional parameters for the operation
769
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
770
+ # will be added to the HTTP request.
771
+ #
772
+ # @return [PolicyStatesQueryResults] operation results.
773
+ #
774
+ def list_query_results_for_resource(policy_states_resource, resource_id, query_options:nil, custom_headers:nil)
775
+ response = list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:query_options, custom_headers:custom_headers).value!
776
+ response.body unless response.nil?
777
+ end
778
+
779
+ #
780
+ # Queries policy states for the resource.
781
+ #
782
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
783
+ # under PolicyStates resource type. In a given time range, 'latest' represents
784
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
785
+ # Possible values include: 'default', 'latest'
786
+ # @param resource_id [String] Resource ID.
787
+ # @param query_options [QueryOptions] Additional parameters for the operation
788
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
789
+ # will be added to the HTTP request.
790
+ #
791
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
792
+ #
793
+ def list_query_results_for_resource_with_http_info(policy_states_resource, resource_id, query_options:nil, custom_headers:nil)
794
+ list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:query_options, custom_headers:custom_headers).value!
795
+ end
796
+
797
+ #
798
+ # Queries policy states for the resource.
799
+ #
800
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
801
+ # under PolicyStates resource type. In a given time range, 'latest' represents
802
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
803
+ # Possible values include: 'default', 'latest'
804
+ # @param resource_id [String] Resource ID.
805
+ # @param query_options [QueryOptions] Additional parameters for the operation
806
+ # @param [Hash{String => String}] A hash of custom headers that will be added
807
+ # to the HTTP request.
808
+ #
809
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
810
+ #
811
+ def list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:nil, custom_headers:nil)
812
+ fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil?
813
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
814
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
815
+
816
+ top = nil
817
+ order_by = nil
818
+ select = nil
819
+ from = nil
820
+ to = nil
821
+ filter = nil
822
+ apply = nil
823
+ expand = nil
824
+ unless query_options.nil?
825
+ top = query_options.Top
826
+ end
827
+ unless query_options.nil?
828
+ order_by = query_options.OrderBy
829
+ end
830
+ unless query_options.nil?
831
+ select = query_options.Select
832
+ end
833
+ unless query_options.nil?
834
+ from = query_options.From
835
+ end
836
+ unless query_options.nil?
837
+ to = query_options.To
838
+ end
839
+ unless query_options.nil?
840
+ filter = query_options.Filter
841
+ end
842
+ unless query_options.nil?
843
+ apply = query_options.Apply
844
+ end
845
+ unless query_options.nil?
846
+ expand = query_options.Expand
847
+ end
848
+
849
+ request_headers = {}
850
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
851
+
852
+ # Set Headers
853
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
854
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
855
+ path_template = '{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'
856
+
857
+ request_url = @base_url || @client.base_url
858
+
859
+ options = {
860
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
861
+ path_params: {'policyStatesResource' => policy_states_resource},
862
+ skip_encoding_path_params: {'resourceId' => resource_id},
863
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$expand' => expand},
864
+ headers: request_headers.merge(custom_headers || {}),
865
+ base_url: request_url
866
+ }
867
+ promise = @client.make_request_async(:post, path_template, options)
868
+
869
+ promise = promise.then do |result|
870
+ http_response = result.response
871
+ status_code = http_response.status
872
+ response_content = http_response.body
873
+ unless status_code == 200
874
+ error_model = JSON.load(response_content)
875
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
876
+ end
877
+
878
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
879
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
880
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
881
+ # Deserialize Response
882
+ if status_code == 200
883
+ begin
884
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
885
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyStatesQueryResults.mapper()
886
+ result.body = @client.deserialize(result_mapper, parsed_response)
887
+ rescue Exception => e
888
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
889
+ end
890
+ end
891
+
892
+ result
893
+ end
894
+
895
+ promise.execute
896
+ end
897
+
898
+ #
899
+ # Summarizes policy states for the resource.
900
+ #
901
+ # @param resource_id [String] Resource ID.
902
+ # @param query_options [QueryOptions] Additional parameters for the operation
903
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
904
+ # will be added to the HTTP request.
905
+ #
906
+ # @return [SummarizeResults] operation results.
907
+ #
908
+ def summarize_for_resource(resource_id, query_options:nil, custom_headers:nil)
909
+ response = summarize_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
910
+ response.body unless response.nil?
911
+ end
912
+
913
+ #
914
+ # Summarizes policy states for the resource.
915
+ #
916
+ # @param resource_id [String] Resource ID.
917
+ # @param query_options [QueryOptions] Additional parameters for the operation
918
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
919
+ # will be added to the HTTP request.
920
+ #
921
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
922
+ #
923
+ def summarize_for_resource_with_http_info(resource_id, query_options:nil, custom_headers:nil)
924
+ summarize_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
925
+ end
926
+
927
+ #
928
+ # Summarizes policy states for the resource.
929
+ #
930
+ # @param resource_id [String] Resource ID.
931
+ # @param query_options [QueryOptions] Additional parameters for the operation
932
+ # @param [Hash{String => String}] A hash of custom headers that will be added
933
+ # to the HTTP request.
934
+ #
935
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
936
+ #
937
+ def summarize_for_resource_async(resource_id, query_options:nil, custom_headers:nil)
938
+ policy_states_summary_resource = 'latest'
939
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
940
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
941
+
942
+ top = nil
943
+ from = nil
944
+ to = nil
945
+ filter = nil
946
+ unless query_options.nil?
947
+ top = query_options.Top
948
+ end
949
+ unless query_options.nil?
950
+ from = query_options.From
951
+ end
952
+ unless query_options.nil?
953
+ to = query_options.To
954
+ end
955
+ unless query_options.nil?
956
+ filter = query_options.Filter
957
+ end
958
+
959
+ request_headers = {}
960
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
961
+
962
+ # Set Headers
963
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
964
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
965
+ path_template = '{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'
966
+
967
+ request_url = @base_url || @client.base_url
968
+
969
+ options = {
970
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
971
+ path_params: {'policyStatesSummaryResource' => policy_states_summary_resource},
972
+ skip_encoding_path_params: {'resourceId' => resource_id},
973
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
974
+ headers: request_headers.merge(custom_headers || {}),
975
+ base_url: request_url
976
+ }
977
+ promise = @client.make_request_async(:post, path_template, options)
978
+
979
+ promise = promise.then do |result|
980
+ http_response = result.response
981
+ status_code = http_response.status
982
+ response_content = http_response.body
983
+ unless status_code == 200
984
+ error_model = JSON.load(response_content)
985
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
986
+ end
987
+
988
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
989
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
990
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
991
+ # Deserialize Response
992
+ if status_code == 200
993
+ begin
994
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
995
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::SummarizeResults.mapper()
996
+ result.body = @client.deserialize(result_mapper, parsed_response)
997
+ rescue Exception => e
998
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
999
+ end
1000
+ end
1001
+
1002
+ result
1003
+ end
1004
+
1005
+ promise.execute
1006
+ end
1007
+
1008
+ #
1009
+ # Queries policy states for the subscription level policy set definition.
1010
+ #
1011
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1012
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1013
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1014
+ # Possible values include: 'default', 'latest'
1015
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1016
+ # @param policy_set_definition_name [String] Policy set definition name.
1017
+ # @param query_options [QueryOptions] Additional parameters for the operation
1018
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1019
+ # will be added to the HTTP request.
1020
+ #
1021
+ # @return [PolicyStatesQueryResults] operation results.
1022
+ #
1023
+ def list_query_results_for_policy_set_definition(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
1024
+ response = list_query_results_for_policy_set_definition_async(policy_states_resource, subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
1025
+ response.body unless response.nil?
1026
+ end
1027
+
1028
+ #
1029
+ # Queries policy states for the subscription level policy set definition.
1030
+ #
1031
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1032
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1033
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1034
+ # Possible values include: 'default', 'latest'
1035
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1036
+ # @param policy_set_definition_name [String] Policy set definition name.
1037
+ # @param query_options [QueryOptions] Additional parameters for the operation
1038
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1039
+ # will be added to the HTTP request.
1040
+ #
1041
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1042
+ #
1043
+ def list_query_results_for_policy_set_definition_with_http_info(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
1044
+ list_query_results_for_policy_set_definition_async(policy_states_resource, subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
1045
+ end
1046
+
1047
+ #
1048
+ # Queries policy states for the subscription level policy set definition.
1049
+ #
1050
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1051
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1052
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1053
+ # Possible values include: 'default', 'latest'
1054
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1055
+ # @param policy_set_definition_name [String] Policy set definition name.
1056
+ # @param query_options [QueryOptions] Additional parameters for the operation
1057
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1058
+ # to the HTTP request.
1059
+ #
1060
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1061
+ #
1062
+ def list_query_results_for_policy_set_definition_async(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
1063
+ fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil?
1064
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
1065
+ authorization_namespace = 'Microsoft.Authorization'
1066
+ fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil?
1067
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1068
+
1069
+ top = nil
1070
+ order_by = nil
1071
+ select = nil
1072
+ from = nil
1073
+ to = nil
1074
+ filter = nil
1075
+ apply = nil
1076
+ unless query_options.nil?
1077
+ top = query_options.Top
1078
+ end
1079
+ unless query_options.nil?
1080
+ order_by = query_options.OrderBy
1081
+ end
1082
+ unless query_options.nil?
1083
+ select = query_options.Select
1084
+ end
1085
+ unless query_options.nil?
1086
+ from = query_options.From
1087
+ end
1088
+ unless query_options.nil?
1089
+ to = query_options.To
1090
+ end
1091
+ unless query_options.nil?
1092
+ filter = query_options.Filter
1093
+ end
1094
+ unless query_options.nil?
1095
+ apply = query_options.Apply
1096
+ end
1097
+
1098
+ request_headers = {}
1099
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1100
+
1101
+ # Set Headers
1102
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1103
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1104
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'
1105
+
1106
+ request_url = @base_url || @client.base_url
1107
+
1108
+ options = {
1109
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1110
+ path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policySetDefinitionName' => policy_set_definition_name},
1111
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
1112
+ headers: request_headers.merge(custom_headers || {}),
1113
+ base_url: request_url
1114
+ }
1115
+ promise = @client.make_request_async(:post, path_template, options)
1116
+
1117
+ promise = promise.then do |result|
1118
+ http_response = result.response
1119
+ status_code = http_response.status
1120
+ response_content = http_response.body
1121
+ unless status_code == 200
1122
+ error_model = JSON.load(response_content)
1123
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1124
+ end
1125
+
1126
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1127
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1128
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1129
+ # Deserialize Response
1130
+ if status_code == 200
1131
+ begin
1132
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1133
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyStatesQueryResults.mapper()
1134
+ result.body = @client.deserialize(result_mapper, parsed_response)
1135
+ rescue Exception => e
1136
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1137
+ end
1138
+ end
1139
+
1140
+ result
1141
+ end
1142
+
1143
+ promise.execute
1144
+ end
1145
+
1146
+ #
1147
+ # Summarizes policy states for the subscription level policy set definition.
1148
+ #
1149
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1150
+ # @param policy_set_definition_name [String] Policy set definition name.
1151
+ # @param query_options [QueryOptions] Additional parameters for the operation
1152
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1153
+ # will be added to the HTTP request.
1154
+ #
1155
+ # @return [SummarizeResults] operation results.
1156
+ #
1157
+ def summarize_for_policy_set_definition(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
1158
+ response = summarize_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
1159
+ response.body unless response.nil?
1160
+ end
1161
+
1162
+ #
1163
+ # Summarizes policy states for the subscription level policy set definition.
1164
+ #
1165
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1166
+ # @param policy_set_definition_name [String] Policy set definition name.
1167
+ # @param query_options [QueryOptions] Additional parameters for the operation
1168
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1169
+ # will be added to the HTTP request.
1170
+ #
1171
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1172
+ #
1173
+ def summarize_for_policy_set_definition_with_http_info(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
1174
+ summarize_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
1175
+ end
1176
+
1177
+ #
1178
+ # Summarizes policy states for the subscription level policy set definition.
1179
+ #
1180
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1181
+ # @param policy_set_definition_name [String] Policy set definition name.
1182
+ # @param query_options [QueryOptions] Additional parameters for the operation
1183
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1184
+ # to the HTTP request.
1185
+ #
1186
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1187
+ #
1188
+ def summarize_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
1189
+ policy_states_summary_resource = 'latest'
1190
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
1191
+ authorization_namespace = 'Microsoft.Authorization'
1192
+ fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil?
1193
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1194
+
1195
+ top = nil
1196
+ from = nil
1197
+ to = nil
1198
+ filter = nil
1199
+ unless query_options.nil?
1200
+ top = query_options.Top
1201
+ end
1202
+ unless query_options.nil?
1203
+ from = query_options.From
1204
+ end
1205
+ unless query_options.nil?
1206
+ to = query_options.To
1207
+ end
1208
+ unless query_options.nil?
1209
+ filter = query_options.Filter
1210
+ end
1211
+
1212
+ request_headers = {}
1213
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1214
+
1215
+ # Set Headers
1216
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1217
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1218
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'
1219
+
1220
+ request_url = @base_url || @client.base_url
1221
+
1222
+ options = {
1223
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1224
+ path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policySetDefinitionName' => policy_set_definition_name},
1225
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
1226
+ headers: request_headers.merge(custom_headers || {}),
1227
+ base_url: request_url
1228
+ }
1229
+ promise = @client.make_request_async(:post, path_template, options)
1230
+
1231
+ promise = promise.then do |result|
1232
+ http_response = result.response
1233
+ status_code = http_response.status
1234
+ response_content = http_response.body
1235
+ unless status_code == 200
1236
+ error_model = JSON.load(response_content)
1237
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1238
+ end
1239
+
1240
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1241
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1242
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1243
+ # Deserialize Response
1244
+ if status_code == 200
1245
+ begin
1246
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1247
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::SummarizeResults.mapper()
1248
+ result.body = @client.deserialize(result_mapper, parsed_response)
1249
+ rescue Exception => e
1250
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1251
+ end
1252
+ end
1253
+
1254
+ result
1255
+ end
1256
+
1257
+ promise.execute
1258
+ end
1259
+
1260
+ #
1261
+ # Queries policy states for the subscription level policy definition.
1262
+ #
1263
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1264
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1265
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1266
+ # Possible values include: 'default', 'latest'
1267
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1268
+ # @param policy_definition_name [String] Policy definition name.
1269
+ # @param query_options [QueryOptions] Additional parameters for the operation
1270
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1271
+ # will be added to the HTTP request.
1272
+ #
1273
+ # @return [PolicyStatesQueryResults] operation results.
1274
+ #
1275
+ def list_query_results_for_policy_definition(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
1276
+ response = list_query_results_for_policy_definition_async(policy_states_resource, subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
1277
+ response.body unless response.nil?
1278
+ end
1279
+
1280
+ #
1281
+ # Queries policy states for the subscription level policy definition.
1282
+ #
1283
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1284
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1285
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1286
+ # Possible values include: 'default', 'latest'
1287
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1288
+ # @param policy_definition_name [String] Policy definition name.
1289
+ # @param query_options [QueryOptions] Additional parameters for the operation
1290
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1291
+ # will be added to the HTTP request.
1292
+ #
1293
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1294
+ #
1295
+ def list_query_results_for_policy_definition_with_http_info(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
1296
+ list_query_results_for_policy_definition_async(policy_states_resource, subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
1297
+ end
1298
+
1299
+ #
1300
+ # Queries policy states for the subscription level policy definition.
1301
+ #
1302
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1303
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1304
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1305
+ # Possible values include: 'default', 'latest'
1306
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1307
+ # @param policy_definition_name [String] Policy definition name.
1308
+ # @param query_options [QueryOptions] Additional parameters for the operation
1309
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1310
+ # to the HTTP request.
1311
+ #
1312
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1313
+ #
1314
+ def list_query_results_for_policy_definition_async(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
1315
+ fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil?
1316
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
1317
+ authorization_namespace = 'Microsoft.Authorization'
1318
+ fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
1319
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1320
+
1321
+ top = nil
1322
+ order_by = nil
1323
+ select = nil
1324
+ from = nil
1325
+ to = nil
1326
+ filter = nil
1327
+ apply = nil
1328
+ unless query_options.nil?
1329
+ top = query_options.Top
1330
+ end
1331
+ unless query_options.nil?
1332
+ order_by = query_options.OrderBy
1333
+ end
1334
+ unless query_options.nil?
1335
+ select = query_options.Select
1336
+ end
1337
+ unless query_options.nil?
1338
+ from = query_options.From
1339
+ end
1340
+ unless query_options.nil?
1341
+ to = query_options.To
1342
+ end
1343
+ unless query_options.nil?
1344
+ filter = query_options.Filter
1345
+ end
1346
+ unless query_options.nil?
1347
+ apply = query_options.Apply
1348
+ end
1349
+
1350
+ request_headers = {}
1351
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1352
+
1353
+ # Set Headers
1354
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1355
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1356
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'
1357
+
1358
+ request_url = @base_url || @client.base_url
1359
+
1360
+ options = {
1361
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1362
+ path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyDefinitionName' => policy_definition_name},
1363
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
1364
+ headers: request_headers.merge(custom_headers || {}),
1365
+ base_url: request_url
1366
+ }
1367
+ promise = @client.make_request_async(:post, path_template, options)
1368
+
1369
+ promise = promise.then do |result|
1370
+ http_response = result.response
1371
+ status_code = http_response.status
1372
+ response_content = http_response.body
1373
+ unless status_code == 200
1374
+ error_model = JSON.load(response_content)
1375
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1376
+ end
1377
+
1378
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1379
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1380
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1381
+ # Deserialize Response
1382
+ if status_code == 200
1383
+ begin
1384
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1385
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyStatesQueryResults.mapper()
1386
+ result.body = @client.deserialize(result_mapper, parsed_response)
1387
+ rescue Exception => e
1388
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1389
+ end
1390
+ end
1391
+
1392
+ result
1393
+ end
1394
+
1395
+ promise.execute
1396
+ end
1397
+
1398
+ #
1399
+ # Summarizes policy states for the subscription level policy definition.
1400
+ #
1401
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1402
+ # @param policy_definition_name [String] Policy definition name.
1403
+ # @param query_options [QueryOptions] Additional parameters for the operation
1404
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1405
+ # will be added to the HTTP request.
1406
+ #
1407
+ # @return [SummarizeResults] operation results.
1408
+ #
1409
+ def summarize_for_policy_definition(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
1410
+ response = summarize_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
1411
+ response.body unless response.nil?
1412
+ end
1413
+
1414
+ #
1415
+ # Summarizes policy states for the subscription level policy definition.
1416
+ #
1417
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1418
+ # @param policy_definition_name [String] Policy definition name.
1419
+ # @param query_options [QueryOptions] Additional parameters for the operation
1420
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1421
+ # will be added to the HTTP request.
1422
+ #
1423
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1424
+ #
1425
+ def summarize_for_policy_definition_with_http_info(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
1426
+ summarize_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
1427
+ end
1428
+
1429
+ #
1430
+ # Summarizes policy states for the subscription level policy definition.
1431
+ #
1432
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1433
+ # @param policy_definition_name [String] Policy definition name.
1434
+ # @param query_options [QueryOptions] Additional parameters for the operation
1435
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1436
+ # to the HTTP request.
1437
+ #
1438
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1439
+ #
1440
+ def summarize_for_policy_definition_async(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
1441
+ policy_states_summary_resource = 'latest'
1442
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
1443
+ authorization_namespace = 'Microsoft.Authorization'
1444
+ fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
1445
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1446
+
1447
+ top = nil
1448
+ from = nil
1449
+ to = nil
1450
+ filter = nil
1451
+ unless query_options.nil?
1452
+ top = query_options.Top
1453
+ end
1454
+ unless query_options.nil?
1455
+ from = query_options.From
1456
+ end
1457
+ unless query_options.nil?
1458
+ to = query_options.To
1459
+ end
1460
+ unless query_options.nil?
1461
+ filter = query_options.Filter
1462
+ end
1463
+
1464
+ request_headers = {}
1465
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1466
+
1467
+ # Set Headers
1468
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1469
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1470
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'
1471
+
1472
+ request_url = @base_url || @client.base_url
1473
+
1474
+ options = {
1475
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1476
+ path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyDefinitionName' => policy_definition_name},
1477
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
1478
+ headers: request_headers.merge(custom_headers || {}),
1479
+ base_url: request_url
1480
+ }
1481
+ promise = @client.make_request_async(:post, path_template, options)
1482
+
1483
+ promise = promise.then do |result|
1484
+ http_response = result.response
1485
+ status_code = http_response.status
1486
+ response_content = http_response.body
1487
+ unless status_code == 200
1488
+ error_model = JSON.load(response_content)
1489
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1490
+ end
1491
+
1492
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1493
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1494
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1495
+ # Deserialize Response
1496
+ if status_code == 200
1497
+ begin
1498
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1499
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::SummarizeResults.mapper()
1500
+ result.body = @client.deserialize(result_mapper, parsed_response)
1501
+ rescue Exception => e
1502
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1503
+ end
1504
+ end
1505
+
1506
+ result
1507
+ end
1508
+
1509
+ promise.execute
1510
+ end
1511
+
1512
+ #
1513
+ # Queries policy states for the subscription level policy assignment.
1514
+ #
1515
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1516
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1517
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1518
+ # Possible values include: 'default', 'latest'
1519
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1520
+ # @param policy_assignment_name [String] Policy assignment name.
1521
+ # @param query_options [QueryOptions] Additional parameters for the operation
1522
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1523
+ # will be added to the HTTP request.
1524
+ #
1525
+ # @return [PolicyStatesQueryResults] operation results.
1526
+ #
1527
+ def list_query_results_for_subscription_level_policy_assignment(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
1528
+ response = list_query_results_for_subscription_level_policy_assignment_async(policy_states_resource, subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
1529
+ response.body unless response.nil?
1530
+ end
1531
+
1532
+ #
1533
+ # Queries policy states for the subscription level policy assignment.
1534
+ #
1535
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1536
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1537
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1538
+ # Possible values include: 'default', 'latest'
1539
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1540
+ # @param policy_assignment_name [String] Policy assignment name.
1541
+ # @param query_options [QueryOptions] Additional parameters for the operation
1542
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1543
+ # will be added to the HTTP request.
1544
+ #
1545
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1546
+ #
1547
+ def list_query_results_for_subscription_level_policy_assignment_with_http_info(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
1548
+ list_query_results_for_subscription_level_policy_assignment_async(policy_states_resource, subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
1549
+ end
1550
+
1551
+ #
1552
+ # Queries policy states for the subscription level policy assignment.
1553
+ #
1554
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1555
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1556
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1557
+ # Possible values include: 'default', 'latest'
1558
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1559
+ # @param policy_assignment_name [String] Policy assignment name.
1560
+ # @param query_options [QueryOptions] Additional parameters for the operation
1561
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1562
+ # to the HTTP request.
1563
+ #
1564
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1565
+ #
1566
+ def list_query_results_for_subscription_level_policy_assignment_async(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
1567
+ fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil?
1568
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
1569
+ authorization_namespace = 'Microsoft.Authorization'
1570
+ fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
1571
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1572
+
1573
+ top = nil
1574
+ order_by = nil
1575
+ select = nil
1576
+ from = nil
1577
+ to = nil
1578
+ filter = nil
1579
+ apply = nil
1580
+ unless query_options.nil?
1581
+ top = query_options.Top
1582
+ end
1583
+ unless query_options.nil?
1584
+ order_by = query_options.OrderBy
1585
+ end
1586
+ unless query_options.nil?
1587
+ select = query_options.Select
1588
+ end
1589
+ unless query_options.nil?
1590
+ from = query_options.From
1591
+ end
1592
+ unless query_options.nil?
1593
+ to = query_options.To
1594
+ end
1595
+ unless query_options.nil?
1596
+ filter = query_options.Filter
1597
+ end
1598
+ unless query_options.nil?
1599
+ apply = query_options.Apply
1600
+ end
1601
+
1602
+ request_headers = {}
1603
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1604
+
1605
+ # Set Headers
1606
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1607
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1608
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'
1609
+
1610
+ request_url = @base_url || @client.base_url
1611
+
1612
+ options = {
1613
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1614
+ path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
1615
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
1616
+ headers: request_headers.merge(custom_headers || {}),
1617
+ base_url: request_url
1618
+ }
1619
+ promise = @client.make_request_async(:post, path_template, options)
1620
+
1621
+ promise = promise.then do |result|
1622
+ http_response = result.response
1623
+ status_code = http_response.status
1624
+ response_content = http_response.body
1625
+ unless status_code == 200
1626
+ error_model = JSON.load(response_content)
1627
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1628
+ end
1629
+
1630
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1631
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1632
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1633
+ # Deserialize Response
1634
+ if status_code == 200
1635
+ begin
1636
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1637
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyStatesQueryResults.mapper()
1638
+ result.body = @client.deserialize(result_mapper, parsed_response)
1639
+ rescue Exception => e
1640
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1641
+ end
1642
+ end
1643
+
1644
+ result
1645
+ end
1646
+
1647
+ promise.execute
1648
+ end
1649
+
1650
+ #
1651
+ # Summarizes policy states for the subscription level policy assignment.
1652
+ #
1653
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1654
+ # @param policy_assignment_name [String] Policy assignment name.
1655
+ # @param query_options [QueryOptions] Additional parameters for the operation
1656
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1657
+ # will be added to the HTTP request.
1658
+ #
1659
+ # @return [SummarizeResults] operation results.
1660
+ #
1661
+ def summarize_for_subscription_level_policy_assignment(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
1662
+ response = summarize_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
1663
+ response.body unless response.nil?
1664
+ end
1665
+
1666
+ #
1667
+ # Summarizes policy states for the subscription level policy assignment.
1668
+ #
1669
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1670
+ # @param policy_assignment_name [String] Policy assignment name.
1671
+ # @param query_options [QueryOptions] Additional parameters for the operation
1672
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1673
+ # will be added to the HTTP request.
1674
+ #
1675
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1676
+ #
1677
+ def summarize_for_subscription_level_policy_assignment_with_http_info(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
1678
+ summarize_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
1679
+ end
1680
+
1681
+ #
1682
+ # Summarizes policy states for the subscription level policy assignment.
1683
+ #
1684
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1685
+ # @param policy_assignment_name [String] Policy assignment name.
1686
+ # @param query_options [QueryOptions] Additional parameters for the operation
1687
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1688
+ # to the HTTP request.
1689
+ #
1690
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1691
+ #
1692
+ def summarize_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
1693
+ policy_states_summary_resource = 'latest'
1694
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
1695
+ authorization_namespace = 'Microsoft.Authorization'
1696
+ fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
1697
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1698
+
1699
+ top = nil
1700
+ from = nil
1701
+ to = nil
1702
+ filter = nil
1703
+ unless query_options.nil?
1704
+ top = query_options.Top
1705
+ end
1706
+ unless query_options.nil?
1707
+ from = query_options.From
1708
+ end
1709
+ unless query_options.nil?
1710
+ to = query_options.To
1711
+ end
1712
+ unless query_options.nil?
1713
+ filter = query_options.Filter
1714
+ end
1715
+
1716
+ request_headers = {}
1717
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1718
+
1719
+ # Set Headers
1720
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1721
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1722
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'
1723
+
1724
+ request_url = @base_url || @client.base_url
1725
+
1726
+ options = {
1727
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1728
+ path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
1729
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
1730
+ headers: request_headers.merge(custom_headers || {}),
1731
+ base_url: request_url
1732
+ }
1733
+ promise = @client.make_request_async(:post, path_template, options)
1734
+
1735
+ promise = promise.then do |result|
1736
+ http_response = result.response
1737
+ status_code = http_response.status
1738
+ response_content = http_response.body
1739
+ unless status_code == 200
1740
+ error_model = JSON.load(response_content)
1741
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1742
+ end
1743
+
1744
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1745
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1746
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1747
+ # Deserialize Response
1748
+ if status_code == 200
1749
+ begin
1750
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1751
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::SummarizeResults.mapper()
1752
+ result.body = @client.deserialize(result_mapper, parsed_response)
1753
+ rescue Exception => e
1754
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1755
+ end
1756
+ end
1757
+
1758
+ result
1759
+ end
1760
+
1761
+ promise.execute
1762
+ end
1763
+
1764
+ #
1765
+ # Queries policy states for the resource group level policy assignment.
1766
+ #
1767
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1768
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1769
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1770
+ # Possible values include: 'default', 'latest'
1771
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1772
+ # @param resource_group_name [String] Resource group name.
1773
+ # @param policy_assignment_name [String] Policy assignment name.
1774
+ # @param query_options [QueryOptions] Additional parameters for the operation
1775
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1776
+ # will be added to the HTTP request.
1777
+ #
1778
+ # @return [PolicyStatesQueryResults] operation results.
1779
+ #
1780
+ def list_query_results_for_resource_group_level_policy_assignment(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
1781
+ response = list_query_results_for_resource_group_level_policy_assignment_async(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
1782
+ response.body unless response.nil?
1783
+ end
1784
+
1785
+ #
1786
+ # Queries policy states for the resource group level policy assignment.
1787
+ #
1788
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1789
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1790
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1791
+ # Possible values include: 'default', 'latest'
1792
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1793
+ # @param resource_group_name [String] Resource group name.
1794
+ # @param policy_assignment_name [String] Policy assignment name.
1795
+ # @param query_options [QueryOptions] Additional parameters for the operation
1796
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1797
+ # will be added to the HTTP request.
1798
+ #
1799
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1800
+ #
1801
+ def list_query_results_for_resource_group_level_policy_assignment_with_http_info(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
1802
+ list_query_results_for_resource_group_level_policy_assignment_async(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
1803
+ end
1804
+
1805
+ #
1806
+ # Queries policy states for the resource group level policy assignment.
1807
+ #
1808
+ # @param policy_states_resource [PolicyStatesResource] The virtual resource
1809
+ # under PolicyStates resource type. In a given time range, 'latest' represents
1810
+ # the latest policy state(s), whereas 'default' represents all policy state(s).
1811
+ # Possible values include: 'default', 'latest'
1812
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1813
+ # @param resource_group_name [String] Resource group name.
1814
+ # @param policy_assignment_name [String] Policy assignment name.
1815
+ # @param query_options [QueryOptions] Additional parameters for the operation
1816
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1817
+ # to the HTTP request.
1818
+ #
1819
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1820
+ #
1821
+ def list_query_results_for_resource_group_level_policy_assignment_async(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
1822
+ fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil?
1823
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
1824
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1825
+ authorization_namespace = 'Microsoft.Authorization'
1826
+ fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
1827
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1828
+
1829
+ top = nil
1830
+ order_by = nil
1831
+ select = nil
1832
+ from = nil
1833
+ to = nil
1834
+ filter = nil
1835
+ apply = nil
1836
+ unless query_options.nil?
1837
+ top = query_options.Top
1838
+ end
1839
+ unless query_options.nil?
1840
+ order_by = query_options.OrderBy
1841
+ end
1842
+ unless query_options.nil?
1843
+ select = query_options.Select
1844
+ end
1845
+ unless query_options.nil?
1846
+ from = query_options.From
1847
+ end
1848
+ unless query_options.nil?
1849
+ to = query_options.To
1850
+ end
1851
+ unless query_options.nil?
1852
+ filter = query_options.Filter
1853
+ end
1854
+ unless query_options.nil?
1855
+ apply = query_options.Apply
1856
+ end
1857
+
1858
+ request_headers = {}
1859
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1860
+
1861
+ # Set Headers
1862
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1863
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1864
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'
1865
+
1866
+ request_url = @base_url || @client.base_url
1867
+
1868
+ options = {
1869
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1870
+ path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
1871
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
1872
+ headers: request_headers.merge(custom_headers || {}),
1873
+ base_url: request_url
1874
+ }
1875
+ promise = @client.make_request_async(:post, path_template, options)
1876
+
1877
+ promise = promise.then do |result|
1878
+ http_response = result.response
1879
+ status_code = http_response.status
1880
+ response_content = http_response.body
1881
+ unless status_code == 200
1882
+ error_model = JSON.load(response_content)
1883
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1884
+ end
1885
+
1886
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1887
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1888
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1889
+ # Deserialize Response
1890
+ if status_code == 200
1891
+ begin
1892
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1893
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyStatesQueryResults.mapper()
1894
+ result.body = @client.deserialize(result_mapper, parsed_response)
1895
+ rescue Exception => e
1896
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1897
+ end
1898
+ end
1899
+
1900
+ result
1901
+ end
1902
+
1903
+ promise.execute
1904
+ end
1905
+
1906
+ #
1907
+ # Summarizes policy states for the resource group level policy assignment.
1908
+ #
1909
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1910
+ # @param resource_group_name [String] Resource group name.
1911
+ # @param policy_assignment_name [String] Policy assignment name.
1912
+ # @param query_options [QueryOptions] Additional parameters for the operation
1913
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1914
+ # will be added to the HTTP request.
1915
+ #
1916
+ # @return [SummarizeResults] operation results.
1917
+ #
1918
+ def summarize_for_resource_group_level_policy_assignment(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
1919
+ response = summarize_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
1920
+ response.body unless response.nil?
1921
+ end
1922
+
1923
+ #
1924
+ # Summarizes policy states for the resource group level policy assignment.
1925
+ #
1926
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1927
+ # @param resource_group_name [String] Resource group name.
1928
+ # @param policy_assignment_name [String] Policy assignment name.
1929
+ # @param query_options [QueryOptions] Additional parameters for the operation
1930
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1931
+ # will be added to the HTTP request.
1932
+ #
1933
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1934
+ #
1935
+ def summarize_for_resource_group_level_policy_assignment_with_http_info(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
1936
+ summarize_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
1937
+ end
1938
+
1939
+ #
1940
+ # Summarizes policy states for the resource group level policy assignment.
1941
+ #
1942
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1943
+ # @param resource_group_name [String] Resource group name.
1944
+ # @param policy_assignment_name [String] Policy assignment name.
1945
+ # @param query_options [QueryOptions] Additional parameters for the operation
1946
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1947
+ # to the HTTP request.
1948
+ #
1949
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1950
+ #
1951
+ def summarize_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
1952
+ policy_states_summary_resource = 'latest'
1953
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
1954
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1955
+ authorization_namespace = 'Microsoft.Authorization'
1956
+ fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
1957
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1958
+
1959
+ top = nil
1960
+ from = nil
1961
+ to = nil
1962
+ filter = nil
1963
+ unless query_options.nil?
1964
+ top = query_options.Top
1965
+ end
1966
+ unless query_options.nil?
1967
+ from = query_options.From
1968
+ end
1969
+ unless query_options.nil?
1970
+ to = query_options.To
1971
+ end
1972
+ unless query_options.nil?
1973
+ filter = query_options.Filter
1974
+ end
1975
+
1976
+ request_headers = {}
1977
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1978
+
1979
+ # Set Headers
1980
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1981
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1982
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'
1983
+
1984
+ request_url = @base_url || @client.base_url
1985
+
1986
+ options = {
1987
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1988
+ path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
1989
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
1990
+ headers: request_headers.merge(custom_headers || {}),
1991
+ base_url: request_url
1992
+ }
1993
+ promise = @client.make_request_async(:post, path_template, options)
1994
+
1995
+ promise = promise.then do |result|
1996
+ http_response = result.response
1997
+ status_code = http_response.status
1998
+ response_content = http_response.body
1999
+ unless status_code == 200
2000
+ error_model = JSON.load(response_content)
2001
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2002
+ end
2003
+
2004
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2005
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2006
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2007
+ # Deserialize Response
2008
+ if status_code == 200
2009
+ begin
2010
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2011
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::SummarizeResults.mapper()
2012
+ result.body = @client.deserialize(result_mapper, parsed_response)
2013
+ rescue Exception => e
2014
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2015
+ end
2016
+ end
2017
+
2018
+ result
2019
+ end
2020
+
2021
+ promise.execute
2022
+ end
2023
+
2024
+ end
2025
+ end