lib/oci/vault/vaults_client.rb
# Lists all secrets in the specified vault and compartment.
# @param [String] compartment_id The OCID of the 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 [String] :name The secret name.
# @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] :opc_request_id 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.
#
# @option opts [String] :sort_by The field to sort by. You can specify only one sort order. The default order for
#   `TIMECREATED` is descending. The default order for `NAME` is ascending.
#    (default to NAME)
#   Allowed values are: TIMECREATED, NAME
# @option opts [String] :sort_order The sort order to use, either ascending (`ASC`) or descending (`DESC`).
#
#   Allowed values are: ASC, DESC
# @option opts [String] :vault_id The OCID of the vault.
# @option opts [String] :lifecycle_state A filter that returns only resources that match the specified lifecycle state. The state value is case-insensitive.
#
# @return [Response] A Response object with data of type Array<{OCI::Vault::Models::SecretSummary SecretSummary}>
# @note Click [here](https://docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/vault/list_secrets.rb.html) to see an example of how to use list_secrets API.
Lists all secrets in the specified vault and compartment.
Lists all secrets in the specified vault and compartment .
def list_secrets(compartment_id, opts = {})
      logger.debug 'Calling operation VaultsClient#list_secrets.' if logger
      raise "Missing the required parameter 'compartment_id' when calling list_secrets." if compartment_id.nil?
      if opts[:sort_by] && !%w[TIMECREATED NAME].include?(opts[:sort_by])
        raise 'Invalid value for "sort_by", must be one of TIMECREATED, 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
      if opts[:lifecycle_state] && !OCI::Vault::Models::SecretSummary::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state])
        raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Vault::Models::SecretSummary::LIFECYCLE_STATE_ENUM.'
      end
      path = '/secrets'
      operation_signing_strategy = :standard
      query_params = {}
      query_params[:compartmentId] = compartment_id
      query_params[:name] = opts[:name] if opts[:name]
      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[:vaultId] = opts[:vault_id] if opts[:vault_id]
      query_params[:lifecycleState] = opts[:lifecycle_state] if opts[:lifecycle_state]
      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: 'VaultsClient#list_secrets') 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::Vault::Models::SecretSummary>'
        )
      end
    end
def list_secrets ( compartment_id , opts = { } ) logger . debug 'Calling operation VaultsClient#list_secrets.' if logger raise "Missing the required parameter 'compartment_id' when calling list_secrets." if compartment_id . nil? if opts [ :sort_by ] && ! %w[ TIMECREATED NAME ] . include? ( opts [ :sort_by ] ) raise 'Invalid value for "sort_by", must be one of TIMECREATED, 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 if opts [ :lifecycle_state ] && ! OCI :: Vault :: Models :: SecretSummary :: LIFECYCLE_STATE_ENUM . include? ( opts [ :lifecycle_state ] ) raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Vault::Models::SecretSummary::LIFECYCLE_STATE_ENUM.' end path = '/secrets' operation_signing_strategy = :standard query_params = { } query_params [ :compartmentId ] = compartment_id query_params [ :name ] = opts [ :name ] if opts [ :name ] 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 [ :vaultId ] = opts [ :vault_id ] if opts [ :vault_id ] query_params [ :lifecycleState ] = opts [ :lifecycle_state ] if opts [ :lifecycle_state ] 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 : 'VaultsClient#list_secrets' ) 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::Vault::Models::SecretSummary>' ) end end
Lists all secrets in the specified vault and compartment.
Lists all secrets in the specified vault and 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::Vault::Models::SecretSummary SecretSummary}>
A Response object with data of type Array< { OCI :: Vault :: Models :: SecretSummary SecretSummary } >
Response
compartment_id
opts
:lifecycle_state A filter that returns only resources that match the specified lifecycle state. The state value is case-insensitive.
: lifecycle_state A filter that returns only resources that match the specified lifecycle state . The state value is case - insensitive .
opts the optional parameters
opts the optional parameters
note
Click [here] to see an example of how to use list_secrets API.
Click [ here ] to see an example of how to use list_secrets API .