You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
876 B
40 lines
876 B
package node
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
)
|
|
|
|
// GetSSHIdentityRequest struct to get node ssh information
|
|
type GetSSHIdentityRequest struct {
|
|
// Node ID
|
|
// Required: true
|
|
NID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
|
}
|
|
|
|
// GetSSHIdentity gets node ssh information
|
|
func (n Node) GetSSHIdentity(ctx context.Context, req GetSSHIdentityRequest) (*SSHIdentity, error) {
|
|
if err := validators.ValidateRequest(req); err != nil {
|
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
|
}
|
|
|
|
url := "/cloudbroker/node/get_ssh_identity"
|
|
|
|
res, err := n.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
info := SSHIdentity{}
|
|
|
|
err = json.Unmarshal(res, &info)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &info, nil
|
|
}
|