lib/oci/events/events_client.rb
# Lists rules for this compartment.
#
# @param [String] compartment_id The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment to which this rule belongs.
#
# @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 [Integer] :limit The maximum number of items to return. 1 is the minimum, 50 is the maximum.
#   Default: 10
#    (default to 5)
# @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] :lifecycle_state A filter to return only rules that match the lifecycle state in this parameter.
#
#   Example: `Creating`
#
# @option opts [String] :display_name A filter to return only rules with descriptions that match the displayName string
#   in this parameter.
#
#   Example: `\"This rule sends a notification upon completion of DbaaS backup.\"`
#
# @option opts [String] :sort_by Specifies the attribute with which to sort the rules.
#
#   Default: `timeCreated`
#
#   * **TIME_CREATED:** Sorts by timeCreated.
#   * **DISPLAY_NAME:** Sorts by displayName.
#   * **ID:** Sorts by id.
#
#   Allowed values are: TIME_CREATED, ID, DISPLAY_NAME
# @option opts [String] :sort_order Specifies sort order.
#
#   * **ASC:** Ascending sort order.
#   * **DESC:** Descending sort order.
#
#   Allowed values are: ASC, DESC
# @option opts [String] :opc_request_id The unique Oracle-assigned 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::Events::Models::RuleSummary RuleSummary}>
# @note Click [here](https://docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/events/list_rules.rb.html) to see an example of how to use list_rules API.
Lists rules for this compartment.
Lists rules for this compartment .
def list_rules(compartment_id, opts = {})
      logger.debug 'Calling operation EventsClient#list_rules.' if logger
      raise "Missing the required parameter 'compartment_id' when calling list_rules." if compartment_id.nil?
      if opts[:lifecycle_state] && !OCI::Events::Models::Rule::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state])
        raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Events::Models::Rule::LIFECYCLE_STATE_ENUM.'
      end
      if opts[:sort_by] && !%w[TIME_CREATED ID DISPLAY_NAME].include?(opts[:sort_by])
        raise 'Invalid value for "sort_by", must be one of TIME_CREATED, ID, DISPLAY_NAME.'
      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 = '/rules'
      operation_signing_strategy = :standard
      query_params = {}
      query_params[:compartmentId] = compartment_id
      query_params[:limit] = opts[:limit] if opts[:limit]
      query_params[:page] = opts[:page] if opts[:page]
      query_params[:lifecycleState] = opts[:lifecycle_state] if opts[:lifecycle_state]
      query_params[:displayName] = opts[:display_name] if opts[:display_name]
      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: 'EventsClient#list_rules') 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::Events::Models::RuleSummary>'
        )
      end
    end
def list_rules ( compartment_id , opts = { } ) logger . debug 'Calling operation EventsClient#list_rules.' if logger raise "Missing the required parameter 'compartment_id' when calling list_rules." if compartment_id . nil? if opts [ :lifecycle_state ] && ! OCI :: Events :: Models :: Rule :: LIFECYCLE_STATE_ENUM . include? ( opts [ :lifecycle_state ] ) raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Events::Models::Rule::LIFECYCLE_STATE_ENUM.' end if opts [ :sort_by ] && ! %w[ TIME_CREATED ID DISPLAY_NAME ] . include? ( opts [ :sort_by ] ) raise 'Invalid value for "sort_by", must be one of TIME_CREATED, ID, DISPLAY_NAME.' 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 = '/rules' operation_signing_strategy = :standard query_params = { } query_params [ :compartmentId ] = compartment_id query_params [ :limit ] = opts [ :limit ] if opts [ :limit ] query_params [ :page ] = opts [ :page ] if opts [ :page ] query_params [ :lifecycleState ] = opts [ :lifecycle_state ] if opts [ :lifecycle_state ] query_params [ :displayName ] = opts [ :display_name ] if opts [ :display_name ] 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 : 'EventsClient#list_rules' ) 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::Events::Models::RuleSummary>' ) end end
Lists rules for this compartment.
Lists rules for this 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::Events::Models::RuleSummary RuleSummary}>
A Response object with data of type Array< { OCI :: Events :: Models :: RuleSummary RuleSummary } >
Response
compartment_id
opts
:opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
: opc_request_id The unique Oracle - assigned 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_rules API.
Click [ here ] to see an example of how to use list_rules API .