Class: Azure::PolicyInsights::Mgmt::V2017_10_17_preview::PolicyStates
- Inherits:
-
Object
- Object
- Azure::PolicyInsights::Mgmt::V2017_10_17_preview::PolicyStates
- Includes:
- MsRestAzure
- Defined in:
- lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb
Overview
PolicyStates
Instance Attribute Summary collapse
-
#client ⇒ PolicyInsightsClient
readonly
Reference to the PolicyInsightsClient.
Instance Method Summary collapse
-
#get_metadata(scope, custom_headers: nil) ⇒ String
Gets OData metadata XML document.
-
#get_metadata_async(scope, custom_headers: nil) ⇒ Concurrent::Promise
Gets OData metadata XML document.
-
#get_metadata_with_http_info(scope, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Gets OData metadata XML document.
-
#initialize(client) ⇒ PolicyStates
constructor
Creates and initializes a new instance of the PolicyStates class.
-
#list_query_results_for_management_group(policy_states_resource, management_group_name, query_options: nil, custom_headers: nil) ⇒ PolicyStatesQueryResults
Queries policy states for the resources under the management group.
-
#list_query_results_for_management_group_async(policy_states_resource, management_group_name, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise
Queries policy states for the resources under the management group.
-
#list_query_results_for_management_group_with_http_info(policy_states_resource, management_group_name, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Queries policy states for the resources under the management group.
-
#list_query_results_for_resource(policy_states_resource, resource_id, query_options: nil, custom_headers: nil) ⇒ PolicyStatesQueryResults
Queries policy states for the resource.
-
#list_query_results_for_resource_async(policy_states_resource, resource_id, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise
Queries policy states for the resource.
-
#list_query_results_for_resource_group(policy_states_resource, subscription_id, resource_group_name, query_options: nil, custom_headers: nil) ⇒ PolicyStatesQueryResults
Queries policy states for the resources under the resource group.
-
#list_query_results_for_resource_group_async(policy_states_resource, subscription_id, resource_group_name, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise
Queries policy states for the resources under the resource group.
-
#list_query_results_for_resource_group_with_http_info(policy_states_resource, subscription_id, resource_group_name, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Queries policy states for the resources under the resource group.
-
#list_query_results_for_resource_with_http_info(policy_states_resource, resource_id, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Queries policy states for the resource.
-
#list_query_results_for_subscription(policy_states_resource, subscription_id, query_options: nil, custom_headers: nil) ⇒ PolicyStatesQueryResults
Queries policy states for the resources under the subscription.
-
#list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise
Queries policy states for the resources under the subscription.
-
#list_query_results_for_subscription_with_http_info(policy_states_resource, subscription_id, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Queries policy states for the resources under the subscription.
Constructor Details
#initialize(client) ⇒ PolicyStates
Creates and initializes a new instance of the PolicyStates class.
17 18 19 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 17 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ PolicyInsightsClient (readonly)
22 23 24 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 22 def client @client end |
Instance Method Details
#get_metadata(scope, custom_headers: nil) ⇒ String
Gets OData metadata XML document.
resource group, or resource ID. Scope used has no effect on metadata returned. will be added to the HTTP request.
573 574 575 576 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 573 def (scope, custom_headers:nil) response = (scope, custom_headers:custom_headers).value! response.body unless response.nil? end |
#get_metadata_async(scope, custom_headers: nil) ⇒ Concurrent::Promise
Gets OData metadata XML document.
resource group, or resource ID. Scope used has no effect on metadata returned. to the HTTP request.
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 604 def (scope, custom_headers:nil) fail ArgumentError, 'scope is nil' if scope.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{scope}/providers/Microsoft.PolicyInsights/policyStates/$metadata' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'scope' => scope}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'String' } } result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#get_metadata_with_http_info(scope, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Gets OData metadata XML document.
resource group, or resource ID. Scope used has no effect on metadata returned. will be added to the HTTP request.
589 590 591 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 589 def (scope, custom_headers:nil) (scope, custom_headers:custom_headers).value! end |
#list_query_results_for_management_group(policy_states_resource, management_group_name, query_options: nil, custom_headers: nil) ⇒ PolicyStatesQueryResults
Queries policy states for the resources under the management group.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ will be added to the HTTP request.
38 39 40 41 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 38 def list_query_results_for_management_group(policy_states_resource, management_group_name, query_options:nil, custom_headers:nil) response = list_query_results_for_management_group_async(policy_states_resource, management_group_name, query_options:, custom_headers:custom_headers).value! response.body unless response.nil? end |
#list_query_results_for_management_group_async(policy_states_resource, management_group_name, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise
Queries policy states for the resources under the management group.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ to the HTTP request.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 75 def list_query_results_for_management_group_async(policy_states_resource, management_group_name, query_options:nil, custom_headers:nil) fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil? management_groups_namespace = 'Microsoft.Management' fail ArgumentError, 'management_group_name is nil' if management_group_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? top = nil order_by = nil select = nil from = nil to = nil filter = nil apply = nil unless .nil? top = .Top end unless .nil? order_by = .OrderBy end unless .nil? select = .Select end unless .nil? from = .From end unless .nil? to = .To end unless .nil? filter = .Filter end unless .nil? apply = .Apply end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'policyStatesResource' => policy_states_resource,'managementGroupsNamespace' => management_groups_namespace,'managementGroupName' => management_group_name}, query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::PolicyInsights::Mgmt::V2017_10_17_preview::Models::PolicyStatesQueryResults.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#list_query_results_for_management_group_with_http_info(policy_states_resource, management_group_name, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Queries policy states for the resources under the management group.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ will be added to the HTTP request.
57 58 59 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 57 def list_query_results_for_management_group_with_http_info(policy_states_resource, management_group_name, query_options:nil, custom_headers:nil) list_query_results_for_management_group_async(policy_states_resource, management_group_name, query_options:, custom_headers:custom_headers).value! end |
#list_query_results_for_resource(policy_states_resource, resource_id, query_options: nil, custom_headers: nil) ⇒ PolicyStatesQueryResults
Queries policy states for the resource.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ will be added to the HTTP request.
442 443 444 445 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 442 def list_query_results_for_resource(policy_states_resource, resource_id, query_options:nil, custom_headers:nil) response = list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:, custom_headers:custom_headers).value! response.body unless response.nil? end |
#list_query_results_for_resource_async(policy_states_resource, resource_id, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise
Queries policy states for the resource.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ to the HTTP request.
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 479 def list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:nil, custom_headers:nil) fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil? fail ArgumentError, 'resource_id is nil' if resource_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? top = nil order_by = nil select = nil from = nil to = nil filter = nil apply = nil unless .nil? top = .Top end unless .nil? order_by = .OrderBy end unless .nil? select = .Select end unless .nil? from = .From end unless .nil? to = .To end unless .nil? filter = .Filter end unless .nil? apply = .Apply end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'policyStatesResource' => policy_states_resource}, skip_encoding_path_params: {'resourceId' => resource_id}, query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::PolicyInsights::Mgmt::V2017_10_17_preview::Models::PolicyStatesQueryResults.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#list_query_results_for_resource_group(policy_states_resource, subscription_id, resource_group_name, query_options: nil, custom_headers: nil) ⇒ PolicyStatesQueryResults
Queries policy states for the resources under the resource group.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ will be added to the HTTP request.
306 307 308 309 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 306 def list_query_results_for_resource_group(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil) response = list_query_results_for_resource_group_async(policy_states_resource, subscription_id, resource_group_name, query_options:, custom_headers:custom_headers).value! response.body unless response.nil? end |
#list_query_results_for_resource_group_async(policy_states_resource, subscription_id, resource_group_name, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise
Queries policy states for the resources under the resource group.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ to the HTTP request.
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 345 def list_query_results_for_resource_group_async(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil) fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil? fail ArgumentError, 'subscription_id is nil' if subscription_id.nil? fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? top = nil order_by = nil select = nil from = nil to = nil filter = nil apply = nil unless .nil? top = .Top end unless .nil? order_by = .OrderBy end unless .nil? select = .Select end unless .nil? from = .From end unless .nil? to = .To end unless .nil? filter = .Filter end unless .nil? apply = .Apply end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name}, query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::PolicyInsights::Mgmt::V2017_10_17_preview::Models::PolicyStatesQueryResults.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#list_query_results_for_resource_group_with_http_info(policy_states_resource, subscription_id, resource_group_name, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Queries policy states for the resources under the resource group.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ will be added to the HTTP request.
326 327 328 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 326 def list_query_results_for_resource_group_with_http_info(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil) list_query_results_for_resource_group_async(policy_states_resource, subscription_id, resource_group_name, query_options:, custom_headers:custom_headers).value! end |
#list_query_results_for_resource_with_http_info(policy_states_resource, resource_id, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Queries policy states for the resource.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ will be added to the HTTP request.
461 462 463 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 461 def list_query_results_for_resource_with_http_info(policy_states_resource, resource_id, query_options:nil, custom_headers:nil) list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:, custom_headers:custom_headers).value! end |
#list_query_results_for_subscription(policy_states_resource, subscription_id, query_options: nil, custom_headers: nil) ⇒ PolicyStatesQueryResults
Queries policy states for the resources under the subscription.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ will be added to the HTTP request.
172 173 174 175 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 172 def list_query_results_for_subscription(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil) response = list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:, custom_headers:custom_headers).value! response.body unless response.nil? end |
#list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options: nil, custom_headers: nil) ⇒ Concurrent::Promise
Queries policy states for the resources under the subscription.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ to the HTTP request.
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 209 def list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil) fail ArgumentError, 'policy_states_resource is nil' if policy_states_resource.nil? fail ArgumentError, 'subscription_id is nil' if subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? top = nil order_by = nil select = nil from = nil to = nil filter = nil apply = nil unless .nil? top = .Top end unless .nil? order_by = .OrderBy end unless .nil? select = .Select end unless .nil? from = .From end unless .nil? to = .To end unless .nil? filter = .Filter end unless .nil? apply = .Apply end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id}, query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::PolicyInsights::Mgmt::V2017_10_17_preview::Models::PolicyStatesQueryResults.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#list_query_results_for_subscription_with_http_info(policy_states_resource, subscription_id, query_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Queries policy states for the resources under the subscription.
under PolicyStates resource type. In a given time range, ‘latest’ represents the latest policy state(s), whereas ‘default’ represents all policy state(s). Possible values include: ‘default’, ‘latest’ will be added to the HTTP request.
191 192 193 |
# File 'lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb', line 191 def list_query_results_for_subscription_with_http_info(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil) list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:, custom_headers:custom_headers).value! end |