-
Notifications
You must be signed in to change notification settings - Fork 4
/
endpoint_stop_replication_service.go
99 lines (73 loc) · 3.34 KB
/
endpoint_stop_replication_service.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package isegosdk
import (
"fmt"
"github.com/go-resty/resty/v2"
)
type EndpointStopReplicationServiceService service
type ResponseEndpointStopReplicationServiceGetStopReplicationStatus struct {
Response *ResponseEndpointStopReplicationServiceGetStopReplicationStatusResponse `json:"response,omitempty"` //
Version string `json:"version,omitempty"` //
}
type ResponseEndpointStopReplicationServiceGetStopReplicationStatusResponse struct {
IsEnabled *bool `json:"isEnabled,omitempty"` //
}
type ResponseEndpointStopReplicationServiceSetStopReplicationService struct {
Success *ResponseEndpointStopReplicationServiceSetStopReplicationServiceSuccess `json:"success,omitempty"` //
Version string `json:"version,omitempty"` //
}
type ResponseEndpointStopReplicationServiceSetStopReplicationServiceSuccess struct {
Message string `json:"message,omitempty"` //
}
type RequestEndpointStopReplicationServiceSetStopReplicationService struct {
IsEnabled *bool `json:"isEnabled,omitempty"` //
}
//GetStopReplicationStatus Retrieve the status of Endpoint stop replication Service
/* This API retrieves the status of Endpoint stop replication Service
*/
func (s *EndpointStopReplicationServiceService) GetStopReplicationStatus() (*ResponseEndpointStopReplicationServiceGetStopReplicationStatus, *resty.Response, error) {
setHost(s.client, "_ui")
path := "/api/v1/stop-replication"
setCSRFToken(s.client)
response, err := s.client.R().
SetHeader("Content-Type", "application/json").
SetHeader("Accept", "application/json").
SetResult(&ResponseEndpointStopReplicationServiceGetStopReplicationStatus{}).
SetError(&Error).
Get(path)
if err != nil {
return nil, nil, err
}
if response.IsError() {
return nil, response, fmt.Errorf("error with operation GetStopReplicationStatus")
}
getCSFRToken(response.Header())
result := response.Result().(*ResponseEndpointStopReplicationServiceGetStopReplicationStatus)
return result, response, err
}
//SetStopReplicationService Update the status of Endpoint stop replication Service
/* This API updates the status of Endpoint stop replication Service.
*/
func (s *EndpointStopReplicationServiceService) SetStopReplicationService(requestEndpointStopReplicationServiceSetStopReplicationService *RequestEndpointStopReplicationServiceSetStopReplicationService) (*ResponseEndpointStopReplicationServiceSetStopReplicationService, *resty.Response, error) {
setHost(s.client, "_ui")
path := "/api/v1/stop-replication"
setCSRFToken(s.client)
response, err := s.client.R().
SetHeader("Content-Type", "application/json").
SetHeader("Accept", "application/json").
SetBody(requestEndpointStopReplicationServiceSetStopReplicationService).
SetResult(&ResponseEndpointStopReplicationServiceSetStopReplicationService{}).
SetError(&Error).
Put(path)
if err != nil {
if err.Error() == emptyStringToJSONError {
return &ResponseEndpointStopReplicationServiceSetStopReplicationService{}, response, nil
}
return nil, nil, err
}
if response.IsError() {
return nil, response, fmt.Errorf("error with operation SetStopReplicationService")
}
getCSFRToken(response.Header())
result := response.Result().(*ResponseEndpointStopReplicationServiceSetStopReplicationService)
return result, response, err
}