/
configuration_archive.go
52 lines (39 loc) · 1.77 KB
/
configuration_archive.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
package dnac
import (
"fmt"
"github.com/go-resty/resty/v2"
)
type ConfigurationArchiveService service
type ResponseConfigurationArchiveExportDeviceConfigurations struct {
Response *ResponseConfigurationArchiveExportDeviceConfigurationsResponse `json:"response,omitempty"` //
Version string `json:"version,omitempty"` // Version
}
type ResponseConfigurationArchiveExportDeviceConfigurationsResponse struct {
TaskID string `json:"taskId,omitempty"` // Task Id
URL string `json:"url,omitempty"` // Url
}
type RequestConfigurationArchiveExportDeviceConfigurations struct {
DeviceID []string `json:"deviceId,omitempty"` // Device Id
Password string `json:"password,omitempty"` // Password
}
//ExportDeviceConfigurations Export Device configurations - 51a4-0aba-4c68-ac17
/* Export Device configurations to an encrypted zip file.
*/
func (s *ConfigurationArchiveService) ExportDeviceConfigurations(requestConfigurationArchiveExportDeviceConfigurations *RequestConfigurationArchiveExportDeviceConfigurations) (*ResponseConfigurationArchiveExportDeviceConfigurations, *resty.Response, error) {
path := "/dna/intent/api/v1/network-device-archive/cleartext"
response, err := s.client.R().
SetHeader("Content-Type", "application/json").
SetHeader("Accept", "application/json").
SetBody(requestConfigurationArchiveExportDeviceConfigurations).
SetResult(&ResponseConfigurationArchiveExportDeviceConfigurations{}).
SetError(&Error).
Post(path)
if err != nil {
return nil, nil, err
}
if response.IsError() {
return nil, response, fmt.Errorf("error with operation ExportDeviceConfigurations")
}
result := response.Result().(*ResponseConfigurationArchiveExportDeviceConfigurations)
return result, response, err
}