-
Notifications
You must be signed in to change notification settings - Fork 103
Using Shared Credentials
Here's a walk-through of how to use Shared Credentials, as of version 0.5.1 of the gem.
In order to keep verbosity to a minimum, all of the examples assume that the Nexpose module has been included:
include Nexpose
As with all uses of the gem, in order to interact with a Nexpose console you will need an active, valid connection. The following line can be assumed for all code below:
nsc = Connection.new('10.2.0.1', 'nxadmin', 'secret-password')
nsc.login
This will get an Array of all existing credentials. This is just a summary of each credential
nsc.shared_credentials
Load in the configuration details of a credential. This can be used to modify the existing cred.
Note that when password information has already been saved, it is not transfered as part of this request. If the credential is saved without password details, they will be preserved on the console. You should only set password information if it is changing.
Here we add site 42 to the list of sites this shared credential is applied to.
cred = SharedCredential.load(nsc, 13)
cred.sites << 42
cred.save(nsc)
Project Home 🔹 Release Notes 🔹 Wiki 🔹 Issues 🔹 Pull Requests