-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from newrelic/dev
public-apis
- Loading branch information
Showing
3 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,72 @@ | ||
module NewRelic::Security | ||
# | ||
# This module contains most of the public API methods for the Ruby Security Agent. | ||
# | ||
# @api public | ||
# | ||
module API | ||
def refresh_state() | ||
|
||
# | ||
# Check whether security is enabled | ||
# | ||
# @return [Boolean] true if security is enabled else false | ||
# | ||
# @api public | ||
# | ||
def is_security_active? | ||
NewRelic::Security::Agent.config[:'agent.enabled'] && NewRelic::Security::Agent.config[:enabled] | ||
end | ||
|
||
# | ||
# Manually initializes the security agent | ||
# | ||
# @param [Hash] Unused options Hash | ||
# | ||
# @return [nil] | ||
# | ||
# @api public | ||
# | ||
def manual_start(options = {}) | ||
raise "Options must be a hash" unless Hash === options | ||
NewRelic::Security::Agent.config.enable_security | ||
NewRelic::Security::Agent.agent.init | ||
end | ||
|
||
# | ||
# Deactivates security and stops sending events to security engine | ||
# | ||
# @return [nil] | ||
# | ||
# @api public | ||
# | ||
def deactivate_security | ||
NewRelic::Security::Agent.config.disable_security | ||
end | ||
|
||
def send_event() | ||
# | ||
# Send and event to security engine | ||
# | ||
# @param [NewRelic::Security::Agent::Control::Event] event IAST event to be sent to validator | ||
# | ||
# @return [nil] | ||
# | ||
# @api public | ||
# | ||
def send_event(event) | ||
NewRelic::Security::Agent.agent.event_processor.send_event(event) | ||
end | ||
|
||
def is_security_active() | ||
end | ||
|
||
def send_exit_event | ||
# | ||
# Send and exit event to security engine | ||
# | ||
# @param [NewRelic::Security::Agent::Control::ExitEvent] exit_event IAST exit event for api call to be sent to validator | ||
# | ||
# @return [nil] | ||
# | ||
# @api public | ||
# | ||
def send_exit_event(exit_event) | ||
NewRelic::Security::Agent.agent.event_processor.send_exit_event(exit_event) | ||
end | ||
end | ||
end |