-
Notifications
You must be signed in to change notification settings - Fork 1
/
xavm_set_friendly_name_by_ip.go
32 lines (29 loc) · 1.07 KB
/
xavm_set_friendly_name_by_ip.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
package lan
import (
"encoding/xml"
"github.com/nitram509/gofritz/pkg/soap"
"github.com/nitram509/gofritz/pkg/tr064model"
)
// XavmSetFriendlyNameByIP AUTO-GENERATED (do not edit) code from [hostsSCPD],
// based on SOAP action 'X_AVM-DE_SetFriendlyNameByIP', Fritz!Box-System-Version 164.07.57
//
// [hostsSCPD]: http://fritz.box:49000/hostsSCPD.xml
func XavmSetFriendlyNameByIP(session *soap.SoapSession, ipAddress string, avmFriendlyName string) (tr064model.XavmSetFriendlyNameByIPResponse, error) {
fbAction, err := soap.NewSoapRequest(session).
ReqPath("/upnp/control/hosts").
Uri("urn:dslforum-org:service:Hosts:1").
Action("X_AVM-DE_SetFriendlyNameByIP").
AddStringParam("NewIPAddress", ipAddress).
AddStringParam("NewX_AVM-DE_FriendlyName", avmFriendlyName).
Do()
if err != nil {
return tr064model.XavmSetFriendlyNameByIPResponse{}, err
}
bodyData := fbAction.Body.Data
result := tr064model.XavmSetFriendlyNameByIPResponse{}
err = xml.Unmarshal(bodyData, &result)
if err != nil {
return tr064model.XavmSetFriendlyNameByIPResponse{}, err
}
return result, nil
}