Module: Auth0::Api::V2::LogStreams

Included in:
Auth0::Api::V2
Defined in:
lib/auth0/api/v2/log_streams.rb

Overview

Methods to use the log streams endpoints

Instance Method Summary collapse

Instance Method Details

#create_log_stream(name, type, options) ⇒ json

Creates a new log stream according to the JSON object received in body.

Parameters:

  • name (string)

    The name of the log stream.

  • type (string)

    The type of log stream

  • options (hash)

    The Hash options used to define the log streams’s properties.

Returns:

  • (json)

    Returns the log stream.

Raises:

See Also:



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/auth0/api/v2/log_streams.rb', line 35

def create_log_stream(name, type, options)
  raise Auth0::InvalidParameter, 'Name must contain at least one character' if name.to_s.empty?
  raise Auth0::InvalidParameter, 'Must specify a valid type' if type.to_s.empty?
  raise Auth0::InvalidParameter, 'Must supply a valid hash for options' unless options.is_a? Hash

  request_params = {}
  request_params[:name] = name
  request_params[:type] = type
  request_params[:sink] = options
  post(log_streams_path, request_params)
end

#delete_log_stream(id) ⇒ Object

Deletes a log stream by its ID.

Parameters:

  • id (string)

    The id of the log stream to delete.

Raises:

See Also:



50
51
52
53
54
# File 'lib/auth0/api/v2/log_streams.rb', line 50

def delete_log_stream(id)
  raise Auth0::InvalidParameter, 'Must supply a valid log stream id' if id.to_s.empty?
  path = "#{log_streams_path}/#{id}"
  delete(path)
end

#log_stream(id) ⇒ json Also known as: get_log_stream

Retrieves a log stream by its ID.

Parameters:

  • id (string)

    The id of the log stream to retrieve.

Returns:

  • (json)

    Returns the log stream.

Raises:

See Also:



21
22
23
24
25
# File 'lib/auth0/api/v2/log_streams.rb', line 21

def log_stream(id)
  raise Auth0::InvalidParameter, 'Must supply a valid log stream id' if id.to_s.empty?
  path = "#{log_streams_path}/#{id}"
  get(path)
end

#log_streamsjson Also known as: get_log_streams

Retrieves a list of all log streams.

Returns:

  • (json)

    Returns the log streams.

See Also:



11
12
13
# File 'lib/auth0/api/v2/log_streams.rb', line 11

def log_streams()
  get(log_streams_path)
end

#patch_log_stream(id, status) ⇒ Object

Updates a log stream.

Parameters:

  • id (string)

    The id or audience of the log stream to update.

  • status (string)

    The Hash options used to define the log streams’s properties.

Raises:

See Also:



60
61
62
63
64
65
66
67
68
# File 'lib/auth0/api/v2/log_streams.rb', line 60

def patch_log_stream(id, status)
  raise Auth0::InvalidParameter, 'Must specify a log stream id' if id.to_s.empty?
  raise Auth0::InvalidParameter, 'Must specify a valid status' if status.to_s.empty?

  request_params = {}
  request_params[:status] = status
  path = "#{log_streams_path}/#{id}"
  patch(path, request_params)
end