class Azure::PolicyInsights::Mgmt::V2019_07_01::Remediations

Remediations

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 Remediations class. @param client service class for accessing basic functionality.

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

Public Instance Methods

cancel_at_management_group(management_group_id, remediation_name, custom_headers:nil) click to toggle source

Cancels a remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 135
def cancel_at_management_group(management_group_id, remediation_name, custom_headers:nil)
  response = cancel_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
cancel_at_management_group_async(management_group_id, remediation_name, custom_headers:nil) click to toggle source

Cancels a remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 164
def cancel_at_management_group_async(management_group_id, remediation_name, custom_headers:nil)
  management_groups_namespace = 'Microsoft.Management'
  fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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 = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id,'remediationName' => remediation_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
      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_07_01::Models::Remediation.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
cancel_at_management_group_with_http_info(management_group_id, remediation_name, custom_headers:nil) click to toggle source

Cancels a remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 150
def cancel_at_management_group_with_http_info(management_group_id, remediation_name, custom_headers:nil)
  cancel_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
end
cancel_at_resource(resource_id, remediation_name, custom_headers:nil) click to toggle source

Cancel a remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1908
def cancel_at_resource(resource_id, remediation_name, custom_headers:nil)
  response = cancel_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
cancel_at_resource_async(resource_id, remediation_name, custom_headers:nil) click to toggle source

Cancel a remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1937
def cancel_at_resource_async(resource_id, remediation_name, custom_headers:nil)
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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 = '{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'remediationName' => remediation_name},
      skip_encoding_path_params: {'resourceId' => resource_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
      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_07_01::Models::Remediation.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
cancel_at_resource_group(resource_group_name, remediation_name, custom_headers:nil) click to toggle source

Cancels a remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1309
def cancel_at_resource_group(resource_group_name, remediation_name, custom_headers:nil)
  response = cancel_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
cancel_at_resource_group_async(resource_group_name, remediation_name, custom_headers:nil) click to toggle source

Cancels a remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1338
def cancel_at_resource_group_async(resource_group_name, remediation_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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/remediations/{remediationName}/cancel'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'remediationName' => remediation_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
      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_07_01::Models::Remediation.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
cancel_at_resource_group_with_http_info(resource_group_name, remediation_name, custom_headers:nil) click to toggle source

Cancels a remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1324
def cancel_at_resource_group_with_http_info(resource_group_name, remediation_name, custom_headers:nil)
  cancel_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
end
cancel_at_resource_with_http_info(resource_id, remediation_name, custom_headers:nil) click to toggle source

Cancel a remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1923
def cancel_at_resource_with_http_info(resource_id, remediation_name, custom_headers:nil)
  cancel_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
end
cancel_at_subscription(remediation_name, custom_headers:nil) click to toggle source

Cancels a remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 729
def cancel_at_subscription(remediation_name, custom_headers:nil)
  response = cancel_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
cancel_at_subscription_async(remediation_name, custom_headers:nil) click to toggle source

Cancels a remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 756
def cancel_at_subscription_async(remediation_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'remediationName' => remediation_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
      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_07_01::Models::Remediation.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
cancel_at_subscription_with_http_info(remediation_name, custom_headers:nil) click to toggle source

Cancels a remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 743
def cancel_at_subscription_with_http_info(remediation_name, custom_headers:nil)
  cancel_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
end
create_or_update_at_management_group(management_group_id, remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 331
def create_or_update_at_management_group(management_group_id, remediation_name, parameters, custom_headers:nil)
  response = create_or_update_at_management_group_async(management_group_id, remediation_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_or_update_at_management_group_async(management_group_id, remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 362
def create_or_update_at_management_group_async(management_group_id, remediation_name, parameters, custom_headers:nil)
  management_groups_namespace = 'Microsoft.Management'
  fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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?

  # Serialize Request
  request_mapper = Azure::PolicyInsights::Mgmt::V2019_07_01::Models::Remediation.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, 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 == 201
      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_07_01::Models::Remediation.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
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PolicyInsights::Mgmt::V2019_07_01::Models::Remediation.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
create_or_update_at_management_group_with_http_info(management_group_id, remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 347
def create_or_update_at_management_group_with_http_info(management_group_id, remediation_name, parameters, custom_headers:nil)
  create_or_update_at_management_group_async(management_group_id, remediation_name, parameters, custom_headers:custom_headers).value!
end
create_or_update_at_resource(resource_id, remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2103
def create_or_update_at_resource(resource_id, remediation_name, parameters, custom_headers:nil)
  response = create_or_update_at_resource_async(resource_id, remediation_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_or_update_at_resource_async(resource_id, remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2134
def create_or_update_at_resource_async(resource_id, remediation_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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?

  # Serialize Request
  request_mapper = Azure::PolicyInsights::Mgmt::V2019_07_01::Models::Remediation.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'remediationName' => remediation_name},
      skip_encoding_path_params: {'resourceId' => resource_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, 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 == 201
      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_07_01::Models::Remediation.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
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PolicyInsights::Mgmt::V2019_07_01::Models::Remediation.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
create_or_update_at_resource_group(resource_group_name, remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1505
def create_or_update_at_resource_group(resource_group_name, remediation_name, parameters, custom_headers:nil)
  response = create_or_update_at_resource_group_async(resource_group_name, remediation_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_or_update_at_resource_group_async(resource_group_name, remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1536
def create_or_update_at_resource_group_async(resource_group_name, remediation_name, parameters, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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?

  # Serialize Request
  request_mapper = Azure::PolicyInsights::Mgmt::V2019_07_01::Models::Remediation.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, 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 == 201
      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_07_01::Models::Remediation.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
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PolicyInsights::Mgmt::V2019_07_01::Models::Remediation.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
create_or_update_at_resource_group_with_http_info(resource_group_name, remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1521
def create_or_update_at_resource_group_with_http_info(resource_group_name, remediation_name, parameters, custom_headers:nil)
  create_or_update_at_resource_group_async(resource_group_name, remediation_name, parameters, custom_headers:custom_headers).value!
end
create_or_update_at_resource_with_http_info(resource_id, remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2119
def create_or_update_at_resource_with_http_info(resource_id, remediation_name, parameters, custom_headers:nil)
  create_or_update_at_resource_async(resource_id, remediation_name, parameters, custom_headers:custom_headers).value!
end
create_or_update_at_subscription(remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 917
def create_or_update_at_subscription(remediation_name, parameters, custom_headers:nil)
  response = create_or_update_at_subscription_async(remediation_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_or_update_at_subscription_async(remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 946
def create_or_update_at_subscription_async(remediation_name, parameters, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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?

  # Serialize Request
  request_mapper = Azure::PolicyInsights::Mgmt::V2019_07_01::Models::Remediation.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, 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 == 201
      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_07_01::Models::Remediation.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
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::PolicyInsights::Mgmt::V2019_07_01::Models::Remediation.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
create_or_update_at_subscription_with_http_info(remediation_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @param parameters [Remediation] The remediation parameters. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 932
def create_or_update_at_subscription_with_http_info(remediation_name, parameters, custom_headers:nil)
  create_or_update_at_subscription_async(remediation_name, parameters, custom_headers:custom_headers).value!
end
delete_at_management_group(management_group_id, remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 539
def delete_at_management_group(management_group_id, remediation_name, custom_headers:nil)
  response = delete_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
delete_at_management_group_async(management_group_id, remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 568
def delete_at_management_group_async(management_group_id, remediation_name, custom_headers:nil)
  management_groups_namespace = 'Microsoft.Management'
  fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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 = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, 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 == 204
      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_07_01::Models::Remediation.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
delete_at_management_group_with_http_info(management_group_id, remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 554
def delete_at_management_group_with_http_info(management_group_id, remediation_name, custom_headers:nil)
  delete_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
end
delete_at_resource(resource_id, remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at individual resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2311
def delete_at_resource(resource_id, remediation_name, custom_headers:nil)
  response = delete_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
delete_at_resource_async(resource_id, remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at individual resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2340
def delete_at_resource_async(resource_id, remediation_name, custom_headers:nil)
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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 = '{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'remediationName' => remediation_name},
      skip_encoding_path_params: {'resourceId' => resource_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, 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 == 204
      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_07_01::Models::Remediation.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
delete_at_resource_group(resource_group_name, remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1713
def delete_at_resource_group(resource_group_name, remediation_name, custom_headers:nil)
  response = delete_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
delete_at_resource_group_async(resource_group_name, remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1742
def delete_at_resource_group_async(resource_group_name, remediation_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, 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 == 204
      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_07_01::Models::Remediation.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
delete_at_resource_group_with_http_info(resource_group_name, remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1728
def delete_at_resource_group_with_http_info(resource_group_name, remediation_name, custom_headers:nil)
  delete_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
end
delete_at_resource_with_http_info(resource_id, remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at individual resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2326
def delete_at_resource_with_http_info(resource_id, remediation_name, custom_headers:nil)
  delete_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
end
delete_at_subscription(remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1117
def delete_at_subscription(remediation_name, custom_headers:nil)
  response = delete_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
delete_at_subscription_async(remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1144
def delete_at_subscription_async(remediation_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, 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 == 204
      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_07_01::Models::Remediation.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
delete_at_subscription_with_http_info(remediation_name, custom_headers:nil) click to toggle source

Deletes an existing remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1131
def delete_at_subscription_with_http_info(remediation_name, custom_headers:nil)
  delete_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
end
get_at_management_group(management_group_id, remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 445
def get_at_management_group(management_group_id, remediation_name, custom_headers:nil)
  response = get_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_at_management_group_async(management_group_id, remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 474
def get_at_management_group_async(management_group_id, remediation_name, custom_headers:nil)
  management_groups_namespace = 'Microsoft.Management'
  fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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 = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, 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_07_01::Models::Remediation.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
get_at_management_group_with_http_info(management_group_id, remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 460
def get_at_management_group_with_http_info(management_group_id, remediation_name, custom_headers:nil)
  get_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
end
get_at_resource(resource_id, remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2217
def get_at_resource(resource_id, remediation_name, custom_headers:nil)
  response = get_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_at_resource_async(resource_id, remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2246
def get_at_resource_async(resource_id, remediation_name, custom_headers:nil)
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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 = '{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'remediationName' => remediation_name},
      skip_encoding_path_params: {'resourceId' => resource_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, 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_07_01::Models::Remediation.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
get_at_resource_group(resource_group_name, remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1619
def get_at_resource_group(resource_group_name, remediation_name, custom_headers:nil)
  response = get_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_at_resource_group_async(resource_group_name, remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1648
def get_at_resource_group_async(resource_group_name, remediation_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, 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_07_01::Models::Remediation.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
get_at_resource_group_with_http_info(resource_group_name, remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1634
def get_at_resource_group_with_http_info(resource_group_name, remediation_name, custom_headers:nil)
  get_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
end
get_at_resource_with_http_info(resource_id, remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2232
def get_at_resource_with_http_info(resource_id, remediation_name, custom_headers:nil)
  get_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
end
get_at_subscription(remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Remediation] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1027
def get_at_subscription(remediation_name, custom_headers:nil)
  response = get_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_at_subscription_async(remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1054
def get_at_subscription_async(remediation_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_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}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, 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_07_01::Models::Remediation.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
get_at_subscription_with_http_info(remediation_name, custom_headers:nil) click to toggle source

Gets an existing remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1041
def get_at_subscription_with_http_info(remediation_name, custom_headers:nil)
  get_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
end
list_deployments_at_management_group(management_group_id, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @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<RemediationDeployment>] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 35
def list_deployments_at_management_group(management_group_id, remediation_name, query_options:nil, custom_headers:nil)
  first_page = list_deployments_at_management_group_as_lazy(management_group_id, remediation_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_deployments_at_management_group_as_lazy(management_group_id, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @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 [RemediationDeploymentsListResult] which provide lazy access to pages of the response.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 3127
def list_deployments_at_management_group_as_lazy(management_group_id, remediation_name, query_options:nil, custom_headers:nil)
  response = list_deployments_at_management_group_async(management_group_id, remediation_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_deployments_at_management_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_deployments_at_management_group_async(management_group_id, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 66
def list_deployments_at_management_group_async(management_group_id, remediation_name, query_options:nil, custom_headers:nil)
  management_groups_namespace = 'Microsoft.Management'
  fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  unless query_options.nil?
    top = query_options.Top
  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/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version,'$top' => top},
      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_07_01::Models::RemediationDeploymentsListResult.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_deployments_at_management_group_next(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at management group scope.

@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 [RemediationDeploymentsListResult] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2405
def list_deployments_at_management_group_next(next_page_link, custom_headers:nil)
  response = list_deployments_at_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_deployments_at_management_group_next_async(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at management group scope.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2434
def list_deployments_at_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_07_01::Models::RemediationDeploymentsListResult.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_deployments_at_management_group_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at management group scope.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2420
def list_deployments_at_management_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_deployments_at_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_deployments_at_management_group_with_http_info(management_group_id, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at management group scope.

@param management_group_id [String] Management group ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 51
def list_deployments_at_management_group_with_http_info(management_group_id, remediation_name, query_options:nil, custom_headers:nil)
  list_deployments_at_management_group_async(management_group_id, remediation_name, query_options:query_options, custom_headers:custom_headers).value!
end
list_deployments_at_resource(resource_id, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @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<RemediationDeployment>] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1808
def list_deployments_at_resource(resource_id, remediation_name, query_options:nil, custom_headers:nil)
  first_page = list_deployments_at_resource_as_lazy(resource_id, remediation_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_deployments_at_resource_as_lazy(resource_id, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @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 [RemediationDeploymentsListResult] which provide lazy access to pages of the response.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 3260
def list_deployments_at_resource_as_lazy(resource_id, remediation_name, query_options:nil, custom_headers:nil)
  response = list_deployments_at_resource_async(resource_id, remediation_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_deployments_at_resource_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_deployments_at_resource_async(resource_id, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1839
def list_deployments_at_resource_async(resource_id, remediation_name, query_options:nil, custom_headers:nil)
  fail ArgumentError, 'resource_id is nil' if resource_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  unless query_options.nil?
    top = query_options.Top
  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/remediations/{remediationName}/listDeployments'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'remediationName' => remediation_name},
      skip_encoding_path_params: {'resourceId' => resource_id},
      query_params: {'api-version' => @client.api_version,'$top' => top},
      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_07_01::Models::RemediationDeploymentsListResult.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_deployments_at_resource_group(resource_group_name, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @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<RemediationDeployment>] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1209
def list_deployments_at_resource_group(resource_group_name, remediation_name, query_options:nil, custom_headers:nil)
  first_page = list_deployments_at_resource_group_as_lazy(resource_group_name, remediation_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_deployments_at_resource_group_as_lazy(resource_group_name, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @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 [RemediationDeploymentsListResult] which provide lazy access to pages of the response.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 3215
def list_deployments_at_resource_group_as_lazy(resource_group_name, remediation_name, query_options:nil, custom_headers:nil)
  response = list_deployments_at_resource_group_async(resource_group_name, remediation_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_deployments_at_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_deployments_at_resource_group_async(resource_group_name, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1240
def list_deployments_at_resource_group_async(resource_group_name, remediation_name, query_options:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  unless query_options.nil?
    top = query_options.Top
  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/remediations/{remediationName}/listDeployments'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version,'$top' => top},
      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_07_01::Models::RemediationDeploymentsListResult.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_deployments_at_resource_group_next(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource group scope.

@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 [RemediationDeploymentsListResult] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2765
def list_deployments_at_resource_group_next(next_page_link, custom_headers:nil)
  response = list_deployments_at_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_deployments_at_resource_group_next_async(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource group scope.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2794
def list_deployments_at_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_07_01::Models::RemediationDeploymentsListResult.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_deployments_at_resource_group_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource group scope.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2780
def list_deployments_at_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_deployments_at_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_deployments_at_resource_group_with_http_info(resource_group_name, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource group scope.

@param resource_group_name [String] Resource group name. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1225
def list_deployments_at_resource_group_with_http_info(resource_group_name, remediation_name, query_options:nil, custom_headers:nil)
  list_deployments_at_resource_group_async(resource_group_name, remediation_name, query_options:query_options, custom_headers:custom_headers).value!
end
list_deployments_at_resource_next(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource scope.

@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 [RemediationDeploymentsListResult] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2945
def list_deployments_at_resource_next(next_page_link, custom_headers:nil)
  response = list_deployments_at_resource_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_deployments_at_resource_next_async(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource scope.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2974
def list_deployments_at_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_07_01::Models::RemediationDeploymentsListResult.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_deployments_at_resource_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource scope.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2960
def list_deployments_at_resource_next_with_http_info(next_page_link, custom_headers:nil)
  list_deployments_at_resource_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_deployments_at_resource_with_http_info(resource_id, remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at resource scope.

@param resource_id [String] Resource ID. @param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1824
def list_deployments_at_resource_with_http_info(resource_id, remediation_name, query_options:nil, custom_headers:nil)
  list_deployments_at_resource_async(resource_id, remediation_name, query_options:query_options, custom_headers:custom_headers).value!
end
list_deployments_at_subscription(remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @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<RemediationDeployment>] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 633
def list_deployments_at_subscription(remediation_name, query_options:nil, custom_headers:nil)
  first_page = list_deployments_at_subscription_as_lazy(remediation_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_deployments_at_subscription_as_lazy(remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @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 [RemediationDeploymentsListResult] which provide lazy access to pages of the response.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 3171
def list_deployments_at_subscription_as_lazy(remediation_name, query_options:nil, custom_headers:nil)
  response = list_deployments_at_subscription_async(remediation_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_deployments_at_subscription_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_deployments_at_subscription_async(remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 662
def list_deployments_at_subscription_async(remediation_name, query_options:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  unless query_options.nil?
    top = query_options.Top
  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/remediations/{remediationName}/listDeployments'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'remediationName' => remediation_name},
      query_params: {'api-version' => @client.api_version,'$top' => top},
      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_07_01::Models::RemediationDeploymentsListResult.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_deployments_at_subscription_next(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at subscription scope.

@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 [RemediationDeploymentsListResult] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2585
def list_deployments_at_subscription_next(next_page_link, custom_headers:nil)
  response = list_deployments_at_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_deployments_at_subscription_next_async(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at subscription scope.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2614
def list_deployments_at_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_07_01::Models::RemediationDeploymentsListResult.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_deployments_at_subscription_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at subscription scope.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2600
def list_deployments_at_subscription_next_with_http_info(next_page_link, custom_headers:nil)
  list_deployments_at_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_deployments_at_subscription_with_http_info(remediation_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all deployments for a remediation at subscription scope.

@param remediation_name [String] The name of the remediation. @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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 648
def list_deployments_at_subscription_with_http_info(remediation_name, query_options:nil, custom_headers:nil)
  list_deployments_at_subscription_async(remediation_name, query_options:query_options, custom_headers:custom_headers).value!
end
list_for_management_group(management_group_id, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the management group.

@param management_group_id [String] Management group 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<Remediation>] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 229
def list_for_management_group(management_group_id, query_options:nil, custom_headers:nil)
  first_page = list_for_management_group_as_lazy(management_group_id, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_for_management_group_as_lazy(management_group_id, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the management group.

@param management_group_id [String] Management group 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 [RemediationListResult] which provide lazy access to pages of the response.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 3149
def list_for_management_group_as_lazy(management_group_id, query_options:nil, custom_headers:nil)
  response = list_for_management_group_async(management_group_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_for_management_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_for_management_group_async(management_group_id, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the management group.

@param management_group_id [String] Management group 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 258
def list_for_management_group_async(management_group_id, query_options:nil, custom_headers:nil)
  management_groups_namespace = 'Microsoft.Management'
  fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  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/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, 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_07_01::Models::RemediationListResult.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_for_management_group_next(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for 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 [RemediationListResult] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2495
def list_for_management_group_next(next_page_link, custom_headers:nil)
  response = list_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_for_management_group_next_async(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2524
def list_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(:get, 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_07_01::Models::RemediationListResult.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_for_management_group_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2510
def list_for_management_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_for_management_group_with_http_info(management_group_id, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the management group.

@param management_group_id [String] Management group 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 244
def list_for_management_group_with_http_info(management_group_id, query_options:nil, custom_headers:nil)
  list_for_management_group_async(management_group_id, query_options:query_options, custom_headers:custom_headers).value!
end
list_for_resource(resource_id, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for a 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 [Array<Remediation>] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2002
def list_for_resource(resource_id, query_options:nil, custom_headers:nil)
  first_page = list_for_resource_as_lazy(resource_id, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_for_resource_as_lazy(resource_id, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for a 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 [RemediationListResult] which provide lazy access to pages of the response.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 3282
def list_for_resource_as_lazy(resource_id, query_options:nil, custom_headers:nil)
  response = list_for_resource_async(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_for_resource_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_for_resource_async(resource_id, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for a 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2031
def list_for_resource_async(resource_id, query_options:nil, custom_headers: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
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  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/remediations'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'resourceId' => resource_id},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, 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_07_01::Models::RemediationListResult.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_for_resource_group(resource_group_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the subscription.

@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<Remediation>] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1403
def list_for_resource_group(resource_group_name, query_options:nil, custom_headers:nil)
  first_page = list_for_resource_group_as_lazy(resource_group_name, query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_for_resource_group_as_lazy(resource_group_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the subscription.

@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 [RemediationListResult] which provide lazy access to pages of the response.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 3237
def list_for_resource_group_as_lazy(resource_group_name, query_options:nil, custom_headers:nil)
  response = list_for_resource_group_async(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_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_for_resource_group_async(resource_group_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the subscription.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1432
def list_for_resource_group_async(resource_group_name, query_options:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.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
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  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/remediations'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, 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_07_01::Models::RemediationListResult.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_for_resource_group_next(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for 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 [RemediationListResult] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2855
def list_for_resource_group_next(next_page_link, custom_headers:nil)
  response = list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_for_resource_group_next_async(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2884
def list_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(:get, 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_07_01::Models::RemediationListResult.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_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2870
def list_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_for_resource_group_with_http_info(resource_group_name, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the subscription.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 1418
def list_for_resource_group_with_http_info(resource_group_name, query_options:nil, custom_headers:nil)
  list_for_resource_group_async(resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
end
list_for_resource_next(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for a 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 [RemediationListResult] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 3035
def list_for_resource_next(next_page_link, custom_headers:nil)
  response = list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_for_resource_next_async(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for a 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 3064
def list_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(:get, 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_07_01::Models::RemediationListResult.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_for_resource_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for a 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 3050
def list_for_resource_next_with_http_info(next_page_link, custom_headers:nil)
  list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_for_resource_with_http_info(resource_id, query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for a 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2017
def list_for_resource_with_http_info(resource_id, query_options:nil, custom_headers:nil)
  list_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
end
list_for_subscription(query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the subscription.

@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<Remediation>] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 819
def list_for_subscription(query_options:nil, custom_headers:nil)
  first_page = list_for_subscription_as_lazy(query_options:query_options, custom_headers:custom_headers)
  first_page.get_all_items
end
list_for_subscription_as_lazy(query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the subscription.

@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 [RemediationListResult] which provide lazy access to pages of the response.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 3192
def list_for_subscription_as_lazy(query_options:nil, custom_headers:nil)
  response = list_for_subscription_async(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_for_subscription_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_for_subscription_async(query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the subscription.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 846
def list_for_subscription_async(query_options:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

  top = nil
  filter = nil
  unless query_options.nil?
    top = query_options.Top
  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/remediations'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, 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_07_01::Models::RemediationListResult.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_for_subscription_next(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for 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 [RemediationListResult] operation results.

# File lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2675
def list_for_subscription_next(next_page_link, custom_headers:nil)
  response = list_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_for_subscription_next_async(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2704
def list_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(:get, 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_07_01::Models::RemediationListResult.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_for_subscription_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Gets all remediations for 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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 2690
def list_for_subscription_next_with_http_info(next_page_link, custom_headers:nil)
  list_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_for_subscription_with_http_info(query_options:nil, custom_headers:nil) click to toggle source

Gets all remediations for the subscription.

@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-07-01/generated/azure_mgmt_policy_insights/remediations.rb, line 833
def list_for_subscription_with_http_info(query_options:nil, custom_headers:nil)
  list_for_subscription_async(query_options:query_options, custom_headers:custom_headers).value!
end