azure_mgmt_policy_insights 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights.rb +46 -0
  4. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/column.rb +68 -0
  5. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
  6. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
  7. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +55 -0
  8. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +55 -0
  9. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table.rb +88 -0
  10. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_columns.rb +387 -0
  11. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_metadata.rb +47 -0
  12. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +55 -0
  13. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table.rb +88 -0
  14. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_columns.rb +362 -0
  15. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_metadata.rb +47 -0
  16. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
  17. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
  18. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
  19. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
  20. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  21. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/operations.rb +107 -0
  22. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_events.rb +507 -0
  23. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
  24. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_states.rb +555 -0
  25. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights.rb +41 -0
  26. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
  27. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
  28. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +70 -0
  29. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +384 -0
  30. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +82 -0
  31. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +361 -0
  32. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +82 -0
  33. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
  34. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
  35. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
  36. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
  37. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  38. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/operations.rb +107 -0
  39. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_events.rb +607 -0
  40. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
  41. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb +655 -0
  42. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights.rb +46 -0
  43. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
  44. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
  45. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +70 -0
  46. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +91 -0
  47. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +70 -0
  48. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +384 -0
  49. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +82 -0
  50. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +361 -0
  51. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +82 -0
  52. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
  53. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
  54. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
  55. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
  56. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summarize_results.rb +83 -0
  57. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summary.rb +92 -0
  58. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summary_results.rb +76 -0
  59. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  60. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/operations.rb +107 -0
  61. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_events.rb +1107 -0
  62. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
  63. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_states.rb +2089 -0
  64. data/lib/2018-04-04/generated/azure_mgmt_policy_insights.rb +46 -0
  65. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
  66. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
  67. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +70 -0
  68. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +91 -0
  69. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +81 -0
  70. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_event.rb +384 -0
  71. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +82 -0
  72. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_state.rb +361 -0
  73. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +82 -0
  74. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
  75. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
  76. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
  77. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
  78. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summarize_results.rb +83 -0
  79. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summary.rb +92 -0
  80. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summary_results.rb +76 -0
  81. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  82. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/operations.rb +107 -0
  83. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_events.rb +1107 -0
  84. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
  85. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb +2089 -0
  86. data/lib/azure_mgmt_policy_insights.rb +9 -0
  87. data/lib/module_definition.rb +7 -0
  88. data/lib/profiles/latest/modules/policyinsights_profile_module.rb +129 -0
  89. data/lib/profiles/latest/policyinsights_latest_profile_client.rb +40 -0
  90. data/lib/profiles/latest/policyinsights_module_definition.rb +8 -0
  91. data/lib/version.rb +7 -0
  92. metadata +210 -0
@@ -0,0 +1,16 @@
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::V2017_10_17_preview
7
+ module Models
8
+ #
9
+ # Defines values for PolicyStatesResource
10
+ #
11
+ module PolicyStatesResource
12
+ Default = "default"
13
+ Latest = "latest"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,47 @@
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::V2017_10_17_preview
7
+ module Models
8
+ #
9
+ # Error response.
10
+ #
11
+ class QueryFailure
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [QueryFailureError] Error definition.
16
+ attr_accessor :error
17
+
18
+
19
+ #
20
+ # Mapper for QueryFailure class as Ruby Hash.
21
+ # This will be used for serialization/deserialization.
22
+ #
23
+ def self.mapper()
24
+ {
25
+ client_side_validation: true,
26
+ required: false,
27
+ serialized_name: 'QueryFailure',
28
+ type: {
29
+ name: 'Composite',
30
+ class_name: 'QueryFailure',
31
+ model_properties: {
32
+ error: {
33
+ client_side_validation: true,
34
+ required: false,
35
+ serialized_name: 'error',
36
+ type: {
37
+ name: 'Composite',
38
+ class_name: 'QueryFailureError'
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,58 @@
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::V2017_10_17_preview
7
+ module Models
8
+ #
9
+ # Error definition.
10
+ #
11
+ class QueryFailureError
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Service specific error code which serves as the
16
+ # substatus for the HTTP error code.
17
+ attr_accessor :code
18
+
19
+ # @return [String] Description of the error.
20
+ attr_accessor :message
21
+
22
+
23
+ #
24
+ # Mapper for QueryFailureError class as Ruby Hash.
25
+ # This will be used for serialization/deserialization.
26
+ #
27
+ def self.mapper()
28
+ {
29
+ client_side_validation: true,
30
+ required: false,
31
+ serialized_name: 'QueryFailure_error',
32
+ type: {
33
+ name: 'Composite',
34
+ class_name: 'QueryFailureError',
35
+ model_properties: {
36
+ code: {
37
+ client_side_validation: true,
38
+ required: false,
39
+ serialized_name: 'code',
40
+ type: {
41
+ name: 'String'
42
+ }
43
+ },
44
+ message: {
45
+ client_side_validation: true,
46
+ required: false,
47
+ serialized_name: 'message',
48
+ type: {
49
+ name: 'String'
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,112 @@
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::V2017_10_17_preview
7
+ module Models
8
+ #
9
+ # Additional parameters for a set of operations.
10
+ #
11
+ class QueryOptions
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Integer] Maximum number of records to return.
16
+ attr_accessor :top
17
+
18
+ # @return [String] Ordering expression using OData notation. One or more
19
+ # comma-separated column names with an optional "desc" (the default) or
20
+ # "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc".
21
+ attr_accessor :order_by
22
+
23
+ # @return [String] Select expression using OData notation. Limits the
24
+ # columns on each record to just those requested, e.g.
25
+ # "$select=PolicyAssignmentId, ResourceId".
26
+ attr_accessor :select
27
+
28
+ # @return [DateTime] ISO 8601 formatted timestamp specifying the start
29
+ # time of the interval to query. When not specified, the service uses
30
+ # ($to - 1-day).
31
+ attr_accessor :from
32
+
33
+ # @return [DateTime] ISO 8601 formatted timestamp specifying the end time
34
+ # of the interval to query. When not specified, the service uses request
35
+ # time.
36
+ attr_accessor :to
37
+
38
+ # @return [String] OData filter expression.
39
+ attr_accessor :filter
40
+
41
+ # @return [String] OData apply expression for aggregations.
42
+ attr_accessor :apply
43
+
44
+
45
+ #
46
+ # Mapper for QueryOptions class as Ruby Hash.
47
+ # This will be used for serialization/deserialization.
48
+ #
49
+ def self.mapper()
50
+ {
51
+ client_side_validation: true,
52
+ required: false,
53
+ type: {
54
+ name: 'Composite',
55
+ class_name: 'QueryOptions',
56
+ model_properties: {
57
+ top: {
58
+ client_side_validation: true,
59
+ required: false,
60
+ type: {
61
+ name: 'Number'
62
+ }
63
+ },
64
+ order_by: {
65
+ client_side_validation: true,
66
+ required: false,
67
+ type: {
68
+ name: 'String'
69
+ }
70
+ },
71
+ select: {
72
+ client_side_validation: true,
73
+ required: false,
74
+ type: {
75
+ name: 'String'
76
+ }
77
+ },
78
+ from: {
79
+ client_side_validation: true,
80
+ required: false,
81
+ type: {
82
+ name: 'DateTime'
83
+ }
84
+ },
85
+ to: {
86
+ client_side_validation: true,
87
+ required: false,
88
+ type: {
89
+ name: 'DateTime'
90
+ }
91
+ },
92
+ filter: {
93
+ client_side_validation: true,
94
+ required: false,
95
+ type: {
96
+ name: 'String'
97
+ }
98
+ },
99
+ apply: {
100
+ client_side_validation: true,
101
+ required: false,
102
+ type: {
103
+ name: 'String'
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::PolicyInsights end
8
+ module Azure::PolicyInsights::Mgmt end
9
+ module Azure::PolicyInsights::Mgmt::V2017_10_17_preview end
@@ -0,0 +1,107 @@
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::V2017_10_17_preview
7
+ #
8
+ # Operations
9
+ #
10
+ class Operations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Operations 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
+ # Lists available operations.
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [OperationsListResults] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ response = list_async(custom_headers:custom_headers).value!
34
+ response.body unless response.nil?
35
+ end
36
+
37
+ #
38
+ # Lists available operations.
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_with_http_info(custom_headers:nil)
46
+ list_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # Lists available operations.
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_async(custom_headers:nil)
58
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
59
+
60
+
61
+ request_headers = {}
62
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
63
+
64
+ # Set Headers
65
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
67
+ path_template = 'providers/Microsoft.PolicyInsights/operations'
68
+
69
+ request_url = @base_url || @client.base_url
70
+
71
+ options = {
72
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
73
+ query_params: {'api-version' => @client.api_version},
74
+ headers: request_headers.merge(custom_headers || {}),
75
+ base_url: request_url
76
+ }
77
+ promise = @client.make_request_async(:get, path_template, options)
78
+
79
+ promise = promise.then do |result|
80
+ http_response = result.response
81
+ status_code = http_response.status
82
+ response_content = http_response.body
83
+ unless status_code == 200
84
+ error_model = JSON.load(response_content)
85
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
86
+ end
87
+
88
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
89
+ # Deserialize Response
90
+ if status_code == 200
91
+ begin
92
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
93
+ result_mapper = Azure::PolicyInsights::Mgmt::V2017_10_17_preview::Models::OperationsListResults.mapper()
94
+ result.body = @client.deserialize(result_mapper, parsed_response)
95
+ rescue Exception => e
96
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
97
+ end
98
+ end
99
+
100
+ result
101
+ end
102
+
103
+ promise.execute
104
+ end
105
+
106
+ end
107
+ end
@@ -0,0 +1,607 @@
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::V2017_10_17_preview
7
+ #
8
+ # PolicyEvents
9
+ #
10
+ class PolicyEvents
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PolicyEvents 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 events for the resources under the management group.
26
+ #
27
+ # @param management_group_name [String] Management group name.
28
+ # @param query_options [QueryOptions] Additional parameters for the operation
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [PolicyEventsQueryResults] operation results.
33
+ #
34
+ def list_query_results_for_management_group(management_group_name, query_options:nil, custom_headers:nil)
35
+ response = list_query_results_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
36
+ response.body unless response.nil?
37
+ end
38
+
39
+ #
40
+ # Queries policy events for the resources under the management group.
41
+ #
42
+ # @param management_group_name [String] Management group name.
43
+ # @param query_options [QueryOptions] Additional parameters for the operation
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_query_results_for_management_group_with_http_info(management_group_name, query_options:nil, custom_headers:nil)
50
+ list_query_results_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Queries policy events for the resources under the management group.
55
+ #
56
+ # @param management_group_name [String] Management group name.
57
+ # @param query_options [QueryOptions] Additional parameters for the operation
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def list_query_results_for_management_group_async(management_group_name, query_options:nil, custom_headers:nil)
64
+ policy_events_resource = 'default'
65
+ management_groups_namespace = 'Microsoft.Management'
66
+ fail ArgumentError, 'management_group_name is nil' if management_group_name.nil?
67
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
+
69
+ top = nil
70
+ order_by = nil
71
+ select = nil
72
+ from = nil
73
+ to = nil
74
+ filter = nil
75
+ apply = nil
76
+ unless query_options.nil?
77
+ top = query_options.Top
78
+ end
79
+ unless query_options.nil?
80
+ order_by = query_options.OrderBy
81
+ end
82
+ unless query_options.nil?
83
+ select = query_options.Select
84
+ end
85
+ unless query_options.nil?
86
+ from = query_options.From
87
+ end
88
+ unless query_options.nil?
89
+ to = query_options.To
90
+ end
91
+ unless query_options.nil?
92
+ filter = query_options.Filter
93
+ end
94
+ unless query_options.nil?
95
+ apply = query_options.Apply
96
+ end
97
+
98
+ request_headers = {}
99
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
100
+
101
+ # Set Headers
102
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
103
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
104
+ path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
105
+
106
+ request_url = @base_url || @client.base_url
107
+
108
+ options = {
109
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
110
+ path_params: {'policyEventsResource' => policy_events_resource,'managementGroupsNamespace' => management_groups_namespace,'managementGroupName' => management_group_name},
111
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
112
+ headers: request_headers.merge(custom_headers || {}),
113
+ base_url: request_url
114
+ }
115
+ promise = @client.make_request_async(:post, path_template, options)
116
+
117
+ promise = promise.then do |result|
118
+ http_response = result.response
119
+ status_code = http_response.status
120
+ response_content = http_response.body
121
+ unless status_code == 200
122
+ error_model = JSON.load(response_content)
123
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
124
+ end
125
+
126
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
127
+ # Deserialize Response
128
+ if status_code == 200
129
+ begin
130
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
131
+ result_mapper = Azure::PolicyInsights::Mgmt::V2017_10_17_preview::Models::PolicyEventsQueryResults.mapper()
132
+ result.body = @client.deserialize(result_mapper, parsed_response)
133
+ rescue Exception => e
134
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
135
+ end
136
+ end
137
+
138
+ result
139
+ end
140
+
141
+ promise.execute
142
+ end
143
+
144
+ #
145
+ # Queries policy events for the resources under the subscription.
146
+ #
147
+ # @param subscription_id [String] Microsoft Azure subscription ID.
148
+ # @param query_options [QueryOptions] Additional parameters for the operation
149
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
150
+ # will be added to the HTTP request.
151
+ #
152
+ # @return [PolicyEventsQueryResults] operation results.
153
+ #
154
+ def list_query_results_for_subscription(subscription_id, query_options:nil, custom_headers:nil)
155
+ response = list_query_results_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
156
+ response.body unless response.nil?
157
+ end
158
+
159
+ #
160
+ # Queries policy events for the resources under the subscription.
161
+ #
162
+ # @param subscription_id [String] Microsoft Azure subscription ID.
163
+ # @param query_options [QueryOptions] Additional parameters for the operation
164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
165
+ # will be added to the HTTP request.
166
+ #
167
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
168
+ #
169
+ def list_query_results_for_subscription_with_http_info(subscription_id, query_options:nil, custom_headers:nil)
170
+ list_query_results_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
171
+ end
172
+
173
+ #
174
+ # Queries policy events for the resources under the subscription.
175
+ #
176
+ # @param subscription_id [String] Microsoft Azure subscription ID.
177
+ # @param query_options [QueryOptions] Additional parameters for the operation
178
+ # @param [Hash{String => String}] A hash of custom headers that will be added
179
+ # to the HTTP request.
180
+ #
181
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
182
+ #
183
+ def list_query_results_for_subscription_async(subscription_id, query_options:nil, custom_headers:nil)
184
+ policy_events_resource = 'default'
185
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
186
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
187
+
188
+ top = nil
189
+ order_by = nil
190
+ select = nil
191
+ from = nil
192
+ to = nil
193
+ filter = nil
194
+ apply = nil
195
+ unless query_options.nil?
196
+ top = query_options.Top
197
+ end
198
+ unless query_options.nil?
199
+ order_by = query_options.OrderBy
200
+ end
201
+ unless query_options.nil?
202
+ select = query_options.Select
203
+ end
204
+ unless query_options.nil?
205
+ from = query_options.From
206
+ end
207
+ unless query_options.nil?
208
+ to = query_options.To
209
+ end
210
+ unless query_options.nil?
211
+ filter = query_options.Filter
212
+ end
213
+ unless query_options.nil?
214
+ apply = query_options.Apply
215
+ end
216
+
217
+ request_headers = {}
218
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
219
+
220
+ # Set Headers
221
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
222
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
223
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
224
+
225
+ request_url = @base_url || @client.base_url
226
+
227
+ options = {
228
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
229
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id},
230
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
231
+ headers: request_headers.merge(custom_headers || {}),
232
+ base_url: request_url
233
+ }
234
+ promise = @client.make_request_async(:post, path_template, options)
235
+
236
+ promise = promise.then do |result|
237
+ http_response = result.response
238
+ status_code = http_response.status
239
+ response_content = http_response.body
240
+ unless status_code == 200
241
+ error_model = JSON.load(response_content)
242
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
243
+ end
244
+
245
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
246
+ # Deserialize Response
247
+ if status_code == 200
248
+ begin
249
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
250
+ result_mapper = Azure::PolicyInsights::Mgmt::V2017_10_17_preview::Models::PolicyEventsQueryResults.mapper()
251
+ result.body = @client.deserialize(result_mapper, parsed_response)
252
+ rescue Exception => e
253
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
254
+ end
255
+ end
256
+
257
+ result
258
+ end
259
+
260
+ promise.execute
261
+ end
262
+
263
+ #
264
+ # Queries policy events for the resources under the resource group.
265
+ #
266
+ # @param subscription_id [String] Microsoft Azure subscription ID.
267
+ # @param resource_group_name [String] Resource group name.
268
+ # @param query_options [QueryOptions] Additional parameters for the operation
269
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
270
+ # will be added to the HTTP request.
271
+ #
272
+ # @return [PolicyEventsQueryResults] operation results.
273
+ #
274
+ def list_query_results_for_resource_group(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
275
+ response = list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
276
+ response.body unless response.nil?
277
+ end
278
+
279
+ #
280
+ # Queries policy events for the resources under the resource group.
281
+ #
282
+ # @param subscription_id [String] Microsoft Azure subscription ID.
283
+ # @param resource_group_name [String] Resource group name.
284
+ # @param query_options [QueryOptions] Additional parameters for the operation
285
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
286
+ # will be added to the HTTP request.
287
+ #
288
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
289
+ #
290
+ def list_query_results_for_resource_group_with_http_info(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
291
+ list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
292
+ end
293
+
294
+ #
295
+ # Queries policy events for the resources under the resource group.
296
+ #
297
+ # @param subscription_id [String] Microsoft Azure subscription ID.
298
+ # @param resource_group_name [String] Resource group name.
299
+ # @param query_options [QueryOptions] Additional parameters for the operation
300
+ # @param [Hash{String => String}] A hash of custom headers that will be added
301
+ # to the HTTP request.
302
+ #
303
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
304
+ #
305
+ def list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
306
+ policy_events_resource = 'default'
307
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
308
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
309
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
310
+
311
+ top = nil
312
+ order_by = nil
313
+ select = nil
314
+ from = nil
315
+ to = nil
316
+ filter = nil
317
+ apply = nil
318
+ unless query_options.nil?
319
+ top = query_options.Top
320
+ end
321
+ unless query_options.nil?
322
+ order_by = query_options.OrderBy
323
+ end
324
+ unless query_options.nil?
325
+ select = query_options.Select
326
+ end
327
+ unless query_options.nil?
328
+ from = query_options.From
329
+ end
330
+ unless query_options.nil?
331
+ to = query_options.To
332
+ end
333
+ unless query_options.nil?
334
+ filter = query_options.Filter
335
+ end
336
+ unless query_options.nil?
337
+ apply = query_options.Apply
338
+ end
339
+
340
+ request_headers = {}
341
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
342
+
343
+ # Set Headers
344
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
345
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
346
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
347
+
348
+ request_url = @base_url || @client.base_url
349
+
350
+ options = {
351
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
352
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name},
353
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
354
+ headers: request_headers.merge(custom_headers || {}),
355
+ base_url: request_url
356
+ }
357
+ promise = @client.make_request_async(:post, path_template, options)
358
+
359
+ promise = promise.then do |result|
360
+ http_response = result.response
361
+ status_code = http_response.status
362
+ response_content = http_response.body
363
+ unless status_code == 200
364
+ error_model = JSON.load(response_content)
365
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
366
+ end
367
+
368
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
369
+ # Deserialize Response
370
+ if status_code == 200
371
+ begin
372
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
373
+ result_mapper = Azure::PolicyInsights::Mgmt::V2017_10_17_preview::Models::PolicyEventsQueryResults.mapper()
374
+ result.body = @client.deserialize(result_mapper, parsed_response)
375
+ rescue Exception => e
376
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
377
+ end
378
+ end
379
+
380
+ result
381
+ end
382
+
383
+ promise.execute
384
+ end
385
+
386
+ #
387
+ # Queries policy events for the resource.
388
+ #
389
+ # @param resource_id [String] Resource ID.
390
+ # @param query_options [QueryOptions] Additional parameters for the operation
391
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
392
+ # will be added to the HTTP request.
393
+ #
394
+ # @return [PolicyEventsQueryResults] operation results.
395
+ #
396
+ def list_query_results_for_resource(resource_id, query_options:nil, custom_headers:nil)
397
+ response = list_query_results_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
398
+ response.body unless response.nil?
399
+ end
400
+
401
+ #
402
+ # Queries policy events for the resource.
403
+ #
404
+ # @param resource_id [String] Resource 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 [MsRestAzure::AzureOperationResponse] HTTP response information.
410
+ #
411
+ def list_query_results_for_resource_with_http_info(resource_id, query_options:nil, custom_headers:nil)
412
+ list_query_results_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
413
+ end
414
+
415
+ #
416
+ # Queries policy events for the resource.
417
+ #
418
+ # @param resource_id [String] Resource ID.
419
+ # @param query_options [QueryOptions] Additional parameters for the operation
420
+ # @param [Hash{String => String}] A hash of custom headers that will be added
421
+ # to the HTTP request.
422
+ #
423
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
424
+ #
425
+ def list_query_results_for_resource_async(resource_id, query_options:nil, custom_headers:nil)
426
+ policy_events_resource = 'default'
427
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
428
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
429
+
430
+ top = nil
431
+ order_by = nil
432
+ select = nil
433
+ from = nil
434
+ to = nil
435
+ filter = nil
436
+ apply = nil
437
+ unless query_options.nil?
438
+ top = query_options.Top
439
+ end
440
+ unless query_options.nil?
441
+ order_by = query_options.OrderBy
442
+ end
443
+ unless query_options.nil?
444
+ select = query_options.Select
445
+ end
446
+ unless query_options.nil?
447
+ from = query_options.From
448
+ end
449
+ unless query_options.nil?
450
+ to = query_options.To
451
+ end
452
+ unless query_options.nil?
453
+ filter = query_options.Filter
454
+ end
455
+ unless query_options.nil?
456
+ apply = query_options.Apply
457
+ end
458
+
459
+ request_headers = {}
460
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
461
+
462
+ # Set Headers
463
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
464
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
465
+ path_template = '{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
466
+
467
+ request_url = @base_url || @client.base_url
468
+
469
+ options = {
470
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
471
+ path_params: {'policyEventsResource' => policy_events_resource},
472
+ skip_encoding_path_params: {'resourceId' => resource_id},
473
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
474
+ headers: request_headers.merge(custom_headers || {}),
475
+ base_url: request_url
476
+ }
477
+ promise = @client.make_request_async(:post, path_template, options)
478
+
479
+ promise = promise.then do |result|
480
+ http_response = result.response
481
+ status_code = http_response.status
482
+ response_content = http_response.body
483
+ unless status_code == 200
484
+ error_model = JSON.load(response_content)
485
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
486
+ end
487
+
488
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
489
+ # Deserialize Response
490
+ if status_code == 200
491
+ begin
492
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
493
+ result_mapper = Azure::PolicyInsights::Mgmt::V2017_10_17_preview::Models::PolicyEventsQueryResults.mapper()
494
+ result.body = @client.deserialize(result_mapper, parsed_response)
495
+ rescue Exception => e
496
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
497
+ end
498
+ end
499
+
500
+ result
501
+ end
502
+
503
+ promise.execute
504
+ end
505
+
506
+ #
507
+ # Gets OData metadata XML document.
508
+ #
509
+ # @param scope [String] A valid scope, i.e. management group, subscription,
510
+ # resource group, or resource ID. Scope used has no effect on metadata
511
+ # returned.
512
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
513
+ # will be added to the HTTP request.
514
+ #
515
+ # @return [String] operation results.
516
+ #
517
+ def get_metadata(scope, custom_headers:nil)
518
+ response = get_metadata_async(scope, custom_headers:custom_headers).value!
519
+ response.body unless response.nil?
520
+ end
521
+
522
+ #
523
+ # Gets OData metadata XML document.
524
+ #
525
+ # @param scope [String] A valid scope, i.e. management group, subscription,
526
+ # resource group, or resource ID. Scope used has no effect on metadata
527
+ # returned.
528
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
529
+ # will be added to the HTTP request.
530
+ #
531
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
532
+ #
533
+ def get_metadata_with_http_info(scope, custom_headers:nil)
534
+ get_metadata_async(scope, custom_headers:custom_headers).value!
535
+ end
536
+
537
+ #
538
+ # Gets OData metadata XML document.
539
+ #
540
+ # @param scope [String] A valid scope, i.e. management group, subscription,
541
+ # resource group, or resource ID. Scope used has no effect on metadata
542
+ # returned.
543
+ # @param [Hash{String => String}] A hash of custom headers that will be added
544
+ # to the HTTP request.
545
+ #
546
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
547
+ #
548
+ def get_metadata_async(scope, custom_headers:nil)
549
+ fail ArgumentError, 'scope is nil' if scope.nil?
550
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
551
+
552
+
553
+ request_headers = {}
554
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
555
+
556
+ # Set Headers
557
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
558
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
559
+ path_template = '{scope}/providers/Microsoft.PolicyInsights/policyEvents/$metadata'
560
+
561
+ request_url = @base_url || @client.base_url
562
+
563
+ options = {
564
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
565
+ skip_encoding_path_params: {'scope' => scope},
566
+ query_params: {'api-version' => @client.api_version},
567
+ headers: request_headers.merge(custom_headers || {}),
568
+ base_url: request_url
569
+ }
570
+ promise = @client.make_request_async(:get, path_template, options)
571
+
572
+ promise = promise.then do |result|
573
+ http_response = result.response
574
+ status_code = http_response.status
575
+ response_content = http_response.body
576
+ unless status_code == 200
577
+ error_model = JSON.load(response_content)
578
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
579
+ end
580
+
581
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
582
+ # Deserialize Response
583
+ if status_code == 200
584
+ begin
585
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
586
+ result_mapper = {
587
+ client_side_validation: true,
588
+ required: false,
589
+ serialized_name: 'parsed_response',
590
+ type: {
591
+ name: 'String'
592
+ }
593
+ }
594
+ result.body = @client.deserialize(result_mapper, parsed_response)
595
+ rescue Exception => e
596
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
597
+ end
598
+ end
599
+
600
+ result
601
+ end
602
+
603
+ promise.execute
604
+ end
605
+
606
+ end
607
+ end