Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DHCP Protocol/Type constants to the DiscoveryConnection class #164

Merged
merged 1 commit into from
Apr 28, 2015

Conversation

erran-r7
Copy link
Contributor

Example

require 'nexpose'

###
# NOTE: These definitions will no longer be required once the gem has been released with the changes from this pull request.
unless defined?(Nexpose::DiscoveryConnection::Protocol::SERVICE_PROXY)
  Nexpose::DiscoveryConnection::Protocol::SERVICE_PROXY = 'SERVICE_PROXY'
end

unless defined?(Nexpose::DiscoveryConnection::Type::DHCP_SERVICE)
  Nexpose::DiscoveryConnection::Type::DHCP_SERVICE = 'DHCP_SERVICE'
end
#
###

nexpose_connection = Nexpose::Connection.new(hostname, nexpose_user, nexpose_password)

discovery_connection = Nexpose::DiscoveryConnection.new(
  connection_name,
  log_directory,
  cifs_user,
  cifs_password
)
engine = nexpose_connection.engines.find { |connection| connection.name.eql?('Local scan engine') }
discovery_connection.engine_id = engine.id
discovery_connection.protocol = Nexpose::DiscoveryConnection::Protocol::SERVICE_PROXY
discovery_connection.type = Nexpose::DiscoveryConnection::Type::DHCP_SERVICE

# Save a new DHCP discovery connection
discovery_connection.save(nexpose_connection)

# Delete a DHCP discovery connection
discovery_connection.delete(nexpose_connection)

@erran-r7 erran-r7 changed the title Add DiscoveryConnection::Protocol/DiscoveryConnection::Type constants Add DHCP Protocol/Type constants to the DiscoveryConnection class Apr 28, 2015
gschneider-r7 added a commit that referenced this pull request Apr 28, 2015
Add DHCP Protocol/Type constants to the DiscoveryConnection class
@gschneider-r7 gschneider-r7 merged commit 5886b0b into master Apr 28, 2015
@gschneider-r7
Copy link
Contributor

TODO: Put the example in the wiki somewhere 😄

@gschneider-r7 gschneider-r7 deleted the add-dhcp-constants branch April 28, 2015 19:48
@gschneider-r7
Copy link
Contributor

Wiki updated, but needs more work https://github.com/rapid7/nexpose-client/wiki/Using-Discovery-Connections

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants