azure_mgmt_policy_insights 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights.rb +46 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/column.rb +68 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +55 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +55 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table.rb +88 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_columns.rb +387 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_metadata.rb +47 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +55 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table.rb +88 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_columns.rb +362 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_metadata.rb +47 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/operations.rb +107 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_events.rb +507 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_states.rb +555 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights.rb +41 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +70 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +384 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +82 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +361 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +82 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/operations.rb +107 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_events.rb +607 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb +655 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights.rb +46 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +70 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +91 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +70 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +384 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +82 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +361 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +82 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summarize_results.rb +83 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summary.rb +92 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summary_results.rb +76 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/operations.rb +107 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_events.rb +1107 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_states.rb +2089 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights.rb +46 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +70 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +91 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +81 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_event.rb +384 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +82 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_state.rb +361 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +82 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summarize_results.rb +83 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summary.rb +92 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summary_results.rb +76 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/operations.rb +107 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_events.rb +1107 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb +2089 -0
- data/lib/azure_mgmt_policy_insights.rb +9 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/modules/policyinsights_profile_module.rb +129 -0
- data/lib/profiles/latest/policyinsights_latest_profile_client.rb +40 -0
- data/lib/profiles/latest/policyinsights_module_definition.rb +8 -0
- data/lib/version.rb +7 -0
- metadata +210 -0
@@ -0,0 +1,135 @@
|
|
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_08_09_preview
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class PolicyInsightsClient < MsRestAzure::AzureServiceClient
|
11
|
+
include MsRestAzure
|
12
|
+
include MsRestAzure::Serialization
|
13
|
+
|
14
|
+
# @return [String] the base URI of the service.
|
15
|
+
attr_accessor :base_url
|
16
|
+
|
17
|
+
# @return Credentials needed for the client to connect to Azure.
|
18
|
+
attr_reader :credentials
|
19
|
+
|
20
|
+
# @return [String] API version to use with the client requests.
|
21
|
+
attr_reader :api_version
|
22
|
+
|
23
|
+
# @return [String] Gets or sets the preferred language for the response.
|
24
|
+
attr_accessor :accept_language
|
25
|
+
|
26
|
+
# @return [Integer] Gets or sets the retry timeout in seconds for Long
|
27
|
+
# Running Operations. Default value is 30.
|
28
|
+
attr_accessor :long_running_operation_retry_timeout
|
29
|
+
|
30
|
+
# @return [Boolean] When set to true a unique x-ms-client-request-id value
|
31
|
+
# is generated and included in each request. Default is true.
|
32
|
+
attr_accessor :generate_client_request_id
|
33
|
+
|
34
|
+
# @return [PolicyEvents] policy_events
|
35
|
+
attr_reader :policy_events
|
36
|
+
|
37
|
+
# @return [PolicyStates] policy_states
|
38
|
+
attr_reader :policy_states
|
39
|
+
|
40
|
+
# @return [Operations] operations
|
41
|
+
attr_reader :operations
|
42
|
+
|
43
|
+
#
|
44
|
+
# Creates initializes a new instance of the PolicyInsightsClient class.
|
45
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
46
|
+
# @param base_url [String] the base URI of the service.
|
47
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
48
|
+
#
|
49
|
+
def initialize(credentials = nil, base_url = nil, options = nil)
|
50
|
+
super(credentials, options)
|
51
|
+
@base_url = base_url || 'https://management.azure.com'
|
52
|
+
|
53
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
54
|
+
@credentials = credentials
|
55
|
+
|
56
|
+
@policy_events = PolicyEvents.new(self)
|
57
|
+
@policy_states = PolicyStates.new(self)
|
58
|
+
@operations = Operations.new(self)
|
59
|
+
@api_version = '2017-08-09-preview'
|
60
|
+
@accept_language = 'en-US'
|
61
|
+
@long_running_operation_retry_timeout = 30
|
62
|
+
@generate_client_request_id = true
|
63
|
+
add_telemetry
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Makes a request and returns the body of the response.
|
68
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
69
|
+
# @param path [String] the path, relative to {base_url}.
|
70
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
71
|
+
# @return [Hash{String=>String}] containing the body of the response.
|
72
|
+
# Example:
|
73
|
+
#
|
74
|
+
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
75
|
+
# path = "/path"
|
76
|
+
# options = {
|
77
|
+
# body: request_content,
|
78
|
+
# query_params: {'api-version' => '2016-02-01'}
|
79
|
+
# }
|
80
|
+
# result = @client.make_request(:put, path, options)
|
81
|
+
#
|
82
|
+
def make_request(method, path, options = {})
|
83
|
+
result = make_request_with_http_info(method, path, options)
|
84
|
+
result.body unless result.nil?
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
# Makes a request and returns the operation response.
|
89
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
90
|
+
# @param path [String] the path, relative to {base_url}.
|
91
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
92
|
+
# @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
|
93
|
+
#
|
94
|
+
def make_request_with_http_info(method, path, options = {})
|
95
|
+
result = make_request_async(method, path, options).value!
|
96
|
+
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
97
|
+
result
|
98
|
+
end
|
99
|
+
|
100
|
+
#
|
101
|
+
# Makes a request asynchronously.
|
102
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
103
|
+
# @param path [String] the path, relative to {base_url}.
|
104
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
105
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
106
|
+
#
|
107
|
+
def make_request_async(method, path, options = {})
|
108
|
+
fail ArgumentError, 'method is nil' if method.nil?
|
109
|
+
fail ArgumentError, 'path is nil' if path.nil?
|
110
|
+
|
111
|
+
request_url = options[:base_url] || @base_url
|
112
|
+
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
113
|
+
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
114
|
+
end
|
115
|
+
|
116
|
+
request_headers = @request_headers
|
117
|
+
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
118
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
119
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
120
|
+
|
121
|
+
super(request_url, method, path, options)
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
private
|
126
|
+
#
|
127
|
+
# Adds telemetry information.
|
128
|
+
#
|
129
|
+
def add_telemetry
|
130
|
+
sdk_information = 'azure_mgmt_policy_insights'
|
131
|
+
sdk_information = "#{sdk_information}/0.16.0"
|
132
|
+
add_user_agent_information(sdk_information)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,555 @@
|
|
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_08_09_preview
|
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
|
+
# Deserialize Response
|
140
|
+
if status_code == 200
|
141
|
+
begin
|
142
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
143
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2017_08_09_preview::Models::PolicyStatesQueryResults.mapper()
|
144
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
145
|
+
rescue Exception => e
|
146
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
result
|
151
|
+
end
|
152
|
+
|
153
|
+
promise.execute
|
154
|
+
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# Queries policy states for the resources under the subscription.
|
158
|
+
#
|
159
|
+
# @param policy_states_resource [PolicyStatesResource] The virtual resource
|
160
|
+
# under PolicyStates resource type. In a given time range, 'latest' represents
|
161
|
+
# the latest policy state(s), whereas 'default' represents all policy state(s).
|
162
|
+
# Possible values include: 'default', 'latest'
|
163
|
+
# @param subscription_id [String] Microsoft Azure subscription ID.
|
164
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
165
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
166
|
+
# will be added to the HTTP request.
|
167
|
+
#
|
168
|
+
# @return [PolicyStatesQueryResults] operation results.
|
169
|
+
#
|
170
|
+
def list_query_results_for_subscription(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil)
|
171
|
+
response = list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:query_options, custom_headers:custom_headers).value!
|
172
|
+
response.body unless response.nil?
|
173
|
+
end
|
174
|
+
|
175
|
+
#
|
176
|
+
# Queries policy states for the resources under the subscription.
|
177
|
+
#
|
178
|
+
# @param policy_states_resource [PolicyStatesResource] The virtual resource
|
179
|
+
# under PolicyStates resource type. In a given time range, 'latest' represents
|
180
|
+
# the latest policy state(s), whereas 'default' represents all policy state(s).
|
181
|
+
# Possible values include: 'default', 'latest'
|
182
|
+
# @param subscription_id [String] Microsoft Azure subscription ID.
|
183
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
184
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
185
|
+
# will be added to the HTTP request.
|
186
|
+
#
|
187
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
188
|
+
#
|
189
|
+
def list_query_results_for_subscription_with_http_info(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil)
|
190
|
+
list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:query_options, custom_headers:custom_headers).value!
|
191
|
+
end
|
192
|
+
|
193
|
+
#
|
194
|
+
# Queries policy states for the resources under the subscription.
|
195
|
+
#
|
196
|
+
# @param policy_states_resource [PolicyStatesResource] The virtual resource
|
197
|
+
# under PolicyStates resource type. In a given time range, 'latest' represents
|
198
|
+
# the latest policy state(s), whereas 'default' represents all policy state(s).
|
199
|
+
# Possible values include: 'default', 'latest'
|
200
|
+
# @param subscription_id [String] Microsoft Azure subscription ID.
|
201
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
202
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
203
|
+
# to the HTTP request.
|
204
|
+
#
|
205
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
206
|
+
#
|
207
|
+
def list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil)
|
208
|
+
fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil?
|
209
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
210
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
211
|
+
|
212
|
+
top = nil
|
213
|
+
order_by = nil
|
214
|
+
select = nil
|
215
|
+
from = nil
|
216
|
+
to = nil
|
217
|
+
filter = nil
|
218
|
+
apply = nil
|
219
|
+
unless query_options.nil?
|
220
|
+
top = query_options.Top
|
221
|
+
end
|
222
|
+
unless query_options.nil?
|
223
|
+
order_by = query_options.OrderBy
|
224
|
+
end
|
225
|
+
unless query_options.nil?
|
226
|
+
select = query_options.Select
|
227
|
+
end
|
228
|
+
unless query_options.nil?
|
229
|
+
from = query_options.From
|
230
|
+
end
|
231
|
+
unless query_options.nil?
|
232
|
+
to = query_options.To
|
233
|
+
end
|
234
|
+
unless query_options.nil?
|
235
|
+
filter = query_options.Filter
|
236
|
+
end
|
237
|
+
unless query_options.nil?
|
238
|
+
apply = query_options.Apply
|
239
|
+
end
|
240
|
+
|
241
|
+
request_headers = {}
|
242
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
243
|
+
|
244
|
+
# Set Headers
|
245
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
246
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
247
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'
|
248
|
+
|
249
|
+
request_url = @base_url || @client.base_url
|
250
|
+
|
251
|
+
options = {
|
252
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
253
|
+
path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id},
|
254
|
+
query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
|
255
|
+
headers: request_headers.merge(custom_headers || {}),
|
256
|
+
base_url: request_url
|
257
|
+
}
|
258
|
+
promise = @client.make_request_async(:post, path_template, options)
|
259
|
+
|
260
|
+
promise = promise.then do |result|
|
261
|
+
http_response = result.response
|
262
|
+
status_code = http_response.status
|
263
|
+
response_content = http_response.body
|
264
|
+
unless status_code == 200
|
265
|
+
error_model = JSON.load(response_content)
|
266
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
267
|
+
end
|
268
|
+
|
269
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
270
|
+
# Deserialize Response
|
271
|
+
if status_code == 200
|
272
|
+
begin
|
273
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
274
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2017_08_09_preview::Models::PolicyStatesQueryResults.mapper()
|
275
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
276
|
+
rescue Exception => e
|
277
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
result
|
282
|
+
end
|
283
|
+
|
284
|
+
promise.execute
|
285
|
+
end
|
286
|
+
|
287
|
+
#
|
288
|
+
# Queries policy states for the resources under the resource group.
|
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 resource_group_name [String] Resource group name.
|
296
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
297
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
298
|
+
# will be added to the HTTP request.
|
299
|
+
#
|
300
|
+
# @return [PolicyStatesQueryResults] operation results.
|
301
|
+
#
|
302
|
+
def list_query_results_for_resource_group(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
|
303
|
+
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!
|
304
|
+
response.body unless response.nil?
|
305
|
+
end
|
306
|
+
|
307
|
+
#
|
308
|
+
# Queries policy states for the resources under the resource group.
|
309
|
+
#
|
310
|
+
# @param policy_states_resource [PolicyStatesResource] The virtual resource
|
311
|
+
# under PolicyStates resource type. In a given time range, 'latest' represents
|
312
|
+
# the latest policy state(s), whereas 'default' represents all policy state(s).
|
313
|
+
# Possible values include: 'default', 'latest'
|
314
|
+
# @param subscription_id [String] Microsoft Azure subscription ID.
|
315
|
+
# @param resource_group_name [String] Resource group name.
|
316
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
317
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
318
|
+
# will be added to the HTTP request.
|
319
|
+
#
|
320
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
321
|
+
#
|
322
|
+
def list_query_results_for_resource_group_with_http_info(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
|
323
|
+
list_query_results_for_resource_group_async(policy_states_resource, subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
|
324
|
+
end
|
325
|
+
|
326
|
+
#
|
327
|
+
# Queries policy states for the resources under the resource group.
|
328
|
+
#
|
329
|
+
# @param policy_states_resource [PolicyStatesResource] The virtual resource
|
330
|
+
# under PolicyStates resource type. In a given time range, 'latest' represents
|
331
|
+
# the latest policy state(s), whereas 'default' represents all policy state(s).
|
332
|
+
# Possible values include: 'default', 'latest'
|
333
|
+
# @param subscription_id [String] Microsoft Azure subscription ID.
|
334
|
+
# @param resource_group_name [String] Resource group name.
|
335
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
336
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
337
|
+
# to the HTTP request.
|
338
|
+
#
|
339
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
340
|
+
#
|
341
|
+
def list_query_results_for_resource_group_async(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
|
342
|
+
fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil?
|
343
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
344
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
345
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
346
|
+
|
347
|
+
top = nil
|
348
|
+
order_by = nil
|
349
|
+
select = nil
|
350
|
+
from = nil
|
351
|
+
to = nil
|
352
|
+
filter = nil
|
353
|
+
apply = nil
|
354
|
+
unless query_options.nil?
|
355
|
+
top = query_options.Top
|
356
|
+
end
|
357
|
+
unless query_options.nil?
|
358
|
+
order_by = query_options.OrderBy
|
359
|
+
end
|
360
|
+
unless query_options.nil?
|
361
|
+
select = query_options.Select
|
362
|
+
end
|
363
|
+
unless query_options.nil?
|
364
|
+
from = query_options.From
|
365
|
+
end
|
366
|
+
unless query_options.nil?
|
367
|
+
to = query_options.To
|
368
|
+
end
|
369
|
+
unless query_options.nil?
|
370
|
+
filter = query_options.Filter
|
371
|
+
end
|
372
|
+
unless query_options.nil?
|
373
|
+
apply = query_options.Apply
|
374
|
+
end
|
375
|
+
|
376
|
+
request_headers = {}
|
377
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
378
|
+
|
379
|
+
# Set Headers
|
380
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
381
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
382
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'
|
383
|
+
|
384
|
+
request_url = @base_url || @client.base_url
|
385
|
+
|
386
|
+
options = {
|
387
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
388
|
+
path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name},
|
389
|
+
query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
|
390
|
+
headers: request_headers.merge(custom_headers || {}),
|
391
|
+
base_url: request_url
|
392
|
+
}
|
393
|
+
promise = @client.make_request_async(:post, path_template, options)
|
394
|
+
|
395
|
+
promise = promise.then do |result|
|
396
|
+
http_response = result.response
|
397
|
+
status_code = http_response.status
|
398
|
+
response_content = http_response.body
|
399
|
+
unless status_code == 200
|
400
|
+
error_model = JSON.load(response_content)
|
401
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
402
|
+
end
|
403
|
+
|
404
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
405
|
+
# Deserialize Response
|
406
|
+
if status_code == 200
|
407
|
+
begin
|
408
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
409
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2017_08_09_preview::Models::PolicyStatesQueryResults.mapper()
|
410
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
411
|
+
rescue Exception => e
|
412
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
result
|
417
|
+
end
|
418
|
+
|
419
|
+
promise.execute
|
420
|
+
end
|
421
|
+
|
422
|
+
#
|
423
|
+
# Queries policy states for the resource.
|
424
|
+
#
|
425
|
+
# @param policy_states_resource [PolicyStatesResource] The virtual resource
|
426
|
+
# under PolicyStates resource type. In a given time range, 'latest' represents
|
427
|
+
# the latest policy state(s), whereas 'default' represents all policy state(s).
|
428
|
+
# Possible values include: 'default', 'latest'
|
429
|
+
# @param resource_id [String] Resource ID.
|
430
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
431
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
432
|
+
# will be added to the HTTP request.
|
433
|
+
#
|
434
|
+
# @return [PolicyStatesQueryResults] operation results.
|
435
|
+
#
|
436
|
+
def list_query_results_for_resource(policy_states_resource, resource_id, query_options:nil, custom_headers:nil)
|
437
|
+
response = list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:query_options, custom_headers:custom_headers).value!
|
438
|
+
response.body unless response.nil?
|
439
|
+
end
|
440
|
+
|
441
|
+
#
|
442
|
+
# Queries policy states for the resource.
|
443
|
+
#
|
444
|
+
# @param policy_states_resource [PolicyStatesResource] The virtual resource
|
445
|
+
# under PolicyStates resource type. In a given time range, 'latest' represents
|
446
|
+
# the latest policy state(s), whereas 'default' represents all policy state(s).
|
447
|
+
# Possible values include: 'default', 'latest'
|
448
|
+
# @param resource_id [String] Resource ID.
|
449
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
450
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
451
|
+
# will be added to the HTTP request.
|
452
|
+
#
|
453
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
454
|
+
#
|
455
|
+
def list_query_results_for_resource_with_http_info(policy_states_resource, resource_id, query_options:nil, custom_headers:nil)
|
456
|
+
list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:query_options, custom_headers:custom_headers).value!
|
457
|
+
end
|
458
|
+
|
459
|
+
#
|
460
|
+
# Queries policy states for the resource.
|
461
|
+
#
|
462
|
+
# @param policy_states_resource [PolicyStatesResource] The virtual resource
|
463
|
+
# under PolicyStates resource type. In a given time range, 'latest' represents
|
464
|
+
# the latest policy state(s), whereas 'default' represents all policy state(s).
|
465
|
+
# Possible values include: 'default', 'latest'
|
466
|
+
# @param resource_id [String] Resource ID.
|
467
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
468
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
469
|
+
# to the HTTP request.
|
470
|
+
#
|
471
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
472
|
+
#
|
473
|
+
def list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:nil, custom_headers:nil)
|
474
|
+
fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil?
|
475
|
+
fail ArgumentError, 'resource_id is nil' if resource_id.nil?
|
476
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
477
|
+
|
478
|
+
top = nil
|
479
|
+
order_by = nil
|
480
|
+
select = nil
|
481
|
+
from = nil
|
482
|
+
to = nil
|
483
|
+
filter = nil
|
484
|
+
apply = nil
|
485
|
+
unless query_options.nil?
|
486
|
+
top = query_options.Top
|
487
|
+
end
|
488
|
+
unless query_options.nil?
|
489
|
+
order_by = query_options.OrderBy
|
490
|
+
end
|
491
|
+
unless query_options.nil?
|
492
|
+
select = query_options.Select
|
493
|
+
end
|
494
|
+
unless query_options.nil?
|
495
|
+
from = query_options.From
|
496
|
+
end
|
497
|
+
unless query_options.nil?
|
498
|
+
to = query_options.To
|
499
|
+
end
|
500
|
+
unless query_options.nil?
|
501
|
+
filter = query_options.Filter
|
502
|
+
end
|
503
|
+
unless query_options.nil?
|
504
|
+
apply = query_options.Apply
|
505
|
+
end
|
506
|
+
|
507
|
+
request_headers = {}
|
508
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
509
|
+
|
510
|
+
# Set Headers
|
511
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
512
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
513
|
+
path_template = '{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'
|
514
|
+
|
515
|
+
request_url = @base_url || @client.base_url
|
516
|
+
|
517
|
+
options = {
|
518
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
519
|
+
path_params: {'policyStatesResource' => policy_states_resource},
|
520
|
+
skip_encoding_path_params: {'resourceId' => resource_id},
|
521
|
+
query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
|
522
|
+
headers: request_headers.merge(custom_headers || {}),
|
523
|
+
base_url: request_url
|
524
|
+
}
|
525
|
+
promise = @client.make_request_async(:post, path_template, options)
|
526
|
+
|
527
|
+
promise = promise.then do |result|
|
528
|
+
http_response = result.response
|
529
|
+
status_code = http_response.status
|
530
|
+
response_content = http_response.body
|
531
|
+
unless status_code == 200
|
532
|
+
error_model = JSON.load(response_content)
|
533
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
534
|
+
end
|
535
|
+
|
536
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
537
|
+
# Deserialize Response
|
538
|
+
if status_code == 200
|
539
|
+
begin
|
540
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
541
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2017_08_09_preview::Models::PolicyStatesQueryResults.mapper()
|
542
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
543
|
+
rescue Exception => e
|
544
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
548
|
+
result
|
549
|
+
end
|
550
|
+
|
551
|
+
promise.execute
|
552
|
+
end
|
553
|
+
|
554
|
+
end
|
555
|
+
end
|