lib/oci/ons/notification_data_plane_client.rb
def publish_message(topic_id, message_details, opts = {})
      logger.debug 'Calling operation NotificationDataPlaneClient#publish_message.' if logger

      raise "Missing the required parameter 'topic_id' when calling publish_message." if topic_id.nil?
      raise "Missing the required parameter 'message_details' when calling publish_message." if message_details.nil?

      if opts[:message_type] && !%w[JSON RAW_TEXT].include?(opts[:message_type])
        raise 'Invalid value for "message_type", must be one of JSON, RAW_TEXT.'
      end
      raise "Parameter value for 'topic_id' must not be blank" if OCI::Internal::Util.blank_string?(topic_id)

      path = '/topics/{topicId}/messages'.sub('{topicId}', topic_id.to_s)
      operation_signing_strategy = :standard

      # rubocop:disable Style/NegatedIf
      # Query Params
      query_params = {}

      # 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]
      header_params[:messagetype] = opts[:message_type] if opts[:message_type]
      # rubocop:enable Style/NegatedIf

      post_body = @api_client.object_to_http_body(message_details)

      # rubocop:disable Metrics/BlockLength
      OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'NotificationDataPlaneClient#publish_message') do
        @api_client.call_api(
          :POST,
          path,
          endpoint,
          header_params: header_params,
          query_params: query_params,
          operation_signing_strategy: operation_signing_strategy,
          body: post_body,
          return_type: 'OCI::Ons::Models::PublishResult'
        )
      end
      # rubocop:enable Metrics/BlockLength
    end
# Publishes a message to the specified topic.
#
# The topic endpoint is required for this operation.
# To get the topic endpoint, use {#get_topic get_topic}
# and review the `apiEndpoint` value in the response ({NotificationTopic}).
#
# Limits information follows.
#
# Message size limit per request: 64KB.
#
# Message delivery rate limit per endpoint: 60 messages per minute for HTTP-based protocols, 10 messages per minute for the `EMAIL` protocol.
# HTTP-based protocols use URL endpoints that begin with \"http:\" or \"https:\".
#
# Transactions Per Minute (TPM) per-tenancy limit for this operation: 60 per topic. (This TPM limit represents messages per minute.)
#
# For more information about publishing messages, see [Publishing Messages](https://docs.cloud.oracle.com/iaas/Content/Notification/Tasks/publishingmessages.htm).
# For steps to request a limit increase, see [Requesting a Service Limit Increase](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/servicelimits.htm#three).
#
# @param [String] topic_id The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the topic.
#
# @param [OCI::Ons::Models::MessageDetails] message_details The message to publish.
# @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] :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.
#
# @option opts [String] :message_type **Deprecated.**
#   Support for JSON is deprecated.
#   You can send a JSON payload even when transmitting the payload as a raw string.
#   Configure your receiving system to read the raw payload as JSON format.
#
#   Type of message body in the request.
#   For `messageType` of JSON, a default key-value pair is required. Example: `{\"default\": \"Alarm breached\", \"Email\": \"Alarm breached: <url>\"}.`
#    (default to RAW_TEXT)
#   Allowed values are: JSON, RAW_TEXT
# @return [Response] A Response object with data of type {OCI::Ons::Models::PublishResult PublishResult}
# @note Click [here](https://docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/ons/publish_message.rb.html) to see an example of how to use publish_message API.
Publishes a message to the specified topic.
The topic endpoint is required for this operation.
To get the topic endpoint, use {#get_topic get_topic}
and review the `apiEndpoint` value in the response ({NotificationTopic}).

Limits information follows.

Message size limit per request: 64KB.

Message delivery rate limit per endpoint: 60 messages per minute for HTTP-based protocols, 10 messages per minute for the `EMAIL` protocol.
HTTP-based protocols use URL endpoints that begin with \"http:\" or \"https:\".

Transactions Per Minute (TPM) per-tenancy limit for this operation: 60 per topic. (This TPM limit represents messages per minute.)

For more information about publishing messages, see [Publishing Messages].
For steps to request a limit increase, see [Requesting a Service Limit Increase].
Publishes a message to the specified topic . The topic endpoint is required for this operation . To get the topic endpoint use { #get_topic get_topic } and review the ` apiEndpoint ` value in the response ( { NotificationTopic } ) . Limits information follows . Message size limit per request : 64KB . Message delivery rate limit per endpoint : 60 messages per minute for HTTP - based protocols 10 messages per minute for the ` EMAIL ` protocol . HTTP - based protocols use URL endpoints that begin with \ " http : \ " or \ " https : \ " . Transactions Per Minute ( TPM ) per - tenancy limit for this operation : 60 per topic . ( This TPM limit represents messages per minute . ) For more information about publishing messages see [ Publishing Messages ] . For steps to request a limit increase see [ Requesting a Service Limit Increase ] .
def publish_message(topic_id, message_details, opts = {})
      logger.debug 'Calling operation NotificationDataPlaneClient#publish_message.' if logger
      raise "Missing the required parameter 'topic_id' when calling publish_message." if topic_id.nil?
      raise "Missing the required parameter 'message_details' when calling publish_message." if message_details.nil?
      if opts[:message_type] && !%w[JSON RAW_TEXT].include?(opts[:message_type])
        raise 'Invalid value for "message_type", must be one of JSON, RAW_TEXT.'
      end
      raise "Parameter value for 'topic_id' must not be blank" if OCI::Internal::Util.blank_string?(topic_id)
      path = '/topics/{topicId}/messages'.sub('{topicId}', topic_id.to_s)
      operation_signing_strategy = :standard
      query_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]
      header_params[:messagetype] = opts[:message_type] if opts[:message_type]
      post_body = @api_client.object_to_http_body(message_details)
      OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'NotificationDataPlaneClient#publish_message') do
        @api_client.call_api(
          :POST,
          path,
          endpoint,
          header_params: header_params,
          query_params: query_params,
          operation_signing_strategy: operation_signing_strategy,
          body: post_body,
          return_type: 'OCI::Ons::Models::PublishResult'
        )
      end
    end
def publish_message ( topic_id , message_details , opts = { } ) logger . debug 'Calling operation NotificationDataPlaneClient#publish_message.' if logger raise "Missing the required parameter 'topic_id' when calling publish_message." if topic_id . nil? raise "Missing the required parameter 'message_details' when calling publish_message." if message_details . nil? if opts [ :message_type ] && ! %w[ JSON RAW_TEXT ] . include? ( opts [ :message_type ] ) raise 'Invalid value for "message_type", must be one of JSON, RAW_TEXT.' end raise "Parameter value for 'topic_id' must not be blank" if OCI :: Internal :: Util . blank_string? ( topic_id ) path = '/topics/{topicId}/messages' . sub ( '{topicId}' , topic_id . to_s ) operation_signing_strategy = :standard query_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 ] header_params [ :messagetype ] = opts [ :message_type ] if opts [ :message_type ] post_body = @api_client . object_to_http_body ( message_details ) OCI :: Retry . make_retrying_call ( applicable_retry_config ( opts ) , call_name : 'NotificationDataPlaneClient#publish_message' ) do @api_client . call_api ( :POST , path , endpoint , header_params : header_params , query_params : query_params , operation_signing_strategy : operation_signing_strategy , body : post_body , return_type : 'OCI::Ons::Models::PublishResult' ) end end
Publishes a message to the specified topic.
Publishes a message to the specified topic .
# 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 {OCI::Ons::Models::PublishResult PublishResult}
A Response object with data of type { OCI :: Ons :: Models :: PublishResult PublishResult }
Response
topic_id
message_details
opts
:message_type **Deprecated. Support for JSON is deprecated. You can send a JSON payload even when transmitting the payload as a raw string. Configure your receiving system to read the raw payload as JSON format. Type of message body in the request. For `messageType` of JSON, a default key-value pair is required. Example: `{\"default\": \"Alarm breached\", \"Email\": \"Alarm breached: \"}.` (default to RAW_TEXT) Allowed values are: JSON, RAW_TEXT
: message_type ** Deprecated . Support for JSON is deprecated . You can send a JSON payload even when transmitting the payload as a raw string . Configure your receiving system to read the raw payload as JSON format . Type of message body in the request . For ` messageType ` of JSON a default key - value pair is required . Example : ` { \ " default \ " : \ " Alarm breached \ " \ " Email \ " : \ " Alarm breached : \ " } . ` ( default to RAW_TEXT ) Allowed values are : JSON RAW_TEXT
opts the optional parameters
opts the optional parameters
note
Click [here] to see an example of how to use publish_message API.
Click [ here ] to see an example of how to use publish_message API .