/
sync_ise_node.go
51 lines (38 loc) · 1.42 KB
/
sync_ise_node.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package isegosdk
import (
"fmt"
"github.com/go-resty/resty/v2"
)
type SyncIseNodeService service
type ResponseSyncIseNodeSyncNode struct {
Code *int `json:"code,omitempty"` //
Message string `json:"message,omitempty"` //
RootCause string `json:"rootCause,omitempty"` //
}
type RequestSyncIseNodeSyncNode struct {
Hostname string `json:"hostname,omitempty"` //
}
//SyncNode API to trigger manual sync of the node this API is invoked on
/* Performing a manual sync will involve a reload of the target node, but not the primary PAN. There might be situations where if the node has been out of sync for a long time, it may not be possible to recover via a manual sync.
*/
func (s *SyncIseNodeService) SyncNode(requestSyncIseNodeSyncNode *RequestSyncIseNodeSyncNode) (*ResponseSyncIseNodeSyncNode, *resty.Response, error) {
setHost(s.client, "_ui")
path := "/api/v1/deployment/sync-node"
setCSRFToken(s.client)
response, err := s.client.R().
SetHeader("Content-Type", "application/json").
SetHeader("Accept", "application/json").
SetBody(requestSyncIseNodeSyncNode).
SetResult(&ResponseSyncIseNodeSyncNode{}).
SetError(&Error).
Post(path)
if err != nil {
return nil, nil, err
}
getCSFRToken(response.Header())
if response.IsError() {
return nil, response, fmt.Errorf("error with operation SyncNode")
}
result := response.Result().(*ResponseSyncIseNodeSyncNode)
return result, response, err
}