class Azure::PolicyInsights::Mgmt::V2019_10_01::PolicyStates

PolicyStates

Attributes

client[R]

@return [PolicyInsightsClient] reference to the PolicyInsightsClient

Public Class Methods

new(client) click to toggle source

Creates and initializes a new instance of the PolicyStates class. @param client service class for accessing basic functionality.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 17
def initialize(client)
  @client = client
end

Public Instance Methods

begin_trigger_resource_group_evaluation(subscription_id, resource_group_name, custom_headers:nil) click to toggle source

Triggers a policy evaluation scan for all the resources under the resource group.

@param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2223
def begin_trigger_resource_group_evaluation(subscription_id, resource_group_name, custom_headers:nil)
  response = begin_trigger_resource_group_evaluation_async(subscription_id, resource_group_name, custom_headers:custom_headers).value!
  nil
end
begin_trigger_resource_group_evaluation_async(subscription_id, resource_group_name, custom_headers:nil) click to toggle source

Triggers a policy evaluation scan for all the resources under the resource group.

@param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2254
def begin_trigger_resource_group_evaluation_async(subscription_id, resource_group_name, custom_headers: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?


  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/latest/triggerEvaluation'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      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?

    result
  end

  promise.execute
end
begin_trigger_resource_group_evaluation_with_http_info(subscription_id, resource_group_name, custom_headers:nil) click to toggle source

Triggers a policy evaluation scan for all the resources under the resource group.

@param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2239
def begin_trigger_resource_group_evaluation_with_http_info(subscription_id, resource_group_name, custom_headers:nil)
  begin_trigger_resource_group_evaluation_async(subscription_id, resource_group_name, custom_headers:custom_headers).value!
end
begin_trigger_subscription_evaluation(subscription_id, custom_headers:nil) click to toggle source

Triggers a policy evaluation scan for all the resources under the subscription

@param subscription_id [String] Microsoft Azure subscription ID. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2141
def begin_trigger_subscription_evaluation(subscription_id, custom_headers:nil)
  response = begin_trigger_subscription_evaluation_async(subscription_id, custom_headers:custom_headers).value!
  nil
end
begin_trigger_subscription_evaluation_async(subscription_id, custom_headers:nil) click to toggle source

Triggers a policy evaluation scan for all the resources under the subscription

@param subscription_id [String] Microsoft Azure subscription ID. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2170
def begin_trigger_subscription_evaluation_async(subscription_id, custom_headers:nil)
  fail ArgumentError, 'subscription_id is nil' if subscription_id.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 = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      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?

    result
  end

  promise.execute
end
begin_trigger_subscription_evaluation_with_http_info(subscription_id, custom_headers:nil) click to toggle source

Triggers a policy evaluation scan for all the resources under the subscription

@param subscription_id [String] Microsoft Azure subscription ID. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2156
def begin_trigger_subscription_evaluation_with_http_info(subscription_id, custom_headers:nil)
  begin_trigger_subscription_evaluation_async(subscription_id, custom_headers:custom_headers).value!
end
list_query_results_for_management_group(policy_states_resource, management_group_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resources under the management group.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param management_group_name [String] Management group name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<PolicyState>] operation results.

# File lib/2019-10-01/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)
  first_page = list_query_results_for_management_group_as_lazy(policy_states_resource, management_group_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_query_results_for_management_group_as_lazy(policy_states_resource, management_group_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resources under the management group.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param management_group_name [String] Management group name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] which provide lazy access to pages of the response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 3033
def list_query_results_for_management_group_as_lazy(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:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_management_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_query_results_for_management_group_async(policy_states_resource, management_group_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resources under the management group.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param management_group_name [String] Management group name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/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
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  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

  options = {
      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,'$skiptoken' => skip_token},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_management_group_next(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resources under the management group.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2308
def list_query_results_for_management_group_next(next_page_link, custom_headers:nil)
  response = list_query_results_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_query_results_for_management_group_next_async(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resources under the management group.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2337
def list_query_results_for_management_group_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_management_group_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resources under the management group.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2323
def list_query_results_for_management_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_query_results_for_management_group_with_http_info(policy_states_resource, management_group_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resources under the management group.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param management_group_name [String] Management group name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/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:query_options, custom_headers:custom_headers).value!
end
list_query_results_for_policy_definition(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy definition.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_definition_name [String] Policy definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<PolicyState>] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1371
def list_query_results_for_policy_definition(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_policy_definition_as_lazy(policy_states_resource, subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_query_results_for_policy_definition_as_lazy(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy definition.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_definition_name [String] Policy definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] which provide lazy access to pages of the response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 3166
def list_query_results_for_policy_definition_as_lazy(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
  response = list_query_results_for_policy_definition_async(policy_states_resource, subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_policy_definition_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_query_results_for_policy_definition_async(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy definition.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_definition_name [String] Policy definition name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1410
def list_query_results_for_policy_definition_async(policy_states_resource, subscription_id, policy_definition_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?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_definition_name is nil' if policy_definition_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
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  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/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyDefinitionName' => policy_definition_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$skiptoken' => skip_token},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_policy_definition_next(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy definition.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2758
def list_query_results_for_policy_definition_next(next_page_link, custom_headers:nil)
  response = list_query_results_for_policy_definition_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_query_results_for_policy_definition_next_async(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy definition.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2787
def list_query_results_for_policy_definition_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_policy_definition_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy definition.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2773
def list_query_results_for_policy_definition_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_policy_definition_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_query_results_for_policy_definition_with_http_info(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy definition.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_definition_name [String] Policy definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1391
def list_query_results_for_policy_definition_with_http_info(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
  list_query_results_for_policy_definition_async(policy_states_resource, subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
end
list_query_results_for_policy_set_definition(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy set definition.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_set_definition_name [String] Policy set definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<PolicyState>] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1115
def list_query_results_for_policy_set_definition(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_policy_set_definition_as_lazy(policy_states_resource, subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_query_results_for_policy_set_definition_as_lazy(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy set definition.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_set_definition_name [String] Policy set definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] which provide lazy access to pages of the response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 3139
def list_query_results_for_policy_set_definition_as_lazy(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
  response = list_query_results_for_policy_set_definition_async(policy_states_resource, subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_policy_set_definition_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_query_results_for_policy_set_definition_async(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy set definition.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_set_definition_name [String] Policy set definition name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1154
def list_query_results_for_policy_set_definition_async(policy_states_resource, subscription_id, policy_set_definition_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?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_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
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  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/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policySetDefinitionName' => policy_set_definition_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$skiptoken' => skip_token},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_policy_set_definition_next(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy set definition.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2668
def list_query_results_for_policy_set_definition_next(next_page_link, custom_headers:nil)
  response = list_query_results_for_policy_set_definition_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_query_results_for_policy_set_definition_next_async(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy set definition.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2697
def list_query_results_for_policy_set_definition_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_policy_set_definition_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy set definition.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2683
def list_query_results_for_policy_set_definition_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_policy_set_definition_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_query_results_for_policy_set_definition_with_http_info(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy set definition.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_set_definition_name [String] Policy set definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1135
def list_query_results_for_policy_set_definition_with_http_info(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
  list_query_results_for_policy_set_definition_async(policy_states_resource, subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
end
list_query_results_for_resource(policy_states_resource, resource_id, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resource.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param resource_id [String] Resource ID. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<PolicyState>] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 786
def list_query_results_for_resource(policy_states_resource, resource_id, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_resource_as_lazy(policy_states_resource, resource_id, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_query_results_for_resource_as_lazy(policy_states_resource, resource_id, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resource.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param resource_id [String] Resource ID. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] which provide lazy access to pages of the response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 3112
def list_query_results_for_resource_as_lazy(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:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_resource_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resource.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param resource_id [String] Resource ID. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 823
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
  expand = nil
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    expand = query_options.Expand
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  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

  options = {
      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,'$expand' => expand,'$skiptoken' => skip_token},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, 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) click to toggle source

Queries policy states for the resources under the resource group.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<PolicyState>] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 533
def list_query_results_for_resource_group(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_resource_group_as_lazy(policy_states_resource, subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_query_results_for_resource_group_as_lazy(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resources under the resource group.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] which provide lazy access to pages of the response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 3086
def list_query_results_for_resource_group_as_lazy(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:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_query_results_for_resource_group_async(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resources under the resource group.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 572
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
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  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

  options = {
      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,'$skiptoken' => skip_token},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_resource_group_level_policy_assignment(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resource group level policy assignment.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<PolicyState>] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1884
def list_query_results_for_resource_group_level_policy_assignment(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_resource_group_level_policy_assignment_as_lazy(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_query_results_for_resource_group_level_policy_assignment_as_lazy(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resource group level policy assignment.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] which provide lazy access to pages of the response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 3221
def list_query_results_for_resource_group_level_policy_assignment_as_lazy(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
  response = list_query_results_for_resource_group_level_policy_assignment_async(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_resource_group_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_query_results_for_resource_group_level_policy_assignment_async(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resource group level policy assignment.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1925
def list_query_results_for_resource_group_level_policy_assignment_async(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
  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?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_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
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  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/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$skiptoken' => skip_token},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_resource_group_level_policy_assignment_next(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resource group level policy assignment.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2938
def list_query_results_for_resource_group_level_policy_assignment_next(next_page_link, custom_headers:nil)
  response = list_query_results_for_resource_group_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_query_results_for_resource_group_level_policy_assignment_next_async(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resource group level policy assignment.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2967
def list_query_results_for_resource_group_level_policy_assignment_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_resource_group_level_policy_assignment_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resource group level policy assignment.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2953
def list_query_results_for_resource_group_level_policy_assignment_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_resource_group_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_query_results_for_resource_group_level_policy_assignment_with_http_info(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resource group level policy assignment.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1905
def list_query_results_for_resource_group_level_policy_assignment_with_http_info(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
  list_query_results_for_resource_group_level_policy_assignment_async(policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
end
list_query_results_for_resource_group_next(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resources under the resource group.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2488
def list_query_results_for_resource_group_next(next_page_link, custom_headers:nil)
  response = list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_query_results_for_resource_group_next_async(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resources under the resource group.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2517
def list_query_results_for_resource_group_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resources under the resource group.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2503
def list_query_results_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_query_results_for_resource_group_with_http_info(policy_states_resource, subscription_id, resource_group_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resources under the resource group.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 553
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:query_options, custom_headers:custom_headers).value!
end
list_query_results_for_resource_next(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resource.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2578
def list_query_results_for_resource_next(next_page_link, custom_headers:nil)
  response = list_query_results_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_query_results_for_resource_next_async(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resource.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2607
def list_query_results_for_resource_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_resource_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resource.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2593
def list_query_results_for_resource_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_resource_next_async(next_page_link, 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) click to toggle source

Queries policy states for the resource.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param resource_id [String] Resource ID. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 805
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:query_options, custom_headers:custom_headers).value!
end
list_query_results_for_subscription(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resources under the subscription.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<PolicyState>] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 286
def list_query_results_for_subscription(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_subscription_as_lazy(policy_states_resource, subscription_id, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_query_results_for_subscription_as_lazy(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resources under the subscription.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] which provide lazy access to pages of the response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 3059
def list_query_results_for_subscription_as_lazy(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:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resources under the subscription.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 323
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
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  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

  options = {
      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,'$skiptoken' => skip_token},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_subscription_level_policy_assignment(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy assignment.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<PolicyState>] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1627
def list_query_results_for_subscription_level_policy_assignment(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
  first_page = list_query_results_for_subscription_level_policy_assignment_as_lazy(policy_states_resource, subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_query_results_for_subscription_level_policy_assignment_as_lazy(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy assignment.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] which provide lazy access to pages of the response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 3193
def list_query_results_for_subscription_level_policy_assignment_as_lazy(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
  response = list_query_results_for_subscription_level_policy_assignment_async(policy_states_resource, subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_query_results_for_subscription_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_query_results_for_subscription_level_policy_assignment_async(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy assignment.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1666
def list_query_results_for_subscription_level_policy_assignment_async(policy_states_resource, subscription_id, policy_assignment_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?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_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
  skip_token = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    order_by = query_options.OrderBy
  end
  unless query_options.nil?
    select = query_options.Select
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  end
  unless query_options.nil?
    apply = query_options.Apply
  end
  unless query_options.nil?
    skip_token = query_options.SkipToken
  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/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesResource' => policy_states_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply,'$skiptoken' => skip_token},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_subscription_level_policy_assignment_next(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy assignment.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2848
def list_query_results_for_subscription_level_policy_assignment_next(next_page_link, custom_headers:nil)
  response = list_query_results_for_subscription_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_query_results_for_subscription_level_policy_assignment_next_async(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy assignment.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2877
def list_query_results_for_subscription_level_policy_assignment_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_subscription_level_policy_assignment_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy assignment.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2863
def list_query_results_for_subscription_level_policy_assignment_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_subscription_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_query_results_for_subscription_level_policy_assignment_with_http_info(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the subscription level policy assignment.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1647
def list_query_results_for_subscription_level_policy_assignment_with_http_info(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
  list_query_results_for_subscription_level_policy_assignment_async(policy_states_resource, subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
end
list_query_results_for_subscription_next(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resources under the subscription.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PolicyStatesQueryResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2398
def list_query_results_for_subscription_next(next_page_link, custom_headers:nil)
  response = list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_query_results_for_subscription_next_async(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resources under the subscription.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2427
def list_query_results_for_subscription_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_query_results_for_subscription_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Queries policy states for the resources under the subscription.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2413
def list_query_results_for_subscription_next_with_http_info(next_page_link, custom_headers:nil)
  list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_query_results_for_subscription_with_http_info(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil) click to toggle source

Queries policy states for the resources under the subscription.

@param policy_states_resource [PolicyStatesResource] The virtual 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' @param subscription_id [String] Microsoft Azure subscription ID. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 305
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:query_options, custom_headers:custom_headers).value!
end
summarize_for_management_group(management_group_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resources under the management group.

@param management_group_name [String] Management group name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SummarizeResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 172
def summarize_for_management_group(management_group_name, query_options:nil, custom_headers:nil)
  response = summarize_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
summarize_for_management_group_async(management_group_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resources under the management group.

@param management_group_name [String] Management group name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 201
def summarize_for_management_group_async(management_group_name, query_options:nil, custom_headers:nil)
  policy_states_summary_resource = 'latest'
  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
  from = nil
  to = nil
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  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/{policyStatesSummaryResource}/summarize'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'managementGroupsNamespace' => management_groups_namespace,'managementGroupName' => management_group_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::Models::SummarizeResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
summarize_for_management_group_with_http_info(management_group_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resources under the management group.

@param management_group_name [String] Management group name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 187
def summarize_for_management_group_with_http_info(management_group_name, query_options:nil, custom_headers:nil)
  summarize_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
end
summarize_for_policy_definition(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the subscription level policy definition.

@param subscription_id [String] Microsoft Azure subscription ID. @param policy_definition_name [String] Policy definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SummarizeResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1509
def summarize_for_policy_definition(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
  response = summarize_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
summarize_for_policy_definition_async(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the subscription level policy definition.

@param subscription_id [String] Microsoft Azure subscription ID. @param policy_definition_name [String] Policy definition name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1540
def summarize_for_policy_definition_async(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
  policy_states_summary_resource = 'latest'
  fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  from = nil
  to = nil
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  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/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyDefinitionName' => policy_definition_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::Models::SummarizeResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
summarize_for_policy_definition_with_http_info(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the subscription level policy definition.

@param subscription_id [String] Microsoft Azure subscription ID. @param policy_definition_name [String] Policy definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1525
def summarize_for_policy_definition_with_http_info(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
  summarize_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
end
summarize_for_policy_set_definition(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the subscription level policy set definition.

@param subscription_id [String] Microsoft Azure subscription ID. @param policy_set_definition_name [String] Policy set definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SummarizeResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1253
def summarize_for_policy_set_definition(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
  response = summarize_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
summarize_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the subscription level policy set definition.

@param subscription_id [String] Microsoft Azure subscription ID. @param policy_set_definition_name [String] Policy set definition name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1284
def summarize_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
  policy_states_summary_resource = 'latest'
  fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  from = nil
  to = nil
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  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/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policySetDefinitionName' => policy_set_definition_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::Models::SummarizeResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
summarize_for_policy_set_definition_with_http_info(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the subscription level policy set definition.

@param subscription_id [String] Microsoft Azure subscription ID. @param policy_set_definition_name [String] Policy set definition name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1269
def summarize_for_policy_set_definition_with_http_info(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
  summarize_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
end
summarize_for_resource(resource_id, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resource.

@param resource_id [String] Resource ID. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SummarizeResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 924
def summarize_for_resource(resource_id, query_options:nil, custom_headers:nil)
  response = summarize_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
summarize_for_resource_async(resource_id, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resource.

@param resource_id [String] Resource ID. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 953
def summarize_for_resource_async(resource_id, query_options:nil, custom_headers:nil)
  policy_states_summary_resource = 'latest'
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  from = nil
  to = nil
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  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/{policyStatesSummaryResource}/summarize'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesSummaryResource' => policy_states_summary_resource},
      skip_encoding_path_params: {'resourceId' => resource_id},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::Models::SummarizeResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
summarize_for_resource_group(subscription_id, resource_group_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resources under the resource group.

@param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SummarizeResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 670
def summarize_for_resource_group(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
  response = summarize_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
summarize_for_resource_group_async(subscription_id, resource_group_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resources under the resource group.

@param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 701
def summarize_for_resource_group_async(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
  policy_states_summary_resource = 'latest'
  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
  from = nil
  to = nil
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  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/{policyStatesSummaryResource}/summarize'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::Models::SummarizeResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
summarize_for_resource_group_level_policy_assignment(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resource group level policy assignment.

@param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SummarizeResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2026
def summarize_for_resource_group_level_policy_assignment(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
  response = summarize_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
summarize_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resource group level policy assignment.

@param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2059
def summarize_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
  policy_states_summary_resource = 'latest'
  fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  from = nil
  to = nil
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  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/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::Models::SummarizeResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
summarize_for_resource_group_level_policy_assignment_with_http_info(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resource group level policy assignment.

@param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 2043
def summarize_for_resource_group_level_policy_assignment_with_http_info(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
  summarize_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
end
summarize_for_resource_group_with_http_info(subscription_id, resource_group_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resources under the resource group.

@param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 686
def summarize_for_resource_group_with_http_info(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
  summarize_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
end
summarize_for_resource_with_http_info(resource_id, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resource.

@param resource_id [String] Resource ID. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 939
def summarize_for_resource_with_http_info(resource_id, query_options:nil, custom_headers:nil)
  summarize_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
end
summarize_for_subscription(subscription_id, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resources under the subscription.

@param subscription_id [String] Microsoft Azure subscription ID. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SummarizeResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 419
def summarize_for_subscription(subscription_id, query_options:nil, custom_headers:nil)
  response = summarize_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
summarize_for_subscription_async(subscription_id, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resources under the subscription.

@param subscription_id [String] Microsoft Azure subscription ID. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 448
def summarize_for_subscription_async(subscription_id, query_options:nil, custom_headers:nil)
  policy_states_summary_resource = 'latest'
  fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  from = nil
  to = nil
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  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/{policyStatesSummaryResource}/summarize'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::Models::SummarizeResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
summarize_for_subscription_level_policy_assignment(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the subscription level policy assignment.

@param subscription_id [String] Microsoft Azure subscription ID. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SummarizeResults] operation results.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1765
def summarize_for_subscription_level_policy_assignment(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
  response = summarize_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
summarize_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the subscription level policy assignment.

@param subscription_id [String] Microsoft Azure subscription ID. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1796
def summarize_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
  policy_states_summary_resource = 'latest'
  fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
  authorization_namespace = 'Microsoft.Authorization'
  fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  from = nil
  to = nil
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  end
  unless query_options.nil?
    from = query_options.From
  end
  unless query_options.nil?
    to = query_options.To
  end
  unless query_options.nil?
    filter = query_options.Filter
  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/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyStatesSummaryResource' => policy_states_summary_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$from' => from,'$to' => to,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  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::V2019_10_01::Models::SummarizeResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
summarize_for_subscription_level_policy_assignment_with_http_info(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the subscription level policy assignment.

@param subscription_id [String] Microsoft Azure subscription ID. @param policy_assignment_name [String] Policy assignment name. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1781
def summarize_for_subscription_level_policy_assignment_with_http_info(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
  summarize_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
end
summarize_for_subscription_with_http_info(subscription_id, query_options:nil, custom_headers:nil) click to toggle source

Summarizes policy states for the resources under the subscription.

@param subscription_id [String] Microsoft Azure subscription ID. @param query_options [QueryOptions] Additional parameters for the operation @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 434
def summarize_for_subscription_with_http_info(subscription_id, query_options:nil, custom_headers:nil)
  summarize_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
end
trigger_resource_group_evaluation(subscription_id, resource_group_name, custom_headers:nil) click to toggle source

Triggers a policy evaluation scan for all the resources under the resource group.

@param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1070
def trigger_resource_group_evaluation(subscription_id, resource_group_name, custom_headers:nil)
  response = trigger_resource_group_evaluation_async(subscription_id, resource_group_name, custom_headers:custom_headers).value!
  nil
end
trigger_resource_group_evaluation_async(subscription_id, resource_group_name, custom_headers:nil) click to toggle source

@param subscription_id [String] Microsoft Azure subscription ID. @param resource_group_name [String] Resource group name. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1084
def trigger_resource_group_evaluation_async(subscription_id, resource_group_name, custom_headers:nil)
  # Send request
  promise = begin_trigger_resource_group_evaluation_async(subscription_id, resource_group_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
  end

  promise
end
trigger_subscription_evaluation(subscription_id, custom_headers:nil) click to toggle source

Triggers a policy evaluation scan for all the resources under the subscription

@param subscription_id [String] Microsoft Azure subscription ID. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1032
def trigger_subscription_evaluation(subscription_id, custom_headers:nil)
  response = trigger_subscription_evaluation_async(subscription_id, custom_headers:custom_headers).value!
  nil
end
trigger_subscription_evaluation_async(subscription_id, custom_headers:nil) click to toggle source

@param subscription_id [String] Microsoft Azure subscription ID. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb, line 1045
def trigger_subscription_evaluation_async(subscription_id, custom_headers:nil)
  # Send request
  promise = begin_trigger_subscription_evaluation_async(subscription_id, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
  end

  promise
end