Method: OCI::DataFlow::DataFlowClient#list_runs

Defined in:
lib/oci/data_flow/data_flow_client.rb

#list_runs(compartment_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/dataflow/list_runs.rb.html) to see an example of how to use list_runs API.

Lists all runs of an application in the specified compartment. Only one parameter other than compartmentId may also be included in a query. The query must include compartmentId. If the query does not include compartmentId, or includes compartmentId but two or more other parameters an error is returned.

Allowed values are: timeCreated, displayName, language, runDurationInMilliseconds, lifecycleState, totalOCpu, dataReadInBytes, dataWrittenInBytes

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    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

  • :opc_request_id (String)

    Unique identifier for the request. If provided, the returned request ID will include this value. Otherwise, a random request ID will be generated by the service.

  • :application_id (String)

    The ID of the application.

  • :owner_principal_id (String)

    The OCID of the user who created the resource.

  • :display_name_starts_with (String)

    The displayName prefix.

  • :lifecycle_state (String)

    The LifecycleState of the run.

  • :time_created_greater_than (DateTime)

    The epoch time that the resource was created.

  • :limit (Integer)

    The maximum number of results to return in a paginated List call. (default to 100)

  • :page (String)

    The value of the opc-next-page or opc-prev-page response header from the last List call to sent back to server for getting the next page of results.

  • :sort_by (String)

    The field used to sort the results. Multiple fields are not supported. (default to timeCreated)

  • :sort_order (String)

    The ordering of results in ascending or descending order.

    Allowed values are: ASC, DESC

  • :display_name (String)

    The query parameter for the Spark application name.

Returns:



1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
# File 'lib/oci/data_flow/data_flow_client.rb', line 1323

def list_runs(compartment_id, opts = {})
  logger.debug 'Calling operation DataFlowClient#list_runs.' if logger

  raise "Missing the required parameter 'compartment_id' when calling list_runs." if compartment_id.nil?

  if opts[:lifecycle_state] && !OCI::DataFlow::Models::RUN_LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state])
    raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::DataFlow::Models::RUN_LIFECYCLE_STATE_ENUM.'
  end

  if opts[:sort_by] && !%w[timeCreated displayName language runDurationInMilliseconds lifecycleState totalOCpu dataReadInBytes dataWrittenInBytes].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of timeCreated, displayName, language, runDurationInMilliseconds, lifecycleState, totalOCpu, dataReadInBytes, dataWrittenInBytes.'
  end

  if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of ASC, DESC.'
  end

  path = '/runs'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id
  query_params[:applicationId] = opts[:application_id] if opts[:application_id]
  query_params[:ownerPrincipalId] = opts[:owner_principal_id] if opts[:owner_principal_id]
  query_params[:displayNameStartsWith] = opts[:display_name_starts_with] if opts[:display_name_starts_with]
  query_params[:lifecycleState] = opts[:lifecycle_state] if opts[:lifecycle_state]
  query_params[:timeCreatedGreaterThan] = opts[:time_created_greater_than] if opts[:time_created_greater_than]
  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]
  query_params[:displayName] = opts[:display_name] if opts[:display_name]

  # Header Params
  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]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'DataFlowClient#list_runs') 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::DataFlow::Models::RunSummary>'
    )
  end
  # rubocop:enable Metrics/BlockLength
end