azure_mgmt_policy_insights 0.17.0 → 0.17.1
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.
- checksums.yaml +5 -5
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_columns.rb +1 -1
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_columns.rb +1 -1
- data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +1 -1
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +1 -1
- data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +1 -1
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +1 -1
- data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_event.rb +1 -1
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_state.rb +1 -1
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +2 -0
- data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights.rb +45 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/error_definition.rb +115 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/error_response.rb +47 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_details.rb +108 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_tracked_resource.rb +102 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_tracked_resources_query_results.rb +100 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +60 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +54 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation.rb +158 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployment.rb +124 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployment_summary.rb +72 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployments_list_result.rb +101 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_filters.rb +55 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_list_result.rb +100 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/tracked_resource_modification_details.rb +76 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/typed_error_info.rb +59 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_tracked_resources.rb +860 -0
- data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb +3230 -0
- data/lib/azure_mgmt_policy_insights.rb +1 -0
- data/lib/profiles/latest/modules/policyinsights_profile_module.rb +78 -14
- data/lib/version.rb +1 -1
- metadata +24 -3
@@ -0,0 +1,76 @@
|
|
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::V2018_07_01_preview
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# The details of the policy triggered deployment that created or modified
|
10
|
+
# the tracked resource.
|
11
|
+
#
|
12
|
+
class TrackedResourceModificationDetails
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
# @return [PolicyDetails] The details of the policy that created or
|
17
|
+
# modified the tracked resource.
|
18
|
+
attr_accessor :policy_details
|
19
|
+
|
20
|
+
# @return [String] The ID of the deployment that created or modified the
|
21
|
+
# tracked resource.
|
22
|
+
attr_accessor :deployment_id
|
23
|
+
|
24
|
+
# @return [DateTime] Timestamp of the deployment that created or modified
|
25
|
+
# the tracked resource.
|
26
|
+
attr_accessor :deployment_time
|
27
|
+
|
28
|
+
|
29
|
+
#
|
30
|
+
# Mapper for TrackedResourceModificationDetails class as Ruby Hash.
|
31
|
+
# This will be used for serialization/deserialization.
|
32
|
+
#
|
33
|
+
def self.mapper()
|
34
|
+
{
|
35
|
+
client_side_validation: true,
|
36
|
+
required: false,
|
37
|
+
serialized_name: 'TrackedResourceModificationDetails',
|
38
|
+
type: {
|
39
|
+
name: 'Composite',
|
40
|
+
class_name: 'TrackedResourceModificationDetails',
|
41
|
+
model_properties: {
|
42
|
+
policy_details: {
|
43
|
+
client_side_validation: true,
|
44
|
+
required: false,
|
45
|
+
read_only: true,
|
46
|
+
serialized_name: 'policyDetails',
|
47
|
+
type: {
|
48
|
+
name: 'Composite',
|
49
|
+
class_name: 'PolicyDetails'
|
50
|
+
}
|
51
|
+
},
|
52
|
+
deployment_id: {
|
53
|
+
client_side_validation: true,
|
54
|
+
required: false,
|
55
|
+
read_only: true,
|
56
|
+
serialized_name: 'deploymentId',
|
57
|
+
type: {
|
58
|
+
name: 'String'
|
59
|
+
}
|
60
|
+
},
|
61
|
+
deployment_time: {
|
62
|
+
client_side_validation: true,
|
63
|
+
required: false,
|
64
|
+
read_only: true,
|
65
|
+
serialized_name: 'deploymentTime',
|
66
|
+
type: {
|
67
|
+
name: 'DateTime'
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,59 @@
|
|
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::V2018_07_01_preview
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Scenario specific error details.
|
10
|
+
#
|
11
|
+
class TypedErrorInfo
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] The type of included error details.
|
16
|
+
attr_accessor :type
|
17
|
+
|
18
|
+
# @return The scenario specific error details.
|
19
|
+
attr_accessor :info
|
20
|
+
|
21
|
+
|
22
|
+
#
|
23
|
+
# Mapper for TypedErrorInfo class as Ruby Hash.
|
24
|
+
# This will be used for serialization/deserialization.
|
25
|
+
#
|
26
|
+
def self.mapper()
|
27
|
+
{
|
28
|
+
client_side_validation: true,
|
29
|
+
required: false,
|
30
|
+
serialized_name: 'TypedErrorInfo',
|
31
|
+
type: {
|
32
|
+
name: 'Composite',
|
33
|
+
class_name: 'TypedErrorInfo',
|
34
|
+
model_properties: {
|
35
|
+
type: {
|
36
|
+
client_side_validation: true,
|
37
|
+
required: false,
|
38
|
+
read_only: true,
|
39
|
+
serialized_name: 'type',
|
40
|
+
type: {
|
41
|
+
name: 'String'
|
42
|
+
}
|
43
|
+
},
|
44
|
+
info: {
|
45
|
+
client_side_validation: true,
|
46
|
+
required: false,
|
47
|
+
read_only: true,
|
48
|
+
serialized_name: 'info',
|
49
|
+
type: {
|
50
|
+
name: 'Object'
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
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::V2018_07_01_preview end
|
@@ -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::V2018_07_01_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] Microsoft Azure subscription ID.
|
21
|
+
attr_accessor :subscription_id
|
22
|
+
|
23
|
+
# @return [String] Client Api Version.
|
24
|
+
attr_reader :api_version
|
25
|
+
|
26
|
+
# @return [String] The preferred language for the response.
|
27
|
+
attr_accessor :accept_language
|
28
|
+
|
29
|
+
# @return [Integer] The retry timeout in seconds for Long Running
|
30
|
+
# Operations. Default value is 30.
|
31
|
+
attr_accessor :long_running_operation_retry_timeout
|
32
|
+
|
33
|
+
# @return [Boolean] Whether a unique x-ms-client-request-id should be
|
34
|
+
# generated. When set to true a unique x-ms-client-request-id value is
|
35
|
+
# generated and included in each request. Default is true.
|
36
|
+
attr_accessor :generate_client_request_id
|
37
|
+
|
38
|
+
# @return [PolicyTrackedResources] policy_tracked_resources
|
39
|
+
attr_reader :policy_tracked_resources
|
40
|
+
|
41
|
+
# @return [Remediations] remediations
|
42
|
+
attr_reader :remediations
|
43
|
+
|
44
|
+
#
|
45
|
+
# Creates initializes a new instance of the PolicyInsightsClient class.
|
46
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
47
|
+
# @param base_url [String] the base URI of the service.
|
48
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
49
|
+
#
|
50
|
+
def initialize(credentials = nil, base_url = nil, options = nil)
|
51
|
+
super(credentials, options)
|
52
|
+
@base_url = base_url || 'https://management.azure.com'
|
53
|
+
|
54
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
55
|
+
@credentials = credentials
|
56
|
+
|
57
|
+
@policy_tracked_resources = PolicyTrackedResources.new(self)
|
58
|
+
@remediations = Remediations.new(self)
|
59
|
+
@api_version = '2018-07-01-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.17.1"
|
132
|
+
add_user_agent_information(sdk_information)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,860 @@
|
|
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::V2018_07_01_preview
|
7
|
+
#
|
8
|
+
# PolicyTrackedResources
|
9
|
+
#
|
10
|
+
class PolicyTrackedResources
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the PolicyTrackedResources 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 tracked 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 [Array<PolicyTrackedResource>] operation results.
|
33
|
+
#
|
34
|
+
def list_query_results_for_management_group(management_group_name, query_options:nil, custom_headers:nil)
|
35
|
+
first_page = list_query_results_for_management_group_as_lazy(management_group_name, query_options:query_options, custom_headers:custom_headers)
|
36
|
+
first_page.get_all_items
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# Queries policy tracked 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 tracked 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
|
+
management_groups_namespace = 'Microsoft.Management'
|
65
|
+
fail ArgumentError, 'management_group_name is nil' if management_group_name.nil?
|
66
|
+
policy_tracked_resources_resource = 'default'
|
67
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
68
|
+
|
69
|
+
top = nil
|
70
|
+
filter = nil
|
71
|
+
unless query_options.nil?
|
72
|
+
top = query_options.Top
|
73
|
+
end
|
74
|
+
unless query_options.nil?
|
75
|
+
filter = query_options.Filter
|
76
|
+
end
|
77
|
+
|
78
|
+
request_headers = {}
|
79
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
80
|
+
|
81
|
+
# Set Headers
|
82
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
83
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
84
|
+
path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults'
|
85
|
+
|
86
|
+
request_url = @base_url || @client.base_url
|
87
|
+
|
88
|
+
options = {
|
89
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
90
|
+
path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupName' => management_group_name,'policyTrackedResourcesResource' => policy_tracked_resources_resource},
|
91
|
+
query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
|
92
|
+
headers: request_headers.merge(custom_headers || {}),
|
93
|
+
base_url: request_url
|
94
|
+
}
|
95
|
+
promise = @client.make_request_async(:post, path_template, options)
|
96
|
+
|
97
|
+
promise = promise.then do |result|
|
98
|
+
http_response = result.response
|
99
|
+
status_code = http_response.status
|
100
|
+
response_content = http_response.body
|
101
|
+
unless status_code == 200
|
102
|
+
error_model = JSON.load(response_content)
|
103
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
104
|
+
end
|
105
|
+
|
106
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
107
|
+
# Deserialize Response
|
108
|
+
if status_code == 200
|
109
|
+
begin
|
110
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
111
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::PolicyTrackedResourcesQueryResults.mapper()
|
112
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
113
|
+
rescue Exception => e
|
114
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
result
|
119
|
+
end
|
120
|
+
|
121
|
+
promise.execute
|
122
|
+
end
|
123
|
+
|
124
|
+
#
|
125
|
+
# Queries policy tracked resources under the subscription.
|
126
|
+
#
|
127
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
128
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
129
|
+
# will be added to the HTTP request.
|
130
|
+
#
|
131
|
+
# @return [Array<PolicyTrackedResource>] operation results.
|
132
|
+
#
|
133
|
+
def list_query_results_for_subscription(query_options:nil, custom_headers:nil)
|
134
|
+
first_page = list_query_results_for_subscription_as_lazy(query_options:query_options, custom_headers:custom_headers)
|
135
|
+
first_page.get_all_items
|
136
|
+
end
|
137
|
+
|
138
|
+
#
|
139
|
+
# Queries policy tracked resources under the subscription.
|
140
|
+
#
|
141
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
142
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
143
|
+
# will be added to the HTTP request.
|
144
|
+
#
|
145
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
146
|
+
#
|
147
|
+
def list_query_results_for_subscription_with_http_info(query_options:nil, custom_headers:nil)
|
148
|
+
list_query_results_for_subscription_async(query_options:query_options, custom_headers:custom_headers).value!
|
149
|
+
end
|
150
|
+
|
151
|
+
#
|
152
|
+
# Queries policy tracked resources under the subscription.
|
153
|
+
#
|
154
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
155
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
156
|
+
# to the HTTP request.
|
157
|
+
#
|
158
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
159
|
+
#
|
160
|
+
def list_query_results_for_subscription_async(query_options:nil, custom_headers:nil)
|
161
|
+
policy_tracked_resources_resource = 'default'
|
162
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
163
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
164
|
+
|
165
|
+
top = nil
|
166
|
+
filter = nil
|
167
|
+
unless query_options.nil?
|
168
|
+
top = query_options.Top
|
169
|
+
end
|
170
|
+
unless query_options.nil?
|
171
|
+
filter = query_options.Filter
|
172
|
+
end
|
173
|
+
|
174
|
+
request_headers = {}
|
175
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
176
|
+
|
177
|
+
# Set Headers
|
178
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
179
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
180
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults'
|
181
|
+
|
182
|
+
request_url = @base_url || @client.base_url
|
183
|
+
|
184
|
+
options = {
|
185
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
186
|
+
path_params: {'policyTrackedResourcesResource' => policy_tracked_resources_resource,'subscriptionId' => @client.subscription_id},
|
187
|
+
query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
|
188
|
+
headers: request_headers.merge(custom_headers || {}),
|
189
|
+
base_url: request_url
|
190
|
+
}
|
191
|
+
promise = @client.make_request_async(:post, path_template, options)
|
192
|
+
|
193
|
+
promise = promise.then do |result|
|
194
|
+
http_response = result.response
|
195
|
+
status_code = http_response.status
|
196
|
+
response_content = http_response.body
|
197
|
+
unless status_code == 200
|
198
|
+
error_model = JSON.load(response_content)
|
199
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
200
|
+
end
|
201
|
+
|
202
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
203
|
+
# Deserialize Response
|
204
|
+
if status_code == 200
|
205
|
+
begin
|
206
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
207
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::PolicyTrackedResourcesQueryResults.mapper()
|
208
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
209
|
+
rescue Exception => e
|
210
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
result
|
215
|
+
end
|
216
|
+
|
217
|
+
promise.execute
|
218
|
+
end
|
219
|
+
|
220
|
+
#
|
221
|
+
# Queries policy tracked resources under the resource group.
|
222
|
+
#
|
223
|
+
# @param resource_group_name [String] Resource group name.
|
224
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
225
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
226
|
+
# will be added to the HTTP request.
|
227
|
+
#
|
228
|
+
# @return [Array<PolicyTrackedResource>] operation results.
|
229
|
+
#
|
230
|
+
def list_query_results_for_resource_group(resource_group_name, query_options:nil, custom_headers:nil)
|
231
|
+
first_page = list_query_results_for_resource_group_as_lazy(resource_group_name, query_options:query_options, custom_headers:custom_headers)
|
232
|
+
first_page.get_all_items
|
233
|
+
end
|
234
|
+
|
235
|
+
#
|
236
|
+
# Queries policy tracked resources under the resource group.
|
237
|
+
#
|
238
|
+
# @param resource_group_name [String] Resource group name.
|
239
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
240
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
241
|
+
# will be added to the HTTP request.
|
242
|
+
#
|
243
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
244
|
+
#
|
245
|
+
def list_query_results_for_resource_group_with_http_info(resource_group_name, query_options:nil, custom_headers:nil)
|
246
|
+
list_query_results_for_resource_group_async(resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
|
247
|
+
end
|
248
|
+
|
249
|
+
#
|
250
|
+
# Queries policy tracked resources under the resource group.
|
251
|
+
#
|
252
|
+
# @param resource_group_name [String] Resource group name.
|
253
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
254
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
255
|
+
# to the HTTP request.
|
256
|
+
#
|
257
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
258
|
+
#
|
259
|
+
def list_query_results_for_resource_group_async(resource_group_name, query_options:nil, custom_headers:nil)
|
260
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
261
|
+
policy_tracked_resources_resource = 'default'
|
262
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
263
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
264
|
+
|
265
|
+
top = nil
|
266
|
+
filter = nil
|
267
|
+
unless query_options.nil?
|
268
|
+
top = query_options.Top
|
269
|
+
end
|
270
|
+
unless query_options.nil?
|
271
|
+
filter = query_options.Filter
|
272
|
+
end
|
273
|
+
|
274
|
+
request_headers = {}
|
275
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
276
|
+
|
277
|
+
# Set Headers
|
278
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
279
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
280
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults'
|
281
|
+
|
282
|
+
request_url = @base_url || @client.base_url
|
283
|
+
|
284
|
+
options = {
|
285
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
286
|
+
path_params: {'resourceGroupName' => resource_group_name,'policyTrackedResourcesResource' => policy_tracked_resources_resource,'subscriptionId' => @client.subscription_id},
|
287
|
+
query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
|
288
|
+
headers: request_headers.merge(custom_headers || {}),
|
289
|
+
base_url: request_url
|
290
|
+
}
|
291
|
+
promise = @client.make_request_async(:post, path_template, options)
|
292
|
+
|
293
|
+
promise = promise.then do |result|
|
294
|
+
http_response = result.response
|
295
|
+
status_code = http_response.status
|
296
|
+
response_content = http_response.body
|
297
|
+
unless status_code == 200
|
298
|
+
error_model = JSON.load(response_content)
|
299
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
300
|
+
end
|
301
|
+
|
302
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
303
|
+
# Deserialize Response
|
304
|
+
if status_code == 200
|
305
|
+
begin
|
306
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
307
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::PolicyTrackedResourcesQueryResults.mapper()
|
308
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
309
|
+
rescue Exception => e
|
310
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
result
|
315
|
+
end
|
316
|
+
|
317
|
+
promise.execute
|
318
|
+
end
|
319
|
+
|
320
|
+
#
|
321
|
+
# Queries policy tracked resources under the resource.
|
322
|
+
#
|
323
|
+
# @param resource_id [String] Resource ID.
|
324
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
325
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
326
|
+
# will be added to the HTTP request.
|
327
|
+
#
|
328
|
+
# @return [Array<PolicyTrackedResource>] operation results.
|
329
|
+
#
|
330
|
+
def list_query_results_for_resource(resource_id, query_options:nil, custom_headers:nil)
|
331
|
+
first_page = list_query_results_for_resource_as_lazy(resource_id, query_options:query_options, custom_headers:custom_headers)
|
332
|
+
first_page.get_all_items
|
333
|
+
end
|
334
|
+
|
335
|
+
#
|
336
|
+
# Queries policy tracked resources under the resource.
|
337
|
+
#
|
338
|
+
# @param resource_id [String] Resource ID.
|
339
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
340
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
341
|
+
# will be added to the HTTP request.
|
342
|
+
#
|
343
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
344
|
+
#
|
345
|
+
def list_query_results_for_resource_with_http_info(resource_id, query_options:nil, custom_headers:nil)
|
346
|
+
list_query_results_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
|
347
|
+
end
|
348
|
+
|
349
|
+
#
|
350
|
+
# Queries policy tracked resources under the resource.
|
351
|
+
#
|
352
|
+
# @param resource_id [String] Resource ID.
|
353
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
354
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
355
|
+
# to the HTTP request.
|
356
|
+
#
|
357
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
358
|
+
#
|
359
|
+
def list_query_results_for_resource_async(resource_id, query_options:nil, custom_headers:nil)
|
360
|
+
fail ArgumentError, 'resource_id is nil' if resource_id.nil?
|
361
|
+
policy_tracked_resources_resource = 'default'
|
362
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
363
|
+
|
364
|
+
top = nil
|
365
|
+
filter = nil
|
366
|
+
unless query_options.nil?
|
367
|
+
top = query_options.Top
|
368
|
+
end
|
369
|
+
unless query_options.nil?
|
370
|
+
filter = query_options.Filter
|
371
|
+
end
|
372
|
+
|
373
|
+
request_headers = {}
|
374
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
375
|
+
|
376
|
+
# Set Headers
|
377
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
378
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
379
|
+
path_template = '{resourceId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults'
|
380
|
+
|
381
|
+
request_url = @base_url || @client.base_url
|
382
|
+
|
383
|
+
options = {
|
384
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
385
|
+
path_params: {'policyTrackedResourcesResource' => policy_tracked_resources_resource},
|
386
|
+
skip_encoding_path_params: {'resourceId' => resource_id},
|
387
|
+
query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
|
388
|
+
headers: request_headers.merge(custom_headers || {}),
|
389
|
+
base_url: request_url
|
390
|
+
}
|
391
|
+
promise = @client.make_request_async(:post, path_template, options)
|
392
|
+
|
393
|
+
promise = promise.then do |result|
|
394
|
+
http_response = result.response
|
395
|
+
status_code = http_response.status
|
396
|
+
response_content = http_response.body
|
397
|
+
unless status_code == 200
|
398
|
+
error_model = JSON.load(response_content)
|
399
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
400
|
+
end
|
401
|
+
|
402
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
403
|
+
# Deserialize Response
|
404
|
+
if status_code == 200
|
405
|
+
begin
|
406
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
407
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::PolicyTrackedResourcesQueryResults.mapper()
|
408
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
409
|
+
rescue Exception => e
|
410
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
result
|
415
|
+
end
|
416
|
+
|
417
|
+
promise.execute
|
418
|
+
end
|
419
|
+
|
420
|
+
#
|
421
|
+
# Queries policy tracked resources under the management group.
|
422
|
+
#
|
423
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
424
|
+
# to List operation.
|
425
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
426
|
+
# will be added to the HTTP request.
|
427
|
+
#
|
428
|
+
# @return [PolicyTrackedResourcesQueryResults] operation results.
|
429
|
+
#
|
430
|
+
def list_query_results_for_management_group_next(next_page_link, custom_headers:nil)
|
431
|
+
response = list_query_results_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
|
432
|
+
response.body unless response.nil?
|
433
|
+
end
|
434
|
+
|
435
|
+
#
|
436
|
+
# Queries policy tracked resources under the management group.
|
437
|
+
#
|
438
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
439
|
+
# to List operation.
|
440
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
441
|
+
# will be added to the HTTP request.
|
442
|
+
#
|
443
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
444
|
+
#
|
445
|
+
def list_query_results_for_management_group_next_with_http_info(next_page_link, custom_headers:nil)
|
446
|
+
list_query_results_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
|
447
|
+
end
|
448
|
+
|
449
|
+
#
|
450
|
+
# Queries policy tracked resources under the management group.
|
451
|
+
#
|
452
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
453
|
+
# to List operation.
|
454
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
455
|
+
# to the HTTP request.
|
456
|
+
#
|
457
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
458
|
+
#
|
459
|
+
def list_query_results_for_management_group_next_async(next_page_link, custom_headers:nil)
|
460
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
461
|
+
|
462
|
+
|
463
|
+
request_headers = {}
|
464
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
465
|
+
|
466
|
+
# Set Headers
|
467
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
468
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
469
|
+
path_template = '{nextLink}'
|
470
|
+
|
471
|
+
request_url = @base_url || @client.base_url
|
472
|
+
|
473
|
+
options = {
|
474
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
475
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
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
|
+
# Deserialize Response
|
492
|
+
if status_code == 200
|
493
|
+
begin
|
494
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
495
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::PolicyTrackedResourcesQueryResults.mapper()
|
496
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
497
|
+
rescue Exception => e
|
498
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
499
|
+
end
|
500
|
+
end
|
501
|
+
|
502
|
+
result
|
503
|
+
end
|
504
|
+
|
505
|
+
promise.execute
|
506
|
+
end
|
507
|
+
|
508
|
+
#
|
509
|
+
# Queries policy tracked resources under the subscription.
|
510
|
+
#
|
511
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
512
|
+
# to List operation.
|
513
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
514
|
+
# will be added to the HTTP request.
|
515
|
+
#
|
516
|
+
# @return [PolicyTrackedResourcesQueryResults] operation results.
|
517
|
+
#
|
518
|
+
def list_query_results_for_subscription_next(next_page_link, custom_headers:nil)
|
519
|
+
response = list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
|
520
|
+
response.body unless response.nil?
|
521
|
+
end
|
522
|
+
|
523
|
+
#
|
524
|
+
# Queries policy tracked resources under the subscription.
|
525
|
+
#
|
526
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
527
|
+
# to List operation.
|
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 list_query_results_for_subscription_next_with_http_info(next_page_link, custom_headers:nil)
|
534
|
+
list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
|
535
|
+
end
|
536
|
+
|
537
|
+
#
|
538
|
+
# Queries policy tracked resources under the subscription.
|
539
|
+
#
|
540
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
541
|
+
# to List operation.
|
542
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
543
|
+
# to the HTTP request.
|
544
|
+
#
|
545
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
546
|
+
#
|
547
|
+
def list_query_results_for_subscription_next_async(next_page_link, custom_headers:nil)
|
548
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
549
|
+
|
550
|
+
|
551
|
+
request_headers = {}
|
552
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
553
|
+
|
554
|
+
# Set Headers
|
555
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
556
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
557
|
+
path_template = '{nextLink}'
|
558
|
+
|
559
|
+
request_url = @base_url || @client.base_url
|
560
|
+
|
561
|
+
options = {
|
562
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
563
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
564
|
+
headers: request_headers.merge(custom_headers || {}),
|
565
|
+
base_url: request_url
|
566
|
+
}
|
567
|
+
promise = @client.make_request_async(:post, path_template, options)
|
568
|
+
|
569
|
+
promise = promise.then do |result|
|
570
|
+
http_response = result.response
|
571
|
+
status_code = http_response.status
|
572
|
+
response_content = http_response.body
|
573
|
+
unless status_code == 200
|
574
|
+
error_model = JSON.load(response_content)
|
575
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
576
|
+
end
|
577
|
+
|
578
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
579
|
+
# Deserialize Response
|
580
|
+
if status_code == 200
|
581
|
+
begin
|
582
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
583
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::PolicyTrackedResourcesQueryResults.mapper()
|
584
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
585
|
+
rescue Exception => e
|
586
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
587
|
+
end
|
588
|
+
end
|
589
|
+
|
590
|
+
result
|
591
|
+
end
|
592
|
+
|
593
|
+
promise.execute
|
594
|
+
end
|
595
|
+
|
596
|
+
#
|
597
|
+
# Queries policy tracked resources under the resource group.
|
598
|
+
#
|
599
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
600
|
+
# to List operation.
|
601
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
602
|
+
# will be added to the HTTP request.
|
603
|
+
#
|
604
|
+
# @return [PolicyTrackedResourcesQueryResults] operation results.
|
605
|
+
#
|
606
|
+
def list_query_results_for_resource_group_next(next_page_link, custom_headers:nil)
|
607
|
+
response = list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
|
608
|
+
response.body unless response.nil?
|
609
|
+
end
|
610
|
+
|
611
|
+
#
|
612
|
+
# Queries policy tracked resources under the resource group.
|
613
|
+
#
|
614
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
615
|
+
# to List operation.
|
616
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
617
|
+
# will be added to the HTTP request.
|
618
|
+
#
|
619
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
620
|
+
#
|
621
|
+
def list_query_results_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
|
622
|
+
list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
|
623
|
+
end
|
624
|
+
|
625
|
+
#
|
626
|
+
# Queries policy tracked resources under the resource group.
|
627
|
+
#
|
628
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
629
|
+
# to List operation.
|
630
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
631
|
+
# to the HTTP request.
|
632
|
+
#
|
633
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
634
|
+
#
|
635
|
+
def list_query_results_for_resource_group_next_async(next_page_link, custom_headers:nil)
|
636
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
637
|
+
|
638
|
+
|
639
|
+
request_headers = {}
|
640
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
641
|
+
|
642
|
+
# Set Headers
|
643
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
644
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
645
|
+
path_template = '{nextLink}'
|
646
|
+
|
647
|
+
request_url = @base_url || @client.base_url
|
648
|
+
|
649
|
+
options = {
|
650
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
651
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
652
|
+
headers: request_headers.merge(custom_headers || {}),
|
653
|
+
base_url: request_url
|
654
|
+
}
|
655
|
+
promise = @client.make_request_async(:post, path_template, options)
|
656
|
+
|
657
|
+
promise = promise.then do |result|
|
658
|
+
http_response = result.response
|
659
|
+
status_code = http_response.status
|
660
|
+
response_content = http_response.body
|
661
|
+
unless status_code == 200
|
662
|
+
error_model = JSON.load(response_content)
|
663
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
664
|
+
end
|
665
|
+
|
666
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
667
|
+
# Deserialize Response
|
668
|
+
if status_code == 200
|
669
|
+
begin
|
670
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
671
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::PolicyTrackedResourcesQueryResults.mapper()
|
672
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
673
|
+
rescue Exception => e
|
674
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
675
|
+
end
|
676
|
+
end
|
677
|
+
|
678
|
+
result
|
679
|
+
end
|
680
|
+
|
681
|
+
promise.execute
|
682
|
+
end
|
683
|
+
|
684
|
+
#
|
685
|
+
# Queries policy tracked resources under the resource.
|
686
|
+
#
|
687
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
688
|
+
# to List operation.
|
689
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
690
|
+
# will be added to the HTTP request.
|
691
|
+
#
|
692
|
+
# @return [PolicyTrackedResourcesQueryResults] operation results.
|
693
|
+
#
|
694
|
+
def list_query_results_for_resource_next(next_page_link, custom_headers:nil)
|
695
|
+
response = list_query_results_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
|
696
|
+
response.body unless response.nil?
|
697
|
+
end
|
698
|
+
|
699
|
+
#
|
700
|
+
# Queries policy tracked resources under the resource.
|
701
|
+
#
|
702
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
703
|
+
# to List operation.
|
704
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
705
|
+
# will be added to the HTTP request.
|
706
|
+
#
|
707
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
708
|
+
#
|
709
|
+
def list_query_results_for_resource_next_with_http_info(next_page_link, custom_headers:nil)
|
710
|
+
list_query_results_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
|
711
|
+
end
|
712
|
+
|
713
|
+
#
|
714
|
+
# Queries policy tracked resources under the resource.
|
715
|
+
#
|
716
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
717
|
+
# to List operation.
|
718
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
719
|
+
# to the HTTP request.
|
720
|
+
#
|
721
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
722
|
+
#
|
723
|
+
def list_query_results_for_resource_next_async(next_page_link, custom_headers:nil)
|
724
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
725
|
+
|
726
|
+
|
727
|
+
request_headers = {}
|
728
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
729
|
+
|
730
|
+
# Set Headers
|
731
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
732
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
733
|
+
path_template = '{nextLink}'
|
734
|
+
|
735
|
+
request_url = @base_url || @client.base_url
|
736
|
+
|
737
|
+
options = {
|
738
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
739
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
740
|
+
headers: request_headers.merge(custom_headers || {}),
|
741
|
+
base_url: request_url
|
742
|
+
}
|
743
|
+
promise = @client.make_request_async(:post, path_template, options)
|
744
|
+
|
745
|
+
promise = promise.then do |result|
|
746
|
+
http_response = result.response
|
747
|
+
status_code = http_response.status
|
748
|
+
response_content = http_response.body
|
749
|
+
unless status_code == 200
|
750
|
+
error_model = JSON.load(response_content)
|
751
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
752
|
+
end
|
753
|
+
|
754
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
755
|
+
# Deserialize Response
|
756
|
+
if status_code == 200
|
757
|
+
begin
|
758
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
759
|
+
result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::PolicyTrackedResourcesQueryResults.mapper()
|
760
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
761
|
+
rescue Exception => e
|
762
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
763
|
+
end
|
764
|
+
end
|
765
|
+
|
766
|
+
result
|
767
|
+
end
|
768
|
+
|
769
|
+
promise.execute
|
770
|
+
end
|
771
|
+
|
772
|
+
#
|
773
|
+
# Queries policy tracked resources under the management group.
|
774
|
+
#
|
775
|
+
# @param management_group_name [String] Management group name.
|
776
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
777
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
778
|
+
# will be added to the HTTP request.
|
779
|
+
#
|
780
|
+
# @return [PolicyTrackedResourcesQueryResults] which provide lazy access to
|
781
|
+
# pages of the response.
|
782
|
+
#
|
783
|
+
def list_query_results_for_management_group_as_lazy(management_group_name, query_options:nil, custom_headers:nil)
|
784
|
+
response = list_query_results_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
|
785
|
+
unless response.nil?
|
786
|
+
page = response.body
|
787
|
+
page.next_method = Proc.new do |next_page_link|
|
788
|
+
list_query_results_for_management_group_next_async(next_page_link, custom_headers:custom_headers)
|
789
|
+
end
|
790
|
+
page
|
791
|
+
end
|
792
|
+
end
|
793
|
+
|
794
|
+
#
|
795
|
+
# Queries policy tracked resources under the subscription.
|
796
|
+
#
|
797
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
798
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
799
|
+
# will be added to the HTTP request.
|
800
|
+
#
|
801
|
+
# @return [PolicyTrackedResourcesQueryResults] which provide lazy access to
|
802
|
+
# pages of the response.
|
803
|
+
#
|
804
|
+
def list_query_results_for_subscription_as_lazy(query_options:nil, custom_headers:nil)
|
805
|
+
response = list_query_results_for_subscription_async(query_options:query_options, custom_headers:custom_headers).value!
|
806
|
+
unless response.nil?
|
807
|
+
page = response.body
|
808
|
+
page.next_method = Proc.new do |next_page_link|
|
809
|
+
list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers)
|
810
|
+
end
|
811
|
+
page
|
812
|
+
end
|
813
|
+
end
|
814
|
+
|
815
|
+
#
|
816
|
+
# Queries policy tracked resources under the resource group.
|
817
|
+
#
|
818
|
+
# @param resource_group_name [String] Resource group name.
|
819
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
820
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
821
|
+
# will be added to the HTTP request.
|
822
|
+
#
|
823
|
+
# @return [PolicyTrackedResourcesQueryResults] which provide lazy access to
|
824
|
+
# pages of the response.
|
825
|
+
#
|
826
|
+
def list_query_results_for_resource_group_as_lazy(resource_group_name, query_options:nil, custom_headers:nil)
|
827
|
+
response = list_query_results_for_resource_group_async(resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
|
828
|
+
unless response.nil?
|
829
|
+
page = response.body
|
830
|
+
page.next_method = Proc.new do |next_page_link|
|
831
|
+
list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
|
832
|
+
end
|
833
|
+
page
|
834
|
+
end
|
835
|
+
end
|
836
|
+
|
837
|
+
#
|
838
|
+
# Queries policy tracked resources under the resource.
|
839
|
+
#
|
840
|
+
# @param resource_id [String] Resource ID.
|
841
|
+
# @param query_options [QueryOptions] Additional parameters for the operation
|
842
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
843
|
+
# will be added to the HTTP request.
|
844
|
+
#
|
845
|
+
# @return [PolicyTrackedResourcesQueryResults] which provide lazy access to
|
846
|
+
# pages of the response.
|
847
|
+
#
|
848
|
+
def list_query_results_for_resource_as_lazy(resource_id, query_options:nil, custom_headers:nil)
|
849
|
+
response = list_query_results_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
|
850
|
+
unless response.nil?
|
851
|
+
page = response.body
|
852
|
+
page.next_method = Proc.new do |next_page_link|
|
853
|
+
list_query_results_for_resource_next_async(next_page_link, custom_headers:custom_headers)
|
854
|
+
end
|
855
|
+
page
|
856
|
+
end
|
857
|
+
end
|
858
|
+
|
859
|
+
end
|
860
|
+
end
|