lib/oci/announcements_service/announcement_client.rb
# Gets a list of announcements for the current tenancy.
#
# @param [String] compartment_id The OCID of the compartment. Because announcements are specific to a tenancy, this is the
#   OCID of the root 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 [Integer] :limit The maximum number of items to return in a paginated \"List\" call.
# @option opts [String] :page The value of the `opc-next-page` response header from the previous \"List\" call.
# @option opts [String] :announcement_type The type of announcement.
# @option opts [String] :lifecycle_state The announcement's current lifecycle state.
#   Allowed values are: ACTIVE, INACTIVE
# @option opts [BOOLEAN] :is_banner Whether the announcement is displayed as a console banner.
# @option opts [String] :sort_by The criteria to sort by. You can specify only one sort order.
#
#   Allowed values are: timeOneValue, timeTwoValue, timeCreated, referenceTicketNumber, summary, announcementType
# @option opts [String] :sort_order The sort order to use. (Sorting by `announcementType` orders the announcements list according to importance.)
#
#   Allowed values are: ASC, DESC
# @option opts [DateTime] :time_one_earliest_time The boundary for the earliest `timeOneValue` date on announcements that you want to see.
# @option opts [DateTime] :time_one_latest_time The boundary for the latest `timeOneValue` date on announcements that you want to see.
# @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 complete request ID.
#
# @return [Response] A Response object with data of type {OCI::AnnouncementsService::Models::AnnouncementsCollection AnnouncementsCollection}
# @note Click [here](https://docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/announcementsservice/list_announcements.rb.html) to see an example of how to use list_announcements API.
Gets a list of announcements for the current tenancy.
Gets a list of announcements for the current tenancy .
def list_announcements(compartment_id, opts = {})
      logger.debug 'Calling operation AnnouncementClient#list_announcements.' if logger
      raise "Missing the required parameter 'compartment_id' when calling list_announcements." if compartment_id.nil?
      if opts[:lifecycle_state] && !%w[ACTIVE INACTIVE].include?(opts[:lifecycle_state])
        raise 'Invalid value for "lifecycle_state", must be one of ACTIVE, INACTIVE.'
      end
      if opts[:sort_by] && !%w[timeOneValue timeTwoValue timeCreated referenceTicketNumber summary announcementType].include?(opts[:sort_by])
        raise 'Invalid value for "sort_by", must be one of timeOneValue, timeTwoValue, timeCreated, referenceTicketNumber, summary, announcementType.'
      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 = '/announcements'
      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[:announcementType] = opts[:announcement_type] if opts[:announcement_type]
      query_params[:lifecycleState] = opts[:lifecycle_state] if opts[:lifecycle_state]
      query_params[:isBanner] = opts[:is_banner] if !opts[:is_banner].nil?
      query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
      query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]
      query_params[:timeOneEarliestTime] = opts[:time_one_earliest_time] if opts[:time_one_earliest_time]
      query_params[:timeOneLatestTime] = opts[:time_one_latest_time] if opts[:time_one_latest_time]
      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: 'AnnouncementClient#list_announcements') 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: 'OCI::AnnouncementsService::Models::AnnouncementsCollection'
        )
      end
    end
def list_announcements ( compartment_id , opts = { } ) logger . debug 'Calling operation AnnouncementClient#list_announcements.' if logger raise "Missing the required parameter 'compartment_id' when calling list_announcements." if compartment_id . nil? if opts [ :lifecycle_state ] && ! %w[ ACTIVE INACTIVE ] . include? ( opts [ :lifecycle_state ] ) raise 'Invalid value for "lifecycle_state", must be one of ACTIVE, INACTIVE.' end if opts [ :sort_by ] && ! %w[ timeOneValue timeTwoValue timeCreated referenceTicketNumber summary announcementType ] . include? ( opts [ :sort_by ] ) raise 'Invalid value for "sort_by", must be one of timeOneValue, timeTwoValue, timeCreated, referenceTicketNumber, summary, announcementType.' 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 = '/announcements' 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 [ :announcementType ] = opts [ :announcement_type ] if opts [ :announcement_type ] query_params [ :lifecycleState ] = opts [ :lifecycle_state ] if opts [ :lifecycle_state ] query_params [ :isBanner ] = opts [ :is_banner ] if ! opts [ :is_banner ] . nil? query_params [ :sortBy ] = opts [ :sort_by ] if opts [ :sort_by ] query_params [ :sortOrder ] = opts [ :sort_order ] if opts [ :sort_order ] query_params [ :timeOneEarliestTime ] = opts [ :time_one_earliest_time ] if opts [ :time_one_earliest_time ] query_params [ :timeOneLatestTime ] = opts [ :time_one_latest_time ] if opts [ :time_one_latest_time ] 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 : 'AnnouncementClient#list_announcements' ) 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 : 'OCI::AnnouncementsService::Models::AnnouncementsCollection' ) end end
Gets a list of announcements for the current tenancy.
Gets a list of announcements for the current tenancy .
# 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::AnnouncementsService::Models::AnnouncementsCollection AnnouncementsCollection}
A Response object with data of type { OCI :: AnnouncementsService :: Models :: AnnouncementsCollection AnnouncementsCollection }
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 complete 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 complete request ID .
opts the optional parameters
opts the optional parameters
note
Click [here] to see an example of how to use list_announcements API.
Click [ here ] to see an example of how to use list_announcements API .