lib/oci/ons/notification_data_plane_client.rb
# Publishes a message to the specified topic. For more information about publishing messages, see [Publishing Messages](https://docs.cloud.oracle.com/iaas/Content/Notification/Tasks/publishingmessages.htm).
#
# @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 Type of message body in the request. Default value: JSON.
#    (default to JSON)
#   Allowed values are: JSON, RAW_TEXT
# @return [Response] A Response object with data of type {OCI::Ons::Models::PublishResult PublishResult}
Publishes a message to the specified topic. For more information about publishing messages, see [Publishing Messages].
Publishes a message to the specified topic . For more information about publishing messages see [ Publishing Messages ] .
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 Type of message body in the request. Default value: JSON. (default to JSON) Allowed values are: JSON, RAW_TEXT
: message_type Type of message body in the request . Default value : JSON . ( default to JSON ) Allowed values are : JSON RAW_TEXT
opts the optional parameters
opts the optional parameters