Skip to content
Snippets Groups Projects
Commit 127ec06f authored by Florent Gluck's avatar Florent Gluck
Browse files

added minor comments

parent dbeadf58
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ func New(host string) (*NexusClient, error) {
}
// Authenticate a user.
// curl --cacert ca-cert.pem -X POST https://localhost:8000/login -H 'Content-Type: application/json' -d '{"email": "johndoe@nexus.org", "pwd":"pipomolo"}'
// curl -X POST https://localhost:8000/login -H 'Content-Type: application/json' -d '{"email": "janedoe@nexus.org", "pwd":"pipomolo"}'
// Returns an JWT token if authentication succeeded or an error if it failed.
// IMPORTANT: caller MUST call the Cleanup() function before exiting!
func (nc *NexusClient) Authenticate(user, pwd string) (string, error) {
......@@ -73,8 +73,7 @@ func (nc *NexusClient) Authenticate(user, pwd string) (string, error) {
}
}
// "Authenticate" by using an already established connection using a previously received token.
// Useful when wanting to access the API without authenticating.
// "Authenticate" by using an already established connection using a previously received token (typically with the Authenticate method).
// IMPORTANT: caller MUST call the Cleanup() function before exiting!
func (nc *NexusClient) AuthenticateWithToken(token string) error {
nc.client.SetAuthToken(token)
......@@ -125,6 +124,10 @@ func (nc *NexusClient) RefreshToken() error {
}
}
//========================================================================================
// Private methods
//========================================================================================
func (nc *NexusClient) getVMAttachCertFile() string {
return nc.certFile
}
......
......@@ -139,6 +139,10 @@ func (nc *NexusClient) GetUsers() ([]params.UserWithoutPwd, error) {
}
}
//========================================================================================
// Private methods
//========================================================================================
// Deserialize a list of users from an http response (no filtering).
func deserializeUsers(resp *resty.Response) ([]params.UserWithoutPwd, error) {
users := []params.UserWithoutPwd{}
......
......@@ -25,7 +25,7 @@ const (
)
//========================================================================================
// Public functions
// Public methods
//========================================================================================
func (nc *NexusClient) VMCreate(p params.VMCreate) (*vm.VMNetworkSerialized, error) {
......@@ -313,7 +313,7 @@ func (nc *NexusClient) GetListVM(vmID string) (*vm.VMNetworkSerialized, error) {
}
//========================================================================================
// Private functions
// Private methods
//========================================================================================
func (nc *NexusClient) vmGetSpiceCreds(vmID string, p params.VMAttachCreds) (*vm.VMSpiceCredentialsSerialized, error) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment