-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathset_user_config.go
33 lines (30 loc) · 1.08 KB
/
set_user_config.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
package gateway
import (
"encoding/xml"
"github.com/nitram509/gofritz/pkg/soap"
"github.com/nitram509/gofritz/pkg/tr064model"
)
// SetUserConfig AUTO-GENERATED (do not edit) code from [x_storageSCPD],
// based on SOAP action 'SetUserConfig', Fritz!Box-System-Version 164.08.00
//
// [x_storageSCPD]: http://fritz.box:49000/x_storageSCPD.xml
func SetUserConfig(session *soap.SoapSession, enable bool, password string, avmNetworkAccessReadOnly bool) (tr064model.SetUserConfigResponse, error) {
fbAction, err := soap.NewSoapRequest(session).
ReqPath("/upnp/control/x_storage").
Uri("urn:dslforum-org:service:X_AVM-DE_Storage:1").
Action("SetUserConfig").
AddBoolParam("NewEnable", enable).
AddStringParam("NewPassword", password).
AddBoolParam("NewX_AVM-DE_NetworkAccessReadOnly", avmNetworkAccessReadOnly).
Do()
if err != nil {
return tr064model.SetUserConfigResponse{}, err
}
bodyData := fbAction.Body.Data
result := tr064model.SetUserConfigResponse{}
err = xml.Unmarshal(bodyData, &result)
if err != nil {
return tr064model.SetUserConfigResponse{}, err
}
return result, nil
}