# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::ServiceFabric::V6_2_0_9
  #
  # A service client - single point of access to the REST API.
  #
  class ServiceFabricClientAPIs < MsRestAzure::AzureServiceClient
    include MsRestAzure
    include MsRestAzure::Serialization

    # @return [String] the base URI of the service.
    attr_accessor :base_url

    # @return Credentials needed for the client to connect to Azure.
    attr_reader :credentials

    # @return [String] The preferred language for the response.
    attr_accessor :accept_language

    # @return [Integer] The retry timeout in seconds for Long Running
    # Operations. Default value is 30.
    attr_accessor :long_running_operation_retry_timeout

    # @return [Boolean] Whether a unique x-ms-client-request-id should be
    # generated. When set to true a unique x-ms-client-request-id value is
    # generated and included in each request. Default is true.
    attr_accessor :generate_client_request_id

    #
    # Creates initializes a new instance of the ServiceFabricClientAPIs class.
    # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
    # @param base_url [String] the base URI of the service.
    # @param options [Array] filters to be applied to the HTTP requests.
    #
    def initialize(credentials = nil, base_url = nil, options = nil)
      super(credentials, options)
      @base_url = base_url || 'http://localhost:19080'

      fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
      @credentials = credentials

      @accept_language = 'en-US'
      @long_running_operation_retry_timeout = 30
      @generate_client_request_id = true
      add_telemetry
    end

    #
    # Makes a request and returns the body of the response.
    # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
    # @param path [String] the path, relative to {base_url}.
    # @param options [Hash{String=>String}] specifying any request options like :body.
    # @return [Hash{String=>String}] containing the body of the response.
    # Example:
    #
    #  request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
    #  path = "/path"
    #  options = {
    #    body: request_content,
    #    query_params: {'api-version' => '2016-02-01'}
    #  }
    #  result = @client.make_request(:put, path, options)
    #
    def make_request(method, path, options = {})
      result = make_request_with_http_info(method, path, options)
      result.body unless result.nil?
    end

    #
    # Makes a request and returns the operation response.
    # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
    # @param path [String] the path, relative to {base_url}.
    # @param options [Hash{String=>String}] specifying any request options like :body.
    # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
    #
    def make_request_with_http_info(method, path, options = {})
      result = make_request_async(method, path, options).value!
      result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
      result
    end

    #
    # Makes a request asynchronously.
    # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
    # @param path [String] the path, relative to {base_url}.
    # @param options [Hash{String=>String}] specifying any request options like :body.
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def make_request_async(method, path, options = {})
      fail ArgumentError, 'method is nil' if method.nil?
      fail ArgumentError, 'path is nil' if path.nil?

      request_url = options[:base_url] || @base_url
      if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
        @request_headers['Content-Type'] = options[:headers]['Content-Type']
      end

      request_headers = @request_headers
      request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
      options.merge!({headers: request_headers.merge(options[:headers] || {})})
      options.merge!({credentials: @credentials}) unless @credentials.nil?

      super(request_url, method, path, options)
    end

    #
    # Get the Service Fabric cluster manifest.
    #
    # Get the Service Fabric cluster manifest. The cluster manifest contains
    # properties of the cluster that include different node types on the cluster,
    # security configurations, fault and upgrade domain topologies, etc.
    #
    # These properties are specified as part of the ClusterConfig.JSON file while
    # deploying a stand alone cluster. However, most of the information in the
    # cluster manifest
    # is generated internally by service fabric during cluster deployment in other
    # deployment scenarios (e.g. when using azure portal).
    #
    # The contents of the cluster manifest are for informational purposes only and
    # users are not expected to take a dependency on the format of the file
    # contents or its interpretation.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ClusterManifest] operation results.
    #
    def get_cluster_manifest(timeout:60, custom_headers:nil)
      response = get_cluster_manifest_async(timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get the Service Fabric cluster manifest.
    #
    # Get the Service Fabric cluster manifest. The cluster manifest contains
    # properties of the cluster that include different node types on the cluster,
    # security configurations, fault and upgrade domain topologies, etc.
    #
    # These properties are specified as part of the ClusterConfig.JSON file while
    # deploying a stand alone cluster. However, most of the information in the
    # cluster manifest
    # is generated internally by service fabric during cluster deployment in other
    # deployment scenarios (e.g. when using azure portal).
    #
    # The contents of the cluster manifest are for informational purposes only and
    # users are not expected to take a dependency on the format of the file
    # contents or its interpretation.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_manifest_with_http_info(timeout:60, custom_headers:nil)
      get_cluster_manifest_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Get the Service Fabric cluster manifest.
    #
    # Get the Service Fabric cluster manifest. The cluster manifest contains
    # properties of the cluster that include different node types on the cluster,
    # security configurations, fault and upgrade domain topologies, etc.
    #
    # These properties are specified as part of the ClusterConfig.JSON file while
    # deploying a stand alone cluster. However, most of the information in the
    # cluster manifest
    # is generated internally by service fabric during cluster deployment in other
    # deployment scenarios (e.g. when using azure portal).
    #
    # The contents of the cluster manifest are for informational purposes only and
    # users are not expected to take a dependency on the format of the file
    # contents or its interpretation.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_manifest_async(timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/GetClusterManifest'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ClusterManifest.mapper()
            result.body = self.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

    #
    # Gets the health of a Service Fabric cluster.
    #
    # Gets the health of a Service Fabric cluster.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the cluster based on the health state.
    # Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter to
    # filter the collection of nodes and applications returned based on their
    # aggregated health state.
    #
    # @param nodes_health_state_filter [Integer] Allows filtering of the node
    # health state objects returned in the result of cluster health query
    # based on their health state. The possible values for this parameter include
    # integer value of one of the
    # following health states. Only nodes that match the filter are returned. All
    # nodes are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of nodes with
    # HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param applications_health_state_filter [Integer] Allows filtering of the
    # application health state objects returned in the result of cluster health
    # query based on their health state.
    # The possible values for this parameter include integer value obtained from
    # members or bitwise operations
    # on members of HealthStateFilter enumeration. Only applications that match the
    # filter are returned.
    # All applications are used to evaluate the aggregated health state. If not
    # specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of applications
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param include_system_application_health_statistics [Boolean] Indicates
    # whether the health statistics should include the fabric:/System application
    # health statistics. False by default.
    # If IncludeSystemApplicationHealthStatistics is set to true, the health
    # statistics include the entities that belong to the fabric:/System
    # application.
    # Otherwise, the query result includes health statistics only for user
    # applications.
    # The health statistics must be included in the query result for this parameter
    # to be applied.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ClusterHealth] operation results.
    #
    def get_cluster_health(nodes_health_state_filter:0, applications_health_state_filter:0, events_health_state_filter:0, exclude_health_statistics:false, include_system_application_health_statistics:false, timeout:60, custom_headers:nil)
      response = get_cluster_health_async(nodes_health_state_filter:nodes_health_state_filter, applications_health_state_filter:applications_health_state_filter, events_health_state_filter:events_health_state_filter, exclude_health_statistics:exclude_health_statistics, include_system_application_health_statistics:include_system_application_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of a Service Fabric cluster.
    #
    # Gets the health of a Service Fabric cluster.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the cluster based on the health state.
    # Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter to
    # filter the collection of nodes and applications returned based on their
    # aggregated health state.
    #
    # @param nodes_health_state_filter [Integer] Allows filtering of the node
    # health state objects returned in the result of cluster health query
    # based on their health state. The possible values for this parameter include
    # integer value of one of the
    # following health states. Only nodes that match the filter are returned. All
    # nodes are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of nodes with
    # HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param applications_health_state_filter [Integer] Allows filtering of the
    # application health state objects returned in the result of cluster health
    # query based on their health state.
    # The possible values for this parameter include integer value obtained from
    # members or bitwise operations
    # on members of HealthStateFilter enumeration. Only applications that match the
    # filter are returned.
    # All applications are used to evaluate the aggregated health state. If not
    # specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of applications
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param include_system_application_health_statistics [Boolean] Indicates
    # whether the health statistics should include the fabric:/System application
    # health statistics. False by default.
    # If IncludeSystemApplicationHealthStatistics is set to true, the health
    # statistics include the entities that belong to the fabric:/System
    # application.
    # Otherwise, the query result includes health statistics only for user
    # applications.
    # The health statistics must be included in the query result for this parameter
    # to be applied.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_health_with_http_info(nodes_health_state_filter:0, applications_health_state_filter:0, events_health_state_filter:0, exclude_health_statistics:false, include_system_application_health_statistics:false, timeout:60, custom_headers:nil)
      get_cluster_health_async(nodes_health_state_filter:nodes_health_state_filter, applications_health_state_filter:applications_health_state_filter, events_health_state_filter:events_health_state_filter, exclude_health_statistics:exclude_health_statistics, include_system_application_health_statistics:include_system_application_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of a Service Fabric cluster.
    #
    # Gets the health of a Service Fabric cluster.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the cluster based on the health state.
    # Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter to
    # filter the collection of nodes and applications returned based on their
    # aggregated health state.
    #
    # @param nodes_health_state_filter [Integer] Allows filtering of the node
    # health state objects returned in the result of cluster health query
    # based on their health state. The possible values for this parameter include
    # integer value of one of the
    # following health states. Only nodes that match the filter are returned. All
    # nodes are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of nodes with
    # HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param applications_health_state_filter [Integer] Allows filtering of the
    # application health state objects returned in the result of cluster health
    # query based on their health state.
    # The possible values for this parameter include integer value obtained from
    # members or bitwise operations
    # on members of HealthStateFilter enumeration. Only applications that match the
    # filter are returned.
    # All applications are used to evaluate the aggregated health state. If not
    # specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of applications
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param include_system_application_health_statistics [Boolean] Indicates
    # whether the health statistics should include the fabric:/System application
    # health statistics. False by default.
    # If IncludeSystemApplicationHealthStatistics is set to true, the health
    # statistics include the entities that belong to the fabric:/System
    # application.
    # Otherwise, the query result includes health statistics only for user
    # applications.
    # The health statistics must be included in the query result for this parameter
    # to be applied.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_health_async(nodes_health_state_filter:0, applications_health_state_filter:0, events_health_state_filter:0, exclude_health_statistics:false, include_system_application_health_statistics:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/GetClusterHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'NodesHealthStateFilter' => nodes_health_state_filter,'ApplicationsHealthStateFilter' => applications_health_state_filter,'EventsHealthStateFilter' => events_health_state_filter,'ExcludeHealthStatistics' => exclude_health_statistics,'IncludeSystemApplicationHealthStatistics' => include_system_application_health_statistics,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ClusterHealth.mapper()
            result.body = self.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

    #
    # Gets the health of a Service Fabric cluster using the specified policy.
    #
    # Gets the health of a Service Fabric cluster.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the cluster based on the health state.
    # Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter to
    # filter the collection of nodes and applications returned based on their
    # aggregated health state.
    # Use ClusterHealthPolicies to override the health policies used to evaluate
    # the health.
    #
    # @param nodes_health_state_filter [Integer] Allows filtering of the node
    # health state objects returned in the result of cluster health query
    # based on their health state. The possible values for this parameter include
    # integer value of one of the
    # following health states. Only nodes that match the filter are returned. All
    # nodes are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of nodes with
    # HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param applications_health_state_filter [Integer] Allows filtering of the
    # application health state objects returned in the result of cluster health
    # query based on their health state.
    # The possible values for this parameter include integer value obtained from
    # members or bitwise operations
    # on members of HealthStateFilter enumeration. Only applications that match the
    # filter are returned.
    # All applications are used to evaluate the aggregated health state. If not
    # specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of applications
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param include_system_application_health_statistics [Boolean] Indicates
    # whether the health statistics should include the fabric:/System application
    # health statistics. False by default.
    # If IncludeSystemApplicationHealthStatistics is set to true, the health
    # statistics include the entities that belong to the fabric:/System
    # application.
    # Otherwise, the query result includes health statistics only for user
    # applications.
    # The health statistics must be included in the query result for this parameter
    # to be applied.
    # @param cluster_health_policies [ClusterHealthPolicies] Describes the health
    # policies used to evaluate the cluster health.
    # If not present, the health evaluation uses the cluster health policy defined
    # in the cluster manifest or the default cluster health policy.
    # By default, each application is evaluated using its specific application
    # health policy, defined in the application manifest, or the default health
    # policy, if no policy is defined in manifest.
    # If the application health policy map is specified, and it has an entry for an
    # application, the specified application health policy
    # is used to evaluate the application health.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ClusterHealth] operation results.
    #
    def get_cluster_health_using_policy(nodes_health_state_filter:0, applications_health_state_filter:0, events_health_state_filter:0, exclude_health_statistics:false, include_system_application_health_statistics:false, cluster_health_policies:nil, timeout:60, custom_headers:nil)
      response = get_cluster_health_using_policy_async(nodes_health_state_filter:nodes_health_state_filter, applications_health_state_filter:applications_health_state_filter, events_health_state_filter:events_health_state_filter, exclude_health_statistics:exclude_health_statistics, include_system_application_health_statistics:include_system_application_health_statistics, cluster_health_policies:cluster_health_policies, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of a Service Fabric cluster using the specified policy.
    #
    # Gets the health of a Service Fabric cluster.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the cluster based on the health state.
    # Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter to
    # filter the collection of nodes and applications returned based on their
    # aggregated health state.
    # Use ClusterHealthPolicies to override the health policies used to evaluate
    # the health.
    #
    # @param nodes_health_state_filter [Integer] Allows filtering of the node
    # health state objects returned in the result of cluster health query
    # based on their health state. The possible values for this parameter include
    # integer value of one of the
    # following health states. Only nodes that match the filter are returned. All
    # nodes are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of nodes with
    # HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param applications_health_state_filter [Integer] Allows filtering of the
    # application health state objects returned in the result of cluster health
    # query based on their health state.
    # The possible values for this parameter include integer value obtained from
    # members or bitwise operations
    # on members of HealthStateFilter enumeration. Only applications that match the
    # filter are returned.
    # All applications are used to evaluate the aggregated health state. If not
    # specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of applications
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param include_system_application_health_statistics [Boolean] Indicates
    # whether the health statistics should include the fabric:/System application
    # health statistics. False by default.
    # If IncludeSystemApplicationHealthStatistics is set to true, the health
    # statistics include the entities that belong to the fabric:/System
    # application.
    # Otherwise, the query result includes health statistics only for user
    # applications.
    # The health statistics must be included in the query result for this parameter
    # to be applied.
    # @param cluster_health_policies [ClusterHealthPolicies] Describes the health
    # policies used to evaluate the cluster health.
    # If not present, the health evaluation uses the cluster health policy defined
    # in the cluster manifest or the default cluster health policy.
    # By default, each application is evaluated using its specific application
    # health policy, defined in the application manifest, or the default health
    # policy, if no policy is defined in manifest.
    # If the application health policy map is specified, and it has an entry for an
    # application, the specified application health policy
    # is used to evaluate the application health.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_health_using_policy_with_http_info(nodes_health_state_filter:0, applications_health_state_filter:0, events_health_state_filter:0, exclude_health_statistics:false, include_system_application_health_statistics:false, cluster_health_policies:nil, timeout:60, custom_headers:nil)
      get_cluster_health_using_policy_async(nodes_health_state_filter:nodes_health_state_filter, applications_health_state_filter:applications_health_state_filter, events_health_state_filter:events_health_state_filter, exclude_health_statistics:exclude_health_statistics, include_system_application_health_statistics:include_system_application_health_statistics, cluster_health_policies:cluster_health_policies, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of a Service Fabric cluster using the specified policy.
    #
    # Gets the health of a Service Fabric cluster.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the cluster based on the health state.
    # Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter to
    # filter the collection of nodes and applications returned based on their
    # aggregated health state.
    # Use ClusterHealthPolicies to override the health policies used to evaluate
    # the health.
    #
    # @param nodes_health_state_filter [Integer] Allows filtering of the node
    # health state objects returned in the result of cluster health query
    # based on their health state. The possible values for this parameter include
    # integer value of one of the
    # following health states. Only nodes that match the filter are returned. All
    # nodes are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of nodes with
    # HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param applications_health_state_filter [Integer] Allows filtering of the
    # application health state objects returned in the result of cluster health
    # query based on their health state.
    # The possible values for this parameter include integer value obtained from
    # members or bitwise operations
    # on members of HealthStateFilter enumeration. Only applications that match the
    # filter are returned.
    # All applications are used to evaluate the aggregated health state. If not
    # specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these values obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of applications
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param include_system_application_health_statistics [Boolean] Indicates
    # whether the health statistics should include the fabric:/System application
    # health statistics. False by default.
    # If IncludeSystemApplicationHealthStatistics is set to true, the health
    # statistics include the entities that belong to the fabric:/System
    # application.
    # Otherwise, the query result includes health statistics only for user
    # applications.
    # The health statistics must be included in the query result for this parameter
    # to be applied.
    # @param cluster_health_policies [ClusterHealthPolicies] Describes the health
    # policies used to evaluate the cluster health.
    # If not present, the health evaluation uses the cluster health policy defined
    # in the cluster manifest or the default cluster health policy.
    # By default, each application is evaluated using its specific application
    # health policy, defined in the application manifest, or the default health
    # policy, if no policy is defined in manifest.
    # If the application health policy map is specified, and it has an entry for an
    # application, the specified application health policy
    # is used to evaluate the application health.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_health_using_policy_async(nodes_health_state_filter:0, applications_health_state_filter:0, events_health_state_filter:0, exclude_health_statistics:false, include_system_application_health_statistics:false, cluster_health_policies:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ClusterHealthPolicies.mapper()
      request_content = self.serialize(request_mapper,  cluster_health_policies)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/GetClusterHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'NodesHealthStateFilter' => nodes_health_state_filter,'ApplicationsHealthStateFilter' => applications_health_state_filter,'EventsHealthStateFilter' => events_health_state_filter,'ExcludeHealthStatistics' => exclude_health_statistics,'IncludeSystemApplicationHealthStatistics' => include_system_application_health_statistics,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ClusterHealth.mapper()
            result.body = self.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

    #
    # Gets the health of a Service Fabric cluster using health chunks.
    #
    # Gets the health of a Service Fabric cluster using health chunks. Includes the
    # aggregated health state of the cluster, but none of the cluster entities.
    # To expand the cluster health and get the health state of all or some of the
    # entities, use the POST URI and specify the cluster health chunk query
    # description.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ClusterHealthChunk] operation results.
    #
    def get_cluster_health_chunk(timeout:60, custom_headers:nil)
      response = get_cluster_health_chunk_async(timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of a Service Fabric cluster using health chunks.
    #
    # Gets the health of a Service Fabric cluster using health chunks. Includes the
    # aggregated health state of the cluster, but none of the cluster entities.
    # To expand the cluster health and get the health state of all or some of the
    # entities, use the POST URI and specify the cluster health chunk query
    # description.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_health_chunk_with_http_info(timeout:60, custom_headers:nil)
      get_cluster_health_chunk_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of a Service Fabric cluster using health chunks.
    #
    # Gets the health of a Service Fabric cluster using health chunks. Includes the
    # aggregated health state of the cluster, but none of the cluster entities.
    # To expand the cluster health and get the health state of all or some of the
    # entities, use the POST URI and specify the cluster health chunk query
    # description.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_health_chunk_async(timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/GetClusterHealthChunk'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ClusterHealthChunk.mapper()
            result.body = self.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

    #
    # Gets the health of a Service Fabric cluster using health chunks.
    #
    # Gets the health of a Service Fabric cluster using health chunks. The health
    # evaluation is done based on the input cluster health chunk query description.
    # The query description allows users to specify health policies for evaluating
    # the cluster and its children.
    # Users can specify very flexible filters to select which cluster entities to
    # return. The selection can be done based on the entities health state and
    # based on the hierarchy.
    # The query can return multi-level children of the entities based on the
    # specified filters. For example, it can return one application with a
    # specified name, and for this application, return
    # only services that are in Error or Warning, and all partitions and replicas
    # for one of these services.
    #
    # @param cluster_health_chunk_query_description
    # [ClusterHealthChunkQueryDescription] Describes the cluster and application
    # health policies used to evaluate the cluster health and the filters to select
    # which cluster entities to be returned.
    # If the cluster health policy is present, it is used to evaluate the cluster
    # events and the cluster nodes. If not present, the health evaluation uses the
    # cluster health policy defined in the cluster manifest or the default cluster
    # health policy.
    # By default, each application is evaluated using its specific application
    # health policy, defined in the application manifest, or the default health
    # policy, if no policy is defined in manifest.
    # If the application health policy map is specified, and it has an entry for an
    # application, the specified application health policy
    # is used to evaluate the application health.
    # Users can specify very flexible filters to select which cluster entities to
    # include in response. The selection can be done based on the entities health
    # state and based on the hierarchy.
    # The query can return multi-level children of the entities based on the
    # specified filters. For example, it can return one application with a
    # specified name, and for this application, return
    # only services that are in Error or Warning, and all partitions and replicas
    # for one of these services.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ClusterHealthChunk] operation results.
    #
    def get_cluster_health_chunk_using_policy_and_advanced_filters(cluster_health_chunk_query_description:nil, timeout:60, custom_headers:nil)
      response = get_cluster_health_chunk_using_policy_and_advanced_filters_async(cluster_health_chunk_query_description:cluster_health_chunk_query_description, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of a Service Fabric cluster using health chunks.
    #
    # Gets the health of a Service Fabric cluster using health chunks. The health
    # evaluation is done based on the input cluster health chunk query description.
    # The query description allows users to specify health policies for evaluating
    # the cluster and its children.
    # Users can specify very flexible filters to select which cluster entities to
    # return. The selection can be done based on the entities health state and
    # based on the hierarchy.
    # The query can return multi-level children of the entities based on the
    # specified filters. For example, it can return one application with a
    # specified name, and for this application, return
    # only services that are in Error or Warning, and all partitions and replicas
    # for one of these services.
    #
    # @param cluster_health_chunk_query_description
    # [ClusterHealthChunkQueryDescription] Describes the cluster and application
    # health policies used to evaluate the cluster health and the filters to select
    # which cluster entities to be returned.
    # If the cluster health policy is present, it is used to evaluate the cluster
    # events and the cluster nodes. If not present, the health evaluation uses the
    # cluster health policy defined in the cluster manifest or the default cluster
    # health policy.
    # By default, each application is evaluated using its specific application
    # health policy, defined in the application manifest, or the default health
    # policy, if no policy is defined in manifest.
    # If the application health policy map is specified, and it has an entry for an
    # application, the specified application health policy
    # is used to evaluate the application health.
    # Users can specify very flexible filters to select which cluster entities to
    # include in response. The selection can be done based on the entities health
    # state and based on the hierarchy.
    # The query can return multi-level children of the entities based on the
    # specified filters. For example, it can return one application with a
    # specified name, and for this application, return
    # only services that are in Error or Warning, and all partitions and replicas
    # for one of these services.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_health_chunk_using_policy_and_advanced_filters_with_http_info(cluster_health_chunk_query_description:nil, timeout:60, custom_headers:nil)
      get_cluster_health_chunk_using_policy_and_advanced_filters_async(cluster_health_chunk_query_description:cluster_health_chunk_query_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of a Service Fabric cluster using health chunks.
    #
    # Gets the health of a Service Fabric cluster using health chunks. The health
    # evaluation is done based on the input cluster health chunk query description.
    # The query description allows users to specify health policies for evaluating
    # the cluster and its children.
    # Users can specify very flexible filters to select which cluster entities to
    # return. The selection can be done based on the entities health state and
    # based on the hierarchy.
    # The query can return multi-level children of the entities based on the
    # specified filters. For example, it can return one application with a
    # specified name, and for this application, return
    # only services that are in Error or Warning, and all partitions and replicas
    # for one of these services.
    #
    # @param cluster_health_chunk_query_description
    # [ClusterHealthChunkQueryDescription] Describes the cluster and application
    # health policies used to evaluate the cluster health and the filters to select
    # which cluster entities to be returned.
    # If the cluster health policy is present, it is used to evaluate the cluster
    # events and the cluster nodes. If not present, the health evaluation uses the
    # cluster health policy defined in the cluster manifest or the default cluster
    # health policy.
    # By default, each application is evaluated using its specific application
    # health policy, defined in the application manifest, or the default health
    # policy, if no policy is defined in manifest.
    # If the application health policy map is specified, and it has an entry for an
    # application, the specified application health policy
    # is used to evaluate the application health.
    # Users can specify very flexible filters to select which cluster entities to
    # include in response. The selection can be done based on the entities health
    # state and based on the hierarchy.
    # The query can return multi-level children of the entities based on the
    # specified filters. For example, it can return one application with a
    # specified name, and for this application, return
    # only services that are in Error or Warning, and all partitions and replicas
    # for one of these services.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_health_chunk_using_policy_and_advanced_filters_async(cluster_health_chunk_query_description:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ClusterHealthChunkQueryDescription.mapper()
      request_content = self.serialize(request_mapper,  cluster_health_chunk_query_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/GetClusterHealthChunk'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ClusterHealthChunk.mapper()
            result.body = self.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

    #
    # Sends a health report on the Service Fabric cluster.
    #
    # Sends a health report on a Service Fabric cluster. The report must contain
    # the information about the source of the health report and property on which
    # it is reported.
    # The report is sent to a Service Fabric gateway node, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetClusterHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def report_cluster_health(health_information, immediate:false, timeout:60, custom_headers:nil)
      response = report_cluster_health_async(health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Sends a health report on the Service Fabric cluster.
    #
    # Sends a health report on a Service Fabric cluster. The report must contain
    # the information about the source of the health report and property on which
    # it is reported.
    # The report is sent to a Service Fabric gateway node, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetClusterHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_cluster_health_with_http_info(health_information, immediate:false, timeout:60, custom_headers:nil)
      report_cluster_health_async(health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Sends a health report on the Service Fabric cluster.
    #
    # Sends a health report on a Service Fabric cluster. The report must contain
    # the information about the source of the health report and property on which
    # it is reported.
    # The report is sent to a Service Fabric gateway node, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetClusterHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_cluster_health_async(health_information, immediate:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'health_information is nil' if health_information.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::HealthInformation.mapper()
      request_content = self.serialize(request_mapper,  health_information)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/ReportClusterHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'Immediate' => immediate,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets a list of fabric code versions that are provisioned in a Service Fabric
    # cluster.
    #
    # Gets a list of information about fabric code versions that are provisioned in
    # the cluster. The parameter CodeVersion can be used to optionally filter the
    # output to only that particular version.
    #
    # @param code_version [String] The product version of Service Fabric.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_provisioned_fabric_code_version_info_list(code_version:nil, timeout:60, custom_headers:nil)
      response = get_provisioned_fabric_code_version_info_list_async(code_version:code_version, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets a list of fabric code versions that are provisioned in a Service Fabric
    # cluster.
    #
    # Gets a list of information about fabric code versions that are provisioned in
    # the cluster. The parameter CodeVersion can be used to optionally filter the
    # output to only that particular version.
    #
    # @param code_version [String] The product version of Service Fabric.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_provisioned_fabric_code_version_info_list_with_http_info(code_version:nil, timeout:60, custom_headers:nil)
      get_provisioned_fabric_code_version_info_list_async(code_version:code_version, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets a list of fabric code versions that are provisioned in a Service Fabric
    # cluster.
    #
    # Gets a list of information about fabric code versions that are provisioned in
    # the cluster. The parameter CodeVersion can be used to optionally filter the
    # output to only that particular version.
    #
    # @param code_version [String] The product version of Service Fabric.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_provisioned_fabric_code_version_info_list_async(code_version:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/GetProvisionedCodeVersions'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'CodeVersion' => code_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'FabricCodeVersionInfoElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'FabricCodeVersionInfo'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets a list of fabric config versions that are provisioned in a Service
    # Fabric cluster.
    #
    # Gets a list of information about fabric config versions that are provisioned
    # in the cluster. The parameter ConfigVersion can be used to optionally filter
    # the output to only that particular version.
    #
    # @param config_version [String] The config version of Service Fabric.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_provisioned_fabric_config_version_info_list(config_version:nil, timeout:60, custom_headers:nil)
      response = get_provisioned_fabric_config_version_info_list_async(config_version:config_version, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets a list of fabric config versions that are provisioned in a Service
    # Fabric cluster.
    #
    # Gets a list of information about fabric config versions that are provisioned
    # in the cluster. The parameter ConfigVersion can be used to optionally filter
    # the output to only that particular version.
    #
    # @param config_version [String] The config version of Service Fabric.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_provisioned_fabric_config_version_info_list_with_http_info(config_version:nil, timeout:60, custom_headers:nil)
      get_provisioned_fabric_config_version_info_list_async(config_version:config_version, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets a list of fabric config versions that are provisioned in a Service
    # Fabric cluster.
    #
    # Gets a list of information about fabric config versions that are provisioned
    # in the cluster. The parameter ConfigVersion can be used to optionally filter
    # the output to only that particular version.
    #
    # @param config_version [String] The config version of Service Fabric.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_provisioned_fabric_config_version_info_list_async(config_version:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/GetProvisionedConfigVersions'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'ConfigVersion' => config_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'FabricConfigVersionInfoElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'FabricConfigVersionInfo'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets the progress of the current cluster upgrade.
    #
    # Gets the current progress of the ongoing cluster upgrade. If no upgrade is
    # currently in progress, gets the last state of the previous cluster upgrade.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ClusterUpgradeProgressObject] operation results.
    #
    def get_cluster_upgrade_progress(timeout:60, custom_headers:nil)
      response = get_cluster_upgrade_progress_async(timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the progress of the current cluster upgrade.
    #
    # Gets the current progress of the ongoing cluster upgrade. If no upgrade is
    # currently in progress, gets the last state of the previous cluster upgrade.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_upgrade_progress_with_http_info(timeout:60, custom_headers:nil)
      get_cluster_upgrade_progress_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the progress of the current cluster upgrade.
    #
    # Gets the current progress of the ongoing cluster upgrade. If no upgrade is
    # currently in progress, gets the last state of the previous cluster upgrade.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_upgrade_progress_async(timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/GetUpgradeProgress'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ClusterUpgradeProgressObject.mapper()
            result.body = self.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 the Service Fabric standalone cluster configuration.
    #
    # Get the Service Fabric standalone cluster configuration. The cluster
    # configuration contains properties of the cluster that include different node
    # types on the cluster,
    # security configurations, fault and upgrade domain topologies, etc.
    #
    # @param configuration_api_version [String] The API version of the Standalone
    # cluster json configuration.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ClusterConfiguration] operation results.
    #
    def get_cluster_configuration(configuration_api_version, timeout:60, custom_headers:nil)
      response = get_cluster_configuration_async(configuration_api_version, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get the Service Fabric standalone cluster configuration.
    #
    # Get the Service Fabric standalone cluster configuration. The cluster
    # configuration contains properties of the cluster that include different node
    # types on the cluster,
    # security configurations, fault and upgrade domain topologies, etc.
    #
    # @param configuration_api_version [String] The API version of the Standalone
    # cluster json configuration.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_configuration_with_http_info(configuration_api_version, timeout:60, custom_headers:nil)
      get_cluster_configuration_async(configuration_api_version, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Get the Service Fabric standalone cluster configuration.
    #
    # Get the Service Fabric standalone cluster configuration. The cluster
    # configuration contains properties of the cluster that include different node
    # types on the cluster,
    # security configurations, fault and upgrade domain topologies, etc.
    #
    # @param configuration_api_version [String] The API version of the Standalone
    # cluster json configuration.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_configuration_async(configuration_api_version, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'configuration_api_version is nil' if configuration_api_version.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/GetClusterConfiguration'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'ConfigurationApiVersion' => configuration_api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ClusterConfiguration.mapper()
            result.body = self.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 the cluster configuration upgrade status of a Service Fabric standalone
    # cluster.
    #
    # Get the cluster configuration upgrade status details of a Service Fabric
    # standalone cluster.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ClusterConfigurationUpgradeStatusInfo] operation results.
    #
    def get_cluster_configuration_upgrade_status(timeout:60, custom_headers:nil)
      response = get_cluster_configuration_upgrade_status_async(timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get the cluster configuration upgrade status of a Service Fabric standalone
    # cluster.
    #
    # Get the cluster configuration upgrade status details of a Service Fabric
    # standalone cluster.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_configuration_upgrade_status_with_http_info(timeout:60, custom_headers:nil)
      get_cluster_configuration_upgrade_status_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Get the cluster configuration upgrade status of a Service Fabric standalone
    # cluster.
    #
    # Get the cluster configuration upgrade status details of a Service Fabric
    # standalone cluster.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_cluster_configuration_upgrade_status_async(timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/GetClusterConfigurationUpgradeStatus'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ClusterConfigurationUpgradeStatusInfo.mapper()
            result.body = self.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 the service state of Service Fabric Upgrade Orchestration Service.
    #
    # Get the service state of Service Fabric Upgrade Orchestration Service. This
    # API is internally used for support purposes.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [UpgradeOrchestrationServiceState] operation results.
    #
    def get_upgrade_orchestration_service_state(timeout:60, custom_headers:nil)
      response = get_upgrade_orchestration_service_state_async(timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get the service state of Service Fabric Upgrade Orchestration Service.
    #
    # Get the service state of Service Fabric Upgrade Orchestration Service. This
    # API is internally used for support purposes.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_upgrade_orchestration_service_state_with_http_info(timeout:60, custom_headers:nil)
      get_upgrade_orchestration_service_state_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Get the service state of Service Fabric Upgrade Orchestration Service.
    #
    # Get the service state of Service Fabric Upgrade Orchestration Service. This
    # API is internally used for support purposes.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_upgrade_orchestration_service_state_async(timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/GetUpgradeOrchestrationServiceState'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::UpgradeOrchestrationServiceState.mapper()
            result.body = self.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

    #
    # Update the service state of Service Fabric Upgrade Orchestration Service.
    #
    # Update the service state of Service Fabric Upgrade Orchestration Service.
    # This API is internally used for support purposes.
    #
    # @param upgrade_orchestration_service_state [UpgradeOrchestrationServiceState]
    # Service state of Service Fabric Upgrade Orchestration Service.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [UpgradeOrchestrationServiceStateSummary] operation results.
    #
    def set_upgrade_orchestration_service_state(upgrade_orchestration_service_state, timeout:60, custom_headers:nil)
      response = set_upgrade_orchestration_service_state_async(upgrade_orchestration_service_state, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Update the service state of Service Fabric Upgrade Orchestration Service.
    #
    # Update the service state of Service Fabric Upgrade Orchestration Service.
    # This API is internally used for support purposes.
    #
    # @param upgrade_orchestration_service_state [UpgradeOrchestrationServiceState]
    # Service state of Service Fabric Upgrade Orchestration Service.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def set_upgrade_orchestration_service_state_with_http_info(upgrade_orchestration_service_state, timeout:60, custom_headers:nil)
      set_upgrade_orchestration_service_state_async(upgrade_orchestration_service_state, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Update the service state of Service Fabric Upgrade Orchestration Service.
    #
    # Update the service state of Service Fabric Upgrade Orchestration Service.
    # This API is internally used for support purposes.
    #
    # @param upgrade_orchestration_service_state [UpgradeOrchestrationServiceState]
    # Service state of Service Fabric Upgrade Orchestration Service.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def set_upgrade_orchestration_service_state_async(upgrade_orchestration_service_state, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'upgrade_orchestration_service_state is nil' if upgrade_orchestration_service_state.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::UpgradeOrchestrationServiceState.mapper()
      request_content = self.serialize(request_mapper,  upgrade_orchestration_service_state)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/SetUpgradeOrchestrationServiceState'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::UpgradeOrchestrationServiceStateSummary.mapper()
            result.body = self.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

    #
    # Provision the code or configuration packages of a Service Fabric cluster.
    #
    # Validate and provision the code or configuration packages of a Service Fabric
    # cluster.
    #
    # @param provision_fabric_description [ProvisionFabricDescription] Describes
    # the parameters for provisioning a cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def provision_cluster(provision_fabric_description, timeout:60, custom_headers:nil)
      response = provision_cluster_async(provision_fabric_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Provision the code or configuration packages of a Service Fabric cluster.
    #
    # Validate and provision the code or configuration packages of a Service Fabric
    # cluster.
    #
    # @param provision_fabric_description [ProvisionFabricDescription] Describes
    # the parameters for provisioning a cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def provision_cluster_with_http_info(provision_fabric_description, timeout:60, custom_headers:nil)
      provision_cluster_async(provision_fabric_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Provision the code or configuration packages of a Service Fabric cluster.
    #
    # Validate and provision the code or configuration packages of a Service Fabric
    # cluster.
    #
    # @param provision_fabric_description [ProvisionFabricDescription] Describes
    # the parameters for provisioning a cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def provision_cluster_async(provision_fabric_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'provision_fabric_description is nil' if provision_fabric_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ProvisionFabricDescription.mapper()
      request_content = self.serialize(request_mapper,  provision_fabric_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/Provision'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Unprovision the code or configuration packages of a Service Fabric cluster.
    #
    # Unprovision the code or configuration packages of a Service Fabric cluster.
    # It is supported to unprovision code and configuration separately.
    #
    # @param unprovision_fabric_description [UnprovisionFabricDescription]
    # Describes the parameters for unprovisioning a cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def unprovision_cluster(unprovision_fabric_description, timeout:60, custom_headers:nil)
      response = unprovision_cluster_async(unprovision_fabric_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Unprovision the code or configuration packages of a Service Fabric cluster.
    #
    # Unprovision the code or configuration packages of a Service Fabric cluster.
    # It is supported to unprovision code and configuration separately.
    #
    # @param unprovision_fabric_description [UnprovisionFabricDescription]
    # Describes the parameters for unprovisioning a cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def unprovision_cluster_with_http_info(unprovision_fabric_description, timeout:60, custom_headers:nil)
      unprovision_cluster_async(unprovision_fabric_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Unprovision the code or configuration packages of a Service Fabric cluster.
    #
    # Unprovision the code or configuration packages of a Service Fabric cluster.
    # It is supported to unprovision code and configuration separately.
    #
    # @param unprovision_fabric_description [UnprovisionFabricDescription]
    # Describes the parameters for unprovisioning a cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def unprovision_cluster_async(unprovision_fabric_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'unprovision_fabric_description is nil' if unprovision_fabric_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::UnprovisionFabricDescription.mapper()
      request_content = self.serialize(request_mapper,  unprovision_fabric_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/Unprovision'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Rollback the upgrade of a Service Fabric cluster.
    #
    # Rollback the code or configuration upgrade of a Service Fabric cluster.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def rollback_cluster_upgrade(timeout:60, custom_headers:nil)
      response = rollback_cluster_upgrade_async(timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Rollback the upgrade of a Service Fabric cluster.
    #
    # Rollback the code or configuration upgrade of a Service Fabric cluster.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def rollback_cluster_upgrade_with_http_info(timeout:60, custom_headers:nil)
      rollback_cluster_upgrade_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Rollback the upgrade of a Service Fabric cluster.
    #
    # Rollback the code or configuration upgrade of a Service Fabric cluster.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def rollback_cluster_upgrade_async(timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/RollbackUpgrade'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Make the cluster upgrade move on to the next upgrade domain.
    #
    # Make the cluster code or configuration upgrade move on to the next upgrade
    # domain if appropriate.
    #
    # @param resume_cluster_upgrade_description [ResumeClusterUpgradeDescription]
    # Describes the parameters for resuming a cluster upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def resume_cluster_upgrade(resume_cluster_upgrade_description, timeout:60, custom_headers:nil)
      response = resume_cluster_upgrade_async(resume_cluster_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Make the cluster upgrade move on to the next upgrade domain.
    #
    # Make the cluster code or configuration upgrade move on to the next upgrade
    # domain if appropriate.
    #
    # @param resume_cluster_upgrade_description [ResumeClusterUpgradeDescription]
    # Describes the parameters for resuming a cluster upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resume_cluster_upgrade_with_http_info(resume_cluster_upgrade_description, timeout:60, custom_headers:nil)
      resume_cluster_upgrade_async(resume_cluster_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Make the cluster upgrade move on to the next upgrade domain.
    #
    # Make the cluster code or configuration upgrade move on to the next upgrade
    # domain if appropriate.
    #
    # @param resume_cluster_upgrade_description [ResumeClusterUpgradeDescription]
    # Describes the parameters for resuming a cluster upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resume_cluster_upgrade_async(resume_cluster_upgrade_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'resume_cluster_upgrade_description is nil' if resume_cluster_upgrade_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ResumeClusterUpgradeDescription.mapper()
      request_content = self.serialize(request_mapper,  resume_cluster_upgrade_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/MoveToNextUpgradeDomain'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Start upgrading the code or configuration version of a Service Fabric
    # cluster.
    #
    # Validate the supplied upgrade parameters and start upgrading the code or
    # configuration version of a Service Fabric cluster if the parameters are
    # valid.
    #
    # @param start_cluster_upgrade_description [StartClusterUpgradeDescription]
    # Describes the parameters for starting a cluster upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def start_cluster_upgrade(start_cluster_upgrade_description, timeout:60, custom_headers:nil)
      response = start_cluster_upgrade_async(start_cluster_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Start upgrading the code or configuration version of a Service Fabric
    # cluster.
    #
    # Validate the supplied upgrade parameters and start upgrading the code or
    # configuration version of a Service Fabric cluster if the parameters are
    # valid.
    #
    # @param start_cluster_upgrade_description [StartClusterUpgradeDescription]
    # Describes the parameters for starting a cluster upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_cluster_upgrade_with_http_info(start_cluster_upgrade_description, timeout:60, custom_headers:nil)
      start_cluster_upgrade_async(start_cluster_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Start upgrading the code or configuration version of a Service Fabric
    # cluster.
    #
    # Validate the supplied upgrade parameters and start upgrading the code or
    # configuration version of a Service Fabric cluster if the parameters are
    # valid.
    #
    # @param start_cluster_upgrade_description [StartClusterUpgradeDescription]
    # Describes the parameters for starting a cluster upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_cluster_upgrade_async(start_cluster_upgrade_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'start_cluster_upgrade_description is nil' if start_cluster_upgrade_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::StartClusterUpgradeDescription.mapper()
      request_content = self.serialize(request_mapper,  start_cluster_upgrade_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/Upgrade'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Start upgrading the configuration of a Service Fabric standalone cluster.
    #
    # Validate the supplied configuration upgrade parameters and start upgrading
    # the cluster configuration if the parameters are valid.
    #
    # @param cluster_configuration_upgrade_description
    # [ClusterConfigurationUpgradeDescription] Parameters for a standalone cluster
    # configuration upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def start_cluster_configuration_upgrade(cluster_configuration_upgrade_description, timeout:60, custom_headers:nil)
      response = start_cluster_configuration_upgrade_async(cluster_configuration_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Start upgrading the configuration of a Service Fabric standalone cluster.
    #
    # Validate the supplied configuration upgrade parameters and start upgrading
    # the cluster configuration if the parameters are valid.
    #
    # @param cluster_configuration_upgrade_description
    # [ClusterConfigurationUpgradeDescription] Parameters for a standalone cluster
    # configuration upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_cluster_configuration_upgrade_with_http_info(cluster_configuration_upgrade_description, timeout:60, custom_headers:nil)
      start_cluster_configuration_upgrade_async(cluster_configuration_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Start upgrading the configuration of a Service Fabric standalone cluster.
    #
    # Validate the supplied configuration upgrade parameters and start upgrading
    # the cluster configuration if the parameters are valid.
    #
    # @param cluster_configuration_upgrade_description
    # [ClusterConfigurationUpgradeDescription] Parameters for a standalone cluster
    # configuration upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_cluster_configuration_upgrade_async(cluster_configuration_upgrade_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'cluster_configuration_upgrade_description is nil' if cluster_configuration_upgrade_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ClusterConfigurationUpgradeDescription.mapper()
      request_content = self.serialize(request_mapper,  cluster_configuration_upgrade_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/StartClusterConfigurationUpgrade'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Update the upgrade parameters of a Service Fabric cluster upgrade.
    #
    # Update the upgrade parameters used during a Service Fabric cluster upgrade.
    #
    # @param update_cluster_upgrade_description [UpdateClusterUpgradeDescription]
    # Parameters for updating a cluster upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def update_cluster_upgrade(update_cluster_upgrade_description, timeout:60, custom_headers:nil)
      response = update_cluster_upgrade_async(update_cluster_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Update the upgrade parameters of a Service Fabric cluster upgrade.
    #
    # Update the upgrade parameters used during a Service Fabric cluster upgrade.
    #
    # @param update_cluster_upgrade_description [UpdateClusterUpgradeDescription]
    # Parameters for updating a cluster upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def update_cluster_upgrade_with_http_info(update_cluster_upgrade_description, timeout:60, custom_headers:nil)
      update_cluster_upgrade_async(update_cluster_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Update the upgrade parameters of a Service Fabric cluster upgrade.
    #
    # Update the upgrade parameters used during a Service Fabric cluster upgrade.
    #
    # @param update_cluster_upgrade_description [UpdateClusterUpgradeDescription]
    # Parameters for updating a cluster upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def update_cluster_upgrade_async(update_cluster_upgrade_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'update_cluster_upgrade_description is nil' if update_cluster_upgrade_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::UpdateClusterUpgradeDescription.mapper()
      request_content = self.serialize(request_mapper,  update_cluster_upgrade_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/UpdateUpgrade'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the Azure Active Directory metadata used for secured connection to
    # cluster.
    #
    # Gets the Azure Active Directory metadata used for secured connection to
    # cluster.
    # This API is not supposed to be called separately. It provides information
    # needed to set up an Azure Active Directory secured connection with a Service
    # Fabric cluster.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [AadMetadataObject] operation results.
    #
    def get_aad_metadata(timeout:60, custom_headers:nil)
      response = get_aad_metadata_async(timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the Azure Active Directory metadata used for secured connection to
    # cluster.
    #
    # Gets the Azure Active Directory metadata used for secured connection to
    # cluster.
    # This API is not supposed to be called separately. It provides information
    # needed to set up an Azure Active Directory secured connection with a Service
    # Fabric cluster.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_aad_metadata_with_http_info(timeout:60, custom_headers:nil)
      get_aad_metadata_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the Azure Active Directory metadata used for secured connection to
    # cluster.
    #
    # Gets the Azure Active Directory metadata used for secured connection to
    # cluster.
    # This API is not supposed to be called separately. It provides information
    # needed to set up an Azure Active Directory secured connection with a Service
    # Fabric cluster.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_aad_metadata_async(timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/GetAadMetadata'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::AadMetadataObject.mapper()
            result.body = self.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

    #
    # Gets the list of nodes in the Service Fabric cluster.
    #
    # Gets the list of nodes in the Service Fabric cluster. The response includes
    # the name, status, id, health, uptime, and other details about the node.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param node_status_filter [NodeStatusFilter] Allows filtering the nodes based
    # on the NodeStatus. Only the nodes that are matching the specified filter
    # value will be returned. The filter value can be one of the following.
    # Possible values include: 'default', 'all', 'up', 'down', 'enabling',
    # 'disabling', 'disabled', 'unknown', 'removed'
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedNodeInfoList] operation results.
    #
    def get_node_info_list(continuation_token:nil, node_status_filter:nil, timeout:60, custom_headers:nil)
      response = get_node_info_list_async(continuation_token:continuation_token, node_status_filter:node_status_filter, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of nodes in the Service Fabric cluster.
    #
    # Gets the list of nodes in the Service Fabric cluster. The response includes
    # the name, status, id, health, uptime, and other details about the node.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param node_status_filter [NodeStatusFilter] Allows filtering the nodes based
    # on the NodeStatus. Only the nodes that are matching the specified filter
    # value will be returned. The filter value can be one of the following.
    # Possible values include: 'default', 'all', 'up', 'down', 'enabling',
    # 'disabling', 'disabled', 'unknown', 'removed'
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_info_list_with_http_info(continuation_token:nil, node_status_filter:nil, timeout:60, custom_headers:nil)
      get_node_info_list_async(continuation_token:continuation_token, node_status_filter:node_status_filter, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of nodes in the Service Fabric cluster.
    #
    # Gets the list of nodes in the Service Fabric cluster. The response includes
    # the name, status, id, health, uptime, and other details about the node.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param node_status_filter [NodeStatusFilter] Allows filtering the nodes based
    # on the NodeStatus. Only the nodes that are matching the specified filter
    # value will be returned. The filter value can be one of the following.
    # Possible values include: 'default', 'all', 'up', 'down', 'enabling',
    # 'disabling', 'disabled', 'unknown', 'removed'
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_info_list_async(continuation_token:nil, node_status_filter:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'NodeStatusFilter' => node_status_filter,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedNodeInfoList.mapper()
            result.body = self.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

    #
    # Gets the information about a specific node in the Service Fabric cluster.
    #
    # Gets the information about a specific node in the Service Fabric Cluster. The
    # response includes the name, status, id, health, uptime, and other details
    # about the node.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [NodeInfo] operation results.
    #
    def get_node_info(node_name, timeout:60, custom_headers:nil)
      response = get_node_info_async(node_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about a specific node in the Service Fabric cluster.
    #
    # Gets the information about a specific node in the Service Fabric Cluster. The
    # response includes the name, status, id, health, uptime, and other details
    # about the node.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_info_with_http_info(node_name, timeout:60, custom_headers:nil)
      get_node_info_async(node_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about a specific node in the Service Fabric cluster.
    #
    # Gets the information about a specific node in the Service Fabric Cluster. The
    # response includes the name, status, id, health, uptime, and other details
    # about the node.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_info_async(node_name, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 || 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::ServiceFabric::V6_2_0_9::Models::NodeInfo.mapper()
            result.body = self.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

    #
    # Gets the health of a Service Fabric node.
    #
    # Gets the health of a Service Fabric node. Use EventsHealthStateFilter to
    # filter the collection of health events reported on the node based on the
    # health state. If the node that you specify by name does not exist in the
    # health store, this returns an error.
    #
    # @param node_name [String] The name of the node.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [NodeHealth] operation results.
    #
    def get_node_health(node_name, events_health_state_filter:0, timeout:60, custom_headers:nil)
      response = get_node_health_async(node_name, events_health_state_filter:events_health_state_filter, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of a Service Fabric node.
    #
    # Gets the health of a Service Fabric node. Use EventsHealthStateFilter to
    # filter the collection of health events reported on the node based on the
    # health state. If the node that you specify by name does not exist in the
    # health store, this returns an error.
    #
    # @param node_name [String] The name of the node.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_health_with_http_info(node_name, events_health_state_filter:0, timeout:60, custom_headers:nil)
      get_node_health_async(node_name, events_health_state_filter:events_health_state_filter, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of a Service Fabric node.
    #
    # Gets the health of a Service Fabric node. Use EventsHealthStateFilter to
    # filter the collection of health events reported on the node based on the
    # health state. If the node that you specify by name does not exist in the
    # health store, this returns an error.
    #
    # @param node_name [String] The name of the node.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_health_async(node_name, events_health_state_filter:0, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::NodeHealth.mapper()
            result.body = self.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

    #
    # Gets the health of a Service Fabric node, by using the specified health
    # policy.
    #
    # Gets the health of a Service Fabric node. Use EventsHealthStateFilter to
    # filter the collection of health events reported on the node based on the
    # health state. Use ClusterHealthPolicy in the POST body to override the health
    # policies used to evaluate the health. If the node that you specify by name
    # does not exist in the health store, this returns an error.
    #
    # @param node_name [String] The name of the node.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param cluster_health_policy [ClusterHealthPolicy] Describes the health
    # policies used to evaluate the health of a cluster or node. If not present,
    # the health evaluation uses the health policy from cluster manifest or the
    # default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [NodeHealth] operation results.
    #
    def get_node_health_using_policy(node_name, events_health_state_filter:0, cluster_health_policy:nil, timeout:60, custom_headers:nil)
      response = get_node_health_using_policy_async(node_name, events_health_state_filter:events_health_state_filter, cluster_health_policy:cluster_health_policy, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of a Service Fabric node, by using the specified health
    # policy.
    #
    # Gets the health of a Service Fabric node. Use EventsHealthStateFilter to
    # filter the collection of health events reported on the node based on the
    # health state. Use ClusterHealthPolicy in the POST body to override the health
    # policies used to evaluate the health. If the node that you specify by name
    # does not exist in the health store, this returns an error.
    #
    # @param node_name [String] The name of the node.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param cluster_health_policy [ClusterHealthPolicy] Describes the health
    # policies used to evaluate the health of a cluster or node. If not present,
    # the health evaluation uses the health policy from cluster manifest or the
    # default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_health_using_policy_with_http_info(node_name, events_health_state_filter:0, cluster_health_policy:nil, timeout:60, custom_headers:nil)
      get_node_health_using_policy_async(node_name, events_health_state_filter:events_health_state_filter, cluster_health_policy:cluster_health_policy, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of a Service Fabric node, by using the specified health
    # policy.
    #
    # Gets the health of a Service Fabric node. Use EventsHealthStateFilter to
    # filter the collection of health events reported on the node based on the
    # health state. Use ClusterHealthPolicy in the POST body to override the health
    # policies used to evaluate the health. If the node that you specify by name
    # does not exist in the health store, this returns an error.
    #
    # @param node_name [String] The name of the node.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param cluster_health_policy [ClusterHealthPolicy] Describes the health
    # policies used to evaluate the health of a cluster or node. If not present,
    # the health evaluation uses the health policy from cluster manifest or the
    # default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_health_using_policy_async(node_name, events_health_state_filter:0, cluster_health_policy:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ClusterHealthPolicy.mapper()
      request_content = self.serialize(request_mapper,  cluster_health_policy)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Nodes/{nodeName}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::NodeHealth.mapper()
            result.body = self.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

    #
    # Sends a health report on the Service Fabric node.
    #
    # Reports health state of the specified Service Fabric node. The report must
    # contain the information about the source of the health report and property on
    # which it is reported.
    # The report is sent to a Service Fabric gateway node, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run GetNodeHealth
    # and check that the report appears in the HealthEvents section.
    #
    # @param node_name [String] The name of the node.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def report_node_health(node_name, health_information, immediate:false, timeout:60, custom_headers:nil)
      response = report_node_health_async(node_name, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Sends a health report on the Service Fabric node.
    #
    # Reports health state of the specified Service Fabric node. The report must
    # contain the information about the source of the health report and property on
    # which it is reported.
    # The report is sent to a Service Fabric gateway node, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run GetNodeHealth
    # and check that the report appears in the HealthEvents section.
    #
    # @param node_name [String] The name of the node.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_node_health_with_http_info(node_name, health_information, immediate:false, timeout:60, custom_headers:nil)
      report_node_health_async(node_name, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Sends a health report on the Service Fabric node.
    #
    # Reports health state of the specified Service Fabric node. The report must
    # contain the information about the source of the health report and property on
    # which it is reported.
    # The report is sent to a Service Fabric gateway node, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run GetNodeHealth
    # and check that the report appears in the HealthEvents section.
    #
    # @param node_name [String] The name of the node.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_node_health_async(node_name, health_information, immediate:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'health_information is nil' if health_information.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::HealthInformation.mapper()
      request_content = self.serialize(request_mapper,  health_information)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Nodes/{nodeName}/$/ReportHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'Immediate' => immediate,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the load information of a Service Fabric node.
    #
    # Retrieves the load information of a Service Fabric node for all the metrics
    # that have load or capacity defined.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [NodeLoadInfo] operation results.
    #
    def get_node_load_info(node_name, timeout:60, custom_headers:nil)
      response = get_node_load_info_async(node_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the load information of a Service Fabric node.
    #
    # Retrieves the load information of a Service Fabric node for all the metrics
    # that have load or capacity defined.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_load_info_with_http_info(node_name, timeout:60, custom_headers:nil)
      get_node_load_info_async(node_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the load information of a Service Fabric node.
    #
    # Retrieves the load information of a Service Fabric node for all the metrics
    # that have load or capacity defined.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_load_info_async(node_name, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetLoadInformation'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::NodeLoadInfo.mapper()
            result.body = self.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

    #
    # Deactivate a Service Fabric cluster node with the specified deactivation
    # intent.
    #
    # Deactivate a Service Fabric cluster node with the specified deactivation
    # intent. Once the deactivation is in progress, the deactivation intent can be
    # increased, but not decreased (for example, a node which is was deactivated
    # with the Pause intent can be deactivated further with Restart, but not the
    # other way around. Nodes may be reactivated using the Activate a node
    # operation any time after they are deactivated. If the deactivation is not
    # complete this will cancel the deactivation. A node which goes down and comes
    # back up while deactivated will still need to be reactivated before services
    # will be placed on that node.
    #
    # @param node_name [String] The name of the node.
    # @param deactivation_intent_description [DeactivationIntentDescription]
    # Describes the intent or reason for deactivating the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def disable_node(node_name, deactivation_intent_description, timeout:60, custom_headers:nil)
      response = disable_node_async(node_name, deactivation_intent_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Deactivate a Service Fabric cluster node with the specified deactivation
    # intent.
    #
    # Deactivate a Service Fabric cluster node with the specified deactivation
    # intent. Once the deactivation is in progress, the deactivation intent can be
    # increased, but not decreased (for example, a node which is was deactivated
    # with the Pause intent can be deactivated further with Restart, but not the
    # other way around. Nodes may be reactivated using the Activate a node
    # operation any time after they are deactivated. If the deactivation is not
    # complete this will cancel the deactivation. A node which goes down and comes
    # back up while deactivated will still need to be reactivated before services
    # will be placed on that node.
    #
    # @param node_name [String] The name of the node.
    # @param deactivation_intent_description [DeactivationIntentDescription]
    # Describes the intent or reason for deactivating the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def disable_node_with_http_info(node_name, deactivation_intent_description, timeout:60, custom_headers:nil)
      disable_node_async(node_name, deactivation_intent_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Deactivate a Service Fabric cluster node with the specified deactivation
    # intent.
    #
    # Deactivate a Service Fabric cluster node with the specified deactivation
    # intent. Once the deactivation is in progress, the deactivation intent can be
    # increased, but not decreased (for example, a node which is was deactivated
    # with the Pause intent can be deactivated further with Restart, but not the
    # other way around. Nodes may be reactivated using the Activate a node
    # operation any time after they are deactivated. If the deactivation is not
    # complete this will cancel the deactivation. A node which goes down and comes
    # back up while deactivated will still need to be reactivated before services
    # will be placed on that node.
    #
    # @param node_name [String] The name of the node.
    # @param deactivation_intent_description [DeactivationIntentDescription]
    # Describes the intent or reason for deactivating the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def disable_node_async(node_name, deactivation_intent_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'deactivation_intent_description is nil' if deactivation_intent_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::DeactivationIntentDescription.mapper()
      request_content = self.serialize(request_mapper,  deactivation_intent_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Nodes/{nodeName}/$/Deactivate'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Activate a Service Fabric cluster node which is currently deactivated.
    #
    # Activates a Service Fabric cluster node which is currently deactivated. Once
    # activated, the node will again become a viable target for placing new
    # replicas, and any deactivated replicas remaining on the node will be
    # reactivated.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def enable_node(node_name, timeout:60, custom_headers:nil)
      response = enable_node_async(node_name, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Activate a Service Fabric cluster node which is currently deactivated.
    #
    # Activates a Service Fabric cluster node which is currently deactivated. Once
    # activated, the node will again become a viable target for placing new
    # replicas, and any deactivated replicas remaining on the node will be
    # reactivated.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def enable_node_with_http_info(node_name, timeout:60, custom_headers:nil)
      enable_node_async(node_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Activate a Service Fabric cluster node which is currently deactivated.
    #
    # Activates a Service Fabric cluster node which is currently deactivated. Once
    # activated, the node will again become a viable target for placing new
    # replicas, and any deactivated replicas remaining on the node will be
    # reactivated.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def enable_node_async(node_name, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/Activate'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Notifies Service Fabric that the persisted state on a node has been
    # permanently removed or lost.
    #
    # Notifies Service Fabric that the persisted state on a node has been
    # permanently removed or lost.  This implies that it is not possible to recover
    # the persisted state of that node. This generally happens if a hard disk has
    # been wiped clean, or if a hard disk crashes. The node has to be down for this
    # operation to be successful. This operation lets Service Fabric know that the
    # replicas on that node no longer exist, and that Service Fabric should stop
    # waiting for those replicas to come back up. Do not run this cmdlet if the
    # state on the node has not been removed and the node can comes back up with
    # its state intact.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def remove_node_state(node_name, timeout:60, custom_headers:nil)
      response = remove_node_state_async(node_name, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Notifies Service Fabric that the persisted state on a node has been
    # permanently removed or lost.
    #
    # Notifies Service Fabric that the persisted state on a node has been
    # permanently removed or lost.  This implies that it is not possible to recover
    # the persisted state of that node. This generally happens if a hard disk has
    # been wiped clean, or if a hard disk crashes. The node has to be down for this
    # operation to be successful. This operation lets Service Fabric know that the
    # replicas on that node no longer exist, and that Service Fabric should stop
    # waiting for those replicas to come back up. Do not run this cmdlet if the
    # state on the node has not been removed and the node can comes back up with
    # its state intact.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def remove_node_state_with_http_info(node_name, timeout:60, custom_headers:nil)
      remove_node_state_async(node_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Notifies Service Fabric that the persisted state on a node has been
    # permanently removed or lost.
    #
    # Notifies Service Fabric that the persisted state on a node has been
    # permanently removed or lost.  This implies that it is not possible to recover
    # the persisted state of that node. This generally happens if a hard disk has
    # been wiped clean, or if a hard disk crashes. The node has to be down for this
    # operation to be successful. This operation lets Service Fabric know that the
    # replicas on that node no longer exist, and that Service Fabric should stop
    # waiting for those replicas to come back up. Do not run this cmdlet if the
    # state on the node has not been removed and the node can comes back up with
    # its state intact.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def remove_node_state_async(node_name, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/RemoveNodeState'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Restarts a Service Fabric cluster node.
    #
    # Restarts a Service Fabric cluster node that is already started.
    #
    # @param node_name [String] The name of the node.
    # @param restart_node_description [RestartNodeDescription] The instance of the
    # node to be restarted and a flag indicating the need to take dump of the
    # fabric process.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def restart_node(node_name, restart_node_description, timeout:60, custom_headers:nil)
      response = restart_node_async(node_name, restart_node_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Restarts a Service Fabric cluster node.
    #
    # Restarts a Service Fabric cluster node that is already started.
    #
    # @param node_name [String] The name of the node.
    # @param restart_node_description [RestartNodeDescription] The instance of the
    # node to be restarted and a flag indicating the need to take dump of the
    # fabric process.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def restart_node_with_http_info(node_name, restart_node_description, timeout:60, custom_headers:nil)
      restart_node_async(node_name, restart_node_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Restarts a Service Fabric cluster node.
    #
    # Restarts a Service Fabric cluster node that is already started.
    #
    # @param node_name [String] The name of the node.
    # @param restart_node_description [RestartNodeDescription] The instance of the
    # node to be restarted and a flag indicating the need to take dump of the
    # fabric process.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def restart_node_async(node_name, restart_node_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'restart_node_description is nil' if restart_node_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::RestartNodeDescription.mapper()
      request_content = self.serialize(request_mapper,  restart_node_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Nodes/{nodeName}/$/Restart'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the list of application types in the Service Fabric cluster.
    #
    # Returns the information about the application types that are provisioned or
    # in the process of being provisioned in the Service Fabric cluster. Each
    # version of an application type is returned as one application type. The
    # response includes the name, version, status and other details about the
    # application type. This is a paged query, meaning that if not all of the
    # application types fit in a page, one page of results is returned as well as a
    # continuation token which can be used to get the next page. For example, if
    # there are 10 application types but a page only fits the first 3 application
    # types, or if max results is set to 3, then 3 is returned. To access the rest
    # of the results, retrieve subsequent pages by using the returned continuation
    # token in the next query. An empty continuation token is returned if there are
    # no subsequent pages.
    #
    # @param application_type_definition_kind_filter [Integer] Used to filter on
    # ApplicationTypeDefinitionKind which is the mechanism used to define a Service
    # Fabric application type.
    # - Default - Default value, which performs the same function as selecting
    # "All". The value is 0.
    # - All - Filter that matches input with any ApplicationTypeDefinitionKind
    # value. The value is 65535.
    # - ServiceFabricApplicationPackage - Filter that matches input with
    # ApplicationTypeDefinitionKind value ServiceFabricApplicationPackage. The
    # value is 1.
    # - Compose - Filter that matches input with ApplicationTypeDefinitionKind
    # value Compose. The value is 2.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedApplicationTypeInfoList] operation results.
    #
    def get_application_type_info_list(application_type_definition_kind_filter:0, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      response = get_application_type_info_list_async(application_type_definition_kind_filter:application_type_definition_kind_filter, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of application types in the Service Fabric cluster.
    #
    # Returns the information about the application types that are provisioned or
    # in the process of being provisioned in the Service Fabric cluster. Each
    # version of an application type is returned as one application type. The
    # response includes the name, version, status and other details about the
    # application type. This is a paged query, meaning that if not all of the
    # application types fit in a page, one page of results is returned as well as a
    # continuation token which can be used to get the next page. For example, if
    # there are 10 application types but a page only fits the first 3 application
    # types, or if max results is set to 3, then 3 is returned. To access the rest
    # of the results, retrieve subsequent pages by using the returned continuation
    # token in the next query. An empty continuation token is returned if there are
    # no subsequent pages.
    #
    # @param application_type_definition_kind_filter [Integer] Used to filter on
    # ApplicationTypeDefinitionKind which is the mechanism used to define a Service
    # Fabric application type.
    # - Default - Default value, which performs the same function as selecting
    # "All". The value is 0.
    # - All - Filter that matches input with any ApplicationTypeDefinitionKind
    # value. The value is 65535.
    # - ServiceFabricApplicationPackage - Filter that matches input with
    # ApplicationTypeDefinitionKind value ServiceFabricApplicationPackage. The
    # value is 1.
    # - Compose - Filter that matches input with ApplicationTypeDefinitionKind
    # value Compose. The value is 2.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_type_info_list_with_http_info(application_type_definition_kind_filter:0, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      get_application_type_info_list_async(application_type_definition_kind_filter:application_type_definition_kind_filter, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of application types in the Service Fabric cluster.
    #
    # Returns the information about the application types that are provisioned or
    # in the process of being provisioned in the Service Fabric cluster. Each
    # version of an application type is returned as one application type. The
    # response includes the name, version, status and other details about the
    # application type. This is a paged query, meaning that if not all of the
    # application types fit in a page, one page of results is returned as well as a
    # continuation token which can be used to get the next page. For example, if
    # there are 10 application types but a page only fits the first 3 application
    # types, or if max results is set to 3, then 3 is returned. To access the rest
    # of the results, retrieve subsequent pages by using the returned continuation
    # token in the next query. An empty continuation token is returned if there are
    # no subsequent pages.
    #
    # @param application_type_definition_kind_filter [Integer] Used to filter on
    # ApplicationTypeDefinitionKind which is the mechanism used to define a Service
    # Fabric application type.
    # - Default - Default value, which performs the same function as selecting
    # "All". The value is 0.
    # - All - Filter that matches input with any ApplicationTypeDefinitionKind
    # value. The value is 65535.
    # - ServiceFabricApplicationPackage - Filter that matches input with
    # ApplicationTypeDefinitionKind value ServiceFabricApplicationPackage. The
    # value is 1.
    # - Compose - Filter that matches input with ApplicationTypeDefinitionKind
    # value Compose. The value is 2.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_type_info_list_async(application_type_definition_kind_filter:0, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ApplicationTypes'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'ApplicationTypeDefinitionKindFilter' => application_type_definition_kind_filter,'ExcludeApplicationParameters' => exclude_application_parameters,'MaxResults' => max_results,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedApplicationTypeInfoList.mapper()
            result.body = self.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

    #
    # Gets the list of application types in the Service Fabric cluster matching
    # exactly the specified name.
    #
    # Returns the information about the application types that are provisioned or
    # in the process of being provisioned in the Service Fabric cluster. These
    # results are of application types whose name match exactly the one specified
    # as the parameter, and which comply with the given query parameters. All
    # versions of the application type matching the application type name are
    # returned, with each version returned as one application type. The response
    # includes the name, version, status and other details about the application
    # type. This is a paged query, meaning that if not all of the application types
    # fit in a page, one page of results is returned as well as a continuation
    # token which can be used to get the next page. For example, if there are 10
    # application types but a page only fits the first 3 application types, or if
    # max results is set to 3, then 3 is returned. To access the rest of the
    # results, retrieve subsequent pages by using the returned continuation token
    # in the next query. An empty continuation token is returned if there are no
    # subsequent pages.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedApplicationTypeInfoList] operation results.
    #
    def get_application_type_info_list_by_name(application_type_name, application_type_version:nil, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      response = get_application_type_info_list_by_name_async(application_type_name, application_type_version:application_type_version, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of application types in the Service Fabric cluster matching
    # exactly the specified name.
    #
    # Returns the information about the application types that are provisioned or
    # in the process of being provisioned in the Service Fabric cluster. These
    # results are of application types whose name match exactly the one specified
    # as the parameter, and which comply with the given query parameters. All
    # versions of the application type matching the application type name are
    # returned, with each version returned as one application type. The response
    # includes the name, version, status and other details about the application
    # type. This is a paged query, meaning that if not all of the application types
    # fit in a page, one page of results is returned as well as a continuation
    # token which can be used to get the next page. For example, if there are 10
    # application types but a page only fits the first 3 application types, or if
    # max results is set to 3, then 3 is returned. To access the rest of the
    # results, retrieve subsequent pages by using the returned continuation token
    # in the next query. An empty continuation token is returned if there are no
    # subsequent pages.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_type_info_list_by_name_with_http_info(application_type_name, application_type_version:nil, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      get_application_type_info_list_by_name_async(application_type_name, application_type_version:application_type_version, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of application types in the Service Fabric cluster matching
    # exactly the specified name.
    #
    # Returns the information about the application types that are provisioned or
    # in the process of being provisioned in the Service Fabric cluster. These
    # results are of application types whose name match exactly the one specified
    # as the parameter, and which comply with the given query parameters. All
    # versions of the application type matching the application type name are
    # returned, with each version returned as one application type. The response
    # includes the name, version, status and other details about the application
    # type. This is a paged query, meaning that if not all of the application types
    # fit in a page, one page of results is returned as well as a continuation
    # token which can be used to get the next page. For example, if there are 10
    # application types but a page only fits the first 3 application types, or if
    # max results is set to 3, then 3 is returned. To access the rest of the
    # results, retrieve subsequent pages by using the returned continuation token
    # in the next query. An empty continuation token is returned if there are no
    # subsequent pages.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_type_info_list_by_name_async(application_type_name, application_type_version:nil, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_type_name is nil' if application_type_name.nil?
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ApplicationTypes/{applicationTypeName}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'applicationTypeName' => application_type_name},
          query_params: {'api-version' => api_version,'ApplicationTypeVersion' => application_type_version,'ExcludeApplicationParameters' => exclude_application_parameters,'MaxResults' => max_results,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedApplicationTypeInfoList.mapper()
            result.body = self.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

    #
    # Provisions or registers a Service Fabric application type with the cluster
    # using the '.sfpkg' package in the external store or using the application
    # package in the image store.
    #
    # Provisions a Service Fabric application type with the cluster. The provision
    # is required before any new applications can be instantiated.
    # The provision operation can be performed either on the application package
    # specified by the relativePathInImageStore, or by using the URI of the
    # external '.sfpkg'.
    #
    # @param provision_application_type_description_base_required_body_param
    # [ProvisionApplicationTypeDescriptionBase] The base type of provision
    # application type description which supports either image store-based
    # provision or external store-based provision.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def provision_application_type(provision_application_type_description_base_required_body_param, timeout:60, custom_headers:nil)
      response = provision_application_type_async(provision_application_type_description_base_required_body_param, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Provisions or registers a Service Fabric application type with the cluster
    # using the '.sfpkg' package in the external store or using the application
    # package in the image store.
    #
    # Provisions a Service Fabric application type with the cluster. The provision
    # is required before any new applications can be instantiated.
    # The provision operation can be performed either on the application package
    # specified by the relativePathInImageStore, or by using the URI of the
    # external '.sfpkg'.
    #
    # @param provision_application_type_description_base_required_body_param
    # [ProvisionApplicationTypeDescriptionBase] The base type of provision
    # application type description which supports either image store-based
    # provision or external store-based provision.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def provision_application_type_with_http_info(provision_application_type_description_base_required_body_param, timeout:60, custom_headers:nil)
      provision_application_type_async(provision_application_type_description_base_required_body_param, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Provisions or registers a Service Fabric application type with the cluster
    # using the '.sfpkg' package in the external store or using the application
    # package in the image store.
    #
    # Provisions a Service Fabric application type with the cluster. The provision
    # is required before any new applications can be instantiated.
    # The provision operation can be performed either on the application package
    # specified by the relativePathInImageStore, or by using the URI of the
    # external '.sfpkg'.
    #
    # @param provision_application_type_description_base_required_body_param
    # [ProvisionApplicationTypeDescriptionBase] The base type of provision
    # application type description which supports either image store-based
    # provision or external store-based provision.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def provision_application_type_async(provision_application_type_description_base_required_body_param, timeout:60, custom_headers:nil)
      api_version = '6.2'
      fail ArgumentError, 'provision_application_type_description_base_required_body_param is nil' if provision_application_type_description_base_required_body_param.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ProvisionApplicationTypeDescriptionBase.mapper()
      request_content = self.serialize(request_mapper,  provision_application_type_description_base_required_body_param)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'ApplicationTypes/$/Provision'

      request_url = @base_url || self.base_url

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

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200 || status_code == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Removes or unregisters a Service Fabric application type from the cluster.
    #
    # Removes or unregisters a Service Fabric application type from the cluster.
    # This operation can only be performed if all application instances of the
    # application type has been deleted. Once the application type is unregistered,
    # no new application instances can be created for this particular application
    # type.
    #
    # @param application_type_name [String] The name of the application type.
    # @param unprovision_application_type_description_info
    # [UnprovisionApplicationTypeDescriptionInfo] The relative path for the
    # application package in the image store specified during the prior copy
    # operation.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def unprovision_application_type(application_type_name, unprovision_application_type_description_info, timeout:60, custom_headers:nil)
      response = unprovision_application_type_async(application_type_name, unprovision_application_type_description_info, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Removes or unregisters a Service Fabric application type from the cluster.
    #
    # Removes or unregisters a Service Fabric application type from the cluster.
    # This operation can only be performed if all application instances of the
    # application type has been deleted. Once the application type is unregistered,
    # no new application instances can be created for this particular application
    # type.
    #
    # @param application_type_name [String] The name of the application type.
    # @param unprovision_application_type_description_info
    # [UnprovisionApplicationTypeDescriptionInfo] The relative path for the
    # application package in the image store specified during the prior copy
    # operation.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def unprovision_application_type_with_http_info(application_type_name, unprovision_application_type_description_info, timeout:60, custom_headers:nil)
      unprovision_application_type_async(application_type_name, unprovision_application_type_description_info, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Removes or unregisters a Service Fabric application type from the cluster.
    #
    # Removes or unregisters a Service Fabric application type from the cluster.
    # This operation can only be performed if all application instances of the
    # application type has been deleted. Once the application type is unregistered,
    # no new application instances can be created for this particular application
    # type.
    #
    # @param application_type_name [String] The name of the application type.
    # @param unprovision_application_type_description_info
    # [UnprovisionApplicationTypeDescriptionInfo] The relative path for the
    # application package in the image store specified during the prior copy
    # operation.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def unprovision_application_type_async(application_type_name, unprovision_application_type_description_info, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_type_name is nil' if application_type_name.nil?
      fail ArgumentError, 'unprovision_application_type_description_info is nil' if unprovision_application_type_description_info.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::UnprovisionApplicationTypeDescriptionInfo.mapper()
      request_content = self.serialize(request_mapper,  unprovision_application_type_description_info)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'ApplicationTypes/{applicationTypeName}/$/Unprovision'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'applicationTypeName' => application_type_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.make_request_async(:post, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200 || status_code == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets the list containing the information about service types that are
    # supported by a provisioned application type in a Service Fabric cluster.
    #
    # Gets the list containing the information about service types that are
    # supported by a provisioned application type in a Service Fabric cluster. The
    # provided application type must exist. Otherwise, a 404 status is returned.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_service_type_info_list(application_type_name, application_type_version, timeout:60, custom_headers:nil)
      response = get_service_type_info_list_async(application_type_name, application_type_version, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list containing the information about service types that are
    # supported by a provisioned application type in a Service Fabric cluster.
    #
    # Gets the list containing the information about service types that are
    # supported by a provisioned application type in a Service Fabric cluster. The
    # provided application type must exist. Otherwise, a 404 status is returned.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_type_info_list_with_http_info(application_type_name, application_type_version, timeout:60, custom_headers:nil)
      get_service_type_info_list_async(application_type_name, application_type_version, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list containing the information about service types that are
    # supported by a provisioned application type in a Service Fabric cluster.
    #
    # Gets the list containing the information about service types that are
    # supported by a provisioned application type in a Service Fabric cluster. The
    # provided application type must exist. Otherwise, a 404 status is returned.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_type_info_list_async(application_type_name, application_type_version, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_type_name is nil' if application_type_name.nil?
      fail ArgumentError, 'application_type_version is nil' if application_type_version.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ApplicationTypes/{applicationTypeName}/$/GetServiceTypes'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'applicationTypeName' => application_type_name},
          query_params: {'api-version' => api_version,'ApplicationTypeVersion' => application_type_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'ServiceTypeInfoElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'ServiceTypeInfo'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets the information about a specific service type that is supported by a
    # provisioned application type in a Service Fabric cluster.
    #
    # Gets the information about a specific service type that is supported by a
    # provisioned application type in a Service Fabric cluster. The provided
    # application type must exist. Otherwise, a 404 status is returned. A 204
    # response is returned if the specified service type is not found in the
    # cluster.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param service_type_name [String] Specifies the name of a Service Fabric
    # service type.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ServiceTypeInfo] operation results.
    #
    def get_service_type_info_by_name(application_type_name, application_type_version, service_type_name, timeout:60, custom_headers:nil)
      response = get_service_type_info_by_name_async(application_type_name, application_type_version, service_type_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about a specific service type that is supported by a
    # provisioned application type in a Service Fabric cluster.
    #
    # Gets the information about a specific service type that is supported by a
    # provisioned application type in a Service Fabric cluster. The provided
    # application type must exist. Otherwise, a 404 status is returned. A 204
    # response is returned if the specified service type is not found in the
    # cluster.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param service_type_name [String] Specifies the name of a Service Fabric
    # service type.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_type_info_by_name_with_http_info(application_type_name, application_type_version, service_type_name, timeout:60, custom_headers:nil)
      get_service_type_info_by_name_async(application_type_name, application_type_version, service_type_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about a specific service type that is supported by a
    # provisioned application type in a Service Fabric cluster.
    #
    # Gets the information about a specific service type that is supported by a
    # provisioned application type in a Service Fabric cluster. The provided
    # application type must exist. Otherwise, a 404 status is returned. A 204
    # response is returned if the specified service type is not found in the
    # cluster.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param service_type_name [String] Specifies the name of a Service Fabric
    # service type.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_type_info_by_name_async(application_type_name, application_type_version, service_type_name, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_type_name is nil' if application_type_name.nil?
      fail ArgumentError, 'application_type_version is nil' if application_type_version.nil?
      fail ArgumentError, 'service_type_name is nil' if service_type_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ApplicationTypes/{applicationTypeName}/$/GetServiceTypes/{serviceTypeName}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'applicationTypeName' => application_type_name},
          skip_encoding_path_params: {'serviceTypeName' => service_type_name},
          query_params: {'api-version' => api_version,'ApplicationTypeVersion' => application_type_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 || 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::ServiceFabric::V6_2_0_9::Models::ServiceTypeInfo.mapper()
            result.body = self.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

    #
    # Gets the manifest describing a service type.
    #
    # Gets the manifest describing a service type. The response contains the
    # service manifest XML as a string.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ServiceTypeManifest] operation results.
    #
    def get_service_manifest(application_type_name, application_type_version, service_manifest_name, timeout:60, custom_headers:nil)
      response = get_service_manifest_async(application_type_name, application_type_version, service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the manifest describing a service type.
    #
    # Gets the manifest describing a service type. The response contains the
    # service manifest XML as a string.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_manifest_with_http_info(application_type_name, application_type_version, service_manifest_name, timeout:60, custom_headers:nil)
      get_service_manifest_async(application_type_name, application_type_version, service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the manifest describing a service type.
    #
    # Gets the manifest describing a service type. The response contains the
    # service manifest XML as a string.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_manifest_async(application_type_name, application_type_version, service_manifest_name, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_type_name is nil' if application_type_name.nil?
      fail ArgumentError, 'application_type_version is nil' if application_type_version.nil?
      fail ArgumentError, 'service_manifest_name is nil' if service_manifest_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ApplicationTypes/{applicationTypeName}/$/GetServiceManifest'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'applicationTypeName' => application_type_name},
          query_params: {'api-version' => api_version,'ApplicationTypeVersion' => application_type_version,'ServiceManifestName' => service_manifest_name,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ServiceTypeManifest.mapper()
            result.body = self.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

    #
    # Gets the list containing the information about service types from the
    # applications deployed on a node in a Service Fabric cluster.
    #
    # Gets the list containing the information about service types from the
    # applications deployed on a node in a Service Fabric cluster. The response
    # includes the name of the service type, its registration status, the code
    # package that registered it and activation ID of the service package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of the service manifest to
    # filter the list of deployed service type information. If specified, the
    # response will only contain the information about service types that are
    # defined in this service manifest.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_deployed_service_type_info_list(node_name, application_id, service_manifest_name:nil, timeout:60, custom_headers:nil)
      response = get_deployed_service_type_info_list_async(node_name, application_id, service_manifest_name:service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list containing the information about service types from the
    # applications deployed on a node in a Service Fabric cluster.
    #
    # Gets the list containing the information about service types from the
    # applications deployed on a node in a Service Fabric cluster. The response
    # includes the name of the service type, its registration status, the code
    # package that registered it and activation ID of the service package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of the service manifest to
    # filter the list of deployed service type information. If specified, the
    # response will only contain the information about service types that are
    # defined in this service manifest.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_type_info_list_with_http_info(node_name, application_id, service_manifest_name:nil, timeout:60, custom_headers:nil)
      get_deployed_service_type_info_list_async(node_name, application_id, service_manifest_name:service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list containing the information about service types from the
    # applications deployed on a node in a Service Fabric cluster.
    #
    # Gets the list containing the information about service types from the
    # applications deployed on a node in a Service Fabric cluster. The response
    # includes the name of the service type, its registration status, the code
    # package that registered it and activation ID of the service package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of the service manifest to
    # filter the list of deployed service type information. If specified, the
    # response will only contain the information about service types that are
    # defined in this service manifest.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_type_info_list_async(node_name, application_id, service_manifest_name:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetServiceTypes'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'ServiceManifestName' => service_manifest_name,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'DeployedServiceTypeInfoElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'DeployedServiceTypeInfo'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets the information about a specified service type of the application
    # deployed on a node in a Service Fabric cluster.
    #
    # Gets the list containing the information about a specific service type from
    # the applications deployed on a node in a Service Fabric cluster. The response
    # includes the name of the service type, its registration status, the code
    # package that registered it and activation ID of the service package. Each
    # entry represents one activation of a service type, differentiated by the
    # activation ID.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_type_name [String] Specifies the name of a Service Fabric
    # service type.
    # @param service_manifest_name [String] The name of the service manifest to
    # filter the list of deployed service type information. If specified, the
    # response will only contain the information about service types that are
    # defined in this service manifest.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_deployed_service_type_info_by_name(node_name, application_id, service_type_name, service_manifest_name:nil, timeout:60, custom_headers:nil)
      response = get_deployed_service_type_info_by_name_async(node_name, application_id, service_type_name, service_manifest_name:service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about a specified service type of the application
    # deployed on a node in a Service Fabric cluster.
    #
    # Gets the list containing the information about a specific service type from
    # the applications deployed on a node in a Service Fabric cluster. The response
    # includes the name of the service type, its registration status, the code
    # package that registered it and activation ID of the service package. Each
    # entry represents one activation of a service type, differentiated by the
    # activation ID.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_type_name [String] Specifies the name of a Service Fabric
    # service type.
    # @param service_manifest_name [String] The name of the service manifest to
    # filter the list of deployed service type information. If specified, the
    # response will only contain the information about service types that are
    # defined in this service manifest.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_type_info_by_name_with_http_info(node_name, application_id, service_type_name, service_manifest_name:nil, timeout:60, custom_headers:nil)
      get_deployed_service_type_info_by_name_async(node_name, application_id, service_type_name, service_manifest_name:service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about a specified service type of the application
    # deployed on a node in a Service Fabric cluster.
    #
    # Gets the list containing the information about a specific service type from
    # the applications deployed on a node in a Service Fabric cluster. The response
    # includes the name of the service type, its registration status, the code
    # package that registered it and activation ID of the service package. Each
    # entry represents one activation of a service type, differentiated by the
    # activation ID.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_type_name [String] Specifies the name of a Service Fabric
    # service type.
    # @param service_manifest_name [String] The name of the service manifest to
    # filter the list of deployed service type information. If specified, the
    # response will only contain the information about service types that are
    # defined in this service manifest.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_type_info_by_name_async(node_name, application_id, service_type_name, service_manifest_name:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'service_type_name is nil' if service_type_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetServiceTypes/{serviceTypeName}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id,'serviceTypeName' => service_type_name},
          query_params: {'api-version' => api_version,'ServiceManifestName' => service_manifest_name,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 || 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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'DeployedServiceTypeInfoElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'DeployedServiceTypeInfo'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Creates a Service Fabric application.
    #
    # Creates a Service Fabric application using the specified description.
    #
    # @param application_description [ApplicationDescription] Description for
    # creating an application.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def create_application(application_description, timeout:60, custom_headers:nil)
      response = create_application_async(application_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Creates a Service Fabric application.
    #
    # Creates a Service Fabric application using the specified description.
    #
    # @param application_description [ApplicationDescription] Description for
    # creating an application.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_application_with_http_info(application_description, timeout:60, custom_headers:nil)
      create_application_async(application_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Creates a Service Fabric application.
    #
    # Creates a Service Fabric application using the specified description.
    #
    # @param application_description [ApplicationDescription] Description for
    # creating an application.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_application_async(application_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_description is nil' if application_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ApplicationDescription.mapper()
      request_content = self.serialize(request_mapper,  application_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Applications/$/Create'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 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?

        result
      end

      promise.execute
    end

    #
    # Deletes an existing Service Fabric application.
    #
    # Deletes an existing Service Fabric application. An application must be
    # created before it can be deleted. Deleting an application will delete all
    # services that are part of that application. By default, Service Fabric will
    # try to close service replicas in a graceful manner and then delete the
    # service. However, if a service is having issues closing the replica
    # gracefully, the delete operation may take a long time or get stuck. Use the
    # optional ForceRemove flag to skip the graceful close sequence and forcefully
    # delete the application and all of the its services.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param force_remove [Boolean] Remove a Service Fabric application or service
    # forcefully without going through the graceful shutdown sequence. This
    # parameter can be used to forcefully delete an application or service for
    # which delete is timing out due to issues in the service code that prevents
    # graceful close of replicas.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def delete_application(application_id, force_remove:nil, timeout:60, custom_headers:nil)
      response = delete_application_async(application_id, force_remove:force_remove, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Deletes an existing Service Fabric application.
    #
    # Deletes an existing Service Fabric application. An application must be
    # created before it can be deleted. Deleting an application will delete all
    # services that are part of that application. By default, Service Fabric will
    # try to close service replicas in a graceful manner and then delete the
    # service. However, if a service is having issues closing the replica
    # gracefully, the delete operation may take a long time or get stuck. Use the
    # optional ForceRemove flag to skip the graceful close sequence and forcefully
    # delete the application and all of the its services.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param force_remove [Boolean] Remove a Service Fabric application or service
    # forcefully without going through the graceful shutdown sequence. This
    # parameter can be used to forcefully delete an application or service for
    # which delete is timing out due to issues in the service code that prevents
    # graceful close of replicas.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_application_with_http_info(application_id, force_remove:nil, timeout:60, custom_headers:nil)
      delete_application_async(application_id, force_remove:force_remove, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Deletes an existing Service Fabric application.
    #
    # Deletes an existing Service Fabric application. An application must be
    # created before it can be deleted. Deleting an application will delete all
    # services that are part of that application. By default, Service Fabric will
    # try to close service replicas in a graceful manner and then delete the
    # service. However, if a service is having issues closing the replica
    # gracefully, the delete operation may take a long time or get stuck. Use the
    # optional ForceRemove flag to skip the graceful close sequence and forcefully
    # delete the application and all of the its services.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param force_remove [Boolean] Remove a Service Fabric application or service
    # forcefully without going through the graceful shutdown sequence. This
    # parameter can be used to forcefully delete an application or service for
    # which delete is timing out due to issues in the service code that prevents
    # graceful close of replicas.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_application_async(application_id, force_remove:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/Delete'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'ForceRemove' => force_remove,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets load information about a Service Fabric application.
    #
    # Returns the load information about the application that was created or in the
    # process of being created in the Service Fabric cluster and whose name matches
    # the one specified as the parameter. The response includes the name, minimum
    # nodes, maximum nodes, the number of nodes the application is occupying
    # currently, and application load metric information about the application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ApplicationLoadInfo] operation results.
    #
    def get_application_load_info(application_id, timeout:60, custom_headers:nil)
      response = get_application_load_info_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets load information about a Service Fabric application.
    #
    # Returns the load information about the application that was created or in the
    # process of being created in the Service Fabric cluster and whose name matches
    # the one specified as the parameter. The response includes the name, minimum
    # nodes, maximum nodes, the number of nodes the application is occupying
    # currently, and application load metric information about the application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_load_info_with_http_info(application_id, timeout:60, custom_headers:nil)
      get_application_load_info_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets load information about a Service Fabric application.
    #
    # Returns the load information about the application that was created or in the
    # process of being created in the Service Fabric cluster and whose name matches
    # the one specified as the parameter. The response includes the name, minimum
    # nodes, maximum nodes, the number of nodes the application is occupying
    # currently, and application load metric information about the application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_load_info_async(application_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/GetLoadInformation'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 || 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::ServiceFabric::V6_2_0_9::Models::ApplicationLoadInfo.mapper()
            result.body = self.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

    #
    # Gets the list of applications created in the Service Fabric cluster that
    # match the specified filters.
    #
    # Gets the information about the applications that were created or in the
    # process of being created in the Service Fabric cluster and match the
    # specified filters. The response includes the name, type, status, parameters,
    # and other details about the application. If the applications do not fit in a
    # page, one page of results is returned as well as a continuation token which
    # can be used to get the next page. Filters ApplicationTypeName and
    # ApplicationDefinitionKindFilter cannot be specified at the same time.
    #
    # @param application_definition_kind_filter [Integer] Used to filter on
    # ApplicationDefinitionKind which is the mechanism used to define a Service
    # Fabric application.
    # - Default - Default value, which performs the same function as selecting
    # "All". The value is 0.
    # - All - Filter that matches input with any ApplicationDefinitionKind value.
    # The value is 65535.
    # - ServiceFabricApplicationDescription - Filter that matches input with
    # ApplicationDefinitionKind value ServiceFabricApplicationDescription. The
    # value is 1.
    # - Compose - Filter that matches input with ApplicationDefinitionKind value
    # Compose. The value is 2.
    # @param application_type_name [String] The application type name used to
    # filter the applications to query for. This value should not contain the
    # application type version.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedApplicationInfoList] operation results.
    #
    def get_application_info_list(application_definition_kind_filter:0, application_type_name:nil, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      response = get_application_info_list_async(application_definition_kind_filter:application_definition_kind_filter, application_type_name:application_type_name, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of applications created in the Service Fabric cluster that
    # match the specified filters.
    #
    # Gets the information about the applications that were created or in the
    # process of being created in the Service Fabric cluster and match the
    # specified filters. The response includes the name, type, status, parameters,
    # and other details about the application. If the applications do not fit in a
    # page, one page of results is returned as well as a continuation token which
    # can be used to get the next page. Filters ApplicationTypeName and
    # ApplicationDefinitionKindFilter cannot be specified at the same time.
    #
    # @param application_definition_kind_filter [Integer] Used to filter on
    # ApplicationDefinitionKind which is the mechanism used to define a Service
    # Fabric application.
    # - Default - Default value, which performs the same function as selecting
    # "All". The value is 0.
    # - All - Filter that matches input with any ApplicationDefinitionKind value.
    # The value is 65535.
    # - ServiceFabricApplicationDescription - Filter that matches input with
    # ApplicationDefinitionKind value ServiceFabricApplicationDescription. The
    # value is 1.
    # - Compose - Filter that matches input with ApplicationDefinitionKind value
    # Compose. The value is 2.
    # @param application_type_name [String] The application type name used to
    # filter the applications to query for. This value should not contain the
    # application type version.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_info_list_with_http_info(application_definition_kind_filter:0, application_type_name:nil, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      get_application_info_list_async(application_definition_kind_filter:application_definition_kind_filter, application_type_name:application_type_name, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of applications created in the Service Fabric cluster that
    # match the specified filters.
    #
    # Gets the information about the applications that were created or in the
    # process of being created in the Service Fabric cluster and match the
    # specified filters. The response includes the name, type, status, parameters,
    # and other details about the application. If the applications do not fit in a
    # page, one page of results is returned as well as a continuation token which
    # can be used to get the next page. Filters ApplicationTypeName and
    # ApplicationDefinitionKindFilter cannot be specified at the same time.
    #
    # @param application_definition_kind_filter [Integer] Used to filter on
    # ApplicationDefinitionKind which is the mechanism used to define a Service
    # Fabric application.
    # - Default - Default value, which performs the same function as selecting
    # "All". The value is 0.
    # - All - Filter that matches input with any ApplicationDefinitionKind value.
    # The value is 65535.
    # - ServiceFabricApplicationDescription - Filter that matches input with
    # ApplicationDefinitionKind value ServiceFabricApplicationDescription. The
    # value is 1.
    # - Compose - Filter that matches input with ApplicationDefinitionKind value
    # Compose. The value is 2.
    # @param application_type_name [String] The application type name used to
    # filter the applications to query for. This value should not contain the
    # application type version.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_info_list_async(application_definition_kind_filter:0, application_type_name:nil, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      api_version = '6.1'
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'ApplicationDefinitionKindFilter' => application_definition_kind_filter,'ApplicationTypeName' => application_type_name,'ExcludeApplicationParameters' => exclude_application_parameters,'MaxResults' => max_results,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedApplicationInfoList.mapper()
            result.body = self.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

    #
    # Gets information about a Service Fabric application.
    #
    # Returns the information about the application that was created or in the
    # process of being created in the Service Fabric cluster and whose name matches
    # the one specified as the parameter. The response includes the name, type,
    # status, parameters and other details about the application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ApplicationInfo] operation results.
    #
    def get_application_info(application_id, exclude_application_parameters:false, timeout:60, custom_headers:nil)
      response = get_application_info_async(application_id, exclude_application_parameters:exclude_application_parameters, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets information about a Service Fabric application.
    #
    # Returns the information about the application that was created or in the
    # process of being created in the Service Fabric cluster and whose name matches
    # the one specified as the parameter. The response includes the name, type,
    # status, parameters and other details about the application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_info_with_http_info(application_id, exclude_application_parameters:false, timeout:60, custom_headers:nil)
      get_application_info_async(application_id, exclude_application_parameters:exclude_application_parameters, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets information about a Service Fabric application.
    #
    # Returns the information about the application that was created or in the
    # process of being created in the Service Fabric cluster and whose name matches
    # the one specified as the parameter. The response includes the name, type,
    # status, parameters and other details about the application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param exclude_application_parameters [Boolean] The flag that specifies
    # whether application parameters will be excluded from the result.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_info_async(application_id, exclude_application_parameters:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'ExcludeApplicationParameters' => exclude_application_parameters,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 || 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::ServiceFabric::V6_2_0_9::Models::ApplicationInfo.mapper()
            result.body = self.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

    #
    # Gets the health of the service fabric application.
    #
    # Returns the heath state of the service fabric application. The response
    # reports either Ok, Error or Warning health state. If the entity is not found
    # in the health store, it will return Error.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_applications_health_state_filter [Integer] Allows filtering
    # of the deployed applications health state objects returned in the result of
    # application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states. Only deployed applications that match the filter
    # will be returned.
    # All deployed applications are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of deployed
    # applications with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param services_health_state_filter [Integer] Allows filtering of the
    # services health state objects returned in the result of services health query
    # based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only services that match the filter are returned. All services are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of services with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ApplicationHealth] operation results.
    #
    def get_application_health(application_id, events_health_state_filter:0, deployed_applications_health_state_filter:0, services_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      response = get_application_health_async(application_id, events_health_state_filter:events_health_state_filter, deployed_applications_health_state_filter:deployed_applications_health_state_filter, services_health_state_filter:services_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of the service fabric application.
    #
    # Returns the heath state of the service fabric application. The response
    # reports either Ok, Error or Warning health state. If the entity is not found
    # in the health store, it will return Error.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_applications_health_state_filter [Integer] Allows filtering
    # of the deployed applications health state objects returned in the result of
    # application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states. Only deployed applications that match the filter
    # will be returned.
    # All deployed applications are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of deployed
    # applications with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param services_health_state_filter [Integer] Allows filtering of the
    # services health state objects returned in the result of services health query
    # based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only services that match the filter are returned. All services are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of services with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_health_with_http_info(application_id, events_health_state_filter:0, deployed_applications_health_state_filter:0, services_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      get_application_health_async(application_id, events_health_state_filter:events_health_state_filter, deployed_applications_health_state_filter:deployed_applications_health_state_filter, services_health_state_filter:services_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of the service fabric application.
    #
    # Returns the heath state of the service fabric application. The response
    # reports either Ok, Error or Warning health state. If the entity is not found
    # in the health store, it will return Error.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_applications_health_state_filter [Integer] Allows filtering
    # of the deployed applications health state objects returned in the result of
    # application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states. Only deployed applications that match the filter
    # will be returned.
    # All deployed applications are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of deployed
    # applications with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param services_health_state_filter [Integer] Allows filtering of the
    # services health state objects returned in the result of services health query
    # based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only services that match the filter are returned. All services are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of services with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_health_async(application_id, events_health_state_filter:0, deployed_applications_health_state_filter:0, services_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'DeployedApplicationsHealthStateFilter' => deployed_applications_health_state_filter,'ServicesHealthStateFilter' => services_health_state_filter,'ExcludeHealthStatistics' => exclude_health_statistics,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ApplicationHealth.mapper()
            result.body = self.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

    #
    # Gets the health of a Service Fabric application using the specified policy.
    #
    # Gets the health of a Service Fabric application. Use EventsHealthStateFilter
    # to filter the collection of health events reported on the node based on the
    # health state. Use ClusterHealthPolicies to override the health policies used
    # to evaluate the health.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_applications_health_state_filter [Integer] Allows filtering
    # of the deployed applications health state objects returned in the result of
    # application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states. Only deployed applications that match the filter
    # will be returned.
    # All deployed applications are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of deployed
    # applications with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param services_health_state_filter [Integer] Allows filtering of the
    # services health state objects returned in the result of services health query
    # based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only services that match the filter are returned. All services are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of services with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ApplicationHealth] operation results.
    #
    def get_application_health_using_policy(application_id, events_health_state_filter:0, deployed_applications_health_state_filter:0, services_health_state_filter:0, exclude_health_statistics:false, application_health_policy:nil, timeout:60, custom_headers:nil)
      response = get_application_health_using_policy_async(application_id, events_health_state_filter:events_health_state_filter, deployed_applications_health_state_filter:deployed_applications_health_state_filter, services_health_state_filter:services_health_state_filter, exclude_health_statistics:exclude_health_statistics, application_health_policy:application_health_policy, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of a Service Fabric application using the specified policy.
    #
    # Gets the health of a Service Fabric application. Use EventsHealthStateFilter
    # to filter the collection of health events reported on the node based on the
    # health state. Use ClusterHealthPolicies to override the health policies used
    # to evaluate the health.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_applications_health_state_filter [Integer] Allows filtering
    # of the deployed applications health state objects returned in the result of
    # application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states. Only deployed applications that match the filter
    # will be returned.
    # All deployed applications are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of deployed
    # applications with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param services_health_state_filter [Integer] Allows filtering of the
    # services health state objects returned in the result of services health query
    # based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only services that match the filter are returned. All services are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of services with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_health_using_policy_with_http_info(application_id, events_health_state_filter:0, deployed_applications_health_state_filter:0, services_health_state_filter:0, exclude_health_statistics:false, application_health_policy:nil, timeout:60, custom_headers:nil)
      get_application_health_using_policy_async(application_id, events_health_state_filter:events_health_state_filter, deployed_applications_health_state_filter:deployed_applications_health_state_filter, services_health_state_filter:services_health_state_filter, exclude_health_statistics:exclude_health_statistics, application_health_policy:application_health_policy, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of a Service Fabric application using the specified policy.
    #
    # Gets the health of a Service Fabric application. Use EventsHealthStateFilter
    # to filter the collection of health events reported on the node based on the
    # health state. Use ClusterHealthPolicies to override the health policies used
    # to evaluate the health.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_applications_health_state_filter [Integer] Allows filtering
    # of the deployed applications health state objects returned in the result of
    # application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states. Only deployed applications that match the filter
    # will be returned.
    # All deployed applications are used to evaluate the aggregated health state.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of deployed
    # applications with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param services_health_state_filter [Integer] Allows filtering of the
    # services health state objects returned in the result of services health query
    # based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only services that match the filter are returned. All services are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of services with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_health_using_policy_async(application_id, events_health_state_filter:0, deployed_applications_health_state_filter:0, services_health_state_filter:0, exclude_health_statistics:false, application_health_policy:nil, timeout:60, custom_headers:nil)
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ApplicationHealthPolicy.mapper()
      request_content = self.serialize(request_mapper,  application_health_policy)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Applications/{applicationId}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'DeployedApplicationsHealthStateFilter' => deployed_applications_health_state_filter,'ServicesHealthStateFilter' => services_health_state_filter,'ExcludeHealthStatistics' => exclude_health_statistics,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ApplicationHealth.mapper()
            result.body = self.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

    #
    # Sends a health report on the Service Fabric application.
    #
    # Reports health state of the specified Service Fabric application. The report
    # must contain the information about the source of the health report and
    # property on which it is reported.
    # The report is sent to a Service Fabric gateway Application, which forwards to
    # the health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, get application
    # health and check that the report appears in the HealthEvents section.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def report_application_health(application_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      response = report_application_health_async(application_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Sends a health report on the Service Fabric application.
    #
    # Reports health state of the specified Service Fabric application. The report
    # must contain the information about the source of the health report and
    # property on which it is reported.
    # The report is sent to a Service Fabric gateway Application, which forwards to
    # the health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, get application
    # health and check that the report appears in the HealthEvents section.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_application_health_with_http_info(application_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      report_application_health_async(application_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Sends a health report on the Service Fabric application.
    #
    # Reports health state of the specified Service Fabric application. The report
    # must contain the information about the source of the health report and
    # property on which it is reported.
    # The report is sent to a Service Fabric gateway Application, which forwards to
    # the health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, get application
    # health and check that the report appears in the HealthEvents section.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_application_health_async(application_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'health_information is nil' if health_information.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::HealthInformation.mapper()
      request_content = self.serialize(request_mapper,  health_information)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Applications/{applicationId}/$/ReportHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'Immediate' => immediate,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Starts upgrading an application in the Service Fabric cluster.
    #
    # Validates the supplied application upgrade parameters and starts upgrading
    # the application if the parameters are valid.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param application_upgrade_description [ApplicationUpgradeDescription]
    # Parameters for an application upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def start_application_upgrade(application_id, application_upgrade_description, timeout:60, custom_headers:nil)
      response = start_application_upgrade_async(application_id, application_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Starts upgrading an application in the Service Fabric cluster.
    #
    # Validates the supplied application upgrade parameters and starts upgrading
    # the application if the parameters are valid.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param application_upgrade_description [ApplicationUpgradeDescription]
    # Parameters for an application upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_application_upgrade_with_http_info(application_id, application_upgrade_description, timeout:60, custom_headers:nil)
      start_application_upgrade_async(application_id, application_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Starts upgrading an application in the Service Fabric cluster.
    #
    # Validates the supplied application upgrade parameters and starts upgrading
    # the application if the parameters are valid.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param application_upgrade_description [ApplicationUpgradeDescription]
    # Parameters for an application upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_application_upgrade_async(application_id, application_upgrade_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'application_upgrade_description is nil' if application_upgrade_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ApplicationUpgradeDescription.mapper()
      request_content = self.serialize(request_mapper,  application_upgrade_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Applications/{applicationId}/$/Upgrade'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets details for the latest upgrade performed on this application.
    #
    # Returns information about the state of the latest application upgrade along
    # with details to aid debugging application health issues.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ApplicationUpgradeProgressInfo] operation results.
    #
    def get_application_upgrade(application_id, timeout:60, custom_headers:nil)
      response = get_application_upgrade_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets details for the latest upgrade performed on this application.
    #
    # Returns information about the state of the latest application upgrade along
    # with details to aid debugging application health issues.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_upgrade_with_http_info(application_id, timeout:60, custom_headers:nil)
      get_application_upgrade_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets details for the latest upgrade performed on this application.
    #
    # Returns information about the state of the latest application upgrade along
    # with details to aid debugging application health issues.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_upgrade_async(application_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/GetUpgradeProgress'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ApplicationUpgradeProgressInfo.mapper()
            result.body = self.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

    #
    # Updates an ongoing application upgrade in the Service Fabric cluster.
    #
    # Updates the parameters of an ongoing application upgrade from the ones
    # specified at the time of starting the application upgrade. This may be
    # required to mitigate stuck application upgrades due to incorrect parameters
    # or issues in the application to make progress.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param application_upgrade_update_description
    # [ApplicationUpgradeUpdateDescription] Parameters for updating an existing
    # application upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def update_application_upgrade(application_id, application_upgrade_update_description, timeout:60, custom_headers:nil)
      response = update_application_upgrade_async(application_id, application_upgrade_update_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Updates an ongoing application upgrade in the Service Fabric cluster.
    #
    # Updates the parameters of an ongoing application upgrade from the ones
    # specified at the time of starting the application upgrade. This may be
    # required to mitigate stuck application upgrades due to incorrect parameters
    # or issues in the application to make progress.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param application_upgrade_update_description
    # [ApplicationUpgradeUpdateDescription] Parameters for updating an existing
    # application upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def update_application_upgrade_with_http_info(application_id, application_upgrade_update_description, timeout:60, custom_headers:nil)
      update_application_upgrade_async(application_id, application_upgrade_update_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Updates an ongoing application upgrade in the Service Fabric cluster.
    #
    # Updates the parameters of an ongoing application upgrade from the ones
    # specified at the time of starting the application upgrade. This may be
    # required to mitigate stuck application upgrades due to incorrect parameters
    # or issues in the application to make progress.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param application_upgrade_update_description
    # [ApplicationUpgradeUpdateDescription] Parameters for updating an existing
    # application upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def update_application_upgrade_async(application_id, application_upgrade_update_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'application_upgrade_update_description is nil' if application_upgrade_update_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ApplicationUpgradeUpdateDescription.mapper()
      request_content = self.serialize(request_mapper,  application_upgrade_update_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Applications/{applicationId}/$/UpdateUpgrade'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Resumes upgrading an application in the Service Fabric cluster.
    #
    # Resumes an unmonitored manual Service Fabric application upgrade. Service
    # Fabric upgrades one upgrade domain at a time. For unmonitored manual
    # upgrades, after Service Fabric finishes an upgrade domain, it waits for you
    # to call this API before proceeding to the next upgrade domain.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param resume_application_upgrade_description
    # [ResumeApplicationUpgradeDescription] Describes the parameters for resuming
    # an application upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def resume_application_upgrade(application_id, resume_application_upgrade_description, timeout:60, custom_headers:nil)
      response = resume_application_upgrade_async(application_id, resume_application_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Resumes upgrading an application in the Service Fabric cluster.
    #
    # Resumes an unmonitored manual Service Fabric application upgrade. Service
    # Fabric upgrades one upgrade domain at a time. For unmonitored manual
    # upgrades, after Service Fabric finishes an upgrade domain, it waits for you
    # to call this API before proceeding to the next upgrade domain.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param resume_application_upgrade_description
    # [ResumeApplicationUpgradeDescription] Describes the parameters for resuming
    # an application upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resume_application_upgrade_with_http_info(application_id, resume_application_upgrade_description, timeout:60, custom_headers:nil)
      resume_application_upgrade_async(application_id, resume_application_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Resumes upgrading an application in the Service Fabric cluster.
    #
    # Resumes an unmonitored manual Service Fabric application upgrade. Service
    # Fabric upgrades one upgrade domain at a time. For unmonitored manual
    # upgrades, after Service Fabric finishes an upgrade domain, it waits for you
    # to call this API before proceeding to the next upgrade domain.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param resume_application_upgrade_description
    # [ResumeApplicationUpgradeDescription] Describes the parameters for resuming
    # an application upgrade.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resume_application_upgrade_async(application_id, resume_application_upgrade_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'resume_application_upgrade_description is nil' if resume_application_upgrade_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ResumeApplicationUpgradeDescription.mapper()
      request_content = self.serialize(request_mapper,  resume_application_upgrade_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Applications/{applicationId}/$/MoveToNextUpgradeDomain'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Starts rolling back the currently on-going upgrade of an application in the
    # Service Fabric cluster.
    #
    # Starts rolling back the current application upgrade to the previous version.
    # This API can only be used to rollback the current in-progress upgrade that is
    # rolling forward to new version. If the application is not currently being
    # upgraded use StartApplicationUpgrade API to upgrade it to desired version,
    # including rolling back to a previous version.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def rollback_application_upgrade(application_id, timeout:60, custom_headers:nil)
      response = rollback_application_upgrade_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Starts rolling back the currently on-going upgrade of an application in the
    # Service Fabric cluster.
    #
    # Starts rolling back the current application upgrade to the previous version.
    # This API can only be used to rollback the current in-progress upgrade that is
    # rolling forward to new version. If the application is not currently being
    # upgraded use StartApplicationUpgrade API to upgrade it to desired version,
    # including rolling back to a previous version.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def rollback_application_upgrade_with_http_info(application_id, timeout:60, custom_headers:nil)
      rollback_application_upgrade_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Starts rolling back the currently on-going upgrade of an application in the
    # Service Fabric cluster.
    #
    # Starts rolling back the current application upgrade to the previous version.
    # This API can only be used to rollback the current in-progress upgrade that is
    # rolling forward to new version. If the application is not currently being
    # upgraded use StartApplicationUpgrade API to upgrade it to desired version,
    # including rolling back to a previous version.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def rollback_application_upgrade_async(application_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/RollbackUpgrade'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the list of applications deployed on a Service Fabric node.
    #
    # Gets the list of applications deployed on a Service Fabric node. The results
    # do not include information about deployed system applications unless
    # explicitly queried for by ID. Results encompass deployed applications in
    # active, activating, and downloading states. This query requires that the node
    # name corresponds to a node on the cluster. The query fails if the provided
    # node name does not point to any active Service Fabric nodes on the cluster.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param include_health_state [Boolean] Include the health state of an entity.
    # If this parameter is false or not specified, then the health state returned
    # is "Unknown".
    # When set to true, the query goes in parallel to the node and the health
    # system service before the results are merged.
    # As a result, the query is more expensive and may take a longer time.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedDeployedApplicationInfoList] operation results.
    #
    def get_deployed_application_info_list(node_name, timeout:60, include_health_state:false, continuation_token:nil, max_results:0, custom_headers:nil)
      response = get_deployed_application_info_list_async(node_name, timeout:timeout, include_health_state:include_health_state, continuation_token:continuation_token, max_results:max_results, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of applications deployed on a Service Fabric node.
    #
    # Gets the list of applications deployed on a Service Fabric node. The results
    # do not include information about deployed system applications unless
    # explicitly queried for by ID. Results encompass deployed applications in
    # active, activating, and downloading states. This query requires that the node
    # name corresponds to a node on the cluster. The query fails if the provided
    # node name does not point to any active Service Fabric nodes on the cluster.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param include_health_state [Boolean] Include the health state of an entity.
    # If this parameter is false or not specified, then the health state returned
    # is "Unknown".
    # When set to true, the query goes in parallel to the node and the health
    # system service before the results are merged.
    # As a result, the query is more expensive and may take a longer time.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @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.
    #
    def get_deployed_application_info_list_with_http_info(node_name, timeout:60, include_health_state:false, continuation_token:nil, max_results:0, custom_headers:nil)
      get_deployed_application_info_list_async(node_name, timeout:timeout, include_health_state:include_health_state, continuation_token:continuation_token, max_results:max_results, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of applications deployed on a Service Fabric node.
    #
    # Gets the list of applications deployed on a Service Fabric node. The results
    # do not include information about deployed system applications unless
    # explicitly queried for by ID. Results encompass deployed applications in
    # active, activating, and downloading states. This query requires that the node
    # name corresponds to a node on the cluster. The query fails if the provided
    # node name does not point to any active Service Fabric nodes on the cluster.
    #
    # @param node_name [String] The name of the node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param include_health_state [Boolean] Include the health state of an entity.
    # If this parameter is false or not specified, then the health state returned
    # is "Unknown".
    # When set to true, the query goes in parallel to the node and the health
    # system service before the results are merged.
    # As a result, the query is more expensive and may take a longer time.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @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.
    #
    def get_deployed_application_info_list_async(node_name, timeout:60, include_health_state:false, continuation_token:nil, max_results:0, custom_headers:nil)
      api_version = '6.1'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetApplications'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'timeout' => timeout,'IncludeHealthState' => include_health_state,'MaxResults' => max_results},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedDeployedApplicationInfoList.mapper()
            result.body = self.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

    #
    # Gets the information about an application deployed on a Service Fabric node.
    #
    # Gets the information about an application deployed on a Service Fabric node.
    # This query returns system application information if the application ID
    # provided is for system application. Results encompass deployed applications
    # in active, activating, and downloading states. This query requires that the
    # node name corresponds to a node on the cluster. The query fails if the
    # provided node name does not point to any active Service Fabric nodes on the
    # cluster.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param include_health_state [Boolean] Include the health state of an entity.
    # If this parameter is false or not specified, then the health state returned
    # is "Unknown".
    # When set to true, the query goes in parallel to the node and the health
    # system service before the results are merged.
    # As a result, the query is more expensive and may take a longer time.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [DeployedApplicationInfo] operation results.
    #
    def get_deployed_application_info(node_name, application_id, timeout:60, include_health_state:false, custom_headers:nil)
      response = get_deployed_application_info_async(node_name, application_id, timeout:timeout, include_health_state:include_health_state, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about an application deployed on a Service Fabric node.
    #
    # Gets the information about an application deployed on a Service Fabric node.
    # This query returns system application information if the application ID
    # provided is for system application. Results encompass deployed applications
    # in active, activating, and downloading states. This query requires that the
    # node name corresponds to a node on the cluster. The query fails if the
    # provided node name does not point to any active Service Fabric nodes on the
    # cluster.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param include_health_state [Boolean] Include the health state of an entity.
    # If this parameter is false or not specified, then the health state returned
    # is "Unknown".
    # When set to true, the query goes in parallel to the node and the health
    # system service before the results are merged.
    # As a result, the query is more expensive and may take a longer time.
    # @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.
    #
    def get_deployed_application_info_with_http_info(node_name, application_id, timeout:60, include_health_state:false, custom_headers:nil)
      get_deployed_application_info_async(node_name, application_id, timeout:timeout, include_health_state:include_health_state, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about an application deployed on a Service Fabric node.
    #
    # Gets the information about an application deployed on a Service Fabric node.
    # This query returns system application information if the application ID
    # provided is for system application. Results encompass deployed applications
    # in active, activating, and downloading states. This query requires that the
    # node name corresponds to a node on the cluster. The query fails if the
    # provided node name does not point to any active Service Fabric nodes on the
    # cluster.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param include_health_state [Boolean] Include the health state of an entity.
    # If this parameter is false or not specified, then the health state returned
    # is "Unknown".
    # When set to true, the query goes in parallel to the node and the health
    # system service before the results are merged.
    # As a result, the query is more expensive and may take a longer time.
    # @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.
    #
    def get_deployed_application_info_async(node_name, application_id, timeout:60, include_health_state:false, custom_headers:nil)
      api_version = '6.1'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout,'IncludeHealthState' => include_health_state},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 || 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::ServiceFabric::V6_2_0_9::Models::DeployedApplicationInfo.mapper()
            result.body = self.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

    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node.
    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node. Use EventsHealthStateFilter to optionally filter for the
    # collection of HealthEvent objects reported on the deployed application based
    # on health state. Use DeployedServicePackagesHealthStateFilter to optionally
    # filter for DeployedServicePackageHealth children based on health state.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_service_packages_health_state_filter [Integer] Allows
    # filtering of the deployed service package health state objects returned in
    # the result of deployed application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only deployed service packages that match the filter are returned. All
    # deployed service packages are used to evaluate the aggregated health state of
    # the deployed application.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value can be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of service packages
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [DeployedApplicationHealth] operation results.
    #
    def get_deployed_application_health(node_name, application_id, events_health_state_filter:0, deployed_service_packages_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      response = get_deployed_application_health_async(node_name, application_id, events_health_state_filter:events_health_state_filter, deployed_service_packages_health_state_filter:deployed_service_packages_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node.
    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node. Use EventsHealthStateFilter to optionally filter for the
    # collection of HealthEvent objects reported on the deployed application based
    # on health state. Use DeployedServicePackagesHealthStateFilter to optionally
    # filter for DeployedServicePackageHealth children based on health state.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_service_packages_health_state_filter [Integer] Allows
    # filtering of the deployed service package health state objects returned in
    # the result of deployed application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only deployed service packages that match the filter are returned. All
    # deployed service packages are used to evaluate the aggregated health state of
    # the deployed application.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value can be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of service packages
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_application_health_with_http_info(node_name, application_id, events_health_state_filter:0, deployed_service_packages_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      get_deployed_application_health_async(node_name, application_id, events_health_state_filter:events_health_state_filter, deployed_service_packages_health_state_filter:deployed_service_packages_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node.
    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node. Use EventsHealthStateFilter to optionally filter for the
    # collection of HealthEvent objects reported on the deployed application based
    # on health state. Use DeployedServicePackagesHealthStateFilter to optionally
    # filter for DeployedServicePackageHealth children based on health state.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_service_packages_health_state_filter [Integer] Allows
    # filtering of the deployed service package health state objects returned in
    # the result of deployed application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only deployed service packages that match the filter are returned. All
    # deployed service packages are used to evaluate the aggregated health state of
    # the deployed application.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value can be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of service packages
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_application_health_async(node_name, application_id, events_health_state_filter:0, deployed_service_packages_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'DeployedServicePackagesHealthStateFilter' => deployed_service_packages_health_state_filter,'ExcludeHealthStatistics' => exclude_health_statistics,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::DeployedApplicationHealth.mapper()
            result.body = self.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

    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node. using the specified policy.
    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node using the specified policy. Use EventsHealthStateFilter to
    # optionally filter for the collection of HealthEvent objects reported on the
    # deployed application based on health state. Use
    # DeployedServicePackagesHealthStateFilter to optionally filter for
    # DeployedServicePackageHealth children based on health state. Use
    # ApplicationHealthPolicy to optionally override the health policies used to
    # evaluate the health. This API only uses 'ConsiderWarningAsError' field of the
    # ApplicationHealthPolicy. The rest of the fields are ignored while evaluating
    # the health of the deployed application.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_service_packages_health_state_filter [Integer] Allows
    # filtering of the deployed service package health state objects returned in
    # the result of deployed application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only deployed service packages that match the filter are returned. All
    # deployed service packages are used to evaluate the aggregated health state of
    # the deployed application.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value can be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of service packages
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [DeployedApplicationHealth] operation results.
    #
    def get_deployed_application_health_using_policy(node_name, application_id, events_health_state_filter:0, deployed_service_packages_health_state_filter:0, application_health_policy:nil, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      response = get_deployed_application_health_using_policy_async(node_name, application_id, events_health_state_filter:events_health_state_filter, deployed_service_packages_health_state_filter:deployed_service_packages_health_state_filter, application_health_policy:application_health_policy, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node. using the specified policy.
    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node using the specified policy. Use EventsHealthStateFilter to
    # optionally filter for the collection of HealthEvent objects reported on the
    # deployed application based on health state. Use
    # DeployedServicePackagesHealthStateFilter to optionally filter for
    # DeployedServicePackageHealth children based on health state. Use
    # ApplicationHealthPolicy to optionally override the health policies used to
    # evaluate the health. This API only uses 'ConsiderWarningAsError' field of the
    # ApplicationHealthPolicy. The rest of the fields are ignored while evaluating
    # the health of the deployed application.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_service_packages_health_state_filter [Integer] Allows
    # filtering of the deployed service package health state objects returned in
    # the result of deployed application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only deployed service packages that match the filter are returned. All
    # deployed service packages are used to evaluate the aggregated health state of
    # the deployed application.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value can be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of service packages
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_application_health_using_policy_with_http_info(node_name, application_id, events_health_state_filter:0, deployed_service_packages_health_state_filter:0, application_health_policy:nil, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      get_deployed_application_health_using_policy_async(node_name, application_id, events_health_state_filter:events_health_state_filter, deployed_service_packages_health_state_filter:deployed_service_packages_health_state_filter, application_health_policy:application_health_policy, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node. using the specified policy.
    #
    # Gets the information about health of an application deployed on a Service
    # Fabric node using the specified policy. Use EventsHealthStateFilter to
    # optionally filter for the collection of HealthEvent objects reported on the
    # deployed application based on health state. Use
    # DeployedServicePackagesHealthStateFilter to optionally filter for
    # DeployedServicePackageHealth children based on health state. Use
    # ApplicationHealthPolicy to optionally override the health policies used to
    # evaluate the health. This API only uses 'ConsiderWarningAsError' field of the
    # ApplicationHealthPolicy. The rest of the fields are ignored while evaluating
    # the health of the deployed application.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param deployed_service_packages_health_state_filter [Integer] Allows
    # filtering of the deployed service package health state objects returned in
    # the result of deployed application health query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only deployed service packages that match the filter are returned. All
    # deployed service packages are used to evaluate the aggregated health state of
    # the deployed application.
    # If not specified, all entries are returned.
    # The state values are flag based enumeration, so the value can be a
    # combination of these value obtained using bitwise 'OR' operator.
    # For example, if the provided value is 6 then health state of service packages
    # with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_application_health_using_policy_async(node_name, application_id, events_health_state_filter:0, deployed_service_packages_health_state_filter:0, application_health_policy:nil, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ApplicationHealthPolicy.mapper()
      request_content = self.serialize(request_mapper,  application_health_policy)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'DeployedServicePackagesHealthStateFilter' => deployed_service_packages_health_state_filter,'ExcludeHealthStatistics' => exclude_health_statistics,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::DeployedApplicationHealth.mapper()
            result.body = self.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

    #
    # Sends a health report on the Service Fabric application deployed on a Service
    # Fabric node.
    #
    # Reports health state of the application deployed on a Service Fabric node.
    # The report must contain the information about the source of the health report
    # and property on which it is reported.
    # The report is sent to a Service Fabric gateway Service, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, get deployed
    # application health and check that the report appears in the HealthEvents
    # section.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def report_deployed_application_health(node_name, application_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      response = report_deployed_application_health_async(node_name, application_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Sends a health report on the Service Fabric application deployed on a Service
    # Fabric node.
    #
    # Reports health state of the application deployed on a Service Fabric node.
    # The report must contain the information about the source of the health report
    # and property on which it is reported.
    # The report is sent to a Service Fabric gateway Service, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, get deployed
    # application health and check that the report appears in the HealthEvents
    # section.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_deployed_application_health_with_http_info(node_name, application_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      report_deployed_application_health_async(node_name, application_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Sends a health report on the Service Fabric application deployed on a Service
    # Fabric node.
    #
    # Reports health state of the application deployed on a Service Fabric node.
    # The report must contain the information about the source of the health report
    # and property on which it is reported.
    # The report is sent to a Service Fabric gateway Service, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, get deployed
    # application health and check that the report appears in the HealthEvents
    # section.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_deployed_application_health_async(node_name, application_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'health_information is nil' if health_information.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::HealthInformation.mapper()
      request_content = self.serialize(request_mapper,  health_information)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/ReportHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'Immediate' => immediate,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the manifest describing an application type.
    #
    # Gets the manifest describing an application type. The response contains the
    # application manifest XML as a string.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ApplicationTypeManifest] operation results.
    #
    def get_application_manifest(application_type_name, application_type_version, timeout:60, custom_headers:nil)
      response = get_application_manifest_async(application_type_name, application_type_version, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the manifest describing an application type.
    #
    # Gets the manifest describing an application type. The response contains the
    # application manifest XML as a string.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_manifest_with_http_info(application_type_name, application_type_version, timeout:60, custom_headers:nil)
      get_application_manifest_async(application_type_name, application_type_version, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the manifest describing an application type.
    #
    # Gets the manifest describing an application type. The response contains the
    # application manifest XML as a string.
    #
    # @param application_type_name [String] The name of the application type.
    # @param application_type_version [String] The version of the application type.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_manifest_async(application_type_name, application_type_version, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_type_name is nil' if application_type_name.nil?
      fail ArgumentError, 'application_type_version is nil' if application_type_version.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ApplicationTypes/{applicationTypeName}/$/GetApplicationManifest'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'applicationTypeName' => application_type_name},
          query_params: {'api-version' => api_version,'ApplicationTypeVersion' => application_type_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ApplicationTypeManifest.mapper()
            result.body = self.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

    #
    # Gets the information about all services belonging to the application
    # specified by the application id.
    #
    # Returns the information about all services belonging to the application
    # specified by the application id.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_type_name [String] The service type name used to filter the
    # services to query for.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedServiceInfoList] operation results.
    #
    def get_service_info_list(application_id, service_type_name:nil, continuation_token:nil, timeout:60, custom_headers:nil)
      response = get_service_info_list_async(application_id, service_type_name:service_type_name, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about all services belonging to the application
    # specified by the application id.
    #
    # Returns the information about all services belonging to the application
    # specified by the application id.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_type_name [String] The service type name used to filter the
    # services to query for.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_info_list_with_http_info(application_id, service_type_name:nil, continuation_token:nil, timeout:60, custom_headers:nil)
      get_service_info_list_async(application_id, service_type_name:service_type_name, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about all services belonging to the application
    # specified by the application id.
    #
    # Returns the information about all services belonging to the application
    # specified by the application id.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_type_name [String] The service type name used to filter the
    # services to query for.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_info_list_async(application_id, service_type_name:nil, continuation_token:nil, timeout:60, custom_headers:nil)
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/GetServices'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'ServiceTypeName' => service_type_name,'api-version' => api_version,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedServiceInfoList.mapper()
            result.body = self.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

    #
    # Gets the information about the specific service belonging to the Service
    # Fabric application.
    #
    # Returns the information about the specified service belonging to the
    # specified Service Fabric application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ServiceInfo] operation results.
    #
    def get_service_info(application_id, service_id, timeout:60, custom_headers:nil)
      response = get_service_info_async(application_id, service_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about the specific service belonging to the Service
    # Fabric application.
    #
    # Returns the information about the specified service belonging to the
    # specified Service Fabric application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_info_with_http_info(application_id, service_id, timeout:60, custom_headers:nil)
      get_service_info_async(application_id, service_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about the specific service belonging to the Service
    # Fabric application.
    #
    # Returns the information about the specified service belonging to the
    # specified Service Fabric application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_info_async(application_id, service_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/GetServices/{serviceId}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id,'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 || 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::ServiceFabric::V6_2_0_9::Models::ServiceInfo.mapper()
            result.body = self.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

    #
    # Gets the name of the Service Fabric application for a service.
    #
    # Gets the name of the application for the specified service. A 404
    # FABRIC_E_SERVICE_DOES_NOT_EXIST error is returned if a service with the
    # provided service ID does not exist.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ApplicationNameInfo] operation results.
    #
    def get_application_name_info(service_id, timeout:60, custom_headers:nil)
      response = get_application_name_info_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the name of the Service Fabric application for a service.
    #
    # Gets the name of the application for the specified service. A 404
    # FABRIC_E_SERVICE_DOES_NOT_EXIST error is returned if a service with the
    # provided service ID does not exist.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_name_info_with_http_info(service_id, timeout:60, custom_headers:nil)
      get_application_name_info_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the name of the Service Fabric application for a service.
    #
    # Gets the name of the application for the specified service. A 404
    # FABRIC_E_SERVICE_DOES_NOT_EXIST error is returned if a service with the
    # provided service ID does not exist.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_name_info_async(service_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/{serviceId}/$/GetApplicationName'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ApplicationNameInfo.mapper()
            result.body = self.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

    #
    # Creates the specified Service Fabric service.
    #
    # This api allows creating a new Service Fabric stateless or stateful service
    # under a specified Service Fabric application. The description for creating
    # the service includes partitioning information and optional properties for
    # placement and load balancing. Some of the properties can later be modified
    # using `UpdateService` API.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_description [ServiceDescription] The information necessary to
    # create a service.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def create_service(application_id, service_description, timeout:60, custom_headers:nil)
      response = create_service_async(application_id, service_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Creates the specified Service Fabric service.
    #
    # This api allows creating a new Service Fabric stateless or stateful service
    # under a specified Service Fabric application. The description for creating
    # the service includes partitioning information and optional properties for
    # placement and load balancing. Some of the properties can later be modified
    # using `UpdateService` API.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_description [ServiceDescription] The information necessary to
    # create a service.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_service_with_http_info(application_id, service_description, timeout:60, custom_headers:nil)
      create_service_async(application_id, service_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Creates the specified Service Fabric service.
    #
    # This api allows creating a new Service Fabric stateless or stateful service
    # under a specified Service Fabric application. The description for creating
    # the service includes partitioning information and optional properties for
    # placement and load balancing. Some of the properties can later be modified
    # using `UpdateService` API.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_description [ServiceDescription] The information necessary to
    # create a service.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_service_async(application_id, service_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'service_description is nil' if service_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ServiceDescription.mapper()
      request_content = self.serialize(request_mapper,  service_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Applications/{applicationId}/$/GetServices/$/Create'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Creates a Service Fabric service from the service template.
    #
    # Creates a Service Fabric service from the service template defined in the
    # application manifest. A service template contains the properties that will be
    # same for the service instance of the same type. The API allows overriding the
    # properties that are usually different for different services of the same
    # service type.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_from_template_description [ServiceFromTemplateDescription]
    # Describes the service that needs to be created from the template defined in
    # the application manifest.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def create_service_from_template(application_id, service_from_template_description, timeout:60, custom_headers:nil)
      response = create_service_from_template_async(application_id, service_from_template_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Creates a Service Fabric service from the service template.
    #
    # Creates a Service Fabric service from the service template defined in the
    # application manifest. A service template contains the properties that will be
    # same for the service instance of the same type. The API allows overriding the
    # properties that are usually different for different services of the same
    # service type.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_from_template_description [ServiceFromTemplateDescription]
    # Describes the service that needs to be created from the template defined in
    # the application manifest.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_service_from_template_with_http_info(application_id, service_from_template_description, timeout:60, custom_headers:nil)
      create_service_from_template_async(application_id, service_from_template_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Creates a Service Fabric service from the service template.
    #
    # Creates a Service Fabric service from the service template defined in the
    # application manifest. A service template contains the properties that will be
    # same for the service instance of the same type. The API allows overriding the
    # properties that are usually different for different services of the same
    # service type.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_from_template_description [ServiceFromTemplateDescription]
    # Describes the service that needs to be created from the template defined in
    # the application manifest.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_service_from_template_async(application_id, service_from_template_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'service_from_template_description is nil' if service_from_template_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ServiceFromTemplateDescription.mapper()
      request_content = self.serialize(request_mapper,  service_from_template_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Applications/{applicationId}/$/GetServices/$/CreateFromTemplate'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Deletes an existing Service Fabric service.
    #
    # Deletes an existing Service Fabric service. A service must be created before
    # it can be deleted. By default, Service Fabric will try to close service
    # replicas in a graceful manner and then delete the service. However, if the
    # service is having issues closing the replica gracefully, the delete operation
    # may take a long time or get stuck. Use the optional ForceRemove flag to skip
    # the graceful close sequence and forcefully delete the service.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param force_remove [Boolean] Remove a Service Fabric application or service
    # forcefully without going through the graceful shutdown sequence. This
    # parameter can be used to forcefully delete an application or service for
    # which delete is timing out due to issues in the service code that prevents
    # graceful close of replicas.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def delete_service(service_id, force_remove:nil, timeout:60, custom_headers:nil)
      response = delete_service_async(service_id, force_remove:force_remove, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Deletes an existing Service Fabric service.
    #
    # Deletes an existing Service Fabric service. A service must be created before
    # it can be deleted. By default, Service Fabric will try to close service
    # replicas in a graceful manner and then delete the service. However, if the
    # service is having issues closing the replica gracefully, the delete operation
    # may take a long time or get stuck. Use the optional ForceRemove flag to skip
    # the graceful close sequence and forcefully delete the service.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param force_remove [Boolean] Remove a Service Fabric application or service
    # forcefully without going through the graceful shutdown sequence. This
    # parameter can be used to forcefully delete an application or service for
    # which delete is timing out due to issues in the service code that prevents
    # graceful close of replicas.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_service_with_http_info(service_id, force_remove:nil, timeout:60, custom_headers:nil)
      delete_service_async(service_id, force_remove:force_remove, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Deletes an existing Service Fabric service.
    #
    # Deletes an existing Service Fabric service. A service must be created before
    # it can be deleted. By default, Service Fabric will try to close service
    # replicas in a graceful manner and then delete the service. However, if the
    # service is having issues closing the replica gracefully, the delete operation
    # may take a long time or get stuck. Use the optional ForceRemove flag to skip
    # the graceful close sequence and forcefully delete the service.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param force_remove [Boolean] Remove a Service Fabric application or service
    # forcefully without going through the graceful shutdown sequence. This
    # parameter can be used to forcefully delete an application or service for
    # which delete is timing out due to issues in the service code that prevents
    # graceful close of replicas.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_service_async(service_id, force_remove:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/{serviceId}/$/Delete'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'ForceRemove' => force_remove,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Updates a Service Fabric service using the specified update description.
    #
    # This API allows updating properties of a running Service Fabric service. The
    # set of properties that can be updated are a subset of the properties that
    # were specified at the time of creating the service. The current set of
    # properties can be obtained using `GetServiceDescription` API. Please note
    # that updating the properties of a running service is different than upgrading
    # your application using `StartApplicationUpgrade` API. The upgrade is a long
    # running background operation that involves moving the application from one
    # version to another, one upgrade domain at a time, whereas update applies the
    # new properties immediately to the service.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param service_update_description [ServiceUpdateDescription] The information
    # necessary to update a service.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def update_service(service_id, service_update_description, timeout:60, custom_headers:nil)
      response = update_service_async(service_id, service_update_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Updates a Service Fabric service using the specified update description.
    #
    # This API allows updating properties of a running Service Fabric service. The
    # set of properties that can be updated are a subset of the properties that
    # were specified at the time of creating the service. The current set of
    # properties can be obtained using `GetServiceDescription` API. Please note
    # that updating the properties of a running service is different than upgrading
    # your application using `StartApplicationUpgrade` API. The upgrade is a long
    # running background operation that involves moving the application from one
    # version to another, one upgrade domain at a time, whereas update applies the
    # new properties immediately to the service.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param service_update_description [ServiceUpdateDescription] The information
    # necessary to update a service.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def update_service_with_http_info(service_id, service_update_description, timeout:60, custom_headers:nil)
      update_service_async(service_id, service_update_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Updates a Service Fabric service using the specified update description.
    #
    # This API allows updating properties of a running Service Fabric service. The
    # set of properties that can be updated are a subset of the properties that
    # were specified at the time of creating the service. The current set of
    # properties can be obtained using `GetServiceDescription` API. Please note
    # that updating the properties of a running service is different than upgrading
    # your application using `StartApplicationUpgrade` API. The upgrade is a long
    # running background operation that involves moving the application from one
    # version to another, one upgrade domain at a time, whereas update applies the
    # new properties immediately to the service.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param service_update_description [ServiceUpdateDescription] The information
    # necessary to update a service.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def update_service_async(service_id, service_update_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, 'service_update_description is nil' if service_update_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ServiceUpdateDescription.mapper()
      request_content = self.serialize(request_mapper,  service_update_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Services/{serviceId}/$/Update'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the description of an existing Service Fabric service.
    #
    # Gets the description of an existing Service Fabric service. A service must be
    # created before its description can be obtained.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ServiceDescription] operation results.
    #
    def get_service_description(service_id, timeout:60, custom_headers:nil)
      response = get_service_description_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the description of an existing Service Fabric service.
    #
    # Gets the description of an existing Service Fabric service. A service must be
    # created before its description can be obtained.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_description_with_http_info(service_id, timeout:60, custom_headers:nil)
      get_service_description_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the description of an existing Service Fabric service.
    #
    # Gets the description of an existing Service Fabric service. A service must be
    # created before its description can be obtained.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_description_async(service_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/{serviceId}/$/GetDescription'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ServiceDescription.mapper()
            result.body = self.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

    #
    # Gets the health of the specified Service Fabric service.
    #
    # Gets the health information of the specified service.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the service based on the health state.
    # Use PartitionsHealthStateFilter to filter the collection of partitions
    # returned.
    # If you specify a service that does not exist in the health store, this
    # request returns an error.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param partitions_health_state_filter [Integer] Allows filtering of the
    # partitions health state objects returned in the result of service health
    # query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only partitions that match the filter are returned. All partitions are used
    # to evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of partitions with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ServiceHealth] operation results.
    #
    def get_service_health(service_id, events_health_state_filter:0, partitions_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      response = get_service_health_async(service_id, events_health_state_filter:events_health_state_filter, partitions_health_state_filter:partitions_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of the specified Service Fabric service.
    #
    # Gets the health information of the specified service.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the service based on the health state.
    # Use PartitionsHealthStateFilter to filter the collection of partitions
    # returned.
    # If you specify a service that does not exist in the health store, this
    # request returns an error.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param partitions_health_state_filter [Integer] Allows filtering of the
    # partitions health state objects returned in the result of service health
    # query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only partitions that match the filter are returned. All partitions are used
    # to evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of partitions with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_health_with_http_info(service_id, events_health_state_filter:0, partitions_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      get_service_health_async(service_id, events_health_state_filter:events_health_state_filter, partitions_health_state_filter:partitions_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of the specified Service Fabric service.
    #
    # Gets the health information of the specified service.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the service based on the health state.
    # Use PartitionsHealthStateFilter to filter the collection of partitions
    # returned.
    # If you specify a service that does not exist in the health store, this
    # request returns an error.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param partitions_health_state_filter [Integer] Allows filtering of the
    # partitions health state objects returned in the result of service health
    # query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only partitions that match the filter are returned. All partitions are used
    # to evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of partitions with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_health_async(service_id, events_health_state_filter:0, partitions_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/{serviceId}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'PartitionsHealthStateFilter' => partitions_health_state_filter,'ExcludeHealthStatistics' => exclude_health_statistics,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ServiceHealth.mapper()
            result.body = self.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

    #
    # Gets the health of the specified Service Fabric service, by using the
    # specified health policy.
    #
    # Gets the health information of the specified service.
    # If the application health policy is specified, the health evaluation uses it
    # to get the aggregated health state.
    # If the policy is not specified, the health evaluation uses the application
    # health policy defined in the application manifest, or the default health
    # policy, if no policy is defined in the manifest.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the service based on the health state.
    # Use PartitionsHealthStateFilter to filter the collection of partitions
    # returned.
    # If you specify a service that does not exist in the health store, this
    # request returns an error.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param partitions_health_state_filter [Integer] Allows filtering of the
    # partitions health state objects returned in the result of service health
    # query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only partitions that match the filter are returned. All partitions are used
    # to evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of partitions with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ServiceHealth] operation results.
    #
    def get_service_health_using_policy(service_id, events_health_state_filter:0, partitions_health_state_filter:0, application_health_policy:nil, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      response = get_service_health_using_policy_async(service_id, events_health_state_filter:events_health_state_filter, partitions_health_state_filter:partitions_health_state_filter, application_health_policy:application_health_policy, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of the specified Service Fabric service, by using the
    # specified health policy.
    #
    # Gets the health information of the specified service.
    # If the application health policy is specified, the health evaluation uses it
    # to get the aggregated health state.
    # If the policy is not specified, the health evaluation uses the application
    # health policy defined in the application manifest, or the default health
    # policy, if no policy is defined in the manifest.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the service based on the health state.
    # Use PartitionsHealthStateFilter to filter the collection of partitions
    # returned.
    # If you specify a service that does not exist in the health store, this
    # request returns an error.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param partitions_health_state_filter [Integer] Allows filtering of the
    # partitions health state objects returned in the result of service health
    # query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only partitions that match the filter are returned. All partitions are used
    # to evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of partitions with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_health_using_policy_with_http_info(service_id, events_health_state_filter:0, partitions_health_state_filter:0, application_health_policy:nil, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      get_service_health_using_policy_async(service_id, events_health_state_filter:events_health_state_filter, partitions_health_state_filter:partitions_health_state_filter, application_health_policy:application_health_policy, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of the specified Service Fabric service, by using the
    # specified health policy.
    #
    # Gets the health information of the specified service.
    # If the application health policy is specified, the health evaluation uses it
    # to get the aggregated health state.
    # If the policy is not specified, the health evaluation uses the application
    # health policy defined in the application manifest, or the default health
    # policy, if no policy is defined in the manifest.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the service based on the health state.
    # Use PartitionsHealthStateFilter to filter the collection of partitions
    # returned.
    # If you specify a service that does not exist in the health store, this
    # request returns an error.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param partitions_health_state_filter [Integer] Allows filtering of the
    # partitions health state objects returned in the result of service health
    # query based on their health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only partitions that match the filter are returned. All partitions are used
    # to evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value
    # obtained using bitwise 'OR' operator. For example, if the provided value is 6
    # then health state of partitions with HealthState value of OK (2) and Warning
    # (4) will be returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_health_using_policy_async(service_id, events_health_state_filter:0, partitions_health_state_filter:0, application_health_policy:nil, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ApplicationHealthPolicy.mapper()
      request_content = self.serialize(request_mapper,  application_health_policy)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Services/{serviceId}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'PartitionsHealthStateFilter' => partitions_health_state_filter,'ExcludeHealthStatistics' => exclude_health_statistics,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ServiceHealth.mapper()
            result.body = self.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

    #
    # Sends a health report on the Service Fabric service.
    #
    # Reports health state of the specified Service Fabric service. The report must
    # contain the information about the source of the health report and property on
    # which it is reported.
    # The report is sent to a Service Fabric gateway Service, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetServiceHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def report_service_health(service_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      response = report_service_health_async(service_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Sends a health report on the Service Fabric service.
    #
    # Reports health state of the specified Service Fabric service. The report must
    # contain the information about the source of the health report and property on
    # which it is reported.
    # The report is sent to a Service Fabric gateway Service, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetServiceHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_service_health_with_http_info(service_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      report_service_health_async(service_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Sends a health report on the Service Fabric service.
    #
    # Reports health state of the specified Service Fabric service. The report must
    # contain the information about the source of the health report and property on
    # which it is reported.
    # The report is sent to a Service Fabric gateway Service, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetServiceHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_service_health_async(service_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, 'health_information is nil' if health_information.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::HealthInformation.mapper()
      request_content = self.serialize(request_mapper,  health_information)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Services/{serviceId}/$/ReportHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'Immediate' => immediate,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Resolve a Service Fabric partition.
    #
    # Resolve a Service Fabric service partition to get the endpoints of the
    # service replicas.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_key_type [Integer] Key type for the partition. This
    # parameter is required if the partition scheme for the service is Int64Range
    # or Named. The possible values are following.
    # - None (1) - Indicates that the PartitionKeyValue parameter is not specified.
    # This is valid for the partitions with partitioning scheme as Singleton. This
    # is the default value. The value is 1.
    # - Int64Range (2) - Indicates that the PartitionKeyValue parameter is an int64
    # partition key. This is valid for the partitions with partitioning scheme as
    # Int64Range. The value is 2.
    # - Named (3) - Indicates that the PartitionKeyValue parameter is a name of the
    # partition. This is valid for the partitions with partitioning scheme as
    # Named. The value is 3.
    # @param partition_key_value [String] Partition key. This is required if the
    # partition scheme for the service is Int64Range or Named.
    # @param previous_rsp_version [String] The value in the Version field of the
    # response that was received previously. This is required if the user knows
    # that the result that was got previously is stale.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ResolvedServicePartition] operation results.
    #
    def resolve_service(service_id, partition_key_type:nil, partition_key_value:nil, previous_rsp_version:nil, timeout:60, custom_headers:nil)
      response = resolve_service_async(service_id, partition_key_type:partition_key_type, partition_key_value:partition_key_value, previous_rsp_version:previous_rsp_version, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Resolve a Service Fabric partition.
    #
    # Resolve a Service Fabric service partition to get the endpoints of the
    # service replicas.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_key_type [Integer] Key type for the partition. This
    # parameter is required if the partition scheme for the service is Int64Range
    # or Named. The possible values are following.
    # - None (1) - Indicates that the PartitionKeyValue parameter is not specified.
    # This is valid for the partitions with partitioning scheme as Singleton. This
    # is the default value. The value is 1.
    # - Int64Range (2) - Indicates that the PartitionKeyValue parameter is an int64
    # partition key. This is valid for the partitions with partitioning scheme as
    # Int64Range. The value is 2.
    # - Named (3) - Indicates that the PartitionKeyValue parameter is a name of the
    # partition. This is valid for the partitions with partitioning scheme as
    # Named. The value is 3.
    # @param partition_key_value [String] Partition key. This is required if the
    # partition scheme for the service is Int64Range or Named.
    # @param previous_rsp_version [String] The value in the Version field of the
    # response that was received previously. This is required if the user knows
    # that the result that was got previously is stale.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resolve_service_with_http_info(service_id, partition_key_type:nil, partition_key_value:nil, previous_rsp_version:nil, timeout:60, custom_headers:nil)
      resolve_service_async(service_id, partition_key_type:partition_key_type, partition_key_value:partition_key_value, previous_rsp_version:previous_rsp_version, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Resolve a Service Fabric partition.
    #
    # Resolve a Service Fabric service partition to get the endpoints of the
    # service replicas.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_key_type [Integer] Key type for the partition. This
    # parameter is required if the partition scheme for the service is Int64Range
    # or Named. The possible values are following.
    # - None (1) - Indicates that the PartitionKeyValue parameter is not specified.
    # This is valid for the partitions with partitioning scheme as Singleton. This
    # is the default value. The value is 1.
    # - Int64Range (2) - Indicates that the PartitionKeyValue parameter is an int64
    # partition key. This is valid for the partitions with partitioning scheme as
    # Int64Range. The value is 2.
    # - Named (3) - Indicates that the PartitionKeyValue parameter is a name of the
    # partition. This is valid for the partitions with partitioning scheme as
    # Named. The value is 3.
    # @param partition_key_value [String] Partition key. This is required if the
    # partition scheme for the service is Int64Range or Named.
    # @param previous_rsp_version [String] The value in the Version field of the
    # response that was received previously. This is required if the user knows
    # that the result that was got previously is stale.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resolve_service_async(service_id, partition_key_type:nil, partition_key_value:nil, previous_rsp_version:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/{serviceId}/$/ResolvePartition'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'PartitionKeyType' => partition_key_type,'timeout' => timeout},
          skip_encoding_query_params: {'PartitionKeyValue' => partition_key_value,'PreviousRspVersion' => previous_rsp_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ResolvedServicePartition.mapper()
            result.body = self.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

    #
    # Gets the list of partitions of a Service Fabric service.
    #
    # Gets the list of partitions of a Service Fabric service. The response
    # includes the partition ID, partitioning scheme information, keys supported by
    # the partition, status, health, and other details about the partition.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedServicePartitionInfoList] operation results.
    #
    def get_partition_info_list(service_id, continuation_token:nil, timeout:60, custom_headers:nil)
      response = get_partition_info_list_async(service_id, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of partitions of a Service Fabric service.
    #
    # Gets the list of partitions of a Service Fabric service. The response
    # includes the partition ID, partitioning scheme information, keys supported by
    # the partition, status, health, and other details about the partition.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_info_list_with_http_info(service_id, continuation_token:nil, timeout:60, custom_headers:nil)
      get_partition_info_list_async(service_id, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of partitions of a Service Fabric service.
    #
    # Gets the list of partitions of a Service Fabric service. The response
    # includes the partition ID, partitioning scheme information, keys supported by
    # the partition, status, health, and other details about the partition.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_info_list_async(service_id, continuation_token:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/{serviceId}/$/GetPartitions'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedServicePartitionInfoList.mapper()
            result.body = self.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

    #
    # Gets the information about a Service Fabric partition.
    #
    # Gets the information about the specified partition. The response includes the
    # partition ID, partitioning scheme information, keys supported by the
    # partition, status, health, and other details about the partition.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ServicePartitionInfo] operation results.
    #
    def get_partition_info(partition_id, timeout:60, custom_headers:nil)
      response = get_partition_info_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about a Service Fabric partition.
    #
    # Gets the information about the specified partition. The response includes the
    # partition ID, partitioning scheme information, keys supported by the
    # partition, status, health, and other details about the partition.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_info_with_http_info(partition_id, timeout:60, custom_headers:nil)
      get_partition_info_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about a Service Fabric partition.
    #
    # Gets the information about the specified partition. The response includes the
    # partition ID, partitioning scheme information, keys supported by the
    # partition, status, health, and other details about the partition.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_info_async(partition_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 || 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::ServiceFabric::V6_2_0_9::Models::ServicePartitionInfo.mapper()
            result.body = self.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

    #
    # Gets the name of the Service Fabric service for a partition.
    #
    # Gets name of the service for the specified partition. A 404 error is returned
    # if the partition ID does not exist in the cluster.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ServiceNameInfo] operation results.
    #
    def get_service_name_info(partition_id, timeout:60, custom_headers:nil)
      response = get_service_name_info_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the name of the Service Fabric service for a partition.
    #
    # Gets name of the service for the specified partition. A 404 error is returned
    # if the partition ID does not exist in the cluster.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_name_info_with_http_info(partition_id, timeout:60, custom_headers:nil)
      get_service_name_info_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the name of the Service Fabric service for a partition.
    #
    # Gets name of the service for the specified partition. A 404 error is returned
    # if the partition ID does not exist in the cluster.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_name_info_async(partition_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/GetServiceName'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ServiceNameInfo.mapper()
            result.body = self.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

    #
    # Gets the health of the specified Service Fabric partition.
    #
    # Gets the health information of the specified partition.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the service based on the health state.
    # Use ReplicasHealthStateFilter to filter the collection of ReplicaHealthState
    # objects on the partition.
    # If you specify a partition that does not exist in the health store, this
    # request returns an error.
    #
    # @param partition_id The identity of the partition.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param replicas_health_state_filter [Integer] Allows filtering the collection
    # of ReplicaHealthState objects on the partition. The value can be obtained
    # from members or bitwise operations on members of HealthStateFilter. Only
    # replicas that match the filter will be returned. All replicas will be used to
    # evaluate the aggregated health state. If not specified, all entries will be
    # returned.The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator. For example,
    # If the provided value is 6 then all of the events with HealthState value of
    # OK (2) and Warning (4) will be returned. The possible values for this
    # parameter include integer value of one of the following health states.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PartitionHealth] operation results.
    #
    def get_partition_health(partition_id, events_health_state_filter:0, replicas_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      response = get_partition_health_async(partition_id, events_health_state_filter:events_health_state_filter, replicas_health_state_filter:replicas_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of the specified Service Fabric partition.
    #
    # Gets the health information of the specified partition.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the service based on the health state.
    # Use ReplicasHealthStateFilter to filter the collection of ReplicaHealthState
    # objects on the partition.
    # If you specify a partition that does not exist in the health store, this
    # request returns an error.
    #
    # @param partition_id The identity of the partition.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param replicas_health_state_filter [Integer] Allows filtering the collection
    # of ReplicaHealthState objects on the partition. The value can be obtained
    # from members or bitwise operations on members of HealthStateFilter. Only
    # replicas that match the filter will be returned. All replicas will be used to
    # evaluate the aggregated health state. If not specified, all entries will be
    # returned.The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator. For example,
    # If the provided value is 6 then all of the events with HealthState value of
    # OK (2) and Warning (4) will be returned. The possible values for this
    # parameter include integer value of one of the following health states.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_health_with_http_info(partition_id, events_health_state_filter:0, replicas_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      get_partition_health_async(partition_id, events_health_state_filter:events_health_state_filter, replicas_health_state_filter:replicas_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of the specified Service Fabric partition.
    #
    # Gets the health information of the specified partition.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the service based on the health state.
    # Use ReplicasHealthStateFilter to filter the collection of ReplicaHealthState
    # objects on the partition.
    # If you specify a partition that does not exist in the health store, this
    # request returns an error.
    #
    # @param partition_id The identity of the partition.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param replicas_health_state_filter [Integer] Allows filtering the collection
    # of ReplicaHealthState objects on the partition. The value can be obtained
    # from members or bitwise operations on members of HealthStateFilter. Only
    # replicas that match the filter will be returned. All replicas will be used to
    # evaluate the aggregated health state. If not specified, all entries will be
    # returned.The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator. For example,
    # If the provided value is 6 then all of the events with HealthState value of
    # OK (2) and Warning (4) will be returned. The possible values for this
    # parameter include integer value of one of the following health states.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_health_async(partition_id, events_health_state_filter:0, replicas_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'ReplicasHealthStateFilter' => replicas_health_state_filter,'ExcludeHealthStatistics' => exclude_health_statistics,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PartitionHealth.mapper()
            result.body = self.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

    #
    # Gets the health of the specified Service Fabric partition, by using the
    # specified health policy.
    #
    # Gets the health information of the specified partition.
    # If the application health policy is specified, the health evaluation uses it
    # to get the aggregated health state.
    # If the policy is not specified, the health evaluation uses the application
    # health policy defined in the application manifest, or the default health
    # policy, if no policy is defined in the manifest.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the partition based on the health state.
    # Use ReplicasHealthStateFilter to filter the collection of ReplicaHealthState
    # objects on the partition. Use ApplicationHealthPolicy in the POST body to
    # override the health policies used to evaluate the health.
    # If you specify a partition that does not exist in the health store, this
    # request returns an error.
    #
    # @param partition_id The identity of the partition.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param replicas_health_state_filter [Integer] Allows filtering the collection
    # of ReplicaHealthState objects on the partition. The value can be obtained
    # from members or bitwise operations on members of HealthStateFilter. Only
    # replicas that match the filter will be returned. All replicas will be used to
    # evaluate the aggregated health state. If not specified, all entries will be
    # returned.The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator. For example,
    # If the provided value is 6 then all of the events with HealthState value of
    # OK (2) and Warning (4) will be returned. The possible values for this
    # parameter include integer value of one of the following health states.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PartitionHealth] operation results.
    #
    def get_partition_health_using_policy(partition_id, events_health_state_filter:0, replicas_health_state_filter:0, application_health_policy:nil, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      response = get_partition_health_using_policy_async(partition_id, events_health_state_filter:events_health_state_filter, replicas_health_state_filter:replicas_health_state_filter, application_health_policy:application_health_policy, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of the specified Service Fabric partition, by using the
    # specified health policy.
    #
    # Gets the health information of the specified partition.
    # If the application health policy is specified, the health evaluation uses it
    # to get the aggregated health state.
    # If the policy is not specified, the health evaluation uses the application
    # health policy defined in the application manifest, or the default health
    # policy, if no policy is defined in the manifest.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the partition based on the health state.
    # Use ReplicasHealthStateFilter to filter the collection of ReplicaHealthState
    # objects on the partition. Use ApplicationHealthPolicy in the POST body to
    # override the health policies used to evaluate the health.
    # If you specify a partition that does not exist in the health store, this
    # request returns an error.
    #
    # @param partition_id The identity of the partition.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param replicas_health_state_filter [Integer] Allows filtering the collection
    # of ReplicaHealthState objects on the partition. The value can be obtained
    # from members or bitwise operations on members of HealthStateFilter. Only
    # replicas that match the filter will be returned. All replicas will be used to
    # evaluate the aggregated health state. If not specified, all entries will be
    # returned.The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator. For example,
    # If the provided value is 6 then all of the events with HealthState value of
    # OK (2) and Warning (4) will be returned. The possible values for this
    # parameter include integer value of one of the following health states.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_health_using_policy_with_http_info(partition_id, events_health_state_filter:0, replicas_health_state_filter:0, application_health_policy:nil, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      get_partition_health_using_policy_async(partition_id, events_health_state_filter:events_health_state_filter, replicas_health_state_filter:replicas_health_state_filter, application_health_policy:application_health_policy, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of the specified Service Fabric partition, by using the
    # specified health policy.
    #
    # Gets the health information of the specified partition.
    # If the application health policy is specified, the health evaluation uses it
    # to get the aggregated health state.
    # If the policy is not specified, the health evaluation uses the application
    # health policy defined in the application manifest, or the default health
    # policy, if no policy is defined in the manifest.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the partition based on the health state.
    # Use ReplicasHealthStateFilter to filter the collection of ReplicaHealthState
    # objects on the partition. Use ApplicationHealthPolicy in the POST body to
    # override the health policies used to evaluate the health.
    # If you specify a partition that does not exist in the health store, this
    # request returns an error.
    #
    # @param partition_id The identity of the partition.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param replicas_health_state_filter [Integer] Allows filtering the collection
    # of ReplicaHealthState objects on the partition. The value can be obtained
    # from members or bitwise operations on members of HealthStateFilter. Only
    # replicas that match the filter will be returned. All replicas will be used to
    # evaluate the aggregated health state. If not specified, all entries will be
    # returned.The state values are flag based enumeration, so the value could be a
    # combination of these value obtained using bitwise 'OR' operator. For example,
    # If the provided value is 6 then all of the events with HealthState value of
    # OK (2) and Warning (4) will be returned. The possible values for this
    # parameter include integer value of one of the following health states.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param exclude_health_statistics [Boolean] Indicates whether the health
    # statistics should be returned as part of the query result. False by default.
    # The statistics show the number of children entities in health state Ok,
    # Warning, and Error.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_health_using_policy_async(partition_id, events_health_state_filter:0, replicas_health_state_filter:0, application_health_policy:nil, exclude_health_statistics:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ApplicationHealthPolicy.mapper()
      request_content = self.serialize(request_mapper,  application_health_policy)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Partitions/{partitionId}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'ReplicasHealthStateFilter' => replicas_health_state_filter,'ExcludeHealthStatistics' => exclude_health_statistics,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PartitionHealth.mapper()
            result.body = self.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

    #
    # Sends a health report on the Service Fabric partition.
    #
    # Reports health state of the specified Service Fabric partition. The report
    # must contain the information about the source of the health report and
    # property on which it is reported.
    # The report is sent to a Service Fabric gateway Partition, which forwards to
    # the health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetPartitionHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param partition_id The identity of the partition.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def report_partition_health(partition_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      response = report_partition_health_async(partition_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Sends a health report on the Service Fabric partition.
    #
    # Reports health state of the specified Service Fabric partition. The report
    # must contain the information about the source of the health report and
    # property on which it is reported.
    # The report is sent to a Service Fabric gateway Partition, which forwards to
    # the health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetPartitionHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param partition_id The identity of the partition.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_partition_health_with_http_info(partition_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      report_partition_health_async(partition_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Sends a health report on the Service Fabric partition.
    #
    # Reports health state of the specified Service Fabric partition. The report
    # must contain the information about the source of the health report and
    # property on which it is reported.
    # The report is sent to a Service Fabric gateway Partition, which forwards to
    # the health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetPartitionHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param partition_id The identity of the partition.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_partition_health_async(partition_id, health_information, immediate:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'health_information is nil' if health_information.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::HealthInformation.mapper()
      request_content = self.serialize(request_mapper,  health_information)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Partitions/{partitionId}/$/ReportHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'Immediate' => immediate,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the load information of the specified Service Fabric partition.
    #
    # Returns information about the load of a specified partition.
    # The response includes a list of load reports for a Service Fabric partition.
    # Each report includes the load metric name, value, and last reported time in
    # UTC.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PartitionLoadInformation] operation results.
    #
    def get_partition_load_information(partition_id, timeout:60, custom_headers:nil)
      response = get_partition_load_information_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the load information of the specified Service Fabric partition.
    #
    # Returns information about the load of a specified partition.
    # The response includes a list of load reports for a Service Fabric partition.
    # Each report includes the load metric name, value, and last reported time in
    # UTC.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_load_information_with_http_info(partition_id, timeout:60, custom_headers:nil)
      get_partition_load_information_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the load information of the specified Service Fabric partition.
    #
    # Returns information about the load of a specified partition.
    # The response includes a list of load reports for a Service Fabric partition.
    # Each report includes the load metric name, value, and last reported time in
    # UTC.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_load_information_async(partition_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/GetLoadInformation'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PartitionLoadInformation.mapper()
            result.body = self.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

    #
    # Resets the current load of a Service Fabric partition.
    #
    # Resets the current load of a Service Fabric partition to the default load for
    # the service.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def reset_partition_load(partition_id, timeout:60, custom_headers:nil)
      response = reset_partition_load_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Resets the current load of a Service Fabric partition.
    #
    # Resets the current load of a Service Fabric partition to the default load for
    # the service.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def reset_partition_load_with_http_info(partition_id, timeout:60, custom_headers:nil)
      reset_partition_load_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Resets the current load of a Service Fabric partition.
    #
    # Resets the current load of a Service Fabric partition to the default load for
    # the service.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def reset_partition_load_async(partition_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/ResetLoad'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover a
    # specific partition which is currently stuck in quorum loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover a
    # specific partition which is currently stuck in quorum loss. This operation
    # should only be performed if it is known that the replicas that are down
    # cannot be recovered. Incorrect use of this API can cause potential data loss.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def recover_partition(partition_id, timeout:60, custom_headers:nil)
      response = recover_partition_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover a
    # specific partition which is currently stuck in quorum loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover a
    # specific partition which is currently stuck in quorum loss. This operation
    # should only be performed if it is known that the replicas that are down
    # cannot be recovered. Incorrect use of this API can cause potential data loss.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def recover_partition_with_http_info(partition_id, timeout:60, custom_headers:nil)
      recover_partition_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover a
    # specific partition which is currently stuck in quorum loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover a
    # specific partition which is currently stuck in quorum loss. This operation
    # should only be performed if it is known that the replicas that are down
    # cannot be recovered. Incorrect use of this API can cause potential data loss.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def recover_partition_async(partition_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/Recover'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # specified service which is currently stuck in quorum loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # specified service which is currently stuck in quorum loss. This operation
    # should only be performed if it is known that the replicas that are down
    # cannot be recovered. Incorrect use of this API can cause potential data loss.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def recover_service_partitions(service_id, timeout:60, custom_headers:nil)
      response = recover_service_partitions_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # specified service which is currently stuck in quorum loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # specified service which is currently stuck in quorum loss. This operation
    # should only be performed if it is known that the replicas that are down
    # cannot be recovered. Incorrect use of this API can cause potential data loss.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def recover_service_partitions_with_http_info(service_id, timeout:60, custom_headers:nil)
      recover_service_partitions_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # specified service which is currently stuck in quorum loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # specified service which is currently stuck in quorum loss. This operation
    # should only be performed if it is known that the replicas that are down
    # cannot be recovered. Incorrect use of this API can cause potential data loss.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def recover_service_partitions_async(service_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/$/{serviceId}/$/GetPartitions/$/Recover'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # system services which are currently stuck in quorum loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # system services which are currently stuck in quorum loss. This operation
    # should only be performed if it is known that the replicas that are down
    # cannot be recovered. Incorrect use of this API can cause potential data loss.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def recover_system_partitions(timeout:60, custom_headers:nil)
      response = recover_system_partitions_async(timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # system services which are currently stuck in quorum loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # system services which are currently stuck in quorum loss. This operation
    # should only be performed if it is known that the replicas that are down
    # cannot be recovered. Incorrect use of this API can cause potential data loss.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def recover_system_partitions_with_http_info(timeout:60, custom_headers:nil)
      recover_system_partitions_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # system services which are currently stuck in quorum loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover the
    # system services which are currently stuck in quorum loss. This operation
    # should only be performed if it is known that the replicas that are down
    # cannot be recovered. Incorrect use of this API can cause potential data loss.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def recover_system_partitions_async(timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/RecoverSystemPartitions'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover any
    # services (including system services) which are currently stuck in quorum
    # loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover any
    # services (including system services) which are currently stuck in quorum
    # loss. This operation should only be performed if it is known that the
    # replicas that are down cannot be recovered. Incorrect use of this API can
    # cause potential data loss.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def recover_all_partitions(timeout:60, custom_headers:nil)
      response = recover_all_partitions_async(timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover any
    # services (including system services) which are currently stuck in quorum
    # loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover any
    # services (including system services) which are currently stuck in quorum
    # loss. This operation should only be performed if it is known that the
    # replicas that are down cannot be recovered. Incorrect use of this API can
    # cause potential data loss.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def recover_all_partitions_with_http_info(timeout:60, custom_headers:nil)
      recover_all_partitions_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Indicates to the Service Fabric cluster that it should attempt to recover any
    # services (including system services) which are currently stuck in quorum
    # loss.
    #
    # Indicates to the Service Fabric cluster that it should attempt to recover any
    # services (including system services) which are currently stuck in quorum
    # loss. This operation should only be performed if it is known that the
    # replicas that are down cannot be recovered. Incorrect use of this API can
    # cause potential data loss.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def recover_all_partitions_async(timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/RecoverAllPartitions'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Creates a new repair task.
    #
    # For clusters that have the Repair Manager Service configured,
    # this API provides a way to create repair tasks that run automatically or
    # manually.
    # For repair tasks that run automatically, an appropriate repair executor
    # must be running for each repair action to run automatically.
    # These are currently only available in specially-configured Azure Cloud
    # Services.
    #
    # To create a manual repair task, provide the set of impacted node names and
    # the
    # expected impact. When the state of the created repair task changes to
    # approved,
    # you can safely perform repair actions on those nodes.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task [RepairTask] Describes the repair task to be created or
    # updated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [RepairTaskUpdateInfo] operation results.
    #
    def create_repair_task(repair_task, custom_headers:nil)
      response = create_repair_task_async(repair_task, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Creates a new repair task.
    #
    # For clusters that have the Repair Manager Service configured,
    # this API provides a way to create repair tasks that run automatically or
    # manually.
    # For repair tasks that run automatically, an appropriate repair executor
    # must be running for each repair action to run automatically.
    # These are currently only available in specially-configured Azure Cloud
    # Services.
    #
    # To create a manual repair task, provide the set of impacted node names and
    # the
    # expected impact. When the state of the created repair task changes to
    # approved,
    # you can safely perform repair actions on those nodes.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task [RepairTask] Describes the repair task to be created or
    # updated.
    # @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.
    #
    def create_repair_task_with_http_info(repair_task, custom_headers:nil)
      create_repair_task_async(repair_task, custom_headers:custom_headers).value!
    end

    #
    # Creates a new repair task.
    #
    # For clusters that have the Repair Manager Service configured,
    # this API provides a way to create repair tasks that run automatically or
    # manually.
    # For repair tasks that run automatically, an appropriate repair executor
    # must be running for each repair action to run automatically.
    # These are currently only available in specially-configured Azure Cloud
    # Services.
    #
    # To create a manual repair task, provide the set of impacted node names and
    # the
    # expected impact. When the state of the created repair task changes to
    # approved,
    # you can safely perform repair actions on those nodes.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task [RepairTask] Describes the repair task to be created or
    # updated.
    # @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.
    #
    def create_repair_task_async(repair_task, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'repair_task is nil' if repair_task.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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::RepairTask.mapper()
      request_content = self.serialize(request_mapper,  repair_task)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/CreateRepairTask'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::RepairTaskUpdateInfo.mapper()
            result.body = self.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

    #
    # Requests the cancellation of the given repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_cancel_description [RepairTaskCancelDescription] Describes
    # the repair task to be cancelled.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [RepairTaskUpdateInfo] operation results.
    #
    def cancel_repair_task(repair_task_cancel_description, custom_headers:nil)
      response = cancel_repair_task_async(repair_task_cancel_description, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Requests the cancellation of the given repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_cancel_description [RepairTaskCancelDescription] Describes
    # the repair task to be cancelled.
    # @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.
    #
    def cancel_repair_task_with_http_info(repair_task_cancel_description, custom_headers:nil)
      cancel_repair_task_async(repair_task_cancel_description, custom_headers:custom_headers).value!
    end

    #
    # Requests the cancellation of the given repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_cancel_description [RepairTaskCancelDescription] Describes
    # the repair task to be cancelled.
    # @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.
    #
    def cancel_repair_task_async(repair_task_cancel_description, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'repair_task_cancel_description is nil' if repair_task_cancel_description.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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::RepairTaskCancelDescription.mapper()
      request_content = self.serialize(request_mapper,  repair_task_cancel_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/CancelRepairTask'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::RepairTaskUpdateInfo.mapper()
            result.body = self.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

    #
    # Deletes a completed repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_delete_description [RepairTaskDeleteDescription] Describes
    # the repair task to be deleted.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def delete_repair_task(repair_task_delete_description, custom_headers:nil)
      response = delete_repair_task_async(repair_task_delete_description, custom_headers:custom_headers).value!
      nil
    end

    #
    # Deletes a completed repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_delete_description [RepairTaskDeleteDescription] Describes
    # the repair task to be deleted.
    # @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.
    #
    def delete_repair_task_with_http_info(repair_task_delete_description, custom_headers:nil)
      delete_repair_task_async(repair_task_delete_description, custom_headers:custom_headers).value!
    end

    #
    # Deletes a completed repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_delete_description [RepairTaskDeleteDescription] Describes
    # the repair task to be deleted.
    # @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.
    #
    def delete_repair_task_async(repair_task_delete_description, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'repair_task_delete_description is nil' if repair_task_delete_description.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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::RepairTaskDeleteDescription.mapper()
      request_content = self.serialize(request_mapper,  repair_task_delete_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/DeleteRepairTask'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets a list of repair tasks matching the given filters.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param task_id_filter [String] The repair task ID prefix to be matched.
    # @param state_filter [Integer] A bitwise-OR of the following values,
    # specifying which task states should be included in the result list.
    # - 1 - Created
    # - 2 - Claimed
    # - 4 - Preparing
    # - 8 - Approved
    # - 16 - Executing
    # - 32 - Restoring
    # - 64 - Completed
    # @param executor_filter [String] The name of the repair executor whose claimed
    # tasks should be included in the list.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_repair_task_list(task_id_filter:nil, state_filter:nil, executor_filter:nil, custom_headers:nil)
      response = get_repair_task_list_async(task_id_filter:task_id_filter, state_filter:state_filter, executor_filter:executor_filter, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets a list of repair tasks matching the given filters.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param task_id_filter [String] The repair task ID prefix to be matched.
    # @param state_filter [Integer] A bitwise-OR of the following values,
    # specifying which task states should be included in the result list.
    # - 1 - Created
    # - 2 - Claimed
    # - 4 - Preparing
    # - 8 - Approved
    # - 16 - Executing
    # - 32 - Restoring
    # - 64 - Completed
    # @param executor_filter [String] The name of the repair executor whose claimed
    # tasks should be included in the list.
    # @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.
    #
    def get_repair_task_list_with_http_info(task_id_filter:nil, state_filter:nil, executor_filter:nil, custom_headers:nil)
      get_repair_task_list_async(task_id_filter:task_id_filter, state_filter:state_filter, executor_filter:executor_filter, custom_headers:custom_headers).value!
    end

    #
    # Gets a list of repair tasks matching the given filters.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param task_id_filter [String] The repair task ID prefix to be matched.
    # @param state_filter [Integer] A bitwise-OR of the following values,
    # specifying which task states should be included in the result list.
    # - 1 - Created
    # - 2 - Claimed
    # - 4 - Preparing
    # - 8 - Approved
    # - 16 - Executing
    # - 32 - Restoring
    # - 64 - Completed
    # @param executor_filter [String] The name of the repair executor whose claimed
    # tasks should be included in the list.
    # @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.
    #
    def get_repair_task_list_async(task_id_filter:nil, state_filter:nil, executor_filter:nil, custom_headers:nil)
      api_version = '6.0'


      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'] = accept_language unless accept_language.nil?
      path_template = '$/GetRepairTaskList'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'TaskIdFilter' => task_id_filter,'StateFilter' => state_filter,'ExecutorFilter' => executor_filter},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'RepairTaskElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'RepairTask'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Forces the approval of the given repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_approve_description [RepairTaskApproveDescription]
    # Describes the repair task to be approved.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [RepairTaskUpdateInfo] operation results.
    #
    def force_approve_repair_task(repair_task_approve_description, custom_headers:nil)
      response = force_approve_repair_task_async(repair_task_approve_description, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Forces the approval of the given repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_approve_description [RepairTaskApproveDescription]
    # Describes the repair task to be approved.
    # @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.
    #
    def force_approve_repair_task_with_http_info(repair_task_approve_description, custom_headers:nil)
      force_approve_repair_task_async(repair_task_approve_description, custom_headers:custom_headers).value!
    end

    #
    # Forces the approval of the given repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_approve_description [RepairTaskApproveDescription]
    # Describes the repair task to be approved.
    # @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.
    #
    def force_approve_repair_task_async(repair_task_approve_description, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'repair_task_approve_description is nil' if repair_task_approve_description.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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::RepairTaskApproveDescription.mapper()
      request_content = self.serialize(request_mapper,  repair_task_approve_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/ForceApproveRepairTask'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::RepairTaskUpdateInfo.mapper()
            result.body = self.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

    #
    # Updates the health policy of the given repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_update_health_policy_description
    # [RepairTaskUpdateHealthPolicyDescription] Describes the repair task healthy
    # policy to be updated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [RepairTaskUpdateInfo] operation results.
    #
    def update_repair_task_health_policy(repair_task_update_health_policy_description, custom_headers:nil)
      response = update_repair_task_health_policy_async(repair_task_update_health_policy_description, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Updates the health policy of the given repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_update_health_policy_description
    # [RepairTaskUpdateHealthPolicyDescription] Describes the repair task healthy
    # policy to be updated.
    # @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.
    #
    def update_repair_task_health_policy_with_http_info(repair_task_update_health_policy_description, custom_headers:nil)
      update_repair_task_health_policy_async(repair_task_update_health_policy_description, custom_headers:custom_headers).value!
    end

    #
    # Updates the health policy of the given repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task_update_health_policy_description
    # [RepairTaskUpdateHealthPolicyDescription] Describes the repair task healthy
    # policy to be updated.
    # @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.
    #
    def update_repair_task_health_policy_async(repair_task_update_health_policy_description, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'repair_task_update_health_policy_description is nil' if repair_task_update_health_policy_description.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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::RepairTaskUpdateHealthPolicyDescription.mapper()
      request_content = self.serialize(request_mapper,  repair_task_update_health_policy_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/UpdateRepairTaskHealthPolicy'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::RepairTaskUpdateInfo.mapper()
            result.body = self.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

    #
    # Updates the execution state of a repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task [RepairTask] Describes the repair task to be created or
    # updated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [RepairTaskUpdateInfo] operation results.
    #
    def update_repair_execution_state(repair_task, custom_headers:nil)
      response = update_repair_execution_state_async(repair_task, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Updates the execution state of a repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task [RepairTask] Describes the repair task to be created or
    # updated.
    # @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.
    #
    def update_repair_execution_state_with_http_info(repair_task, custom_headers:nil)
      update_repair_execution_state_async(repair_task, custom_headers:custom_headers).value!
    end

    #
    # Updates the execution state of a repair task.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param repair_task [RepairTask] Describes the repair task to be created or
    # updated.
    # @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.
    #
    def update_repair_execution_state_async(repair_task, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'repair_task is nil' if repair_task.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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::RepairTask.mapper()
      request_content = self.serialize(request_mapper,  repair_task)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '$/UpdateRepairExecutionState'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::RepairTaskUpdateInfo.mapper()
            result.body = self.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

    #
    # Gets the information about replicas of a Service Fabric service partition.
    #
    # The GetReplicas endpoint returns information about the replicas of the
    # specified partition. The response includes the id, role, status, health, node
    # name, uptime, and other details about the replica.
    #
    # @param partition_id The identity of the partition.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedReplicaInfoList] operation results.
    #
    def get_replica_info_list(partition_id, continuation_token:nil, timeout:60, custom_headers:nil)
      response = get_replica_info_list_async(partition_id, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about replicas of a Service Fabric service partition.
    #
    # The GetReplicas endpoint returns information about the replicas of the
    # specified partition. The response includes the id, role, status, health, node
    # name, uptime, and other details about the replica.
    #
    # @param partition_id The identity of the partition.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_replica_info_list_with_http_info(partition_id, continuation_token:nil, timeout:60, custom_headers:nil)
      get_replica_info_list_async(partition_id, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about replicas of a Service Fabric service partition.
    #
    # The GetReplicas endpoint returns information about the replicas of the
    # specified partition. The response includes the id, role, status, health, node
    # name, uptime, and other details about the replica.
    #
    # @param partition_id The identity of the partition.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_replica_info_list_async(partition_id, continuation_token:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/GetReplicas'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedReplicaInfoList.mapper()
            result.body = self.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

    #
    # Gets the information about a replica of a Service Fabric partition.
    #
    # The response includes the id, role, status, health, node name, uptime, and
    # other details about the replica.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ReplicaInfo] operation results.
    #
    def get_replica_info(partition_id, replica_id, timeout:60, custom_headers:nil)
      response = get_replica_info_async(partition_id, replica_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about a replica of a Service Fabric partition.
    #
    # The response includes the id, role, status, health, node name, uptime, and
    # other details about the replica.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_replica_info_with_http_info(partition_id, replica_id, timeout:60, custom_headers:nil)
      get_replica_info_async(partition_id, replica_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about a replica of a Service Fabric partition.
    #
    # The response includes the id, role, status, health, node name, uptime, and
    # other details about the replica.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_replica_info_async(partition_id, replica_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'replica_id is nil' if replica_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/GetReplicas/{replicaId}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id,'replicaId' => replica_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 || 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::ServiceFabric::V6_2_0_9::Models::ReplicaInfo.mapper()
            result.body = self.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

    #
    # Gets the health of a Service Fabric stateful service replica or stateless
    # service instance.
    #
    # Gets the health of a Service Fabric replica.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the replica based on the health state.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ReplicaHealth] operation results.
    #
    def get_replica_health(partition_id, replica_id, events_health_state_filter:0, timeout:60, custom_headers:nil)
      response = get_replica_health_async(partition_id, replica_id, events_health_state_filter:events_health_state_filter, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of a Service Fabric stateful service replica or stateless
    # service instance.
    #
    # Gets the health of a Service Fabric replica.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the replica based on the health state.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_replica_health_with_http_info(partition_id, replica_id, events_health_state_filter:0, timeout:60, custom_headers:nil)
      get_replica_health_async(partition_id, replica_id, events_health_state_filter:events_health_state_filter, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of a Service Fabric stateful service replica or stateless
    # service instance.
    #
    # Gets the health of a Service Fabric replica.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the replica based on the health state.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_replica_health_async(partition_id, replica_id, events_health_state_filter:0, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'replica_id is nil' if replica_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/GetReplicas/{replicaId}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id,'replicaId' => replica_id},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ReplicaHealth.mapper()
            result.body = self.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

    #
    # Gets the health of a Service Fabric stateful service replica or stateless
    # service instance using the specified policy.
    #
    # Gets the health of a Service Fabric stateful service replica or stateless
    # service instance.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the cluster based on the health state.
    # Use ApplicationHealthPolicy to optionally override the health policies used
    # to evaluate the health. This API only uses 'ConsiderWarningAsError' field of
    # the ApplicationHealthPolicy. The rest of the fields are ignored while
    # evaluating the health of the replica.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ReplicaHealth] operation results.
    #
    def get_replica_health_using_policy(partition_id, replica_id, events_health_state_filter:0, application_health_policy:nil, timeout:60, custom_headers:nil)
      response = get_replica_health_using_policy_async(partition_id, replica_id, events_health_state_filter:events_health_state_filter, application_health_policy:application_health_policy, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the health of a Service Fabric stateful service replica or stateless
    # service instance using the specified policy.
    #
    # Gets the health of a Service Fabric stateful service replica or stateless
    # service instance.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the cluster based on the health state.
    # Use ApplicationHealthPolicy to optionally override the health policies used
    # to evaluate the health. This API only uses 'ConsiderWarningAsError' field of
    # the ApplicationHealthPolicy. The rest of the fields are ignored while
    # evaluating the health of the replica.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_replica_health_using_policy_with_http_info(partition_id, replica_id, events_health_state_filter:0, application_health_policy:nil, timeout:60, custom_headers:nil)
      get_replica_health_using_policy_async(partition_id, replica_id, events_health_state_filter:events_health_state_filter, application_health_policy:application_health_policy, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the health of a Service Fabric stateful service replica or stateless
    # service instance using the specified policy.
    #
    # Gets the health of a Service Fabric stateful service replica or stateless
    # service instance.
    # Use EventsHealthStateFilter to filter the collection of health events
    # reported on the cluster based on the health state.
    # Use ApplicationHealthPolicy to optionally override the health policies used
    # to evaluate the health. This API only uses 'ConsiderWarningAsError' field of
    # the ApplicationHealthPolicy. The rest of the fields are ignored while
    # evaluating the health of the replica.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_replica_health_using_policy_async(partition_id, replica_id, events_health_state_filter:0, application_health_policy:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'replica_id is nil' if replica_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ApplicationHealthPolicy.mapper()
      request_content = self.serialize(request_mapper,  application_health_policy)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Partitions/{partitionId}/$/GetReplicas/{replicaId}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id,'replicaId' => replica_id},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ReplicaHealth.mapper()
            result.body = self.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

    #
    # Sends a health report on the Service Fabric replica.
    #
    # Reports health state of the specified Service Fabric replica. The report must
    # contain the information about the source of the health report and property on
    # which it is reported.
    # The report is sent to a Service Fabric gateway Replica, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetReplicaHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param replica_health_report_service_kind [ReplicaHealthReportServiceKind]
    # The kind of service replica (Stateless or Stateful) for which the health is
    # being reported. Following are the possible values. Possible values include:
    # 'Stateless', 'Stateful'
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def report_replica_health(partition_id, replica_id, replica_health_report_service_kind, health_information, immediate:false, timeout:60, custom_headers:nil)
      response = report_replica_health_async(partition_id, replica_id, replica_health_report_service_kind, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Sends a health report on the Service Fabric replica.
    #
    # Reports health state of the specified Service Fabric replica. The report must
    # contain the information about the source of the health report and property on
    # which it is reported.
    # The report is sent to a Service Fabric gateway Replica, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetReplicaHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param replica_health_report_service_kind [ReplicaHealthReportServiceKind]
    # The kind of service replica (Stateless or Stateful) for which the health is
    # being reported. Following are the possible values. Possible values include:
    # 'Stateless', 'Stateful'
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_replica_health_with_http_info(partition_id, replica_id, replica_health_report_service_kind, health_information, immediate:false, timeout:60, custom_headers:nil)
      report_replica_health_async(partition_id, replica_id, replica_health_report_service_kind, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Sends a health report on the Service Fabric replica.
    #
    # Reports health state of the specified Service Fabric replica. The report must
    # contain the information about the source of the health report and property on
    # which it is reported.
    # The report is sent to a Service Fabric gateway Replica, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, run
    # GetReplicaHealth and check that the report appears in the HealthEvents
    # section.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param replica_health_report_service_kind [ReplicaHealthReportServiceKind]
    # The kind of service replica (Stateless or Stateful) for which the health is
    # being reported. Following are the possible values. Possible values include:
    # 'Stateless', 'Stateful'
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_replica_health_async(partition_id, replica_id, replica_health_report_service_kind, health_information, immediate:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'replica_id is nil' if replica_id.nil?
      fail ArgumentError, 'replica_health_report_service_kind is nil' if replica_health_report_service_kind.nil?
      fail ArgumentError, 'health_information is nil' if health_information.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::HealthInformation.mapper()
      request_content = self.serialize(request_mapper,  health_information)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Partitions/{partitionId}/$/GetReplicas/{replicaId}/$/ReportHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id,'replicaId' => replica_id},
          query_params: {'api-version' => api_version,'ReplicaHealthReportServiceKind' => replica_health_report_service_kind,'Immediate' => immediate,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the list of replicas deployed on a Service Fabric node.
    #
    # Gets the list containing the information about replicas deployed on a Service
    # Fabric node. The information include partition ID, replica ID, status of the
    # replica, name of the service, name of the service type, and other
    # information. Use PartitionId or ServiceManifestName query parameters to
    # return information about the deployed replicas matching the specified values
    # for those parameters.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param partition_id The identity of the partition.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_deployed_service_replica_info_list(node_name, application_id, partition_id:nil, service_manifest_name:nil, timeout:60, custom_headers:nil)
      response = get_deployed_service_replica_info_list_async(node_name, application_id, partition_id:partition_id, service_manifest_name:service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of replicas deployed on a Service Fabric node.
    #
    # Gets the list containing the information about replicas deployed on a Service
    # Fabric node. The information include partition ID, replica ID, status of the
    # replica, name of the service, name of the service type, and other
    # information. Use PartitionId or ServiceManifestName query parameters to
    # return information about the deployed replicas matching the specified values
    # for those parameters.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param partition_id The identity of the partition.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_replica_info_list_with_http_info(node_name, application_id, partition_id:nil, service_manifest_name:nil, timeout:60, custom_headers:nil)
      get_deployed_service_replica_info_list_async(node_name, application_id, partition_id:partition_id, service_manifest_name:service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of replicas deployed on a Service Fabric node.
    #
    # Gets the list containing the information about replicas deployed on a Service
    # Fabric node. The information include partition ID, replica ID, status of the
    # replica, name of the service, name of the service type, and other
    # information. Use PartitionId or ServiceManifestName query parameters to
    # return information about the deployed replicas matching the specified values
    # for those parameters.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param partition_id The identity of the partition.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_replica_info_list_async(node_name, application_id, partition_id:nil, service_manifest_name:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetReplicas'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'PartitionId' => partition_id,'ServiceManifestName' => service_manifest_name,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 || 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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'DeployedServiceReplicaInfoElementType',
                    type: {
                      name: 'Composite',
                      polymorphic_discriminator: 'ServiceKind',
                      uber_parent: 'DeployedServiceReplicaInfo',
                      class_name: 'DeployedServiceReplicaInfo'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets the details of replica deployed on a Service Fabric node.
    #
    # Gets the details of the replica deployed on a Service Fabric node. The
    # information include service kind, service name, current service operation,
    # current service operation start date time, partition ID, replica/instance ID,
    # reported load, and other information.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [DeployedServiceReplicaDetailInfo] operation results.
    #
    def get_deployed_service_replica_detail_info(node_name, partition_id, replica_id, timeout:60, custom_headers:nil)
      response = get_deployed_service_replica_detail_info_async(node_name, partition_id, replica_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the details of replica deployed on a Service Fabric node.
    #
    # Gets the details of the replica deployed on a Service Fabric node. The
    # information include service kind, service name, current service operation,
    # current service operation start date time, partition ID, replica/instance ID,
    # reported load, and other information.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_replica_detail_info_with_http_info(node_name, partition_id, replica_id, timeout:60, custom_headers:nil)
      get_deployed_service_replica_detail_info_async(node_name, partition_id, replica_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the details of replica deployed on a Service Fabric node.
    #
    # Gets the details of the replica deployed on a Service Fabric node. The
    # information include service kind, service name, current service operation,
    # current service operation start date time, partition ID, replica/instance ID,
    # reported load, and other information.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_replica_detail_info_async(node_name, partition_id, replica_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'replica_id is nil' if replica_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetPartitions/{partitionId}/$/GetReplicas/{replicaId}/$/GetDetail'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'partitionId' => partition_id,'replicaId' => replica_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::DeployedServiceReplicaDetailInfo.mapper()
            result.body = self.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

    #
    # Gets the details of replica deployed on a Service Fabric node.
    #
    # Gets the details of the replica deployed on a Service Fabric node. The
    # information include service kind, service name, current service operation,
    # current service operation start date time, partition ID, replica/instance ID,
    # reported load, and other information.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [DeployedServiceReplicaDetailInfo] operation results.
    #
    def get_deployed_service_replica_detail_info_by_partition_id(node_name, partition_id, timeout:60, custom_headers:nil)
      response = get_deployed_service_replica_detail_info_by_partition_id_async(node_name, partition_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the details of replica deployed on a Service Fabric node.
    #
    # Gets the details of the replica deployed on a Service Fabric node. The
    # information include service kind, service name, current service operation,
    # current service operation start date time, partition ID, replica/instance ID,
    # reported load, and other information.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_replica_detail_info_by_partition_id_with_http_info(node_name, partition_id, timeout:60, custom_headers:nil)
      get_deployed_service_replica_detail_info_by_partition_id_async(node_name, partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the details of replica deployed on a Service Fabric node.
    #
    # Gets the details of the replica deployed on a Service Fabric node. The
    # information include service kind, service name, current service operation,
    # current service operation start date time, partition ID, replica/instance ID,
    # reported load, and other information.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_replica_detail_info_by_partition_id_async(node_name, partition_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetPartitions/{partitionId}/$/GetReplicas'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::DeployedServiceReplicaDetailInfo.mapper()
            result.body = self.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

    #
    # Restarts a service replica of a persisted service running on a node.
    #
    # Restarts a service replica of a persisted service running on a node. Warning
    # - There are no safety checks performed when this API is used. Incorrect use
    # of this API can lead to availability loss for stateful services.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def restart_replica(node_name, partition_id, replica_id, timeout:60, custom_headers:nil)
      response = restart_replica_async(node_name, partition_id, replica_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Restarts a service replica of a persisted service running on a node.
    #
    # Restarts a service replica of a persisted service running on a node. Warning
    # - There are no safety checks performed when this API is used. Incorrect use
    # of this API can lead to availability loss for stateful services.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def restart_replica_with_http_info(node_name, partition_id, replica_id, timeout:60, custom_headers:nil)
      restart_replica_async(node_name, partition_id, replica_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Restarts a service replica of a persisted service running on a node.
    #
    # Restarts a service replica of a persisted service running on a node. Warning
    # - There are no safety checks performed when this API is used. Incorrect use
    # of this API can lead to availability loss for stateful services.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def restart_replica_async(node_name, partition_id, replica_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'replica_id is nil' if replica_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetPartitions/{partitionId}/$/GetReplicas/{replicaId}/$/Restart'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'partitionId' => partition_id,'replicaId' => replica_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Removes a service replica running on a node.
    #
    # This API simulates a Service Fabric replica failure by removing a replica
    # from a Service Fabric cluster. The removal closes the replica, transitions
    # the replica to the role None, and then removes all of the state information
    # of the replica from the cluster. This API tests the replica state removal
    # path, and simulates the report fault permanent path through client APIs.
    # Warning - There are no safety checks performed when this API is used.
    # Incorrect use of this API can lead to data loss for stateful services.In
    # addition, the forceRemove flag impacts all other replicas hosted in the same
    # process.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param force_remove [Boolean] Remove a Service Fabric application or service
    # forcefully without going through the graceful shutdown sequence. This
    # parameter can be used to forcefully delete an application or service for
    # which delete is timing out due to issues in the service code that prevents
    # graceful close of replicas.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def remove_replica(node_name, partition_id, replica_id, force_remove:nil, timeout:60, custom_headers:nil)
      response = remove_replica_async(node_name, partition_id, replica_id, force_remove:force_remove, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Removes a service replica running on a node.
    #
    # This API simulates a Service Fabric replica failure by removing a replica
    # from a Service Fabric cluster. The removal closes the replica, transitions
    # the replica to the role None, and then removes all of the state information
    # of the replica from the cluster. This API tests the replica state removal
    # path, and simulates the report fault permanent path through client APIs.
    # Warning - There are no safety checks performed when this API is used.
    # Incorrect use of this API can lead to data loss for stateful services.In
    # addition, the forceRemove flag impacts all other replicas hosted in the same
    # process.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param force_remove [Boolean] Remove a Service Fabric application or service
    # forcefully without going through the graceful shutdown sequence. This
    # parameter can be used to forcefully delete an application or service for
    # which delete is timing out due to issues in the service code that prevents
    # graceful close of replicas.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def remove_replica_with_http_info(node_name, partition_id, replica_id, force_remove:nil, timeout:60, custom_headers:nil)
      remove_replica_async(node_name, partition_id, replica_id, force_remove:force_remove, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Removes a service replica running on a node.
    #
    # This API simulates a Service Fabric replica failure by removing a replica
    # from a Service Fabric cluster. The removal closes the replica, transitions
    # the replica to the role None, and then removes all of the state information
    # of the replica from the cluster. This API tests the replica state removal
    # path, and simulates the report fault permanent path through client APIs.
    # Warning - There are no safety checks performed when this API is used.
    # Incorrect use of this API can lead to data loss for stateful services.In
    # addition, the forceRemove flag impacts all other replicas hosted in the same
    # process.
    #
    # @param node_name [String] The name of the node.
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param force_remove [Boolean] Remove a Service Fabric application or service
    # forcefully without going through the graceful shutdown sequence. This
    # parameter can be used to forcefully delete an application or service for
    # which delete is timing out due to issues in the service code that prevents
    # graceful close of replicas.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def remove_replica_async(node_name, partition_id, replica_id, force_remove:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'replica_id is nil' if replica_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetPartitions/{partitionId}/$/GetReplicas/{replicaId}/$/Delete'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'partitionId' => partition_id,'replicaId' => replica_id},
          query_params: {'api-version' => api_version,'ForceRemove' => force_remove,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the list of service packages deployed on a Service Fabric node.
    #
    # Returns the information about the service packages deployed on a Service
    # Fabric node for the given application.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_deployed_service_package_info_list(node_name, application_id, timeout:60, custom_headers:nil)
      response = get_deployed_service_package_info_list_async(node_name, application_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of service packages deployed on a Service Fabric node.
    #
    # Returns the information about the service packages deployed on a Service
    # Fabric node for the given application.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_package_info_list_with_http_info(node_name, application_id, timeout:60, custom_headers:nil)
      get_deployed_service_package_info_list_async(node_name, application_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of service packages deployed on a Service Fabric node.
    #
    # Returns the information about the service packages deployed on a Service
    # Fabric node for the given application.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_package_info_list_async(node_name, application_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetServicePackages'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'DeployedServicePackageInfoElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'DeployedServicePackageInfo'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets the list of service packages deployed on a Service Fabric node matching
    # exactly the specified name.
    #
    # Returns the information about the service packages deployed on a Service
    # Fabric node for the given application. These results are of service packages
    # whose name match exactly the service package name specified as the parameter.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_deployed_service_package_info_list_by_name(node_name, application_id, service_package_name, timeout:60, custom_headers:nil)
      response = get_deployed_service_package_info_list_by_name_async(node_name, application_id, service_package_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of service packages deployed on a Service Fabric node matching
    # exactly the specified name.
    #
    # Returns the information about the service packages deployed on a Service
    # Fabric node for the given application. These results are of service packages
    # whose name match exactly the service package name specified as the parameter.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_package_info_list_by_name_with_http_info(node_name, application_id, service_package_name, timeout:60, custom_headers:nil)
      get_deployed_service_package_info_list_by_name_async(node_name, application_id, service_package_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of service packages deployed on a Service Fabric node matching
    # exactly the specified name.
    #
    # Returns the information about the service packages deployed on a Service
    # Fabric node for the given application. These results are of service packages
    # whose name match exactly the service package name specified as the parameter.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_package_info_list_by_name_async(node_name, application_id, service_package_name, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'service_package_name is nil' if service_package_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetServicePackages/{servicePackageName}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id,'servicePackageName' => service_package_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 || 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 == 204
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'DeployedServicePackageInfoElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'DeployedServicePackageInfo'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets the information about health of an service package for a specific
    # application deployed for a Service Fabric node and application.
    #
    # Gets the information about health of service package for a specific
    # application deployed on a Service Fabric node. Use EventsHealthStateFilter to
    # optionally filter for the collection of HealthEvent objects reported on the
    # deployed service package based on health state.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [DeployedServicePackageHealth] operation results.
    #
    def get_deployed_service_package_health(node_name, application_id, service_package_name, events_health_state_filter:0, timeout:60, custom_headers:nil)
      response = get_deployed_service_package_health_async(node_name, application_id, service_package_name, events_health_state_filter:events_health_state_filter, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about health of an service package for a specific
    # application deployed for a Service Fabric node and application.
    #
    # Gets the information about health of service package for a specific
    # application deployed on a Service Fabric node. Use EventsHealthStateFilter to
    # optionally filter for the collection of HealthEvent objects reported on the
    # deployed service package based on health state.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_package_health_with_http_info(node_name, application_id, service_package_name, events_health_state_filter:0, timeout:60, custom_headers:nil)
      get_deployed_service_package_health_async(node_name, application_id, service_package_name, events_health_state_filter:events_health_state_filter, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about health of an service package for a specific
    # application deployed for a Service Fabric node and application.
    #
    # Gets the information about health of service package for a specific
    # application deployed on a Service Fabric node. Use EventsHealthStateFilter to
    # optionally filter for the collection of HealthEvent objects reported on the
    # deployed service package based on health state.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_package_health_async(node_name, application_id, service_package_name, events_health_state_filter:0, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'service_package_name is nil' if service_package_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetServicePackages/{servicePackageName}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id,'servicePackageName' => service_package_name},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::DeployedServicePackageHealth.mapper()
            result.body = self.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

    #
    # Gets the information about health of service package for a specific
    # application deployed on a Service Fabric node using the specified policy.
    #
    # Gets the information about health of an service package for a specific
    # application deployed on a Service Fabric node. using the specified policy.
    # Use EventsHealthStateFilter to optionally filter for the collection of
    # HealthEvent objects reported on the deployed service package based on health
    # state. Use ApplicationHealthPolicy to optionally override the health policies
    # used to evaluate the health. This API only uses 'ConsiderWarningAsError'
    # field of the ApplicationHealthPolicy. The rest of the fields are ignored
    # while evaluating the health of the deployed service package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [DeployedServicePackageHealth] operation results.
    #
    def get_deployed_service_package_health_using_policy(node_name, application_id, service_package_name, events_health_state_filter:0, application_health_policy:nil, timeout:60, custom_headers:nil)
      response = get_deployed_service_package_health_using_policy_async(node_name, application_id, service_package_name, events_health_state_filter:events_health_state_filter, application_health_policy:application_health_policy, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the information about health of service package for a specific
    # application deployed on a Service Fabric node using the specified policy.
    #
    # Gets the information about health of an service package for a specific
    # application deployed on a Service Fabric node. using the specified policy.
    # Use EventsHealthStateFilter to optionally filter for the collection of
    # HealthEvent objects reported on the deployed service package based on health
    # state. Use ApplicationHealthPolicy to optionally override the health policies
    # used to evaluate the health. This API only uses 'ConsiderWarningAsError'
    # field of the ApplicationHealthPolicy. The rest of the fields are ignored
    # while evaluating the health of the deployed service package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_package_health_using_policy_with_http_info(node_name, application_id, service_package_name, events_health_state_filter:0, application_health_policy:nil, timeout:60, custom_headers:nil)
      get_deployed_service_package_health_using_policy_async(node_name, application_id, service_package_name, events_health_state_filter:events_health_state_filter, application_health_policy:application_health_policy, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the information about health of service package for a specific
    # application deployed on a Service Fabric node using the specified policy.
    #
    # Gets the information about health of an service package for a specific
    # application deployed on a Service Fabric node. using the specified policy.
    # Use EventsHealthStateFilter to optionally filter for the collection of
    # HealthEvent objects reported on the deployed service package based on health
    # state. Use ApplicationHealthPolicy to optionally override the health policies
    # used to evaluate the health. This API only uses 'ConsiderWarningAsError'
    # field of the ApplicationHealthPolicy. The rest of the fields are ignored
    # while evaluating the health of the deployed service package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param events_health_state_filter [Integer] Allows filtering the collection
    # of HealthEvent objects returned based on health state.
    # The possible values for this parameter include integer value of one of the
    # following health states.
    # Only events that match the filter are returned. All events are used to
    # evaluate the aggregated health state.
    # If not specified, all entries are returned. The state values are flag based
    # enumeration, so the value could be a combination of these value obtained
    # using bitwise 'OR' operator. For example, If the provided value is 6 then all
    # of the events with HealthState value of OK (2) and Warning (4) are returned.
    #
    # - Default - Default value. Matches any HealthState. The value is zero.
    # - None - Filter that doesn't match any HealthState value. Used in order to
    # return no results on a given collection of states. The value is 1.
    # - Ok - Filter that matches input with HealthState value Ok. The value is 2.
    # - Warning - Filter that matches input with HealthState value Warning. The
    # value is 4.
    # - Error - Filter that matches input with HealthState value Error. The value
    # is 8.
    # - All - Filter that matches input with any HealthState value. The value is
    # 65535.
    # @param application_health_policy [ApplicationHealthPolicy] Describes the
    # health policies used to evaluate the health of an application or one of its
    # children.
    # If not present, the health evaluation uses the health policy from application
    # manifest or the default health policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_service_package_health_using_policy_async(node_name, application_id, service_package_name, events_health_state_filter:0, application_health_policy:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'service_package_name is nil' if service_package_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ApplicationHealthPolicy.mapper()
      request_content = self.serialize(request_mapper,  application_health_policy)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetServicePackages/{servicePackageName}/$/GetHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id,'servicePackageName' => service_package_name},
          query_params: {'api-version' => api_version,'EventsHealthStateFilter' => events_health_state_filter,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::DeployedServicePackageHealth.mapper()
            result.body = self.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

    #
    # Sends a health report on the Service Fabric deployed service package.
    #
    # Reports health state of the service package of the application deployed on a
    # Service Fabric node. The report must contain the information about the source
    # of the health report and property on which it is reported.
    # The report is sent to a Service Fabric gateway Service, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, get deployed
    # service package health and check that the report appears in the HealthEvents
    # section.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def report_deployed_service_package_health(node_name, application_id, service_package_name, health_information, immediate:false, timeout:60, custom_headers:nil)
      response = report_deployed_service_package_health_async(node_name, application_id, service_package_name, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Sends a health report on the Service Fabric deployed service package.
    #
    # Reports health state of the service package of the application deployed on a
    # Service Fabric node. The report must contain the information about the source
    # of the health report and property on which it is reported.
    # The report is sent to a Service Fabric gateway Service, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, get deployed
    # service package health and check that the report appears in the HealthEvents
    # section.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_deployed_service_package_health_with_http_info(node_name, application_id, service_package_name, health_information, immediate:false, timeout:60, custom_headers:nil)
      report_deployed_service_package_health_async(node_name, application_id, service_package_name, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Sends a health report on the Service Fabric deployed service package.
    #
    # Reports health state of the service package of the application deployed on a
    # Service Fabric node. The report must contain the information about the source
    # of the health report and property on which it is reported.
    # The report is sent to a Service Fabric gateway Service, which forwards to the
    # health store.
    # The report may be accepted by the gateway, but rejected by the health store
    # after extra validation.
    # For example, the health store may reject the report because of an invalid
    # parameter, like a stale sequence number.
    # To see whether the report was applied in the health store, get deployed
    # service package health and check that the report appears in the HealthEvents
    # section.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_package_name [String] The name of the service package.
    # @param health_information [HealthInformation] Describes the health
    # information for the health report. This information needs to be present in
    # all of the health reports sent to the health manager.
    # @param immediate [Boolean] A flag which indicates whether the report should
    # be sent immediately.
    # A health report is sent to a Service Fabric gateway Application, which
    # forwards to the health store.
    # If Immediate is set to true, the report is sent immediately from HTTP Gateway
    # to the health store, regardless of the fabric client settings that the HTTP
    # Gateway Application is using.
    # This is useful for critical reports that should be sent as soon as possible.
    # Depending on timing and other conditions, sending the report may still fail,
    # for example if the HTTP Gateway is closed or the message doesn't reach the
    # Gateway.
    # If Immediate is set to false, the report is sent based on the health client
    # settings from the HTTP Gateway. Therefore, it will be batched according to
    # the HealthReportSendInterval configuration.
    # This is the recommended setting because it allows the health client to
    # optimize health reporting messages to health store as well as health report
    # processing.
    # By default, reports are not sent immediately.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def report_deployed_service_package_health_async(node_name, application_id, service_package_name, health_information, immediate:false, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'service_package_name is nil' if service_package_name.nil?
      fail ArgumentError, 'health_information is nil' if health_information.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::HealthInformation.mapper()
      request_content = self.serialize(request_mapper,  health_information)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetServicePackages/{servicePackageName}/$/ReportHealth'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id,'servicePackageName' => service_package_name},
          query_params: {'api-version' => api_version,'Immediate' => immediate,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Downloads all of the code packages associated with specified service manifest
    # on the specified node.
    #
    # This API provides a way to download code packages including the container
    # images on a specific node outside of the normal application deployment and
    # upgrade path. This is useful for the large code packages and container images
    # to be present on the node before the actual application deployment and
    # upgrade, thus significantly reducing the total time required for the
    # deployment or upgrade.
    #
    # @param node_name [String] The name of the node.
    # @param deploy_service_package_to_node_description
    # [DeployServicePackageToNodeDescription] Describes information for deploying a
    # service package to a Service Fabric node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def deploy_service_package_to_node(node_name, deploy_service_package_to_node_description, timeout:60, custom_headers:nil)
      response = deploy_service_package_to_node_async(node_name, deploy_service_package_to_node_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Downloads all of the code packages associated with specified service manifest
    # on the specified node.
    #
    # This API provides a way to download code packages including the container
    # images on a specific node outside of the normal application deployment and
    # upgrade path. This is useful for the large code packages and container images
    # to be present on the node before the actual application deployment and
    # upgrade, thus significantly reducing the total time required for the
    # deployment or upgrade.
    #
    # @param node_name [String] The name of the node.
    # @param deploy_service_package_to_node_description
    # [DeployServicePackageToNodeDescription] Describes information for deploying a
    # service package to a Service Fabric node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def deploy_service_package_to_node_with_http_info(node_name, deploy_service_package_to_node_description, timeout:60, custom_headers:nil)
      deploy_service_package_to_node_async(node_name, deploy_service_package_to_node_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Downloads all of the code packages associated with specified service manifest
    # on the specified node.
    #
    # This API provides a way to download code packages including the container
    # images on a specific node outside of the normal application deployment and
    # upgrade path. This is useful for the large code packages and container images
    # to be present on the node before the actual application deployment and
    # upgrade, thus significantly reducing the total time required for the
    # deployment or upgrade.
    #
    # @param node_name [String] The name of the node.
    # @param deploy_service_package_to_node_description
    # [DeployServicePackageToNodeDescription] Describes information for deploying a
    # service package to a Service Fabric node.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def deploy_service_package_to_node_async(node_name, deploy_service_package_to_node_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'deploy_service_package_to_node_description is nil' if deploy_service_package_to_node_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::DeployServicePackageToNodeDescription.mapper()
      request_content = self.serialize(request_mapper,  deploy_service_package_to_node_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Nodes/{nodeName}/$/DeployServicePackage'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the list of code packages deployed on a Service Fabric node.
    #
    # Gets the list of code packages deployed on a Service Fabric node for the
    # given application.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param code_package_name [String] The name of code package specified in
    # service manifest registered as part of an application type in a Service
    # Fabric cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_deployed_code_package_info_list(node_name, application_id, service_manifest_name:nil, code_package_name:nil, timeout:60, custom_headers:nil)
      response = get_deployed_code_package_info_list_async(node_name, application_id, service_manifest_name:service_manifest_name, code_package_name:code_package_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of code packages deployed on a Service Fabric node.
    #
    # Gets the list of code packages deployed on a Service Fabric node for the
    # given application.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param code_package_name [String] The name of code package specified in
    # service manifest registered as part of an application type in a Service
    # Fabric cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_code_package_info_list_with_http_info(node_name, application_id, service_manifest_name:nil, code_package_name:nil, timeout:60, custom_headers:nil)
      get_deployed_code_package_info_list_async(node_name, application_id, service_manifest_name:service_manifest_name, code_package_name:code_package_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of code packages deployed on a Service Fabric node.
    #
    # Gets the list of code packages deployed on a Service Fabric node for the
    # given application.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param code_package_name [String] The name of code package specified in
    # service manifest registered as part of an application type in a Service
    # Fabric cluster.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_deployed_code_package_info_list_async(node_name, application_id, service_manifest_name:nil, code_package_name:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetCodePackages'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'ServiceManifestName' => service_manifest_name,'CodePackageName' => code_package_name,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'DeployedCodePackageInfoElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'DeployedCodePackageInfo'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Restarts a code package deployed on a Service Fabric node in a cluster.
    #
    # Restarts a code package deployed on a Service Fabric node in a cluster. This
    # aborts the code package process, which will restart all the user service
    # replicas hosted in that process.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param restart_deployed_code_package_description
    # [RestartDeployedCodePackageDescription] Describes the deployed code package
    # on Service Fabric node to restart.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def restart_deployed_code_package(node_name, application_id, restart_deployed_code_package_description, timeout:60, custom_headers:nil)
      response = restart_deployed_code_package_async(node_name, application_id, restart_deployed_code_package_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Restarts a code package deployed on a Service Fabric node in a cluster.
    #
    # Restarts a code package deployed on a Service Fabric node in a cluster. This
    # aborts the code package process, which will restart all the user service
    # replicas hosted in that process.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param restart_deployed_code_package_description
    # [RestartDeployedCodePackageDescription] Describes the deployed code package
    # on Service Fabric node to restart.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def restart_deployed_code_package_with_http_info(node_name, application_id, restart_deployed_code_package_description, timeout:60, custom_headers:nil)
      restart_deployed_code_package_async(node_name, application_id, restart_deployed_code_package_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Restarts a code package deployed on a Service Fabric node in a cluster.
    #
    # Restarts a code package deployed on a Service Fabric node in a cluster. This
    # aborts the code package process, which will restart all the user service
    # replicas hosted in that process.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param restart_deployed_code_package_description
    # [RestartDeployedCodePackageDescription] Describes the deployed code package
    # on Service Fabric node to restart.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def restart_deployed_code_package_async(node_name, application_id, restart_deployed_code_package_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'restart_deployed_code_package_description is nil' if restart_deployed_code_package_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::RestartDeployedCodePackageDescription.mapper()
      request_content = self.serialize(request_mapper,  restart_deployed_code_package_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetCodePackages/$/Restart'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the container logs for container deployed on a Service Fabric node.
    #
    # Gets the container logs for container deployed on a Service Fabric node for
    # the given code package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param code_package_name [String] The name of code package specified in
    # service manifest registered as part of an application type in a Service
    # Fabric cluster.
    # @param tail [String] Number of lines to show from the end of the logs.
    # Default is 100. 'all' to show the complete logs.
    # @param previous [Boolean] Specifies whether to get container logs from
    # exited/dead containers of the code package instance.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ContainerLogs] operation results.
    #
    def get_container_logs_deployed_on_node(node_name, application_id, service_manifest_name, code_package_name, tail:nil, previous:false, timeout:60, custom_headers:nil)
      response = get_container_logs_deployed_on_node_async(node_name, application_id, service_manifest_name, code_package_name, tail:tail, previous:previous, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the container logs for container deployed on a Service Fabric node.
    #
    # Gets the container logs for container deployed on a Service Fabric node for
    # the given code package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param code_package_name [String] The name of code package specified in
    # service manifest registered as part of an application type in a Service
    # Fabric cluster.
    # @param tail [String] Number of lines to show from the end of the logs.
    # Default is 100. 'all' to show the complete logs.
    # @param previous [Boolean] Specifies whether to get container logs from
    # exited/dead containers of the code package instance.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_container_logs_deployed_on_node_with_http_info(node_name, application_id, service_manifest_name, code_package_name, tail:nil, previous:false, timeout:60, custom_headers:nil)
      get_container_logs_deployed_on_node_async(node_name, application_id, service_manifest_name, code_package_name, tail:tail, previous:previous, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the container logs for container deployed on a Service Fabric node.
    #
    # Gets the container logs for container deployed on a Service Fabric node for
    # the given code package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param code_package_name [String] The name of code package specified in
    # service manifest registered as part of an application type in a Service
    # Fabric cluster.
    # @param tail [String] Number of lines to show from the end of the logs.
    # Default is 100. 'all' to show the complete logs.
    # @param previous [Boolean] Specifies whether to get container logs from
    # exited/dead containers of the code package instance.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_container_logs_deployed_on_node_async(node_name, application_id, service_manifest_name, code_package_name, tail:nil, previous:false, timeout:60, custom_headers:nil)
      api_version = '6.2'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'service_manifest_name is nil' if service_manifest_name.nil?
      fail ArgumentError, 'code_package_name is nil' if code_package_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetCodePackages/$/ContainerLogs'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'ServiceManifestName' => service_manifest_name,'CodePackageName' => code_package_name,'Tail' => tail,'Previous' => previous,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ContainerLogs.mapper()
            result.body = self.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

    #
    # Invoke container API on a container deployed on a Service Fabric node.
    #
    # Invoke container API on a container deployed on a Service Fabric node for the
    # given code package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param code_package_name [String] The name of code package specified in
    # service manifest registered as part of an application type in a Service
    # Fabric cluster.
    # @param code_package_instance_id [String] ID that uniquely identifies a code
    # package instance deployed on a service fabric node.
    # @param container_api_request_body [ContainerApiRequestBody] Parameters for
    # making container API call
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ContainerApiResponse] operation results.
    #
    def invoke_container_api(node_name, application_id, service_manifest_name, code_package_name, code_package_instance_id, container_api_request_body, timeout:60, custom_headers:nil)
      response = invoke_container_api_async(node_name, application_id, service_manifest_name, code_package_name, code_package_instance_id, container_api_request_body, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Invoke container API on a container deployed on a Service Fabric node.
    #
    # Invoke container API on a container deployed on a Service Fabric node for the
    # given code package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param code_package_name [String] The name of code package specified in
    # service manifest registered as part of an application type in a Service
    # Fabric cluster.
    # @param code_package_instance_id [String] ID that uniquely identifies a code
    # package instance deployed on a service fabric node.
    # @param container_api_request_body [ContainerApiRequestBody] Parameters for
    # making container API call
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def invoke_container_api_with_http_info(node_name, application_id, service_manifest_name, code_package_name, code_package_instance_id, container_api_request_body, timeout:60, custom_headers:nil)
      invoke_container_api_async(node_name, application_id, service_manifest_name, code_package_name, code_package_instance_id, container_api_request_body, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Invoke container API on a container deployed on a Service Fabric node.
    #
    # Invoke container API on a container deployed on a Service Fabric node for the
    # given code package.
    #
    # @param node_name [String] The name of the node.
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param service_manifest_name [String] The name of a service manifest
    # registered as part of an application type in a Service Fabric cluster.
    # @param code_package_name [String] The name of code package specified in
    # service manifest registered as part of an application type in a Service
    # Fabric cluster.
    # @param code_package_instance_id [String] ID that uniquely identifies a code
    # package instance deployed on a service fabric node.
    # @param container_api_request_body [ContainerApiRequestBody] Parameters for
    # making container API call
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def invoke_container_api_async(node_name, application_id, service_manifest_name, code_package_name, code_package_instance_id, container_api_request_body, timeout:60, custom_headers:nil)
      api_version = '6.2'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'service_manifest_name is nil' if service_manifest_name.nil?
      fail ArgumentError, 'code_package_name is nil' if code_package_name.nil?
      fail ArgumentError, 'code_package_instance_id is nil' if code_package_instance_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'container_api_request_body is nil' if container_api_request_body.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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ContainerApiRequestBody.mapper()
      request_content = self.serialize(request_mapper,  container_api_request_body)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetCodePackages/$/ContainerApi'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'ServiceManifestName' => service_manifest_name,'CodePackageName' => code_package_name,'CodePackageInstanceId' => code_package_instance_id,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ContainerApiResponse.mapper()
            result.body = self.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

    #
    # Creates a Service Fabric compose deployment.
    #
    # Compose is a file format that describes multi-container applications. This
    # API allows deploying container based applications defined in compose format
    # in a Service Fabric cluster. Once the deployment is created it's status can
    # be tracked via `GetComposeDeploymentStatus` API.
    #
    # @param create_compose_deployment_description
    # [CreateComposeDeploymentDescription] Describes the compose deployment that
    # needs to be created.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def create_compose_deployment(create_compose_deployment_description, timeout:60, custom_headers:nil)
      response = create_compose_deployment_async(create_compose_deployment_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Creates a Service Fabric compose deployment.
    #
    # Compose is a file format that describes multi-container applications. This
    # API allows deploying container based applications defined in compose format
    # in a Service Fabric cluster. Once the deployment is created it's status can
    # be tracked via `GetComposeDeploymentStatus` API.
    #
    # @param create_compose_deployment_description
    # [CreateComposeDeploymentDescription] Describes the compose deployment that
    # needs to be created.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_compose_deployment_with_http_info(create_compose_deployment_description, timeout:60, custom_headers:nil)
      create_compose_deployment_async(create_compose_deployment_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Creates a Service Fabric compose deployment.
    #
    # Compose is a file format that describes multi-container applications. This
    # API allows deploying container based applications defined in compose format
    # in a Service Fabric cluster. Once the deployment is created it's status can
    # be tracked via `GetComposeDeploymentStatus` API.
    #
    # @param create_compose_deployment_description
    # [CreateComposeDeploymentDescription] Describes the compose deployment that
    # needs to be created.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_compose_deployment_async(create_compose_deployment_description, timeout:60, custom_headers:nil)
      api_version = '6.0-preview'
      fail ArgumentError, 'create_compose_deployment_description is nil' if create_compose_deployment_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::CreateComposeDeploymentDescription.mapper()
      request_content = self.serialize(request_mapper,  create_compose_deployment_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'ComposeDeployments/$/Create'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets information about a Service Fabric compose deployment.
    #
    # Returns the status of the compose deployment that was created or in the
    # process of being created in the Service Fabric cluster and whose name matches
    # the one specified as the parameter. The response includes the name, status
    # and other details about the deployment.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ComposeDeploymentStatusInfo] operation results.
    #
    def get_compose_deployment_status(deployment_name, timeout:60, custom_headers:nil)
      response = get_compose_deployment_status_async(deployment_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets information about a Service Fabric compose deployment.
    #
    # Returns the status of the compose deployment that was created or in the
    # process of being created in the Service Fabric cluster and whose name matches
    # the one specified as the parameter. The response includes the name, status
    # and other details about the deployment.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_compose_deployment_status_with_http_info(deployment_name, timeout:60, custom_headers:nil)
      get_compose_deployment_status_async(deployment_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets information about a Service Fabric compose deployment.
    #
    # Returns the status of the compose deployment that was created or in the
    # process of being created in the Service Fabric cluster and whose name matches
    # the one specified as the parameter. The response includes the name, status
    # and other details about the deployment.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_compose_deployment_status_async(deployment_name, timeout:60, custom_headers:nil)
      api_version = '6.0-preview'
      fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ComposeDeployments/{deploymentName}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'deploymentName' => deployment_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ComposeDeploymentStatusInfo.mapper()
            result.body = self.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

    #
    # Gets the list of compose deployments created in the Service Fabric cluster.
    #
    # Gets the status about the compose deployments that were created or in the
    # process of being created in the Service Fabric cluster. The response includes
    # the name, status and other details about the compose deployments. If the list
    # of deployments do not fit in a page, one page of results is returned as well
    # as a continuation token which can be used to get the next page.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedComposeDeploymentStatusInfoList] operation results.
    #
    def get_compose_deployment_status_list(continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      response = get_compose_deployment_status_list_async(continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of compose deployments created in the Service Fabric cluster.
    #
    # Gets the status about the compose deployments that were created or in the
    # process of being created in the Service Fabric cluster. The response includes
    # the name, status and other details about the compose deployments. If the list
    # of deployments do not fit in a page, one page of results is returned as well
    # as a continuation token which can be used to get the next page.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_compose_deployment_status_list_with_http_info(continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      get_compose_deployment_status_list_async(continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of compose deployments created in the Service Fabric cluster.
    #
    # Gets the status about the compose deployments that were created or in the
    # process of being created in the Service Fabric cluster. The response includes
    # the name, status and other details about the compose deployments. If the list
    # of deployments do not fit in a page, one page of results is returned as well
    # as a continuation token which can be used to get the next page.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_compose_deployment_status_list_async(continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      api_version = '6.0-preview'
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ComposeDeployments'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'MaxResults' => max_results,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedComposeDeploymentStatusInfoList.mapper()
            result.body = self.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

    #
    # Gets details for the latest upgrade performed on this Service Fabric compose
    # deployment.
    #
    # Returns the information about the state of the compose deployment upgrade
    # along with details to aid debugging application health issues.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ComposeDeploymentUpgradeProgressInfo] operation results.
    #
    def get_compose_deployment_upgrade_progress(deployment_name, timeout:60, custom_headers:nil)
      response = get_compose_deployment_upgrade_progress_async(deployment_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets details for the latest upgrade performed on this Service Fabric compose
    # deployment.
    #
    # Returns the information about the state of the compose deployment upgrade
    # along with details to aid debugging application health issues.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_compose_deployment_upgrade_progress_with_http_info(deployment_name, timeout:60, custom_headers:nil)
      get_compose_deployment_upgrade_progress_async(deployment_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets details for the latest upgrade performed on this Service Fabric compose
    # deployment.
    #
    # Returns the information about the state of the compose deployment upgrade
    # along with details to aid debugging application health issues.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_compose_deployment_upgrade_progress_async(deployment_name, timeout:60, custom_headers:nil)
      api_version = '6.0-preview'
      fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ComposeDeployments/{deploymentName}/$/GetUpgradeProgress'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'deploymentName' => deployment_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ComposeDeploymentUpgradeProgressInfo.mapper()
            result.body = self.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

    #
    # Deletes an existing Service Fabric compose deployment from cluster.
    #
    # Deletes an existing Service Fabric compose deployment.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def remove_compose_deployment(deployment_name, timeout:60, custom_headers:nil)
      response = remove_compose_deployment_async(deployment_name, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Deletes an existing Service Fabric compose deployment from cluster.
    #
    # Deletes an existing Service Fabric compose deployment.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def remove_compose_deployment_with_http_info(deployment_name, timeout:60, custom_headers:nil)
      remove_compose_deployment_async(deployment_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Deletes an existing Service Fabric compose deployment from cluster.
    #
    # Deletes an existing Service Fabric compose deployment.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def remove_compose_deployment_async(deployment_name, timeout:60, custom_headers:nil)
      api_version = '6.0-preview'
      fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ComposeDeployments/{deploymentName}/$/Delete'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'deploymentName' => deployment_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Starts upgrading a compose deployment in the Service Fabric cluster.
    #
    # Validates the supplied upgrade parameters and starts upgrading the deployment
    # if the parameters are valid.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param compose_deployment_upgrade_description
    # [ComposeDeploymentUpgradeDescription] Parameters for upgrading compose
    # deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def start_compose_deployment_upgrade(deployment_name, compose_deployment_upgrade_description, timeout:60, custom_headers:nil)
      response = start_compose_deployment_upgrade_async(deployment_name, compose_deployment_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Starts upgrading a compose deployment in the Service Fabric cluster.
    #
    # Validates the supplied upgrade parameters and starts upgrading the deployment
    # if the parameters are valid.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param compose_deployment_upgrade_description
    # [ComposeDeploymentUpgradeDescription] Parameters for upgrading compose
    # deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_compose_deployment_upgrade_with_http_info(deployment_name, compose_deployment_upgrade_description, timeout:60, custom_headers:nil)
      start_compose_deployment_upgrade_async(deployment_name, compose_deployment_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Starts upgrading a compose deployment in the Service Fabric cluster.
    #
    # Validates the supplied upgrade parameters and starts upgrading the deployment
    # if the parameters are valid.
    #
    # @param deployment_name [String] The identity of the deployment.
    # @param compose_deployment_upgrade_description
    # [ComposeDeploymentUpgradeDescription] Parameters for upgrading compose
    # deployment.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_compose_deployment_upgrade_async(deployment_name, compose_deployment_upgrade_description, timeout:60, custom_headers:nil)
      api_version = '6.0-preview'
      fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
      fail ArgumentError, 'compose_deployment_upgrade_description is nil' if compose_deployment_upgrade_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ComposeDeploymentUpgradeDescription.mapper()
      request_content = self.serialize(request_mapper,  compose_deployment_upgrade_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'ComposeDeployments/{deploymentName}/$/Upgrade'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'deploymentName' => deployment_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Get the status of Chaos.
    #
    # Get the status of Chaos indicating whether or not Chaos is running, the Chaos
    # parameters used for running Chaos and the status of the Chaos Schedule.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Chaos] operation results.
    #
    def get_chaos(timeout:60, custom_headers:nil)
      response = get_chaos_async(timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get the status of Chaos.
    #
    # Get the status of Chaos indicating whether or not Chaos is running, the Chaos
    # parameters used for running Chaos and the status of the Chaos Schedule.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_chaos_with_http_info(timeout:60, custom_headers:nil)
      get_chaos_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Get the status of Chaos.
    #
    # Get the status of Chaos indicating whether or not Chaos is running, the Chaos
    # parameters used for running Chaos and the status of the Chaos Schedule.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_chaos_async(timeout:60, custom_headers:nil)
      api_version = '6.2'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Tools/Chaos'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::Chaos.mapper()
            result.body = self.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

    #
    # Starts Chaos in the cluster.
    #
    # If Chaos is not already running in the cluster, it starts Chaos with the
    # passed in Chaos parameters.
    # If Chaos is already running when this call is made, the call fails with the
    # error code FABRIC_E_CHAOS_ALREADY_RUNNING.
    # Please refer to the article [Induce controlled Chaos in Service Fabric
    # clusters](https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-controlled-chaos)
    # for more details.
    #
    # @param chaos_parameters [ChaosParameters] Describes all the parameters to
    # configure a Chaos run.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def start_chaos(chaos_parameters, timeout:60, custom_headers:nil)
      response = start_chaos_async(chaos_parameters, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Starts Chaos in the cluster.
    #
    # If Chaos is not already running in the cluster, it starts Chaos with the
    # passed in Chaos parameters.
    # If Chaos is already running when this call is made, the call fails with the
    # error code FABRIC_E_CHAOS_ALREADY_RUNNING.
    # Please refer to the article [Induce controlled Chaos in Service Fabric
    # clusters](https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-controlled-chaos)
    # for more details.
    #
    # @param chaos_parameters [ChaosParameters] Describes all the parameters to
    # configure a Chaos run.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_chaos_with_http_info(chaos_parameters, timeout:60, custom_headers:nil)
      start_chaos_async(chaos_parameters, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Starts Chaos in the cluster.
    #
    # If Chaos is not already running in the cluster, it starts Chaos with the
    # passed in Chaos parameters.
    # If Chaos is already running when this call is made, the call fails with the
    # error code FABRIC_E_CHAOS_ALREADY_RUNNING.
    # Please refer to the article [Induce controlled Chaos in Service Fabric
    # clusters](https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-controlled-chaos)
    # for more details.
    #
    # @param chaos_parameters [ChaosParameters] Describes all the parameters to
    # configure a Chaos run.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_chaos_async(chaos_parameters, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'chaos_parameters is nil' if chaos_parameters.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ChaosParameters.mapper()
      request_content = self.serialize(request_mapper,  chaos_parameters)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Tools/Chaos/$/Start'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Stops Chaos if it is running in the cluster and put the Chaos Schedule in a
    # stopped state.
    #
    # Stops Chaos from executing new faults. In-flight faults will continue to
    # execute until they are complete. The current Chaos Schedule is put into a
    # stopped state.
    # Once a schedule is stopped it will stay in the stopped state and not be used
    # to Chaos Schedule new runs of Chaos. A new Chaos Schedule must be set in
    # order to resume scheduling.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def stop_chaos(timeout:60, custom_headers:nil)
      response = stop_chaos_async(timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Stops Chaos if it is running in the cluster and put the Chaos Schedule in a
    # stopped state.
    #
    # Stops Chaos from executing new faults. In-flight faults will continue to
    # execute until they are complete. The current Chaos Schedule is put into a
    # stopped state.
    # Once a schedule is stopped it will stay in the stopped state and not be used
    # to Chaos Schedule new runs of Chaos. A new Chaos Schedule must be set in
    # order to resume scheduling.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def stop_chaos_with_http_info(timeout:60, custom_headers:nil)
      stop_chaos_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Stops Chaos if it is running in the cluster and put the Chaos Schedule in a
    # stopped state.
    #
    # Stops Chaos from executing new faults. In-flight faults will continue to
    # execute until they are complete. The current Chaos Schedule is put into a
    # stopped state.
    # Once a schedule is stopped it will stay in the stopped state and not be used
    # to Chaos Schedule new runs of Chaos. A new Chaos Schedule must be set in
    # order to resume scheduling.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def stop_chaos_async(timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Tools/Chaos/$/Stop'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets the next segment of the Chaos events based on the continuation token or
    # the time range.
    #
    # To get the next segment of the Chaos events, you can specify the
    # ContinuationToken. To get the start of a new segment of Chaos events, you can
    # specify the time range
    # through StartTimeUtc and EndTimeUtc. You cannot specify both the
    # ContinuationToken and the time range in the same call.
    # When there are more than 100 Chaos events, the Chaos events are returned in
    # multiple segments where a segment contains no more than 100 Chaos events and
    # to get the next segment you make a call to this API with the continuation
    # token.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param start_time_utc [String] The Windows file time representing the start
    # time of the time range for which a Chaos report is to be generated. Please
    # consult [DateTime.ToFileTimeUtc
    # Method](https://msdn.microsoft.com/en-us/library/system.datetime.tofiletimeutc(v=vs.110).aspx)
    # for details.
    # @param end_time_utc [String] The Windows file time representing the end time
    # of the time range for which a Chaos report is to be generated. Please consult
    # [DateTime.ToFileTimeUtc
    # Method](https://msdn.microsoft.com/en-us/library/system.datetime.tofiletimeutc(v=vs.110).aspx)
    # for details.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ChaosEventsSegment] operation results.
    #
    def get_chaos_events(continuation_token:nil, start_time_utc:nil, end_time_utc:nil, max_results:0, timeout:60, custom_headers:nil)
      response = get_chaos_events_async(continuation_token:continuation_token, start_time_utc:start_time_utc, end_time_utc:end_time_utc, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the next segment of the Chaos events based on the continuation token or
    # the time range.
    #
    # To get the next segment of the Chaos events, you can specify the
    # ContinuationToken. To get the start of a new segment of Chaos events, you can
    # specify the time range
    # through StartTimeUtc and EndTimeUtc. You cannot specify both the
    # ContinuationToken and the time range in the same call.
    # When there are more than 100 Chaos events, the Chaos events are returned in
    # multiple segments where a segment contains no more than 100 Chaos events and
    # to get the next segment you make a call to this API with the continuation
    # token.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param start_time_utc [String] The Windows file time representing the start
    # time of the time range for which a Chaos report is to be generated. Please
    # consult [DateTime.ToFileTimeUtc
    # Method](https://msdn.microsoft.com/en-us/library/system.datetime.tofiletimeutc(v=vs.110).aspx)
    # for details.
    # @param end_time_utc [String] The Windows file time representing the end time
    # of the time range for which a Chaos report is to be generated. Please consult
    # [DateTime.ToFileTimeUtc
    # Method](https://msdn.microsoft.com/en-us/library/system.datetime.tofiletimeutc(v=vs.110).aspx)
    # for details.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_chaos_events_with_http_info(continuation_token:nil, start_time_utc:nil, end_time_utc:nil, max_results:0, timeout:60, custom_headers:nil)
      get_chaos_events_async(continuation_token:continuation_token, start_time_utc:start_time_utc, end_time_utc:end_time_utc, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the next segment of the Chaos events based on the continuation token or
    # the time range.
    #
    # To get the next segment of the Chaos events, you can specify the
    # ContinuationToken. To get the start of a new segment of Chaos events, you can
    # specify the time range
    # through StartTimeUtc and EndTimeUtc. You cannot specify both the
    # ContinuationToken and the time range in the same call.
    # When there are more than 100 Chaos events, the Chaos events are returned in
    # multiple segments where a segment contains no more than 100 Chaos events and
    # to get the next segment you make a call to this API with the continuation
    # token.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param start_time_utc [String] The Windows file time representing the start
    # time of the time range for which a Chaos report is to be generated. Please
    # consult [DateTime.ToFileTimeUtc
    # Method](https://msdn.microsoft.com/en-us/library/system.datetime.tofiletimeutc(v=vs.110).aspx)
    # for details.
    # @param end_time_utc [String] The Windows file time representing the end time
    # of the time range for which a Chaos report is to be generated. Please consult
    # [DateTime.ToFileTimeUtc
    # Method](https://msdn.microsoft.com/en-us/library/system.datetime.tofiletimeutc(v=vs.110).aspx)
    # for details.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_chaos_events_async(continuation_token:nil, start_time_utc:nil, end_time_utc:nil, max_results:0, timeout:60, custom_headers:nil)
      api_version = '6.2'
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Tools/Chaos/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'MaxResults' => max_results,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ChaosEventsSegment.mapper()
            result.body = self.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 the Chaos Schedule defining when and how to run Chaos.
    #
    # Gets the version of the Chaos Schedule in use and the Chaos Schedule that
    # defines when and how to run Chaos.
    #
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ChaosScheduleDescription] operation results.
    #
    def get_chaos_schedule(custom_headers:nil)
      response = get_chaos_schedule_async(custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get the Chaos Schedule defining when and how to run Chaos.
    #
    # Gets the version of the Chaos Schedule in use and the Chaos Schedule that
    # defines when and how to run Chaos.
    #
    # @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.
    #
    def get_chaos_schedule_with_http_info(custom_headers:nil)
      get_chaos_schedule_async(custom_headers:custom_headers).value!
    end

    #
    # Get the Chaos Schedule defining when and how to run Chaos.
    #
    # Gets the version of the Chaos Schedule in use and the Chaos Schedule that
    # defines when and how to run Chaos.
    #
    # @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.
    #
    def get_chaos_schedule_async(custom_headers:nil)
      api_version = '6.2'


      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'] = accept_language unless accept_language.nil?
      path_template = 'Tools/Chaos/Schedule'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ChaosScheduleDescription.mapper()
            result.body = self.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

    #
    # Set the schedule used by Chaos.
    #
    # Set the Chaos Schedule currently in use by Chaos. Chaos will automatically
    # schedule runs based on the Chaos Schedule.
    # The version in the provided input schedule must match the version of the
    # Chaos Schedule on the server.
    # If the version provided does not match the version on the server, the Chaos
    # Schedule is not updated.
    # If the version provided matches the version on the server, then the Chaos
    # Schedule is updated and the version of the Chaos Schedule on the server is
    # incremented up by one and wraps back to 0 after 2,147,483,647.
    # If Chaos is running when this call is made, the call will fail.
    #
    # @param chaos_schedule [ChaosScheduleDescription] Describes the schedule used
    # by Chaos.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def post_chaos_schedule(chaos_schedule, custom_headers:nil)
      response = post_chaos_schedule_async(chaos_schedule, custom_headers:custom_headers).value!
      nil
    end

    #
    # Set the schedule used by Chaos.
    #
    # Set the Chaos Schedule currently in use by Chaos. Chaos will automatically
    # schedule runs based on the Chaos Schedule.
    # The version in the provided input schedule must match the version of the
    # Chaos Schedule on the server.
    # If the version provided does not match the version on the server, the Chaos
    # Schedule is not updated.
    # If the version provided matches the version on the server, then the Chaos
    # Schedule is updated and the version of the Chaos Schedule on the server is
    # incremented up by one and wraps back to 0 after 2,147,483,647.
    # If Chaos is running when this call is made, the call will fail.
    #
    # @param chaos_schedule [ChaosScheduleDescription] Describes the schedule used
    # by Chaos.
    # @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.
    #
    def post_chaos_schedule_with_http_info(chaos_schedule, custom_headers:nil)
      post_chaos_schedule_async(chaos_schedule, custom_headers:custom_headers).value!
    end

    #
    # Set the schedule used by Chaos.
    #
    # Set the Chaos Schedule currently in use by Chaos. Chaos will automatically
    # schedule runs based on the Chaos Schedule.
    # The version in the provided input schedule must match the version of the
    # Chaos Schedule on the server.
    # If the version provided does not match the version on the server, the Chaos
    # Schedule is not updated.
    # If the version provided matches the version on the server, then the Chaos
    # Schedule is updated and the version of the Chaos Schedule on the server is
    # incremented up by one and wraps back to 0 after 2,147,483,647.
    # If Chaos is running when this call is made, the call will fail.
    #
    # @param chaos_schedule [ChaosScheduleDescription] Describes the schedule used
    # by Chaos.
    # @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.
    #
    def post_chaos_schedule_async(chaos_schedule, custom_headers:nil)
      api_version = '6.2'
      fail ArgumentError, 'chaos_schedule is nil' if chaos_schedule.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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ChaosScheduleDescription.mapper()
      request_content = self.serialize(request_mapper,  chaos_schedule)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Tools/Chaos/Schedule'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Uploads contents of the file to the image store.
    #
    # Uploads contents of the file to the image store. Use this API if the file is
    # small enough to upload again if the connection fails. The file's data needs
    # to be added to the request body. The contents will be uploaded to the
    # specified path. Image store service uses a mark file to indicate the
    # availability of the folder. The mark file is an empty file named "_.dir". The
    # mark file is generated by the image store service when all files in a folder
    # are uploaded. When using File-by-File approach to upload application package
    # in REST, the image store service isn't aware of the file hierarchy of the
    # application package; you need to create a mark file per folder and upload it
    # last, to let the image store service know that the folder is complete.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def upload_file(content_path, timeout:60, custom_headers:nil)
      response = upload_file_async(content_path, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Uploads contents of the file to the image store.
    #
    # Uploads contents of the file to the image store. Use this API if the file is
    # small enough to upload again if the connection fails. The file's data needs
    # to be added to the request body. The contents will be uploaded to the
    # specified path. Image store service uses a mark file to indicate the
    # availability of the folder. The mark file is an empty file named "_.dir". The
    # mark file is generated by the image store service when all files in a folder
    # are uploaded. When using File-by-File approach to upload application package
    # in REST, the image store service isn't aware of the file hierarchy of the
    # application package; you need to create a mark file per folder and upload it
    # last, to let the image store service know that the folder is complete.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def upload_file_with_http_info(content_path, timeout:60, custom_headers:nil)
      upload_file_async(content_path, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Uploads contents of the file to the image store.
    #
    # Uploads contents of the file to the image store. Use this API if the file is
    # small enough to upload again if the connection fails. The file's data needs
    # to be added to the request body. The contents will be uploaded to the
    # specified path. Image store service uses a mark file to indicate the
    # availability of the folder. The mark file is an empty file named "_.dir". The
    # mark file is generated by the image store service when all files in a folder
    # are uploaded. When using File-by-File approach to upload application package
    # in REST, the image store service isn't aware of the file hierarchy of the
    # application package; you need to create a mark file per folder and upload it
    # last, to let the image store service know that the folder is complete.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def upload_file_async(content_path, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'content_path is nil' if content_path.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ImageStore/{contentPath}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'contentPath' => content_path},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets the image store content information.
    #
    # Returns the information about the image store content at the specified
    # contentPath relative to the root of the image store.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ImageStoreContent] operation results.
    #
    def get_image_store_content(content_path, timeout:60, custom_headers:nil)
      response = get_image_store_content_async(content_path, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the image store content information.
    #
    # Returns the information about the image store content at the specified
    # contentPath relative to the root of the image store.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_image_store_content_with_http_info(content_path, timeout:60, custom_headers:nil)
      get_image_store_content_async(content_path, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the image store content information.
    #
    # Returns the information about the image store content at the specified
    # contentPath relative to the root of the image store.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_image_store_content_async(content_path, timeout:60, custom_headers:nil)
      api_version = '6.2'
      fail ArgumentError, 'content_path is nil' if content_path.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ImageStore/{contentPath}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'contentPath' => content_path},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ImageStoreContent.mapper()
            result.body = self.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

    #
    # Deletes existing image store content.
    #
    # Deletes existing image store content being found within the given image store
    # relative path. This can be used to delete uploaded application packages once
    # they are provisioned.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def delete_image_store_content(content_path, timeout:60, custom_headers:nil)
      response = delete_image_store_content_async(content_path, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Deletes existing image store content.
    #
    # Deletes existing image store content being found within the given image store
    # relative path. This can be used to delete uploaded application packages once
    # they are provisioned.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_image_store_content_with_http_info(content_path, timeout:60, custom_headers:nil)
      delete_image_store_content_async(content_path, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Deletes existing image store content.
    #
    # Deletes existing image store content being found within the given image store
    # relative path. This can be used to delete uploaded application packages once
    # they are provisioned.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_image_store_content_async(content_path, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'content_path is nil' if content_path.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ImageStore/{contentPath}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'contentPath' => content_path},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets the content information at the root of the image store.
    #
    # Returns the information about the image store content at the root of the
    # image store.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ImageStoreContent] operation results.
    #
    def get_image_store_root_content(timeout:60, custom_headers:nil)
      response = get_image_store_root_content_async(timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the content information at the root of the image store.
    #
    # Returns the information about the image store content at the root of the
    # image store.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_image_store_root_content_with_http_info(timeout:60, custom_headers:nil)
      get_image_store_root_content_async(timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the content information at the root of the image store.
    #
    # Returns the information about the image store content at the root of the
    # image store.
    #
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_image_store_root_content_async(timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ImageStore'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::ImageStoreContent.mapper()
            result.body = self.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

    #
    # Copies image store content internally
    #
    # Copies the image store content from the source image store relative path to
    # the destination image store relative path.
    #
    # @param image_store_copy_description [ImageStoreCopyDescription] Describes the
    # copy description for the image store.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def copy_image_store_content(image_store_copy_description, timeout:60, custom_headers:nil)
      response = copy_image_store_content_async(image_store_copy_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Copies image store content internally
    #
    # Copies the image store content from the source image store relative path to
    # the destination image store relative path.
    #
    # @param image_store_copy_description [ImageStoreCopyDescription] Describes the
    # copy description for the image store.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def copy_image_store_content_with_http_info(image_store_copy_description, timeout:60, custom_headers:nil)
      copy_image_store_content_async(image_store_copy_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Copies image store content internally
    #
    # Copies the image store content from the source image store relative path to
    # the destination image store relative path.
    #
    # @param image_store_copy_description [ImageStoreCopyDescription] Describes the
    # copy description for the image store.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def copy_image_store_content_async(image_store_copy_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'image_store_copy_description is nil' if image_store_copy_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::ImageStoreCopyDescription.mapper()
      request_content = self.serialize(request_mapper,  image_store_copy_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'ImageStore/$/Copy'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Cancels an image store upload session.
    #
    # The DELETE request will cause the existing upload session to expire and
    # remove any previously uploaded file chunks.
    #
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def delete_image_store_upload_session(session_id, timeout:60, custom_headers:nil)
      response = delete_image_store_upload_session_async(session_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Cancels an image store upload session.
    #
    # The DELETE request will cause the existing upload session to expire and
    # remove any previously uploaded file chunks.
    #
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_image_store_upload_session_with_http_info(session_id, timeout:60, custom_headers:nil)
      delete_image_store_upload_session_async(session_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Cancels an image store upload session.
    #
    # The DELETE request will cause the existing upload session to expire and
    # remove any previously uploaded file chunks.
    #
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_image_store_upload_session_async(session_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'session_id is nil' if session_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ImageStore/$/DeleteUploadSession'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'session-id' => session_id,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Commit an image store upload session.
    #
    # When all file chunks have been uploaded, the upload session needs to be
    # committed explicitly to complete the upload. Image store preserves the upload
    # session until the expiration time, which is 30 minutes after the last chunk
    # received.
    #
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def commit_image_store_upload_session(session_id, timeout:60, custom_headers:nil)
      response = commit_image_store_upload_session_async(session_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Commit an image store upload session.
    #
    # When all file chunks have been uploaded, the upload session needs to be
    # committed explicitly to complete the upload. Image store preserves the upload
    # session until the expiration time, which is 30 minutes after the last chunk
    # received.
    #
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def commit_image_store_upload_session_with_http_info(session_id, timeout:60, custom_headers:nil)
      commit_image_store_upload_session_async(session_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Commit an image store upload session.
    #
    # When all file chunks have been uploaded, the upload session needs to be
    # committed explicitly to complete the upload. Image store preserves the upload
    # session until the expiration time, which is 30 minutes after the last chunk
    # received.
    #
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def commit_image_store_upload_session_async(session_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'session_id is nil' if session_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ImageStore/$/CommitUploadSession'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'session-id' => session_id,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Get the image store upload session by ID.
    #
    # Gets the image store upload session identified by the given ID. User can
    # query the upload session at any time during uploading.
    #
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [UploadSession] operation results.
    #
    def get_image_store_upload_session_by_id(session_id, timeout:60, custom_headers:nil)
      response = get_image_store_upload_session_by_id_async(session_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get the image store upload session by ID.
    #
    # Gets the image store upload session identified by the given ID. User can
    # query the upload session at any time during uploading.
    #
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_image_store_upload_session_by_id_with_http_info(session_id, timeout:60, custom_headers:nil)
      get_image_store_upload_session_by_id_async(session_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Get the image store upload session by ID.
    #
    # Gets the image store upload session identified by the given ID. User can
    # query the upload session at any time during uploading.
    #
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_image_store_upload_session_by_id_async(session_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'session_id is nil' if session_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ImageStore/$/GetUploadSession'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'session-id' => session_id,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::UploadSession.mapper()
            result.body = self.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 the image store upload session by relative path.
    #
    # Gets the image store upload session associated with the given image store
    # relative path. User can query the upload session at any time during
    # uploading.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [UploadSession] operation results.
    #
    def get_image_store_upload_session_by_path(content_path, timeout:60, custom_headers:nil)
      response = get_image_store_upload_session_by_path_async(content_path, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get the image store upload session by relative path.
    #
    # Gets the image store upload session associated with the given image store
    # relative path. User can query the upload session at any time during
    # uploading.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_image_store_upload_session_by_path_with_http_info(content_path, timeout:60, custom_headers:nil)
      get_image_store_upload_session_by_path_async(content_path, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Get the image store upload session by relative path.
    #
    # Gets the image store upload session associated with the given image store
    # relative path. User can query the upload session at any time during
    # uploading.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_image_store_upload_session_by_path_async(content_path, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'content_path is nil' if content_path.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'ImageStore/{contentPath}/$/GetUploadSession'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'contentPath' => content_path},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::UploadSession.mapper()
            result.body = self.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

    #
    # Uploads a file chunk to the image store relative path.
    #
    # Uploads a file chunk to the image store with the specified upload session ID
    # and image store relative path. This API allows user to resume the file upload
    # operation. user doesn't have to restart the file upload from scratch whenever
    # there is a network interruption. Use this option if the file size is large.
    #
    # To perform a resumable file upload, user need to break the file into multiple
    # chunks and upload these chunks to the image store one-by-one. Chunks don't
    # have to be uploaded in order. If the file represented by the image store
    # relative path already exists, it will be overwritten when the upload session
    # commits.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param content_range [String] When uploading file chunks to the image store,
    # the Content-Range header field need to be configured and sent with a request.
    # The format should looks like "bytes
    # {First-Byte-Position}-{Last-Byte-Position}/{File-Length}". For example,
    # Content-Range:bytes 300-5000/20000 indicates that user is sending bytes 300
    # through 5,000 and the total file length is 20,000 bytes.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def upload_file_chunk(content_path, session_id, content_range, timeout:60, custom_headers:nil)
      response = upload_file_chunk_async(content_path, session_id, content_range, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Uploads a file chunk to the image store relative path.
    #
    # Uploads a file chunk to the image store with the specified upload session ID
    # and image store relative path. This API allows user to resume the file upload
    # operation. user doesn't have to restart the file upload from scratch whenever
    # there is a network interruption. Use this option if the file size is large.
    #
    # To perform a resumable file upload, user need to break the file into multiple
    # chunks and upload these chunks to the image store one-by-one. Chunks don't
    # have to be uploaded in order. If the file represented by the image store
    # relative path already exists, it will be overwritten when the upload session
    # commits.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param content_range [String] When uploading file chunks to the image store,
    # the Content-Range header field need to be configured and sent with a request.
    # The format should looks like "bytes
    # {First-Byte-Position}-{Last-Byte-Position}/{File-Length}". For example,
    # Content-Range:bytes 300-5000/20000 indicates that user is sending bytes 300
    # through 5,000 and the total file length is 20,000 bytes.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def upload_file_chunk_with_http_info(content_path, session_id, content_range, timeout:60, custom_headers:nil)
      upload_file_chunk_async(content_path, session_id, content_range, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Uploads a file chunk to the image store relative path.
    #
    # Uploads a file chunk to the image store with the specified upload session ID
    # and image store relative path. This API allows user to resume the file upload
    # operation. user doesn't have to restart the file upload from scratch whenever
    # there is a network interruption. Use this option if the file size is large.
    #
    # To perform a resumable file upload, user need to break the file into multiple
    # chunks and upload these chunks to the image store one-by-one. Chunks don't
    # have to be uploaded in order. If the file represented by the image store
    # relative path already exists, it will be overwritten when the upload session
    # commits.
    #
    # @param content_path [String] Relative path to file or folder in the image
    # store from its root.
    # @param session_id A GUID generated by the user for a file uploading. It
    # identifies an image store upload session which keeps track of all file chunks
    # until it is committed.
    # @param content_range [String] When uploading file chunks to the image store,
    # the Content-Range header field need to be configured and sent with a request.
    # The format should looks like "bytes
    # {First-Byte-Position}-{Last-Byte-Position}/{File-Length}". For example,
    # Content-Range:bytes 300-5000/20000 indicates that user is sending bytes 300
    # through 5,000 and the total file length is 20,000 bytes.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def upload_file_chunk_async(content_path, session_id, content_range, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'content_path is nil' if content_path.nil?
      fail ArgumentError, 'session_id is nil' if session_id.nil?
      fail ArgumentError, 'content_range is nil' if content_range.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['Content-Range'] = content_range unless content_range.nil?
      request_headers['accept-language'] = accept_language unless accept_language.nil?
      path_template = 'ImageStore/{contentPath}/$/UploadChunk'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'contentPath' => content_path},
          query_params: {'api-version' => api_version,'session-id' => session_id,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Invokes an administrative command on the given Infrastructure Service
    # instance.
    #
    # For clusters that have one or more instances of the Infrastructure Service
    # configured,
    # this API provides a way to send infrastructure-specific commands to a
    # particular
    # instance of the Infrastructure Service.
    #
    # Available commands and their corresponding response formats vary depending
    # upon
    # the infrastructure on which the cluster is running.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param command [String] The text of the command to be invoked. The content of
    # the command is infrastructure-specific.
    # @param service_id [String] The identity of the infrastructure service. This
    # is  the full name of the infrastructure service without the 'fabric:' URI
    # scheme. This parameter required only for the cluster that have more than one
    # instance of infrastructure service running.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [String] operation results.
    #
    def invoke_infrastructure_command(command, service_id:nil, timeout:60, custom_headers:nil)
      response = invoke_infrastructure_command_async(command, service_id:service_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Invokes an administrative command on the given Infrastructure Service
    # instance.
    #
    # For clusters that have one or more instances of the Infrastructure Service
    # configured,
    # this API provides a way to send infrastructure-specific commands to a
    # particular
    # instance of the Infrastructure Service.
    #
    # Available commands and their corresponding response formats vary depending
    # upon
    # the infrastructure on which the cluster is running.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param command [String] The text of the command to be invoked. The content of
    # the command is infrastructure-specific.
    # @param service_id [String] The identity of the infrastructure service. This
    # is  the full name of the infrastructure service without the 'fabric:' URI
    # scheme. This parameter required only for the cluster that have more than one
    # instance of infrastructure service running.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def invoke_infrastructure_command_with_http_info(command, service_id:nil, timeout:60, custom_headers:nil)
      invoke_infrastructure_command_async(command, service_id:service_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Invokes an administrative command on the given Infrastructure Service
    # instance.
    #
    # For clusters that have one or more instances of the Infrastructure Service
    # configured,
    # this API provides a way to send infrastructure-specific commands to a
    # particular
    # instance of the Infrastructure Service.
    #
    # Available commands and their corresponding response formats vary depending
    # upon
    # the infrastructure on which the cluster is running.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param command [String] The text of the command to be invoked. The content of
    # the command is infrastructure-specific.
    # @param service_id [String] The identity of the infrastructure service. This
    # is  the full name of the infrastructure service without the 'fabric:' URI
    # scheme. This parameter required only for the cluster that have more than one
    # instance of infrastructure service running.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def invoke_infrastructure_command_async(command, service_id:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'command is nil' if command.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/InvokeInfrastructureCommand'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'Command' => command,'ServiceId' => service_id,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'String'
              }
            }
            result.body = self.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

    #
    # Invokes a read-only query on the given infrastructure service instance.
    #
    # For clusters that have one or more instances of the Infrastructure Service
    # configured,
    # this API provides a way to send infrastructure-specific queries to a
    # particular
    # instance of the Infrastructure Service.
    #
    # Available commands and their corresponding response formats vary depending
    # upon
    # the infrastructure on which the cluster is running.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param command [String] The text of the command to be invoked. The content of
    # the command is infrastructure-specific.
    # @param service_id [String] The identity of the infrastructure service. This
    # is  the full name of the infrastructure service without the 'fabric:' URI
    # scheme. This parameter required only for the cluster that have more than one
    # instance of infrastructure service running.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [String] operation results.
    #
    def invoke_infrastructure_query(command, service_id:nil, timeout:60, custom_headers:nil)
      response = invoke_infrastructure_query_async(command, service_id:service_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Invokes a read-only query on the given infrastructure service instance.
    #
    # For clusters that have one or more instances of the Infrastructure Service
    # configured,
    # this API provides a way to send infrastructure-specific queries to a
    # particular
    # instance of the Infrastructure Service.
    #
    # Available commands and their corresponding response formats vary depending
    # upon
    # the infrastructure on which the cluster is running.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param command [String] The text of the command to be invoked. The content of
    # the command is infrastructure-specific.
    # @param service_id [String] The identity of the infrastructure service. This
    # is  the full name of the infrastructure service without the 'fabric:' URI
    # scheme. This parameter required only for the cluster that have more than one
    # instance of infrastructure service running.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def invoke_infrastructure_query_with_http_info(command, service_id:nil, timeout:60, custom_headers:nil)
      invoke_infrastructure_query_async(command, service_id:service_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Invokes a read-only query on the given infrastructure service instance.
    #
    # For clusters that have one or more instances of the Infrastructure Service
    # configured,
    # this API provides a way to send infrastructure-specific queries to a
    # particular
    # instance of the Infrastructure Service.
    #
    # Available commands and their corresponding response formats vary depending
    # upon
    # the infrastructure on which the cluster is running.
    #
    # This API supports the Service Fabric platform; it is not meant to be used
    # directly from your code.
    #
    # @param command [String] The text of the command to be invoked. The content of
    # the command is infrastructure-specific.
    # @param service_id [String] The identity of the infrastructure service. This
    # is  the full name of the infrastructure service without the 'fabric:' URI
    # scheme. This parameter required only for the cluster that have more than one
    # instance of infrastructure service running.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def invoke_infrastructure_query_async(command, service_id:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'command is nil' if command.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = '$/InvokeInfrastructureQuery'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'Command' => command,'ServiceId' => service_id,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'String'
              }
            }
            result.body = self.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

    #
    # This API will induce data loss for the specified partition. It will trigger a
    # call to the OnDataLossAsync API of the partition.
    #
    # This API will induce data loss for the specified partition. It will trigger a
    # call to the OnDataLoss API of the partition.
    # Actual data loss will depend on the specified DataLossMode
    # PartialDataLoss - Only a quorum of replicas are removed and OnDataLoss is
    # triggered for the partition but actual data loss depends on the presence of
    # in-flight replication.
    # FullDataLoss - All replicas are removed hence all data is lost and OnDataLoss
    # is triggered.
    #
    # This API should only be called with a stateful service as the target.
    #
    # Calling this API with a system service as the target is not advised.
    #
    # Note:  Once this API has been called, it cannot be reversed. Calling
    # CancelOperation will only stop execution and clean up internal system state.
    # It will not restore data if the command has progressed far enough to cause
    # data loss.
    #
    # Call the GetDataLossProgress API with the same OperationId to return
    # information on the operation started with this API.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param data_loss_mode [DataLossMode] This enum is passed to the StartDataLoss
    # API to indicate what type of data loss to induce. Possible values include:
    # 'Invalid', 'PartialDataLoss', 'FullDataLoss'
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def start_data_loss(service_id, partition_id, operation_id, data_loss_mode, timeout:60, custom_headers:nil)
      response = start_data_loss_async(service_id, partition_id, operation_id, data_loss_mode, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # This API will induce data loss for the specified partition. It will trigger a
    # call to the OnDataLossAsync API of the partition.
    #
    # This API will induce data loss for the specified partition. It will trigger a
    # call to the OnDataLoss API of the partition.
    # Actual data loss will depend on the specified DataLossMode
    # PartialDataLoss - Only a quorum of replicas are removed and OnDataLoss is
    # triggered for the partition but actual data loss depends on the presence of
    # in-flight replication.
    # FullDataLoss - All replicas are removed hence all data is lost and OnDataLoss
    # is triggered.
    #
    # This API should only be called with a stateful service as the target.
    #
    # Calling this API with a system service as the target is not advised.
    #
    # Note:  Once this API has been called, it cannot be reversed. Calling
    # CancelOperation will only stop execution and clean up internal system state.
    # It will not restore data if the command has progressed far enough to cause
    # data loss.
    #
    # Call the GetDataLossProgress API with the same OperationId to return
    # information on the operation started with this API.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param data_loss_mode [DataLossMode] This enum is passed to the StartDataLoss
    # API to indicate what type of data loss to induce. Possible values include:
    # 'Invalid', 'PartialDataLoss', 'FullDataLoss'
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_data_loss_with_http_info(service_id, partition_id, operation_id, data_loss_mode, timeout:60, custom_headers:nil)
      start_data_loss_async(service_id, partition_id, operation_id, data_loss_mode, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # This API will induce data loss for the specified partition. It will trigger a
    # call to the OnDataLossAsync API of the partition.
    #
    # This API will induce data loss for the specified partition. It will trigger a
    # call to the OnDataLoss API of the partition.
    # Actual data loss will depend on the specified DataLossMode
    # PartialDataLoss - Only a quorum of replicas are removed and OnDataLoss is
    # triggered for the partition but actual data loss depends on the presence of
    # in-flight replication.
    # FullDataLoss - All replicas are removed hence all data is lost and OnDataLoss
    # is triggered.
    #
    # This API should only be called with a stateful service as the target.
    #
    # Calling this API with a system service as the target is not advised.
    #
    # Note:  Once this API has been called, it cannot be reversed. Calling
    # CancelOperation will only stop execution and clean up internal system state.
    # It will not restore data if the command has progressed far enough to cause
    # data loss.
    #
    # Call the GetDataLossProgress API with the same OperationId to return
    # information on the operation started with this API.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param data_loss_mode [DataLossMode] This enum is passed to the StartDataLoss
    # API to indicate what type of data loss to induce. Possible values include:
    # 'Invalid', 'PartialDataLoss', 'FullDataLoss'
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_data_loss_async(service_id, partition_id, operation_id, data_loss_mode, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'operation_id is nil' if operation_id.nil?
      fail ArgumentError, 'data_loss_mode is nil' if data_loss_mode.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Faults/Services/{serviceId}/$/GetPartitions/{partitionId}/$/StartDataLoss'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id,'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'OperationId' => operation_id,'DataLossMode' => data_loss_mode,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets the progress of a partition data loss operation started using the
    # StartDataLoss API.
    #
    # Gets the progress of a data loss operation started with StartDataLoss, using
    # the OperationId.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PartitionDataLossProgress] operation results.
    #
    def get_data_loss_progress(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
      response = get_data_loss_progress_async(service_id, partition_id, operation_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the progress of a partition data loss operation started using the
    # StartDataLoss API.
    #
    # Gets the progress of a data loss operation started with StartDataLoss, using
    # the OperationId.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_data_loss_progress_with_http_info(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
      get_data_loss_progress_async(service_id, partition_id, operation_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the progress of a partition data loss operation started using the
    # StartDataLoss API.
    #
    # Gets the progress of a data loss operation started with StartDataLoss, using
    # the OperationId.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_data_loss_progress_async(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'operation_id is nil' if operation_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Faults/Services/{serviceId}/$/GetPartitions/{partitionId}/$/GetDataLossProgress'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id,'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'OperationId' => operation_id,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PartitionDataLossProgress.mapper()
            result.body = self.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

    #
    # Induces quorum loss for a given stateful service partition.
    #
    # Induces quorum loss for a given stateful service partition.  This API is
    # useful for a temporary quorum loss situation on your service.
    #
    # Call the GetQuorumLossProgress API with the same OperationId to return
    # information on the operation started with this API.
    #
    # This can only be called on stateful persisted (HasPersistedState==true)
    # services.  Do not use this API on stateless services or stateful in-memory
    # only services.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param quorum_loss_mode [QuorumLossMode] This enum is passed to the
    # StartQuorumLoss API to indicate what type of quorum loss to induce. Possible
    # values include: 'Invalid', 'QuorumReplicas', 'AllReplicas'
    # @param quorum_loss_duration [Integer] The amount of time for which the
    # partition will be kept in quorum loss.  This must be specified in seconds.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def start_quorum_loss(service_id, partition_id, operation_id, quorum_loss_mode, quorum_loss_duration, timeout:60, custom_headers:nil)
      response = start_quorum_loss_async(service_id, partition_id, operation_id, quorum_loss_mode, quorum_loss_duration, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Induces quorum loss for a given stateful service partition.
    #
    # Induces quorum loss for a given stateful service partition.  This API is
    # useful for a temporary quorum loss situation on your service.
    #
    # Call the GetQuorumLossProgress API with the same OperationId to return
    # information on the operation started with this API.
    #
    # This can only be called on stateful persisted (HasPersistedState==true)
    # services.  Do not use this API on stateless services or stateful in-memory
    # only services.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param quorum_loss_mode [QuorumLossMode] This enum is passed to the
    # StartQuorumLoss API to indicate what type of quorum loss to induce. Possible
    # values include: 'Invalid', 'QuorumReplicas', 'AllReplicas'
    # @param quorum_loss_duration [Integer] The amount of time for which the
    # partition will be kept in quorum loss.  This must be specified in seconds.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_quorum_loss_with_http_info(service_id, partition_id, operation_id, quorum_loss_mode, quorum_loss_duration, timeout:60, custom_headers:nil)
      start_quorum_loss_async(service_id, partition_id, operation_id, quorum_loss_mode, quorum_loss_duration, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Induces quorum loss for a given stateful service partition.
    #
    # Induces quorum loss for a given stateful service partition.  This API is
    # useful for a temporary quorum loss situation on your service.
    #
    # Call the GetQuorumLossProgress API with the same OperationId to return
    # information on the operation started with this API.
    #
    # This can only be called on stateful persisted (HasPersistedState==true)
    # services.  Do not use this API on stateless services or stateful in-memory
    # only services.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param quorum_loss_mode [QuorumLossMode] This enum is passed to the
    # StartQuorumLoss API to indicate what type of quorum loss to induce. Possible
    # values include: 'Invalid', 'QuorumReplicas', 'AllReplicas'
    # @param quorum_loss_duration [Integer] The amount of time for which the
    # partition will be kept in quorum loss.  This must be specified in seconds.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_quorum_loss_async(service_id, partition_id, operation_id, quorum_loss_mode, quorum_loss_duration, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'operation_id is nil' if operation_id.nil?
      fail ArgumentError, 'quorum_loss_mode is nil' if quorum_loss_mode.nil?
      fail ArgumentError, 'quorum_loss_duration is nil' if quorum_loss_duration.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Faults/Services/{serviceId}/$/GetPartitions/{partitionId}/$/StartQuorumLoss'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id,'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'OperationId' => operation_id,'QuorumLossMode' => quorum_loss_mode,'QuorumLossDuration' => quorum_loss_duration,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets the progress of a quorum loss operation on a partition started using the
    # StartQuorumLoss API.
    #
    # Gets the progress of a quorum loss operation started with StartQuorumLoss,
    # using the provided OperationId.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PartitionQuorumLossProgress] operation results.
    #
    def get_quorum_loss_progress(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
      response = get_quorum_loss_progress_async(service_id, partition_id, operation_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the progress of a quorum loss operation on a partition started using the
    # StartQuorumLoss API.
    #
    # Gets the progress of a quorum loss operation started with StartQuorumLoss,
    # using the provided OperationId.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_quorum_loss_progress_with_http_info(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
      get_quorum_loss_progress_async(service_id, partition_id, operation_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the progress of a quorum loss operation on a partition started using the
    # StartQuorumLoss API.
    #
    # Gets the progress of a quorum loss operation started with StartQuorumLoss,
    # using the provided OperationId.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_quorum_loss_progress_async(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'operation_id is nil' if operation_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Faults/Services/{serviceId}/$/GetPartitions/{partitionId}/$/GetQuorumLossProgress'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id,'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'OperationId' => operation_id,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PartitionQuorumLossProgress.mapper()
            result.body = self.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

    #
    # This API will restart some or all replicas or instances of the specified
    # partition.
    #
    # This API is useful for testing failover.
    #
    # If used to target a stateless service partition, RestartPartitionMode must be
    # AllReplicasOrInstances.
    #
    # Call the GetPartitionRestartProgress API using the same OperationId to get
    # the progress.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param restart_partition_mode [RestartPartitionMode] Describe which
    # partitions to restart. Possible values include: 'Invalid',
    # 'AllReplicasOrInstances', 'OnlyActiveSecondaries'
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def start_partition_restart(service_id, partition_id, operation_id, restart_partition_mode, timeout:60, custom_headers:nil)
      response = start_partition_restart_async(service_id, partition_id, operation_id, restart_partition_mode, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # This API will restart some or all replicas or instances of the specified
    # partition.
    #
    # This API is useful for testing failover.
    #
    # If used to target a stateless service partition, RestartPartitionMode must be
    # AllReplicasOrInstances.
    #
    # Call the GetPartitionRestartProgress API using the same OperationId to get
    # the progress.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param restart_partition_mode [RestartPartitionMode] Describe which
    # partitions to restart. Possible values include: 'Invalid',
    # 'AllReplicasOrInstances', 'OnlyActiveSecondaries'
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_partition_restart_with_http_info(service_id, partition_id, operation_id, restart_partition_mode, timeout:60, custom_headers:nil)
      start_partition_restart_async(service_id, partition_id, operation_id, restart_partition_mode, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # This API will restart some or all replicas or instances of the specified
    # partition.
    #
    # This API is useful for testing failover.
    #
    # If used to target a stateless service partition, RestartPartitionMode must be
    # AllReplicasOrInstances.
    #
    # Call the GetPartitionRestartProgress API using the same OperationId to get
    # the progress.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param restart_partition_mode [RestartPartitionMode] Describe which
    # partitions to restart. Possible values include: 'Invalid',
    # 'AllReplicasOrInstances', 'OnlyActiveSecondaries'
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_partition_restart_async(service_id, partition_id, operation_id, restart_partition_mode, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'operation_id is nil' if operation_id.nil?
      fail ArgumentError, 'restart_partition_mode is nil' if restart_partition_mode.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Faults/Services/{serviceId}/$/GetPartitions/{partitionId}/$/StartRestart'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id,'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'OperationId' => operation_id,'RestartPartitionMode' => restart_partition_mode,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets the progress of a PartitionRestart operation started using
    # StartPartitionRestart.
    #
    # Gets the progress of a PartitionRestart started with StartPartitionRestart
    # using the provided OperationId.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PartitionRestartProgress] operation results.
    #
    def get_partition_restart_progress(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
      response = get_partition_restart_progress_async(service_id, partition_id, operation_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the progress of a PartitionRestart operation started using
    # StartPartitionRestart.
    #
    # Gets the progress of a PartitionRestart started with StartPartitionRestart
    # using the provided OperationId.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_restart_progress_with_http_info(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
      get_partition_restart_progress_async(service_id, partition_id, operation_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the progress of a PartitionRestart operation started using
    # StartPartitionRestart.
    #
    # Gets the progress of a PartitionRestart started with StartPartitionRestart
    # using the provided OperationId.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param partition_id The identity of the partition.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_restart_progress_async(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'operation_id is nil' if operation_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Faults/Services/{serviceId}/$/GetPartitions/{partitionId}/$/GetRestartProgress'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id,'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'OperationId' => operation_id,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PartitionRestartProgress.mapper()
            result.body = self.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

    #
    # Starts or stops a cluster node.
    #
    # Starts or stops a cluster node.  A cluster node is a process, not the OS
    # instance itself.  To start a node, pass in "Start" for the NodeTransitionType
    # parameter.
    # To stop a node, pass in "Stop" for the NodeTransitionType parameter.  This
    # API starts the operation - when the API returns the node may not have
    # finished transitioning yet.
    # Call GetNodeTransitionProgress with the same OperationId to get the progress
    # of the operation.
    #
    # @param node_name [String] The name of the node.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param node_transition_type [NodeTransitionType] Indicates the type of
    # transition to perform.  NodeTransitionType.Start will start a stopped node.
    # NodeTransitionType.Stop will stop a node that is up. Possible values include:
    # 'Invalid', 'Start', 'Stop'
    # @param node_instance_id [String] The node instance ID of the target node.
    # This can be determined through GetNodeInfo API.
    # @param stop_duration_in_seconds [Integer] The duration, in seconds, to keep
    # the node stopped.  The minimum value is 600, the maximum is 14400.  After
    # this time expires, the node will automatically come back up.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def start_node_transition(node_name, operation_id, node_transition_type, node_instance_id, stop_duration_in_seconds, timeout:60, custom_headers:nil)
      response = start_node_transition_async(node_name, operation_id, node_transition_type, node_instance_id, stop_duration_in_seconds, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Starts or stops a cluster node.
    #
    # Starts or stops a cluster node.  A cluster node is a process, not the OS
    # instance itself.  To start a node, pass in "Start" for the NodeTransitionType
    # parameter.
    # To stop a node, pass in "Stop" for the NodeTransitionType parameter.  This
    # API starts the operation - when the API returns the node may not have
    # finished transitioning yet.
    # Call GetNodeTransitionProgress with the same OperationId to get the progress
    # of the operation.
    #
    # @param node_name [String] The name of the node.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param node_transition_type [NodeTransitionType] Indicates the type of
    # transition to perform.  NodeTransitionType.Start will start a stopped node.
    # NodeTransitionType.Stop will stop a node that is up. Possible values include:
    # 'Invalid', 'Start', 'Stop'
    # @param node_instance_id [String] The node instance ID of the target node.
    # This can be determined through GetNodeInfo API.
    # @param stop_duration_in_seconds [Integer] The duration, in seconds, to keep
    # the node stopped.  The minimum value is 600, the maximum is 14400.  After
    # this time expires, the node will automatically come back up.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_node_transition_with_http_info(node_name, operation_id, node_transition_type, node_instance_id, stop_duration_in_seconds, timeout:60, custom_headers:nil)
      start_node_transition_async(node_name, operation_id, node_transition_type, node_instance_id, stop_duration_in_seconds, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Starts or stops a cluster node.
    #
    # Starts or stops a cluster node.  A cluster node is a process, not the OS
    # instance itself.  To start a node, pass in "Start" for the NodeTransitionType
    # parameter.
    # To stop a node, pass in "Stop" for the NodeTransitionType parameter.  This
    # API starts the operation - when the API returns the node may not have
    # finished transitioning yet.
    # Call GetNodeTransitionProgress with the same OperationId to get the progress
    # of the operation.
    #
    # @param node_name [String] The name of the node.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param node_transition_type [NodeTransitionType] Indicates the type of
    # transition to perform.  NodeTransitionType.Start will start a stopped node.
    # NodeTransitionType.Stop will stop a node that is up. Possible values include:
    # 'Invalid', 'Start', 'Stop'
    # @param node_instance_id [String] The node instance ID of the target node.
    # This can be determined through GetNodeInfo API.
    # @param stop_duration_in_seconds [Integer] The duration, in seconds, to keep
    # the node stopped.  The minimum value is 600, the maximum is 14400.  After
    # this time expires, the node will automatically come back up.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def start_node_transition_async(node_name, operation_id, node_transition_type, node_instance_id, stop_duration_in_seconds, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'operation_id is nil' if operation_id.nil?
      fail ArgumentError, 'node_transition_type is nil' if node_transition_type.nil?
      fail ArgumentError, 'node_instance_id is nil' if node_instance_id.nil?
      fail ArgumentError, 'stop_duration_in_seconds is nil' if stop_duration_in_seconds.nil?
      fail ArgumentError, "'stop_duration_in_seconds' should satisfy the constraint - 'InclusiveMinimum': '0'" if !stop_duration_in_seconds.nil? && stop_duration_in_seconds < 0
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Faults/Nodes/{nodeName}/$/StartTransition/'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'OperationId' => operation_id,'NodeTransitionType' => node_transition_type,'NodeInstanceId' => node_instance_id,'StopDurationInSeconds' => stop_duration_in_seconds,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets the progress of an operation started using StartNodeTransition.
    #
    # Gets the progress of an operation started with StartNodeTransition using the
    # provided OperationId.
    #
    # @param node_name [String] The name of the node.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [NodeTransitionProgress] operation results.
    #
    def get_node_transition_progress(node_name, operation_id, timeout:60, custom_headers:nil)
      response = get_node_transition_progress_async(node_name, operation_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the progress of an operation started using StartNodeTransition.
    #
    # Gets the progress of an operation started with StartNodeTransition using the
    # provided OperationId.
    #
    # @param node_name [String] The name of the node.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_transition_progress_with_http_info(node_name, operation_id, timeout:60, custom_headers:nil)
      get_node_transition_progress_async(node_name, operation_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the progress of an operation started using StartNodeTransition.
    #
    # Gets the progress of an operation started with StartNodeTransition using the
    # provided OperationId.
    #
    # @param node_name [String] The name of the node.
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_node_transition_progress_async(node_name, operation_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, 'operation_id is nil' if operation_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Faults/Nodes/{nodeName}/$/GetTransitionProgress'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'OperationId' => operation_id,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::NodeTransitionProgress.mapper()
            result.body = self.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

    #
    # Gets a list of user-induced fault operations filtered by provided input.
    #
    # Gets the a list of user-induced fault operations filtered by provided input.
    #
    # @param type_filter [Integer] Used to filter on OperationType for user-induced
    # operations.
    # 65535 - select all
    # 1     - select PartitionDataLoss.
    # 2     - select PartitionQuorumLoss.
    # 4     - select PartitionRestart.
    # 8     - select NodeTransition.
    # @param state_filter [Integer] Used to filter on OperationState's for
    # user-induced operations.
    # 65535 - select All
    # 1     - select Running
    # 2     - select RollingBack
    # 8     - select Completed
    # 16    - select Faulted
    # 32    - select Cancelled
    # 64    - select ForceCancelled
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_fault_operation_list(type_filter, state_filter, timeout:60, custom_headers:nil)
      response = get_fault_operation_list_async(type_filter, state_filter, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets a list of user-induced fault operations filtered by provided input.
    #
    # Gets the a list of user-induced fault operations filtered by provided input.
    #
    # @param type_filter [Integer] Used to filter on OperationType for user-induced
    # operations.
    # 65535 - select all
    # 1     - select PartitionDataLoss.
    # 2     - select PartitionQuorumLoss.
    # 4     - select PartitionRestart.
    # 8     - select NodeTransition.
    # @param state_filter [Integer] Used to filter on OperationState's for
    # user-induced operations.
    # 65535 - select All
    # 1     - select Running
    # 2     - select RollingBack
    # 8     - select Completed
    # 16    - select Faulted
    # 32    - select Cancelled
    # 64    - select ForceCancelled
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_fault_operation_list_with_http_info(type_filter, state_filter, timeout:60, custom_headers:nil)
      get_fault_operation_list_async(type_filter, state_filter, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets a list of user-induced fault operations filtered by provided input.
    #
    # Gets the a list of user-induced fault operations filtered by provided input.
    #
    # @param type_filter [Integer] Used to filter on OperationType for user-induced
    # operations.
    # 65535 - select all
    # 1     - select PartitionDataLoss.
    # 2     - select PartitionQuorumLoss.
    # 4     - select PartitionRestart.
    # 8     - select NodeTransition.
    # @param state_filter [Integer] Used to filter on OperationState's for
    # user-induced operations.
    # 65535 - select All
    # 1     - select Running
    # 2     - select RollingBack
    # 8     - select Completed
    # 16    - select Faulted
    # 32    - select Cancelled
    # 64    - select ForceCancelled
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_fault_operation_list_async(type_filter, state_filter, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'type_filter is nil' if type_filter.nil?
      fail ArgumentError, 'state_filter is nil' if state_filter.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Faults/'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'TypeFilter' => type_filter,'StateFilter' => state_filter,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'OperationStatusElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'OperationStatus'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Cancels a user-induced fault operation.
    #
    # The following is a list of APIs that start fault operations that may be
    # cancelled using CancelOperation -
    # - StartDataLoss
    # - StartQuorumLoss
    # - StartPartitionRestart
    # - StartNodeTransition
    #
    # If force is false, then the specified user-induced operation will be
    # gracefully stopped and cleaned up.  If force is true, the command will be
    # aborted, and some internal state
    # may be left behind.  Specifying force as true should be used with care.
    # Calling this API with force set to true is not allowed until this API has
    # already
    # been called on the same test command with force set to false first, or unless
    # the test command already has an OperationState of OperationState.RollingBack.
    # Clarification: OperationState.RollingBack means that the system will/is be
    # cleaning up internal system state caused by executing the command.  It will
    # not restore data if the
    # test command was to cause data loss.  For example, if you call StartDataLoss
    # then call this API, the system will only clean up internal state from running
    # the command.
    # It will not restore the target partition's data, if the command progressed
    # far enough to cause data loss.
    #
    # Important note:  if this API is invoked with force==true, internal state may
    # be left behind.
    #
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param force [Boolean] Indicates whether to gracefully rollback and clean up
    # internal system state modified by executing the user-induced operation.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def cancel_operation(operation_id, force, timeout:60, custom_headers:nil)
      response = cancel_operation_async(operation_id, force, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Cancels a user-induced fault operation.
    #
    # The following is a list of APIs that start fault operations that may be
    # cancelled using CancelOperation -
    # - StartDataLoss
    # - StartQuorumLoss
    # - StartPartitionRestart
    # - StartNodeTransition
    #
    # If force is false, then the specified user-induced operation will be
    # gracefully stopped and cleaned up.  If force is true, the command will be
    # aborted, and some internal state
    # may be left behind.  Specifying force as true should be used with care.
    # Calling this API with force set to true is not allowed until this API has
    # already
    # been called on the same test command with force set to false first, or unless
    # the test command already has an OperationState of OperationState.RollingBack.
    # Clarification: OperationState.RollingBack means that the system will/is be
    # cleaning up internal system state caused by executing the command.  It will
    # not restore data if the
    # test command was to cause data loss.  For example, if you call StartDataLoss
    # then call this API, the system will only clean up internal state from running
    # the command.
    # It will not restore the target partition's data, if the command progressed
    # far enough to cause data loss.
    #
    # Important note:  if this API is invoked with force==true, internal state may
    # be left behind.
    #
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param force [Boolean] Indicates whether to gracefully rollback and clean up
    # internal system state modified by executing the user-induced operation.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def cancel_operation_with_http_info(operation_id, force, timeout:60, custom_headers:nil)
      cancel_operation_async(operation_id, force, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Cancels a user-induced fault operation.
    #
    # The following is a list of APIs that start fault operations that may be
    # cancelled using CancelOperation -
    # - StartDataLoss
    # - StartQuorumLoss
    # - StartPartitionRestart
    # - StartNodeTransition
    #
    # If force is false, then the specified user-induced operation will be
    # gracefully stopped and cleaned up.  If force is true, the command will be
    # aborted, and some internal state
    # may be left behind.  Specifying force as true should be used with care.
    # Calling this API with force set to true is not allowed until this API has
    # already
    # been called on the same test command with force set to false first, or unless
    # the test command already has an OperationState of OperationState.RollingBack.
    # Clarification: OperationState.RollingBack means that the system will/is be
    # cleaning up internal system state caused by executing the command.  It will
    # not restore data if the
    # test command was to cause data loss.  For example, if you call StartDataLoss
    # then call this API, the system will only clean up internal state from running
    # the command.
    # It will not restore the target partition's data, if the command progressed
    # far enough to cause data loss.
    #
    # Important note:  if this API is invoked with force==true, internal state may
    # be left behind.
    #
    # @param operation_id A GUID that identifies a call of this API.  This is
    # passed into the corresponding GetProgress API
    # @param force [Boolean] Indicates whether to gracefully rollback and clean up
    # internal system state modified by executing the user-induced operation.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def cancel_operation_async(operation_id, force, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'operation_id is nil' if operation_id.nil?
      fail ArgumentError, 'force is nil' if force.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Faults/$/Cancel'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'OperationId' => operation_id,'Force' => force,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Creates a backup policy.
    #
    # Creates a backup policy which can be associated later with a Service Fabric
    # application, service or a partition for periodic backup.
    #
    # @param backup_policy_description [BackupPolicyDescription] Describes the
    # backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def create_backup_policy(backup_policy_description, timeout:60, custom_headers:nil)
      response = create_backup_policy_async(backup_policy_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Creates a backup policy.
    #
    # Creates a backup policy which can be associated later with a Service Fabric
    # application, service or a partition for periodic backup.
    #
    # @param backup_policy_description [BackupPolicyDescription] Describes the
    # backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_backup_policy_with_http_info(backup_policy_description, timeout:60, custom_headers:nil)
      create_backup_policy_async(backup_policy_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Creates a backup policy.
    #
    # Creates a backup policy which can be associated later with a Service Fabric
    # application, service or a partition for periodic backup.
    #
    # @param backup_policy_description [BackupPolicyDescription] Describes the
    # backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_backup_policy_async(backup_policy_description, timeout:60, custom_headers:nil)
      fail ArgumentError, 'backup_policy_description is nil' if backup_policy_description.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::BackupPolicyDescription.mapper()
      request_content = self.serialize(request_mapper,  backup_policy_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'BackupRestore/BackupPolicies/$/Create'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 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?

        result
      end

      promise.execute
    end

    #
    # Deletes the backup policy.
    #
    # Deletes an existing backup policy. A backup policy must be created before it
    # can be deleted. A currently active backup policy, associated with any Service
    # Fabric application, service or partition, cannot be deleted without first
    # deleting the mapping.
    #
    # @param backup_policy_name [String] The name of the backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def delete_backup_policy(backup_policy_name, timeout:60, custom_headers:nil)
      response = delete_backup_policy_async(backup_policy_name, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Deletes the backup policy.
    #
    # Deletes an existing backup policy. A backup policy must be created before it
    # can be deleted. A currently active backup policy, associated with any Service
    # Fabric application, service or partition, cannot be deleted without first
    # deleting the mapping.
    #
    # @param backup_policy_name [String] The name of the backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_backup_policy_with_http_info(backup_policy_name, timeout:60, custom_headers:nil)
      delete_backup_policy_async(backup_policy_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Deletes the backup policy.
    #
    # Deletes an existing backup policy. A backup policy must be created before it
    # can be deleted. A currently active backup policy, associated with any Service
    # Fabric application, service or partition, cannot be deleted without first
    # deleting the mapping.
    #
    # @param backup_policy_name [String] The name of the backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_backup_policy_async(backup_policy_name, timeout:60, custom_headers:nil)
      fail ArgumentError, 'backup_policy_name is nil' if backup_policy_name.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'BackupRestore/BackupPolicies/{backupPolicyName}/$/Delete'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'backupPolicyName' => backup_policy_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Gets all the backup policies configured.
    #
    # Get a list of all the backup policies configured.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedBackupPolicyDescriptionList] operation results.
    #
    def get_backup_policy_list(continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      response = get_backup_policy_list_async(continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets all the backup policies configured.
    #
    # Get a list of all the backup policies configured.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_backup_policy_list_with_http_info(continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      get_backup_policy_list_async(continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets all the backup policies configured.
    #
    # Get a list of all the backup policies configured.
    #
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_backup_policy_list_async(continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'BackupRestore/BackupPolicies'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'MaxResults' => max_results,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedBackupPolicyDescriptionList.mapper()
            result.body = self.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

    #
    # Gets a particular backup policy by name.
    #
    # Gets a particular backup policy identified by {backupPolicyName}
    #
    # @param backup_policy_name [String] The name of the backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [BackupPolicyDescription] operation results.
    #
    def get_backup_policy_by_name(backup_policy_name, timeout:60, custom_headers:nil)
      response = get_backup_policy_by_name_async(backup_policy_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets a particular backup policy by name.
    #
    # Gets a particular backup policy identified by {backupPolicyName}
    #
    # @param backup_policy_name [String] The name of the backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_backup_policy_by_name_with_http_info(backup_policy_name, timeout:60, custom_headers:nil)
      get_backup_policy_by_name_async(backup_policy_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets a particular backup policy by name.
    #
    # Gets a particular backup policy identified by {backupPolicyName}
    #
    # @param backup_policy_name [String] The name of the backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_backup_policy_by_name_async(backup_policy_name, timeout:60, custom_headers:nil)
      fail ArgumentError, 'backup_policy_name is nil' if backup_policy_name.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'BackupRestore/BackupPolicies/{backupPolicyName}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'backupPolicyName' => backup_policy_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::BackupPolicyDescription.mapper()
            result.body = self.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

    #
    # Gets the list of backup entities that are associated with this policy.
    #
    # Returns a list of Service Fabric application, service or partition which are
    # associated with this backup policy.
    #
    # @param backup_policy_name [String] The name of the backup policy.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedBackupEntityList] operation results.
    #
    def get_all_entities_backed_up_by_policy(backup_policy_name, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      response = get_all_entities_backed_up_by_policy_async(backup_policy_name, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of backup entities that are associated with this policy.
    #
    # Returns a list of Service Fabric application, service or partition which are
    # associated with this backup policy.
    #
    # @param backup_policy_name [String] The name of the backup policy.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_all_entities_backed_up_by_policy_with_http_info(backup_policy_name, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      get_all_entities_backed_up_by_policy_async(backup_policy_name, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of backup entities that are associated with this policy.
    #
    # Returns a list of Service Fabric application, service or partition which are
    # associated with this backup policy.
    #
    # @param backup_policy_name [String] The name of the backup policy.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_all_entities_backed_up_by_policy_async(backup_policy_name, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      fail ArgumentError, 'backup_policy_name is nil' if backup_policy_name.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'BackupRestore/BackupPolicies/{backupPolicyName}/$/GetBackupEnabledEntities'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'backupPolicyName' => backup_policy_name},
          query_params: {'api-version' => api_version,'MaxResults' => max_results,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedBackupEntityList.mapper()
            result.body = self.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

    #
    # Updates the backup policy.
    #
    # Updates the backup policy identified by {backupPolicyName}
    #
    # @param backup_policy_description [BackupPolicyDescription] Describes the
    # backup policy.
    # @param backup_policy_name [String] The name of the backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def update_backup_policy(backup_policy_description, backup_policy_name, timeout:60, custom_headers:nil)
      response = update_backup_policy_async(backup_policy_description, backup_policy_name, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Updates the backup policy.
    #
    # Updates the backup policy identified by {backupPolicyName}
    #
    # @param backup_policy_description [BackupPolicyDescription] Describes the
    # backup policy.
    # @param backup_policy_name [String] The name of the backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def update_backup_policy_with_http_info(backup_policy_description, backup_policy_name, timeout:60, custom_headers:nil)
      update_backup_policy_async(backup_policy_description, backup_policy_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Updates the backup policy.
    #
    # Updates the backup policy identified by {backupPolicyName}
    #
    # @param backup_policy_description [BackupPolicyDescription] Describes the
    # backup policy.
    # @param backup_policy_name [String] The name of the backup policy.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def update_backup_policy_async(backup_policy_description, backup_policy_name, timeout:60, custom_headers:nil)
      fail ArgumentError, 'backup_policy_description is nil' if backup_policy_description.nil?
      fail ArgumentError, 'backup_policy_name is nil' if backup_policy_name.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::BackupPolicyDescription.mapper()
      request_content = self.serialize(request_mapper,  backup_policy_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'BackupRestore/BackupPolicies/{backupPolicyName}/$/Update'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'backupPolicyName' => backup_policy_name},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Enables periodic backup of stateful partitions under this Service Fabric
    # application.
    #
    # Enables periodic backup of stateful partitions which are part of this Service
    # Fabric application. Each partition is backed up individually as per the
    # specified backup policy description.
    # Note only C# based Reliable Actor and Reliable Stateful services are
    # currently supported for periodic backup.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param enable_backup_description [EnableBackupDescription] Specifies the
    # parameters for enabling backup.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def enable_application_backup(application_id, enable_backup_description, timeout:60, custom_headers:nil)
      response = enable_application_backup_async(application_id, enable_backup_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Enables periodic backup of stateful partitions under this Service Fabric
    # application.
    #
    # Enables periodic backup of stateful partitions which are part of this Service
    # Fabric application. Each partition is backed up individually as per the
    # specified backup policy description.
    # Note only C# based Reliable Actor and Reliable Stateful services are
    # currently supported for periodic backup.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param enable_backup_description [EnableBackupDescription] Specifies the
    # parameters for enabling backup.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def enable_application_backup_with_http_info(application_id, enable_backup_description, timeout:60, custom_headers:nil)
      enable_application_backup_async(application_id, enable_backup_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Enables periodic backup of stateful partitions under this Service Fabric
    # application.
    #
    # Enables periodic backup of stateful partitions which are part of this Service
    # Fabric application. Each partition is backed up individually as per the
    # specified backup policy description.
    # Note only C# based Reliable Actor and Reliable Stateful services are
    # currently supported for periodic backup.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param enable_backup_description [EnableBackupDescription] Specifies the
    # parameters for enabling backup.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def enable_application_backup_async(application_id, enable_backup_description, timeout:60, custom_headers:nil)
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, 'enable_backup_description is nil' if enable_backup_description.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::EnableBackupDescription.mapper()
      request_content = self.serialize(request_mapper,  enable_backup_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Applications/{applicationId}/$/EnableBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Disables periodic backup of Service Fabric application.
    #
    # Disables periodic backup of Service Fabric application which was previously
    # enabled.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def disable_application_backup(application_id, timeout:60, custom_headers:nil)
      response = disable_application_backup_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Disables periodic backup of Service Fabric application.
    #
    # Disables periodic backup of Service Fabric application which was previously
    # enabled.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def disable_application_backup_with_http_info(application_id, timeout:60, custom_headers:nil)
      disable_application_backup_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Disables periodic backup of Service Fabric application.
    #
    # Disables periodic backup of Service Fabric application which was previously
    # enabled.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def disable_application_backup_async(application_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/DisableBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets the Service Fabric application backup configuration information.
    #
    # Gets the Service Fabric backup configuration information for the application
    # and the services and partitions under this application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedBackupConfigurationInfoList] operation results.
    #
    def get_application_backup_configuration_info(application_id, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      response = get_application_backup_configuration_info_async(application_id, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the Service Fabric application backup configuration information.
    #
    # Gets the Service Fabric backup configuration information for the application
    # and the services and partitions under this application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_backup_configuration_info_with_http_info(application_id, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      get_application_backup_configuration_info_async(application_id, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the Service Fabric application backup configuration information.
    #
    # Gets the Service Fabric backup configuration information for the application
    # and the services and partitions under this application.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_application_backup_configuration_info_async(application_id, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/GetBackupConfigurationInfo'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'MaxResults' => max_results,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedBackupConfigurationInfoList.mapper()
            result.body = self.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

    #
    # Gets the list of backups available for every partition in this application.
    #
    # Returns a list of backups available for every partition in this Service
    # Fabric application. The server enumerates all the backups available at the
    # backup location configured in the backup policy. It also allows filtering of
    # the result based on start and end datetime or just fetching the latest
    # available backup for every partition.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param latest [Boolean] Specifies whether to get only the most recent backup
    # available for a partition for the specified time range.
    # @param start_date_time_filter [DateTime] Specify the start date time from
    # which to enumerate backups, in datetime format. The date time must be
    # specified in ISO8601 format. This is an optional parameter. If not specified,
    # all backups from the beginning are enumerated.
    # @param end_date_time_filter [DateTime] Specify the end date time till which
    # to enumerate backups, in datetime format. The date time must be specified in
    # ISO8601 format. This is an optional parameter. If not specified, enumeration
    # is done till the most recent backup.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedBackupInfoList] operation results.
    #
    def get_application_backup_list(application_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, continuation_token:nil, max_results:0, custom_headers:nil)
      response = get_application_backup_list_async(application_id, timeout:timeout, latest:latest, start_date_time_filter:start_date_time_filter, end_date_time_filter:end_date_time_filter, continuation_token:continuation_token, max_results:max_results, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of backups available for every partition in this application.
    #
    # Returns a list of backups available for every partition in this Service
    # Fabric application. The server enumerates all the backups available at the
    # backup location configured in the backup policy. It also allows filtering of
    # the result based on start and end datetime or just fetching the latest
    # available backup for every partition.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param latest [Boolean] Specifies whether to get only the most recent backup
    # available for a partition for the specified time range.
    # @param start_date_time_filter [DateTime] Specify the start date time from
    # which to enumerate backups, in datetime format. The date time must be
    # specified in ISO8601 format. This is an optional parameter. If not specified,
    # all backups from the beginning are enumerated.
    # @param end_date_time_filter [DateTime] Specify the end date time till which
    # to enumerate backups, in datetime format. The date time must be specified in
    # ISO8601 format. This is an optional parameter. If not specified, enumeration
    # is done till the most recent backup.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @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.
    #
    def get_application_backup_list_with_http_info(application_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, continuation_token:nil, max_results:0, custom_headers:nil)
      get_application_backup_list_async(application_id, timeout:timeout, latest:latest, start_date_time_filter:start_date_time_filter, end_date_time_filter:end_date_time_filter, continuation_token:continuation_token, max_results:max_results, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of backups available for every partition in this application.
    #
    # Returns a list of backups available for every partition in this Service
    # Fabric application. The server enumerates all the backups available at the
    # backup location configured in the backup policy. It also allows filtering of
    # the result based on start and end datetime or just fetching the latest
    # available backup for every partition.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param latest [Boolean] Specifies whether to get only the most recent backup
    # available for a partition for the specified time range.
    # @param start_date_time_filter [DateTime] Specify the start date time from
    # which to enumerate backups, in datetime format. The date time must be
    # specified in ISO8601 format. This is an optional parameter. If not specified,
    # all backups from the beginning are enumerated.
    # @param end_date_time_filter [DateTime] Specify the end date time till which
    # to enumerate backups, in datetime format. The date time must be specified in
    # ISO8601 format. This is an optional parameter. If not specified, enumeration
    # is done till the most recent backup.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @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.
    #
    def get_application_backup_list_async(application_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, continuation_token:nil, max_results:0, custom_headers:nil)
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/GetBackups'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout,'Latest' => latest,'StartDateTimeFilter' => start_date_time_filter,'EndDateTimeFilter' => end_date_time_filter,'MaxResults' => max_results},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedBackupInfoList.mapper()
            result.body = self.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

    #
    # Suspends periodic backup for the specified Service Fabric application.
    #
    # The application which is configured to take periodic backups, is suspended
    # for taking further backups till it is resumed again. This operation applies
    # to the entire application's hierarchy. It means all the services and
    # partitions under this application are now suspended for backup.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def suspend_application_backup(application_id, timeout:60, custom_headers:nil)
      response = suspend_application_backup_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Suspends periodic backup for the specified Service Fabric application.
    #
    # The application which is configured to take periodic backups, is suspended
    # for taking further backups till it is resumed again. This operation applies
    # to the entire application's hierarchy. It means all the services and
    # partitions under this application are now suspended for backup.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def suspend_application_backup_with_http_info(application_id, timeout:60, custom_headers:nil)
      suspend_application_backup_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Suspends periodic backup for the specified Service Fabric application.
    #
    # The application which is configured to take periodic backups, is suspended
    # for taking further backups till it is resumed again. This operation applies
    # to the entire application's hierarchy. It means all the services and
    # partitions under this application are now suspended for backup.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def suspend_application_backup_async(application_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/SuspendBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Resumes periodic backup of a Service Fabric application which was previously
    # suspended.
    #
    # The previously suspended Service Fabric application resumes taking periodic
    # backup as per the backup policy currently configured for the same.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def resume_application_backup(application_id, timeout:60, custom_headers:nil)
      response = resume_application_backup_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Resumes periodic backup of a Service Fabric application which was previously
    # suspended.
    #
    # The previously suspended Service Fabric application resumes taking periodic
    # backup as per the backup policy currently configured for the same.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resume_application_backup_with_http_info(application_id, timeout:60, custom_headers:nil)
      resume_application_backup_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Resumes periodic backup of a Service Fabric application which was previously
    # suspended.
    #
    # The previously suspended Service Fabric application resumes taking periodic
    # backup as per the backup policy currently configured for the same.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resume_application_backup_async(application_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Applications/{applicationId}/$/ResumeBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Enables periodic backup of stateful partitions under this Service Fabric
    # service.
    #
    # Enables periodic backup of stateful partitions which are part of this Service
    # Fabric service. Each partition is backed up individually as per the specified
    # backup policy description. In case the application, which the service is part
    # of, is already enabled for backup then this operation would override the
    # policy being used to take the periodic backup for this service and its
    # partitions (unless explicitly overridden at the partition level).
    # Note only C# based Reliable Actor and Reliable Stateful services are
    # currently supported for periodic backup.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param enable_backup_description [EnableBackupDescription] Specifies the
    # parameters for enabling backup.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def enable_service_backup(service_id, enable_backup_description, timeout:60, custom_headers:nil)
      response = enable_service_backup_async(service_id, enable_backup_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Enables periodic backup of stateful partitions under this Service Fabric
    # service.
    #
    # Enables periodic backup of stateful partitions which are part of this Service
    # Fabric service. Each partition is backed up individually as per the specified
    # backup policy description. In case the application, which the service is part
    # of, is already enabled for backup then this operation would override the
    # policy being used to take the periodic backup for this service and its
    # partitions (unless explicitly overridden at the partition level).
    # Note only C# based Reliable Actor and Reliable Stateful services are
    # currently supported for periodic backup.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param enable_backup_description [EnableBackupDescription] Specifies the
    # parameters for enabling backup.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def enable_service_backup_with_http_info(service_id, enable_backup_description, timeout:60, custom_headers:nil)
      enable_service_backup_async(service_id, enable_backup_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Enables periodic backup of stateful partitions under this Service Fabric
    # service.
    #
    # Enables periodic backup of stateful partitions which are part of this Service
    # Fabric service. Each partition is backed up individually as per the specified
    # backup policy description. In case the application, which the service is part
    # of, is already enabled for backup then this operation would override the
    # policy being used to take the periodic backup for this service and its
    # partitions (unless explicitly overridden at the partition level).
    # Note only C# based Reliable Actor and Reliable Stateful services are
    # currently supported for periodic backup.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param enable_backup_description [EnableBackupDescription] Specifies the
    # parameters for enabling backup.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def enable_service_backup_async(service_id, enable_backup_description, timeout:60, custom_headers:nil)
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, 'enable_backup_description is nil' if enable_backup_description.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::EnableBackupDescription.mapper()
      request_content = self.serialize(request_mapper,  enable_backup_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Services/{serviceId}/$/EnableBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Disables periodic backup of Service Fabric service which was previously
    # enabled.
    #
    # Disables periodic backup of Service Fabric service which was previously
    # enabled. Backup must be explicitly enabled before it can be disabled.
    # In case the backup is enabled for the Service Fabric application, which this
    # service is part of, this service would continue to be periodically backed up
    # as per the policy mapped at the application level.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def disable_service_backup(service_id, timeout:60, custom_headers:nil)
      response = disable_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Disables periodic backup of Service Fabric service which was previously
    # enabled.
    #
    # Disables periodic backup of Service Fabric service which was previously
    # enabled. Backup must be explicitly enabled before it can be disabled.
    # In case the backup is enabled for the Service Fabric application, which this
    # service is part of, this service would continue to be periodically backed up
    # as per the policy mapped at the application level.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def disable_service_backup_with_http_info(service_id, timeout:60, custom_headers:nil)
      disable_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Disables periodic backup of Service Fabric service which was previously
    # enabled.
    #
    # Disables periodic backup of Service Fabric service which was previously
    # enabled. Backup must be explicitly enabled before it can be disabled.
    # In case the backup is enabled for the Service Fabric application, which this
    # service is part of, this service would continue to be periodically backed up
    # as per the policy mapped at the application level.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def disable_service_backup_async(service_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/{serviceId}/$/DisableBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets the Service Fabric service backup configuration information.
    #
    # Gets the Service Fabric backup configuration information for the service and
    # the partitions under this service.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedBackupConfigurationInfoList] operation results.
    #
    def get_service_backup_configuration_info(service_id, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      response = get_service_backup_configuration_info_async(service_id, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the Service Fabric service backup configuration information.
    #
    # Gets the Service Fabric backup configuration information for the service and
    # the partitions under this service.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_backup_configuration_info_with_http_info(service_id, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      get_service_backup_configuration_info_async(service_id, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the Service Fabric service backup configuration information.
    #
    # Gets the Service Fabric backup configuration information for the service and
    # the partitions under this service.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_service_backup_configuration_info_async(service_id, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/{serviceId}/$/GetBackupConfigurationInfo'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'MaxResults' => max_results,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedBackupConfigurationInfoList.mapper()
            result.body = self.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

    #
    # Gets the list of backups available for every partition in this service.
    #
    # Returns a list of backups available for every partition in this Service
    # Fabric service. The server enumerates all the backups available in the backup
    # store configured in the backup policy. It also allows filtering of the result
    # based on start and end datetime or just fetching the latest available backup
    # for every partition.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param latest [Boolean] Specifies whether to get only the most recent backup
    # available for a partition for the specified time range.
    # @param start_date_time_filter [DateTime] Specify the start date time from
    # which to enumerate backups, in datetime format. The date time must be
    # specified in ISO8601 format. This is an optional parameter. If not specified,
    # all backups from the beginning are enumerated.
    # @param end_date_time_filter [DateTime] Specify the end date time till which
    # to enumerate backups, in datetime format. The date time must be specified in
    # ISO8601 format. This is an optional parameter. If not specified, enumeration
    # is done till the most recent backup.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedBackupInfoList] operation results.
    #
    def get_service_backup_list(service_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, continuation_token:nil, max_results:0, custom_headers:nil)
      response = get_service_backup_list_async(service_id, timeout:timeout, latest:latest, start_date_time_filter:start_date_time_filter, end_date_time_filter:end_date_time_filter, continuation_token:continuation_token, max_results:max_results, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of backups available for every partition in this service.
    #
    # Returns a list of backups available for every partition in this Service
    # Fabric service. The server enumerates all the backups available in the backup
    # store configured in the backup policy. It also allows filtering of the result
    # based on start and end datetime or just fetching the latest available backup
    # for every partition.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param latest [Boolean] Specifies whether to get only the most recent backup
    # available for a partition for the specified time range.
    # @param start_date_time_filter [DateTime] Specify the start date time from
    # which to enumerate backups, in datetime format. The date time must be
    # specified in ISO8601 format. This is an optional parameter. If not specified,
    # all backups from the beginning are enumerated.
    # @param end_date_time_filter [DateTime] Specify the end date time till which
    # to enumerate backups, in datetime format. The date time must be specified in
    # ISO8601 format. This is an optional parameter. If not specified, enumeration
    # is done till the most recent backup.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @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.
    #
    def get_service_backup_list_with_http_info(service_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, continuation_token:nil, max_results:0, custom_headers:nil)
      get_service_backup_list_async(service_id, timeout:timeout, latest:latest, start_date_time_filter:start_date_time_filter, end_date_time_filter:end_date_time_filter, continuation_token:continuation_token, max_results:max_results, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of backups available for every partition in this service.
    #
    # Returns a list of backups available for every partition in this Service
    # Fabric service. The server enumerates all the backups available in the backup
    # store configured in the backup policy. It also allows filtering of the result
    # based on start and end datetime or just fetching the latest available backup
    # for every partition.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param latest [Boolean] Specifies whether to get only the most recent backup
    # available for a partition for the specified time range.
    # @param start_date_time_filter [DateTime] Specify the start date time from
    # which to enumerate backups, in datetime format. The date time must be
    # specified in ISO8601 format. This is an optional parameter. If not specified,
    # all backups from the beginning are enumerated.
    # @param end_date_time_filter [DateTime] Specify the end date time till which
    # to enumerate backups, in datetime format. The date time must be specified in
    # ISO8601 format. This is an optional parameter. If not specified, enumeration
    # is done till the most recent backup.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @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.
    #
    def get_service_backup_list_async(service_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, continuation_token:nil, max_results:0, custom_headers:nil)
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/{serviceId}/$/GetBackups'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout,'Latest' => latest,'StartDateTimeFilter' => start_date_time_filter,'EndDateTimeFilter' => end_date_time_filter,'MaxResults' => max_results},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedBackupInfoList.mapper()
            result.body = self.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

    #
    # Suspends periodic backup for the specified Service Fabric service.
    #
    # The service which is configured to take periodic backups, is suspended for
    # taking further backups till it is resumed again. This operation applies to
    # the entire service's hierarchy. It means all the partitions under this
    # service are now suspended for backup.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def suspend_service_backup(service_id, timeout:60, custom_headers:nil)
      response = suspend_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Suspends periodic backup for the specified Service Fabric service.
    #
    # The service which is configured to take periodic backups, is suspended for
    # taking further backups till it is resumed again. This operation applies to
    # the entire service's hierarchy. It means all the partitions under this
    # service are now suspended for backup.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def suspend_service_backup_with_http_info(service_id, timeout:60, custom_headers:nil)
      suspend_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Suspends periodic backup for the specified Service Fabric service.
    #
    # The service which is configured to take periodic backups, is suspended for
    # taking further backups till it is resumed again. This operation applies to
    # the entire service's hierarchy. It means all the partitions under this
    # service are now suspended for backup.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def suspend_service_backup_async(service_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/{serviceId}/$/SuspendBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Resumes periodic backup of a Service Fabric service which was previously
    # suspended.
    #
    # The previously suspended Service Fabric service resumes taking periodic
    # backup as per the backup policy currently configured for the same.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def resume_service_backup(service_id, timeout:60, custom_headers:nil)
      response = resume_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Resumes periodic backup of a Service Fabric service which was previously
    # suspended.
    #
    # The previously suspended Service Fabric service resumes taking periodic
    # backup as per the backup policy currently configured for the same.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resume_service_backup_with_http_info(service_id, timeout:60, custom_headers:nil)
      resume_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Resumes periodic backup of a Service Fabric service which was previously
    # suspended.
    #
    # The previously suspended Service Fabric service resumes taking periodic
    # backup as per the backup policy currently configured for the same.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resume_service_backup_async(service_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Services/{serviceId}/$/ResumeBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Enables periodic backup of the stateful persisted partition.
    #
    # Enables periodic backup of stateful persisted partition. Each partition is
    # backed up as per the specified backup policy description. In case the
    # application or service, which is partition is part of, is already enabled for
    # backup then this operation would override the policy being used to take the
    # periodic backup of this partition.
    # Note only C# based Reliable Actor and Reliable Stateful services are
    # currently supported for periodic backup.
    #
    # @param partition_id The identity of the partition.
    # @param enable_backup_description [EnableBackupDescription] Specifies the
    # parameters for enabling backup.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def enable_partition_backup(partition_id, enable_backup_description, timeout:60, custom_headers:nil)
      response = enable_partition_backup_async(partition_id, enable_backup_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Enables periodic backup of the stateful persisted partition.
    #
    # Enables periodic backup of stateful persisted partition. Each partition is
    # backed up as per the specified backup policy description. In case the
    # application or service, which is partition is part of, is already enabled for
    # backup then this operation would override the policy being used to take the
    # periodic backup of this partition.
    # Note only C# based Reliable Actor and Reliable Stateful services are
    # currently supported for periodic backup.
    #
    # @param partition_id The identity of the partition.
    # @param enable_backup_description [EnableBackupDescription] Specifies the
    # parameters for enabling backup.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def enable_partition_backup_with_http_info(partition_id, enable_backup_description, timeout:60, custom_headers:nil)
      enable_partition_backup_async(partition_id, enable_backup_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Enables periodic backup of the stateful persisted partition.
    #
    # Enables periodic backup of stateful persisted partition. Each partition is
    # backed up as per the specified backup policy description. In case the
    # application or service, which is partition is part of, is already enabled for
    # backup then this operation would override the policy being used to take the
    # periodic backup of this partition.
    # Note only C# based Reliable Actor and Reliable Stateful services are
    # currently supported for periodic backup.
    #
    # @param partition_id The identity of the partition.
    # @param enable_backup_description [EnableBackupDescription] Specifies the
    # parameters for enabling backup.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def enable_partition_backup_async(partition_id, enable_backup_description, timeout:60, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'enable_backup_description is nil' if enable_backup_description.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::EnableBackupDescription.mapper()
      request_content = self.serialize(request_mapper,  enable_backup_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Partitions/{partitionId}/$/EnableBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Disables periodic backup of Service Fabric partition which was previously
    # enabled.
    #
    # Disables periodic backup of partition which was previously enabled. Backup
    # must be explicitly enabled before it can be disabled.
    # In case the backup is enabled for the Service Fabric application or service,
    # which this partition is part of, this partition would continue to be
    # periodically backed up as per the policy mapped at the higher level entity.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def disable_partition_backup(partition_id, timeout:60, custom_headers:nil)
      response = disable_partition_backup_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Disables periodic backup of Service Fabric partition which was previously
    # enabled.
    #
    # Disables periodic backup of partition which was previously enabled. Backup
    # must be explicitly enabled before it can be disabled.
    # In case the backup is enabled for the Service Fabric application or service,
    # which this partition is part of, this partition would continue to be
    # periodically backed up as per the policy mapped at the higher level entity.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def disable_partition_backup_with_http_info(partition_id, timeout:60, custom_headers:nil)
      disable_partition_backup_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Disables periodic backup of Service Fabric partition which was previously
    # enabled.
    #
    # Disables periodic backup of partition which was previously enabled. Backup
    # must be explicitly enabled before it can be disabled.
    # In case the backup is enabled for the Service Fabric application or service,
    # which this partition is part of, this partition would continue to be
    # periodically backed up as per the policy mapped at the higher level entity.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def disable_partition_backup_async(partition_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/DisableBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets the partition backup configuration information
    #
    # Gets the Service Fabric Backup configuration information for the specified
    # partition.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PartitionBackupConfigurationInfo] operation results.
    #
    def get_partition_backup_configuration_info(partition_id, timeout:60, custom_headers:nil)
      response = get_partition_backup_configuration_info_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the partition backup configuration information
    #
    # Gets the Service Fabric Backup configuration information for the specified
    # partition.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_backup_configuration_info_with_http_info(partition_id, timeout:60, custom_headers:nil)
      get_partition_backup_configuration_info_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the partition backup configuration information
    #
    # Gets the Service Fabric Backup configuration information for the specified
    # partition.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_backup_configuration_info_async(partition_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/GetBackupConfigurationInfo'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PartitionBackupConfigurationInfo.mapper()
            result.body = self.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

    #
    # Gets the list of backups available for the specified partition.
    #
    # Returns a list of backups available for the specified partition. The server
    # enumerates all the backups available in the backup store configured in the
    # backup policy. It also allows filtering of the result based on start and end
    # datetime or just fetching the latest available backup for the partition.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param latest [Boolean] Specifies whether to get only the most recent backup
    # available for a partition for the specified time range.
    # @param start_date_time_filter [DateTime] Specify the start date time from
    # which to enumerate backups, in datetime format. The date time must be
    # specified in ISO8601 format. This is an optional parameter. If not specified,
    # all backups from the beginning are enumerated.
    # @param end_date_time_filter [DateTime] Specify the end date time till which
    # to enumerate backups, in datetime format. The date time must be specified in
    # ISO8601 format. This is an optional parameter. If not specified, enumeration
    # is done till the most recent backup.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedBackupInfoList] operation results.
    #
    def get_partition_backup_list(partition_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, custom_headers:nil)
      response = get_partition_backup_list_async(partition_id, timeout:timeout, latest:latest, start_date_time_filter:start_date_time_filter, end_date_time_filter:end_date_time_filter, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of backups available for the specified partition.
    #
    # Returns a list of backups available for the specified partition. The server
    # enumerates all the backups available in the backup store configured in the
    # backup policy. It also allows filtering of the result based on start and end
    # datetime or just fetching the latest available backup for the partition.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param latest [Boolean] Specifies whether to get only the most recent backup
    # available for a partition for the specified time range.
    # @param start_date_time_filter [DateTime] Specify the start date time from
    # which to enumerate backups, in datetime format. The date time must be
    # specified in ISO8601 format. This is an optional parameter. If not specified,
    # all backups from the beginning are enumerated.
    # @param end_date_time_filter [DateTime] Specify the end date time till which
    # to enumerate backups, in datetime format. The date time must be specified in
    # ISO8601 format. This is an optional parameter. If not specified, enumeration
    # is done till the most recent backup.
    # @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.
    #
    def get_partition_backup_list_with_http_info(partition_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, custom_headers:nil)
      get_partition_backup_list_async(partition_id, timeout:timeout, latest:latest, start_date_time_filter:start_date_time_filter, end_date_time_filter:end_date_time_filter, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of backups available for the specified partition.
    #
    # Returns a list of backups available for the specified partition. The server
    # enumerates all the backups available in the backup store configured in the
    # backup policy. It also allows filtering of the result based on start and end
    # datetime or just fetching the latest available backup for the partition.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param latest [Boolean] Specifies whether to get only the most recent backup
    # available for a partition for the specified time range.
    # @param start_date_time_filter [DateTime] Specify the start date time from
    # which to enumerate backups, in datetime format. The date time must be
    # specified in ISO8601 format. This is an optional parameter. If not specified,
    # all backups from the beginning are enumerated.
    # @param end_date_time_filter [DateTime] Specify the end date time till which
    # to enumerate backups, in datetime format. The date time must be specified in
    # ISO8601 format. This is an optional parameter. If not specified, enumeration
    # is done till the most recent backup.
    # @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.
    #
    def get_partition_backup_list_async(partition_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/GetBackups'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout,'Latest' => latest,'StartDateTimeFilter' => start_date_time_filter,'EndDateTimeFilter' => end_date_time_filter},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedBackupInfoList.mapper()
            result.body = self.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

    #
    # Suspends periodic backup for the specified partition.
    #
    # The partition which is configured to take periodic backups, is suspended for
    # taking further backups till it is resumed again.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def suspend_partition_backup(partition_id, timeout:60, custom_headers:nil)
      response = suspend_partition_backup_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Suspends periodic backup for the specified partition.
    #
    # The partition which is configured to take periodic backups, is suspended for
    # taking further backups till it is resumed again.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def suspend_partition_backup_with_http_info(partition_id, timeout:60, custom_headers:nil)
      suspend_partition_backup_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Suspends periodic backup for the specified partition.
    #
    # The partition which is configured to take periodic backups, is suspended for
    # taking further backups till it is resumed again.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def suspend_partition_backup_async(partition_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/SuspendBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Resumes periodic backup of partition which was previously suspended.
    #
    # The previously suspended partition resumes taking periodic backup as per the
    # backup policy currently configured for the same.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def resume_partition_backup(partition_id, timeout:60, custom_headers:nil)
      response = resume_partition_backup_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Resumes periodic backup of partition which was previously suspended.
    #
    # The previously suspended partition resumes taking periodic backup as per the
    # backup policy currently configured for the same.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resume_partition_backup_with_http_info(partition_id, timeout:60, custom_headers:nil)
      resume_partition_backup_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Resumes periodic backup of partition which was previously suspended.
    #
    # The previously suspended partition resumes taking periodic backup as per the
    # backup policy currently configured for the same.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def resume_partition_backup_async(partition_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/ResumeBackup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Triggers backup of the partition's state.
    #
    # Creates a backup of the stateful persisted partition's state. In case the
    # partition is already being periodically backed up, then by default the new
    # backup is created at the same backup storage. One can also override the same
    # by specifying the backup storage details as part of the request body. Once
    # the backup is initiated, its progress can be tracked using the
    # GetBackupProgress operation.
    # In case, the operation times out, specify a greater backup timeout value in
    # the query parameter.
    #
    # @param partition_id The identity of the partition.
    # @param backup_partition_description [BackupPartitionDescription] Describes
    # the parameters to backup the partition now. If not present, backup operation
    # uses default parameters from the backup policy current associated with this
    # partition.
    # @param backup_timeout [Integer] Specifies the maximum amount of time, in
    # minutes, to wait for the backup operation to complete. Post that, the
    # operation completes with timeout error. However, in certain corner cases it
    # could be that though the operation returns back timeout, the backup actually
    # goes through. In case of timeout error, its recommended to invoke this
    # operation again with a greater timeout value. The default value for the same
    # is 10 minutes.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def backup_partition(partition_id, backup_partition_description:nil, backup_timeout:10, timeout:60, custom_headers:nil)
      response = backup_partition_async(partition_id, backup_partition_description:backup_partition_description, backup_timeout:backup_timeout, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Triggers backup of the partition's state.
    #
    # Creates a backup of the stateful persisted partition's state. In case the
    # partition is already being periodically backed up, then by default the new
    # backup is created at the same backup storage. One can also override the same
    # by specifying the backup storage details as part of the request body. Once
    # the backup is initiated, its progress can be tracked using the
    # GetBackupProgress operation.
    # In case, the operation times out, specify a greater backup timeout value in
    # the query parameter.
    #
    # @param partition_id The identity of the partition.
    # @param backup_partition_description [BackupPartitionDescription] Describes
    # the parameters to backup the partition now. If not present, backup operation
    # uses default parameters from the backup policy current associated with this
    # partition.
    # @param backup_timeout [Integer] Specifies the maximum amount of time, in
    # minutes, to wait for the backup operation to complete. Post that, the
    # operation completes with timeout error. However, in certain corner cases it
    # could be that though the operation returns back timeout, the backup actually
    # goes through. In case of timeout error, its recommended to invoke this
    # operation again with a greater timeout value. The default value for the same
    # is 10 minutes.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def backup_partition_with_http_info(partition_id, backup_partition_description:nil, backup_timeout:10, timeout:60, custom_headers:nil)
      backup_partition_async(partition_id, backup_partition_description:backup_partition_description, backup_timeout:backup_timeout, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Triggers backup of the partition's state.
    #
    # Creates a backup of the stateful persisted partition's state. In case the
    # partition is already being periodically backed up, then by default the new
    # backup is created at the same backup storage. One can also override the same
    # by specifying the backup storage details as part of the request body. Once
    # the backup is initiated, its progress can be tracked using the
    # GetBackupProgress operation.
    # In case, the operation times out, specify a greater backup timeout value in
    # the query parameter.
    #
    # @param partition_id The identity of the partition.
    # @param backup_partition_description [BackupPartitionDescription] Describes
    # the parameters to backup the partition now. If not present, backup operation
    # uses default parameters from the backup policy current associated with this
    # partition.
    # @param backup_timeout [Integer] Specifies the maximum amount of time, in
    # minutes, to wait for the backup operation to complete. Post that, the
    # operation completes with timeout error. However, in certain corner cases it
    # could be that though the operation returns back timeout, the backup actually
    # goes through. In case of timeout error, its recommended to invoke this
    # operation again with a greater timeout value. The default value for the same
    # is 10 minutes.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def backup_partition_async(partition_id, backup_partition_description:nil, backup_timeout:10, timeout:60, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::BackupPartitionDescription.mapper()
      request_content = self.serialize(request_mapper,  backup_partition_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Partitions/{partitionId}/$/Backup'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'BackupTimeout' => backup_timeout,'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets details for the latest backup triggered for this partition.
    #
    # Returns information about the state of the latest backup along with details
    # or failure reason in case of completion.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [BackupProgressInfo] operation results.
    #
    def get_partition_backup_progress(partition_id, timeout:60, custom_headers:nil)
      response = get_partition_backup_progress_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets details for the latest backup triggered for this partition.
    #
    # Returns information about the state of the latest backup along with details
    # or failure reason in case of completion.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_backup_progress_with_http_info(partition_id, timeout:60, custom_headers:nil)
      get_partition_backup_progress_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets details for the latest backup triggered for this partition.
    #
    # Returns information about the state of the latest backup along with details
    # or failure reason in case of completion.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_backup_progress_async(partition_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/GetBackupProgress'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::BackupProgressInfo.mapper()
            result.body = self.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

    #
    # Triggers restore of the state of the partition using the specified restore
    # partition description.
    #
    # Restores the state of a of the stateful persisted partition using the
    # specified backup point. In case the partition is already being periodically
    # backed up, then by default the backup point is looked for in the storage
    # specified in backup policy. One can also override the same by specifying the
    # backup storage details as part of the restore partition description in body.
    # Once the restore is initiated, its progress can be tracked using the
    # GetRestoreProgress operation.
    # In case, the operation times out, specify a greater restore timeout value in
    # the query parameter.
    #
    # @param partition_id The identity of the partition.
    # @param restore_partition_description [RestorePartitionDescription] Describes
    # the parameters to restore the partition.
    # @param restore_timeout [Integer] Specifies the maximum amount of time to
    # wait, in minutes, for the restore operation to complete. Post that, the
    # operation returns back with timeout error. However, in certain corner cases
    # it could be that the restore operation goes through even though it completes
    # with timeout. In case of timeout error, its recommended to invoke this
    # operation again with a greater timeout value. the default value for the same
    # is 10 minutes.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def restore_partition(partition_id, restore_partition_description, restore_timeout:10, timeout:60, custom_headers:nil)
      response = restore_partition_async(partition_id, restore_partition_description, restore_timeout:restore_timeout, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Triggers restore of the state of the partition using the specified restore
    # partition description.
    #
    # Restores the state of a of the stateful persisted partition using the
    # specified backup point. In case the partition is already being periodically
    # backed up, then by default the backup point is looked for in the storage
    # specified in backup policy. One can also override the same by specifying the
    # backup storage details as part of the restore partition description in body.
    # Once the restore is initiated, its progress can be tracked using the
    # GetRestoreProgress operation.
    # In case, the operation times out, specify a greater restore timeout value in
    # the query parameter.
    #
    # @param partition_id The identity of the partition.
    # @param restore_partition_description [RestorePartitionDescription] Describes
    # the parameters to restore the partition.
    # @param restore_timeout [Integer] Specifies the maximum amount of time to
    # wait, in minutes, for the restore operation to complete. Post that, the
    # operation returns back with timeout error. However, in certain corner cases
    # it could be that the restore operation goes through even though it completes
    # with timeout. In case of timeout error, its recommended to invoke this
    # operation again with a greater timeout value. the default value for the same
    # is 10 minutes.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def restore_partition_with_http_info(partition_id, restore_partition_description, restore_timeout:10, timeout:60, custom_headers:nil)
      restore_partition_async(partition_id, restore_partition_description, restore_timeout:restore_timeout, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Triggers restore of the state of the partition using the specified restore
    # partition description.
    #
    # Restores the state of a of the stateful persisted partition using the
    # specified backup point. In case the partition is already being periodically
    # backed up, then by default the backup point is looked for in the storage
    # specified in backup policy. One can also override the same by specifying the
    # backup storage details as part of the restore partition description in body.
    # Once the restore is initiated, its progress can be tracked using the
    # GetRestoreProgress operation.
    # In case, the operation times out, specify a greater restore timeout value in
    # the query parameter.
    #
    # @param partition_id The identity of the partition.
    # @param restore_partition_description [RestorePartitionDescription] Describes
    # the parameters to restore the partition.
    # @param restore_timeout [Integer] Specifies the maximum amount of time to
    # wait, in minutes, for the restore operation to complete. Post that, the
    # operation returns back with timeout error. However, in certain corner cases
    # it could be that the restore operation goes through even though it completes
    # with timeout. In case of timeout error, its recommended to invoke this
    # operation again with a greater timeout value. the default value for the same
    # is 10 minutes.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def restore_partition_async(partition_id, restore_partition_description, restore_timeout:10, timeout:60, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'restore_partition_description is nil' if restore_partition_description.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::RestorePartitionDescription.mapper()
      request_content = self.serialize(request_mapper,  restore_partition_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Partitions/{partitionId}/$/Restore'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'RestoreTimeout' => restore_timeout,'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 202
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets details for the latest restore operation triggered for this partition.
    #
    # Returns information about the state of the latest restore operation along
    # with details or failure reason in case of completion.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [RestoreProgressInfo] operation results.
    #
    def get_partition_restore_progress(partition_id, timeout:60, custom_headers:nil)
      response = get_partition_restore_progress_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets details for the latest restore operation triggered for this partition.
    #
    # Returns information about the state of the latest restore operation along
    # with details or failure reason in case of completion.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_restore_progress_with_http_info(partition_id, timeout:60, custom_headers:nil)
      get_partition_restore_progress_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets details for the latest restore operation triggered for this partition.
    #
    # Returns information about the state of the latest restore operation along
    # with details or failure reason in case of completion.
    #
    # @param partition_id The identity of the partition.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_partition_restore_progress_async(partition_id, timeout:60, custom_headers:nil)
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Partitions/{partitionId}/$/GetRestoreProgress'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::RestoreProgressInfo.mapper()
            result.body = self.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

    #
    # Gets the list of backups available for the specified backed up entity at the
    # specified backup location.
    #
    # Gets the list of backups available for the specified backed up entity
    # (Application, Service or Partition) at the specified backup location
    # (FileShare or Azure Blob Storage).
    #
    # @param get_backup_by_storage_query_description
    # [GetBackupByStorageQueryDescription] Describes the filters and backup storage
    # details to be used for enumerating backups.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedBackupInfoList] operation results.
    #
    def get_backups_from_backup_location(get_backup_by_storage_query_description, timeout:60, continuation_token:nil, max_results:0, custom_headers:nil)
      response = get_backups_from_backup_location_async(get_backup_by_storage_query_description, timeout:timeout, continuation_token:continuation_token, max_results:max_results, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the list of backups available for the specified backed up entity at the
    # specified backup location.
    #
    # Gets the list of backups available for the specified backed up entity
    # (Application, Service or Partition) at the specified backup location
    # (FileShare or Azure Blob Storage).
    #
    # @param get_backup_by_storage_query_description
    # [GetBackupByStorageQueryDescription] Describes the filters and backup storage
    # details to be used for enumerating backups.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @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.
    #
    def get_backups_from_backup_location_with_http_info(get_backup_by_storage_query_description, timeout:60, continuation_token:nil, max_results:0, custom_headers:nil)
      get_backups_from_backup_location_async(get_backup_by_storage_query_description, timeout:timeout, continuation_token:continuation_token, max_results:max_results, custom_headers:custom_headers).value!
    end

    #
    # Gets the list of backups available for the specified backed up entity at the
    # specified backup location.
    #
    # Gets the list of backups available for the specified backed up entity
    # (Application, Service or Partition) at the specified backup location
    # (FileShare or Azure Blob Storage).
    #
    # @param get_backup_by_storage_query_description
    # [GetBackupByStorageQueryDescription] Describes the filters and backup storage
    # details to be used for enumerating backups.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param max_results [Integer] The maximum number of results to be returned as
    # part of the paged queries. This parameter defines the upper bound on the
    # number of results returned. The results returned can be less than the
    # specified maximum results if they do not fit in the message as per the max
    # message size restrictions defined in the configuration. If this parameter is
    # zero or not specified, the paged queries includes as many results as possible
    # that fit in the return message.
    # @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.
    #
    def get_backups_from_backup_location_async(get_backup_by_storage_query_description, timeout:60, continuation_token:nil, max_results:0, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, "'max_results' should satisfy the constraint - 'InclusiveMinimum': '0'" if !max_results.nil? && max_results < 0
      fail ArgumentError, 'get_backup_by_storage_query_description is nil' if get_backup_by_storage_query_description.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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::GetBackupByStorageQueryDescription.mapper()
      request_content = self.serialize(request_mapper,  get_backup_by_storage_query_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'BackupRestore/$/GetBackups'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout,'MaxResults' => max_results},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedBackupInfoList.mapper()
            result.body = self.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

    #
    # Creates a Service Fabric name.
    #
    # Creates the specified Service Fabric name.
    #
    # @param name_description [NameDescription] Describes the Service Fabric name
    # to be created.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def create_name(name_description, timeout:60, custom_headers:nil)
      response = create_name_async(name_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Creates a Service Fabric name.
    #
    # Creates the specified Service Fabric name.
    #
    # @param name_description [NameDescription] Describes the Service Fabric name
    # to be created.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_name_with_http_info(name_description, timeout:60, custom_headers:nil)
      create_name_async(name_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Creates a Service Fabric name.
    #
    # Creates the specified Service Fabric name.
    #
    # @param name_description [NameDescription] Describes the Service Fabric name
    # to be created.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def create_name_async(name_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'name_description is nil' if name_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::NameDescription.mapper()
      request_content = self.serialize(request_mapper,  name_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Names/$/Create'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 == 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?

        result
      end

      promise.execute
    end

    #
    # Returns whether the Service Fabric name exists.
    #
    # Returns whether the specified Service Fabric name exists.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def get_name_exists_info(name_id, timeout:60, custom_headers:nil)
      response = get_name_exists_info_async(name_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Returns whether the Service Fabric name exists.
    #
    # Returns whether the specified Service Fabric name exists.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_name_exists_info_with_http_info(name_id, timeout:60, custom_headers:nil)
      get_name_exists_info_async(name_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Returns whether the Service Fabric name exists.
    #
    # Returns whether the specified Service Fabric name exists.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_name_exists_info_async(name_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'name_id is nil' if name_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Names/{nameId}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nameId' => name_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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?

        result
      end

      promise.execute
    end

    #
    # Deletes a Service Fabric name.
    #
    # Deletes the specified Service Fabric name. A name must be created before it
    # can be deleted. Deleting a name with child properties will fail.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def delete_name(name_id, timeout:60, custom_headers:nil)
      response = delete_name_async(name_id, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Deletes a Service Fabric name.
    #
    # Deletes the specified Service Fabric name. A name must be created before it
    # can be deleted. Deleting a name with child properties will fail.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_name_with_http_info(name_id, timeout:60, custom_headers:nil)
      delete_name_async(name_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Deletes a Service Fabric name.
    #
    # Deletes the specified Service Fabric name. A name must be created before it
    # can be deleted. Deleting a name with child properties will fail.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_name_async(name_id, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'name_id is nil' if name_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Names/{nameId}'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nameId' => name_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Enumerates all the Service Fabric names under a given name.
    #
    # Enumerates all the Service Fabric names under a given name. If the subnames
    # do not fit in a page, one page of results is returned as well as a
    # continuation token which can be used to get the next page. Querying a name
    # that doesn't exist will fail.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param recursive [Boolean] Allows specifying that the search performed should
    # be recursive.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedSubNameInfoList] operation results.
    #
    def get_sub_name_info_list(name_id, recursive:false, continuation_token:nil, timeout:60, custom_headers:nil)
      response = get_sub_name_info_list_async(name_id, recursive:recursive, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Enumerates all the Service Fabric names under a given name.
    #
    # Enumerates all the Service Fabric names under a given name. If the subnames
    # do not fit in a page, one page of results is returned as well as a
    # continuation token which can be used to get the next page. Querying a name
    # that doesn't exist will fail.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param recursive [Boolean] Allows specifying that the search performed should
    # be recursive.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_sub_name_info_list_with_http_info(name_id, recursive:false, continuation_token:nil, timeout:60, custom_headers:nil)
      get_sub_name_info_list_async(name_id, recursive:recursive, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Enumerates all the Service Fabric names under a given name.
    #
    # Enumerates all the Service Fabric names under a given name. If the subnames
    # do not fit in a page, one page of results is returned as well as a
    # continuation token which can be used to get the next page. Querying a name
    # that doesn't exist will fail.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param recursive [Boolean] Allows specifying that the search performed should
    # be recursive.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_sub_name_info_list_async(name_id, recursive:false, continuation_token:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'name_id is nil' if name_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Names/{nameId}/$/GetSubNames'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nameId' => name_id},
          query_params: {'api-version' => api_version,'Recursive' => recursive,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedSubNameInfoList.mapper()
            result.body = self.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

    #
    # Gets information on all Service Fabric properties under a given name.
    #
    # A Service Fabric name can have one or more named properties that stores
    # custom information. This operation gets the information about these
    # properties in a paged list. The information include name, value and metadata
    # about each of the properties.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param include_values [Boolean] Allows specifying whether to include the
    # values of the properties returned. True if values should be returned with the
    # metadata; False to return only property metadata.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PagedPropertyInfoList] operation results.
    #
    def get_property_info_list(name_id, include_values:false, continuation_token:nil, timeout:60, custom_headers:nil)
      response = get_property_info_list_async(name_id, include_values:include_values, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets information on all Service Fabric properties under a given name.
    #
    # A Service Fabric name can have one or more named properties that stores
    # custom information. This operation gets the information about these
    # properties in a paged list. The information include name, value and metadata
    # about each of the properties.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param include_values [Boolean] Allows specifying whether to include the
    # values of the properties returned. True if values should be returned with the
    # metadata; False to return only property metadata.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_property_info_list_with_http_info(name_id, include_values:false, continuation_token:nil, timeout:60, custom_headers:nil)
      get_property_info_list_async(name_id, include_values:include_values, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets information on all Service Fabric properties under a given name.
    #
    # A Service Fabric name can have one or more named properties that stores
    # custom information. This operation gets the information about these
    # properties in a paged list. The information include name, value and metadata
    # about each of the properties.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param include_values [Boolean] Allows specifying whether to include the
    # values of the properties returned. True if values should be returned with the
    # metadata; False to return only property metadata.
    # @param continuation_token [String] The continuation token parameter is used
    # to obtain next set of results. A continuation token with a non empty value is
    # included in the response of the API when the results from the system do not
    # fit in a single response. When this value is passed to the next API call, the
    # API returns next set of results. If there are no further results then the
    # continuation token does not contain a value. The value of this parameter
    # should not be URL encoded.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_property_info_list_async(name_id, include_values:false, continuation_token:nil, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'name_id is nil' if name_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Names/{nameId}/$/GetProperties'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nameId' => name_id},
          query_params: {'api-version' => api_version,'IncludeValues' => include_values,'timeout' => timeout},
          skip_encoding_query_params: {'ContinuationToken' => continuation_token},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PagedPropertyInfoList.mapper()
            result.body = self.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

    #
    # Creates or updates a Service Fabric property.
    #
    # Creates or updates the specified Service Fabric property under a given name.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_description [PropertyDescription] Describes the Service
    # Fabric property to be created.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def put_property(name_id, property_description, timeout:60, custom_headers:nil)
      response = put_property_async(name_id, property_description, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Creates or updates a Service Fabric property.
    #
    # Creates or updates the specified Service Fabric property under a given name.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_description [PropertyDescription] Describes the Service
    # Fabric property to be created.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def put_property_with_http_info(name_id, property_description, timeout:60, custom_headers:nil)
      put_property_async(name_id, property_description, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Creates or updates a Service Fabric property.
    #
    # Creates or updates the specified Service Fabric property under a given name.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_description [PropertyDescription] Describes the Service
    # Fabric property to be created.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def put_property_async(name_id, property_description, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'name_id is nil' if name_id.nil?
      fail ArgumentError, 'property_description is nil' if property_description.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::PropertyDescription.mapper()
      request_content = self.serialize(request_mapper,  property_description)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Names/{nameId}/$/GetProperty'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nameId' => name_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Gets the specified Service Fabric property.
    #
    # Gets the specified Service Fabric property under a given name. This will
    # always return both value and metadata.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_name [String] Specifies the name of the property to get.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PropertyInfo] operation results.
    #
    def get_property_info(name_id, property_name, timeout:60, custom_headers:nil)
      response = get_property_info_async(name_id, property_name, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets the specified Service Fabric property.
    #
    # Gets the specified Service Fabric property under a given name. This will
    # always return both value and metadata.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_name [String] Specifies the name of the property to get.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_property_info_with_http_info(name_id, property_name, timeout:60, custom_headers:nil)
      get_property_info_async(name_id, property_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets the specified Service Fabric property.
    #
    # Gets the specified Service Fabric property under a given name. This will
    # always return both value and metadata.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_name [String] Specifies the name of the property to get.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_property_info_async(name_id, property_name, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'name_id is nil' if name_id.nil?
      fail ArgumentError, 'property_name is nil' if property_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Names/{nameId}/$/GetProperty'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nameId' => name_id},
          query_params: {'api-version' => api_version,'PropertyName' => property_name,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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::ServiceFabric::V6_2_0_9::Models::PropertyInfo.mapper()
            result.body = self.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

    #
    # Deletes the specified Service Fabric property.
    #
    # Deletes the specified Service Fabric property under a given name. A property
    # must be created before it can be deleted.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_name [String] Specifies the name of the property to get.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def delete_property(name_id, property_name, timeout:60, custom_headers:nil)
      response = delete_property_async(name_id, property_name, timeout:timeout, custom_headers:custom_headers).value!
      nil
    end

    #
    # Deletes the specified Service Fabric property.
    #
    # Deletes the specified Service Fabric property under a given name. A property
    # must be created before it can be deleted.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_name [String] Specifies the name of the property to get.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_property_with_http_info(name_id, property_name, timeout:60, custom_headers:nil)
      delete_property_async(name_id, property_name, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Deletes the specified Service Fabric property.
    #
    # Deletes the specified Service Fabric property under a given name. A property
    # must be created before it can be deleted.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_name [String] Specifies the name of the property to get.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def delete_property_async(name_id, property_name, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'name_id is nil' if name_id.nil?
      fail ArgumentError, 'property_name is nil' if property_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'Names/{nameId}/$/GetProperty'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nameId' => name_id},
          query_params: {'api-version' => api_version,'PropertyName' => property_name,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Submits a property batch.
    #
    # Submits a batch of property operations. Either all or none of the operations
    # will be committed.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_batch_description_list [PropertyBatchDescriptionList]
    # Describes the property batch operations to be submitted.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PropertyBatchInfo] operation results.
    #
    def submit_property_batch(name_id, property_batch_description_list, timeout:60, custom_headers:nil)
      response = submit_property_batch_async(name_id, property_batch_description_list, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Submits a property batch.
    #
    # Submits a batch of property operations. Either all or none of the operations
    # will be committed.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_batch_description_list [PropertyBatchDescriptionList]
    # Describes the property batch operations to be submitted.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def submit_property_batch_with_http_info(name_id, property_batch_description_list, timeout:60, custom_headers:nil)
      submit_property_batch_async(name_id, property_batch_description_list, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Submits a property batch.
    #
    # Submits a batch of property operations. Either all or none of the operations
    # will be committed.
    #
    # @param name_id [String] The Service Fabric name, without the 'fabric:' URI
    # scheme.
    # @param property_batch_description_list [PropertyBatchDescriptionList]
    # Describes the property batch operations to be submitted.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def submit_property_batch_async(name_id, property_batch_description_list, timeout:60, custom_headers:nil)
      api_version = '6.0'
      fail ArgumentError, 'name_id is nil' if name_id.nil?
      fail ArgumentError, 'property_batch_description_list is nil' if property_batch_description_list.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?

      # Serialize Request
      request_mapper = Azure::ServiceFabric::V6_2_0_9::Models::PropertyBatchDescriptionList.mapper()
      request_content = self.serialize(request_mapper,  property_batch_description_list)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'Names/{nameId}/$/GetProperties/$/SubmitBatch'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nameId' => name_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.make_request_async(:post, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200 || status_code == 409
          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::ServiceFabric::V6_2_0_9::Models::SuccessfulPropertyBatchInfo.mapper()
            result.body = self.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 == 409
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::ServiceFabric::V6_2_0_9::Models::FailedPropertyBatchInfo.mapper()
            result.body = self.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

    #
    # Gets all Cluster-related events.
    #
    # The response is list of ClusterEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_cluster_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_cluster_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets all Cluster-related events.
    #
    # The response is list of ClusterEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_cluster_event_list_with_http_info(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_cluster_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets all Cluster-related events.
    #
    # The response is list of ClusterEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_cluster_event_list_async(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Cluster/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'ClusterEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'ClusterEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets all Containers-related events.
    #
    # The response is list of ContainerInstanceEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_containers_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_containers_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets all Containers-related events.
    #
    # The response is list of ContainerInstanceEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_containers_event_list_with_http_info(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_containers_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets all Containers-related events.
    #
    # The response is list of ContainerInstanceEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_containers_event_list_async(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Containers/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'ContainerInstanceEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'ContainerInstanceEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets a Node-related events.
    #
    # The response is list of NodeEvent objects.
    #
    # @param node_name [String] The name of the node.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_node_event_list(node_name, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_node_event_list_async(node_name, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets a Node-related events.
    #
    # The response is list of NodeEvent objects.
    #
    # @param node_name [String] The name of the node.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_node_event_list_with_http_info(node_name, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_node_event_list_async(node_name, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets a Node-related events.
    #
    # The response is list of NodeEvent objects.
    #
    # @param node_name [String] The name of the node.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_node_event_list_async(node_name, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, 'node_name is nil' if node_name.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Nodes/{nodeName}/$/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'nodeName' => node_name},
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'NodeEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'NodeEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets all Nodes-related Events.
    #
    # The response is list of NodeEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_nodes_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_nodes_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets all Nodes-related Events.
    #
    # The response is list of NodeEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_nodes_event_list_with_http_info(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_nodes_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets all Nodes-related Events.
    #
    # The response is list of NodeEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_nodes_event_list_async(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Nodes/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'NodeEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'NodeEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets an Application-related events.
    #
    # The response is list of ApplicationEvent objects.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_application_event_list(application_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_application_event_list_async(application_id, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets an Application-related events.
    #
    # The response is list of ApplicationEvent objects.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_application_event_list_with_http_info(application_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_application_event_list_async(application_id, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets an Application-related events.
    #
    # The response is list of ApplicationEvent objects.
    #
    # @param application_id [String] The identity of the application. This is
    # typically the full name of the application without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the application name is "fabric:/myapp/app1", the application
    # identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_application_event_list_async(application_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, 'application_id is nil' if application_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Applications/{applicationId}/$/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'applicationId' => application_id},
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'ApplicationEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'ApplicationEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets all Applications-related events.
    #
    # The response is list of ApplicationEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_applications_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_applications_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets all Applications-related events.
    #
    # The response is list of ApplicationEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_applications_event_list_with_http_info(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_applications_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets all Applications-related events.
    #
    # The response is list of ApplicationEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_applications_event_list_async(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Applications/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'ApplicationEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'ApplicationEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets a Service-related events.
    #
    # The response is list of ServiceEvent objects.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_service_event_list(service_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_service_event_list_async(service_id, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets a Service-related events.
    #
    # The response is list of ServiceEvent objects.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_service_event_list_with_http_info(service_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_service_event_list_async(service_id, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets a Service-related events.
    #
    # The response is list of ServiceEvent objects.
    #
    # @param service_id [String] The identity of the service. This is typically the
    # full name of the service without the 'fabric:' URI scheme.
    # Starting from version 6.0, hierarchical names are delimited with the "~"
    # character.
    # For example, if the service name is "fabric:/myapp/app1/svc1", the service
    # identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
    # versions.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_service_event_list_async(service_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, 'service_id is nil' if service_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Services/{serviceId}/$/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'serviceId' => service_id},
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'ServiceEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'ServiceEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets all Services-related events.
    #
    # The response is list of ServiceEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_services_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_services_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets all Services-related events.
    #
    # The response is list of ServiceEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_services_event_list_with_http_info(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_services_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets all Services-related events.
    #
    # The response is list of ServiceEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_services_event_list_async(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Services/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'ServiceEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'ServiceEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets a Partition-related events.
    #
    # The response is list of PartitionEvent objects.
    #
    # @param partition_id The identity of the partition.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_partition_event_list(partition_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_partition_event_list_async(partition_id, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets a Partition-related events.
    #
    # The response is list of PartitionEvent objects.
    #
    # @param partition_id The identity of the partition.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_partition_event_list_with_http_info(partition_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_partition_event_list_async(partition_id, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets a Partition-related events.
    #
    # The response is list of PartitionEvent objects.
    #
    # @param partition_id The identity of the partition.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_partition_event_list_async(partition_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Partitions/{partitionId}/$/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'PartitionEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'PartitionEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets all Partitions-related events.
    #
    # The response is list of PartitionEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_partitions_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_partitions_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets all Partitions-related events.
    #
    # The response is list of PartitionEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_partitions_event_list_with_http_info(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_partitions_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets all Partitions-related events.
    #
    # The response is list of PartitionEvent objects.
    #
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_partitions_event_list_async(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Partitions/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'PartitionEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'PartitionEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets a Partition Replica-related events.
    #
    # The response is list of ReplicaEvent objects.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_partition_replica_event_list(partition_id, replica_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_partition_replica_event_list_async(partition_id, replica_id, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets a Partition Replica-related events.
    #
    # The response is list of ReplicaEvent objects.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_partition_replica_event_list_with_http_info(partition_id, replica_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_partition_replica_event_list_async(partition_id, replica_id, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets a Partition Replica-related events.
    #
    # The response is list of ReplicaEvent objects.
    #
    # @param partition_id The identity of the partition.
    # @param replica_id [String] The identifier of the replica.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_partition_replica_event_list_async(partition_id, replica_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, 'replica_id is nil' if replica_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Partitions/{partitionId}/$/Replicas/{replicaId}/$/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id,'replicaId' => replica_id},
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'ReplicaEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'ReplicaEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets all Replicas-related events for a Partition.
    #
    # The response is list of ReplicaEvent objects.
    #
    # @param partition_id The identity of the partition.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_partition_replicas_event_list(partition_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      response = get_partition_replicas_event_list_async(partition_id, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets all Replicas-related events for a Partition.
    #
    # The response is list of ReplicaEvent objects.
    #
    # @param partition_id The identity of the partition.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_partition_replicas_event_list_with_http_info(partition_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      get_partition_replicas_event_list_async(partition_id, start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
    end

    #
    # Gets all Replicas-related events for a Partition.
    #
    # The response is list of ReplicaEvent objects.
    #
    # @param partition_id The identity of the partition.
    # @param start_time_utc [String] The start time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param end_time_utc [String] The end time of a lookup query in ISO UTC
    # yyyy-MM-ddTHH:mm:ssZ.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param events_types_filter [String] This is a comma separated string
    # specifying the types of FabricEvents that should only be included in the
    # response.
    # @param exclude_analysis_events [Boolean] This param disables the retrieval of
    # AnalysisEvents if true is passed.
    # @param skip_correlation_lookup [Boolean] This param disables the search of
    # CorrelatedEvents information if true is passed. otherwise the
    # CorrelationEvents get processed and HasCorrelatedEvents field in every
    # FabricEvent gets populated.
    # @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.
    #
    def get_partition_replicas_event_list_async(partition_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, 'partition_id is nil' if partition_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1
      fail ArgumentError, 'start_time_utc is nil' if start_time_utc.nil?
      fail ArgumentError, 'end_time_utc is nil' if end_time_utc.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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/Partitions/{partitionId}/$/Replicas/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'partitionId' => partition_id},
          query_params: {'api-version' => api_version,'timeout' => timeout,'StartTimeUtc' => start_time_utc,'EndTimeUtc' => end_time_utc,'EventsTypesFilter' => events_types_filter,'ExcludeAnalysisEvents' => exclude_analysis_events,'SkipCorrelationLookup' => skip_correlation_lookup},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'ReplicaEventElementType',
                    type: {
                      name: 'Composite',
                      class_name: 'ReplicaEvent'
                    }
                }
              }
            }
            result.body = self.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

    #
    # Gets all correlated events for a given event.
    #
    # The response is list of FabricEvents.
    #
    # @param event_instance_id [String] The EventInstanceId.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def get_correlated_event_list(event_instance_id, timeout:60, custom_headers:nil)
      response = get_correlated_event_list_async(event_instance_id, timeout:timeout, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets all correlated events for a given event.
    #
    # The response is list of FabricEvents.
    #
    # @param event_instance_id [String] The EventInstanceId.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_correlated_event_list_with_http_info(event_instance_id, timeout:60, custom_headers:nil)
      get_correlated_event_list_async(event_instance_id, timeout:timeout, custom_headers:custom_headers).value!
    end

    #
    # Gets all correlated events for a given event.
    #
    # The response is list of FabricEvents.
    #
    # @param event_instance_id [String] The EventInstanceId.
    # @param timeout [Integer] The server timeout for performing the operation in
    # seconds. This timeout specifies the time duration that the client is willing
    # to wait for the requested operation to complete. The default value for this
    # parameter is 60 seconds.
    # @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.
    #
    def get_correlated_event_list_async(event_instance_id, timeout:60, custom_headers:nil)
      api_version = '6.2-preview'
      fail ArgumentError, 'event_instance_id is nil' if event_instance_id.nil?
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMaximum': '4294967295'" if !timeout.nil? && timeout > 4294967295
      fail ArgumentError, "'timeout' should satisfy the constraint - 'InclusiveMinimum': '1'" if !timeout.nil? && timeout < 1


      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'] = accept_language unless accept_language.nil?
      path_template = 'EventsStore/CorrelatedEvents/{eventInstanceId}/$/Events'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'eventInstanceId' => event_instance_id},
          query_params: {'api-version' => api_version,'timeout' => timeout},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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 = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'FabricEventElementType',
                    type: {
                      name: 'Composite',
                      polymorphic_discriminator: 'Kind',
                      uber_parent: 'FabricEvent',
                      class_name: 'FabricEvent'
                    }
                }
              }
            }
            result.body = self.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


    private
    #
    # Adds telemetry information.
    #
    def add_telemetry
        sdk_information = 'azure_service_fabric'
        sdk_information = "#{sdk_information}/0.18.1"
        add_user_agent_information(sdk_information)
    end
  end
end
