lib/oci/analytics/analytics_client.rb
# List all work requests in a compartment.
#
# @param [String] compartment_id The OCID of the compartment.
#
# @param [Hash] opts the optional parameters
# @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
#   retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
# @option opts [String] :resource_id The OCID of the resource associated with a work request.
#
# @option opts [String] :resource_type Type of the resource associated with a work request.
#
# @option opts [Array<String>] :status One or more work request status values to filter on.
#
#   Allowed values are: ACCEPTED, IN_PROGRESS, FAILED, SUCCEEDED, CANCELING, CANCELED
# @option opts [Integer] :limit For list pagination. The maximum number of results per page, or items to return in a paginated
#   \"List\" call. For important details about how pagination works, see
#   [List Pagination](https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine).
#
#   Example: `50`
#
# @option opts [String] :page For list pagination. The value of the `opc-next-page` response header from the previous \"List\"
#   call. For important details about how pagination works, see
#   [List Pagination](https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine).
#
# @option opts [String] :sort_by The field used for sorting work request results.
#
# @option opts [String] :sort_order The sort order to use, either ascending (`ASC`) or descending (`DESC`).
#
# @option opts [String] :opc_request_id Unique identifier for the request.
#   If you need to contact Oracle about a particular request, please provide the request ID.
#
# @return [Response] A Response object with data of type Array<{OCI::Analytics::Models::WorkRequestSummary WorkRequestSummary}>
# @note Click [here](https://docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/analytics/list_work_requests.rb.html) to see an example of how to use list_work_requests API.
List all work requests in a compartment.
List all work requests in a compartment .
def list_work_requests(compartment_id, opts = {})
      logger.debug 'Calling operation AnalyticsClient#list_work_requests.' if logger
      raise "Missing the required parameter 'compartment_id' when calling list_work_requests." if compartment_id.nil?
      if opts[:resource_type] && !OCI::Analytics::Models::WORK_REQUEST_RESOURCE_TYPE_ENUM.include?(opts[:resource_type])
        raise 'Invalid value for "resource_type", must be one of the values in OCI::Analytics::Models::WORK_REQUEST_RESOURCE_TYPE_ENUM.'
      end
      status_allowable_values = %w[ACCEPTED IN_PROGRESS FAILED SUCCEEDED CANCELING CANCELED]
      if opts[:status] && !opts[:status].empty?
        opts[:status].each do |val_to_check|
          unless status_allowable_values.include?(val_to_check)
            raise 'Invalid value for "status", must be one of ACCEPTED, IN_PROGRESS, FAILED, SUCCEEDED, CANCELING, CANCELED.'
          end
        end
      end
      if opts[:sort_by] && !OCI::Analytics::Models::WORK_REQUEST_SORT_BY_ENUM.include?(opts[:sort_by])
        raise 'Invalid value for "sort_by", must be one of the values in OCI::Analytics::Models::WORK_REQUEST_SORT_BY_ENUM.'
      end
      if opts[:sort_order] && !OCI::Analytics::Models::SORT_ORDER_ENUM.include?(opts[:sort_order])
        raise 'Invalid value for "sort_order", must be one of the values in OCI::Analytics::Models::SORT_ORDER_ENUM.'
      end
      path = '/workRequests'
      operation_signing_strategy = :standard
      query_params = {}
      query_params[:compartmentId] = compartment_id
      query_params[:resourceId] = opts[:resource_id] if opts[:resource_id]
      query_params[:resourceType] = opts[:resource_type] if opts[:resource_type]
      query_params[:status] = OCI::ApiClient.build_collection_params(opts[:status], :multi) if opts[:status] && !opts[:status].empty?
      query_params[:limit] = opts[:limit] if opts[:limit]
      query_params[:page] = opts[:page] if opts[:page]
      query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
      query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]
      header_params = {}
      header_params[:accept] = 'application/json'
      header_params[:'content-type'] = 'application/json'
      header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
      post_body = nil
      OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'AnalyticsClient#list_work_requests') do
        @api_client.call_api(
          :GET,
          path,
          endpoint,
          header_params: header_params,
          query_params: query_params,
          operation_signing_strategy: operation_signing_strategy,
          body: post_body,
          return_type: 'Array<OCI::Analytics::Models::WorkRequestSummary>'
        )
      end
    end
def list_work_requests ( compartment_id , opts = { } ) logger . debug 'Calling operation AnalyticsClient#list_work_requests.' if logger raise "Missing the required parameter 'compartment_id' when calling list_work_requests." if compartment_id . nil? if opts [ :resource_type ] && ! OCI :: Analytics :: Models :: WORK_REQUEST_RESOURCE_TYPE_ENUM . include? ( opts [ :resource_type ] ) raise 'Invalid value for "resource_type", must be one of the values in OCI::Analytics::Models::WORK_REQUEST_RESOURCE_TYPE_ENUM.' end status_allowable_values = %w[ ACCEPTED IN_PROGRESS FAILED SUCCEEDED CANCELING CANCELED ] if opts [ :status ] && ! opts [ :status ] . empty? opts [ :status ] . each do | val_to_check | unless status_allowable_values . include? ( val_to_check ) raise 'Invalid value for "status", must be one of ACCEPTED, IN_PROGRESS, FAILED, SUCCEEDED, CANCELING, CANCELED.' end end end if opts [ :sort_by ] && ! OCI :: Analytics :: Models :: WORK_REQUEST_SORT_BY_ENUM . include? ( opts [ :sort_by ] ) raise 'Invalid value for "sort_by", must be one of the values in OCI::Analytics::Models::WORK_REQUEST_SORT_BY_ENUM.' end if opts [ :sort_order ] && ! OCI :: Analytics :: Models :: SORT_ORDER_ENUM . include? ( opts [ :sort_order ] ) raise 'Invalid value for "sort_order", must be one of the values in OCI::Analytics::Models::SORT_ORDER_ENUM.' end path = '/workRequests' operation_signing_strategy = :standard query_params = { } query_params [ :compartmentId ] = compartment_id query_params [ :resourceId ] = opts [ :resource_id ] if opts [ :resource_id ] query_params [ :resourceType ] = opts [ :resource_type ] if opts [ :resource_type ] query_params [ :status ] = OCI :: ApiClient . build_collection_params ( opts [ :status ] , :multi ) if opts [ :status ] && ! opts [ :status ] . empty? query_params [ :limit ] = opts [ :limit ] if opts [ :limit ] query_params [ :page ] = opts [ :page ] if opts [ :page ] query_params [ :sortBy ] = opts [ :sort_by ] if opts [ :sort_by ] query_params [ :sortOrder ] = opts [ :sort_order ] if opts [ :sort_order ] header_params = { } header_params [ :accept ] = 'application/json' header_params [ :' content-type ' ] = 'application/json' header_params [ :' opc-request-id ' ] = opts [ :opc_request_id ] if opts [ :opc_request_id ] post_body = nil OCI :: Retry . make_retrying_call ( applicable_retry_config ( opts ) , call_name : 'AnalyticsClient#list_work_requests' ) do @api_client . call_api ( :GET , path , endpoint , header_params : header_params , query_params : query_params , operation_signing_strategy : operation_signing_strategy , body : post_body , return_type : 'Array<OCI::Analytics::Models::WorkRequestSummary>' ) end end
List all work requests in a compartment.
List all work requests in a compartment .
# rubocop:disable Style/NegatedIf # Query Params # Header Params # rubocop:enable Style/NegatedIf # rubocop:disable Metrics/BlockLength # rubocop:enable Metrics/BlockLength
A Response object with data of type Array<{OCI::Analytics::Models::WorkRequestSummary WorkRequestSummary}>
A Response object with data of type Array< { OCI :: Analytics :: Models :: WorkRequestSummary WorkRequestSummary } >
Response
compartment_id
opts
:opc_request_id Unique identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
: opc_request_id Unique identifier for the request . If you need to contact Oracle about a particular request please provide the request ID .
opts the optional parameters
opts the optional parameters
note
Click [here] to see an example of how to use list_work_requests API.
Click [ here ] to see an example of how to use list_work_requests API .