pepabo/go-netapp

Can you share some usage examples?

cdhunt opened this issue · 4 comments

I'm testing with this code.

options := &netapp.ClientOptions{
    BasicAuthUser: `user`,
    BasicAuthPassword: `pass`,
    SSLVerify: false,
}

client := netapp.NewClient("https://filer", "1.1", options)

voloptions := &netapp.VolumeOptions{}

vlresponse, hresponse, err := client.Volume.List(voloptions)

I get the following response.

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE netapp SYSTEM '/na_admin/netapp_filer.dtd'>
<netapp version='1.1' xmlns='http://www.netapp.com/filer/admin'>
<results status="failed" reason="Unable to find API: volume-get-iter" errno="13005"/></netapp>

Hi!
I still have implemented only the method I use, but I think that the answer to the question works with the following test code.

package main

import (
	"fmt"

	"github.com/pepabo/go-netapp/netapp"
)

func main() {
	c := netapp.NewClient("https://your-management-ip/", "1.20", &netapp.ClientOptions{
		BasicAuthUser:     "user",
		BasicAuthPassword: "password",
		SSLVerify:         false,
	})

	sp, _, _ := c.Volume.List(nil)
	fmt.Println(sp)
}
$ DEBUG=1 go run client.go
response xml ====================================
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE netapp SYSTEM 'file:/etc/netapp_gx.dtd'>
<netapp version='1.110' xmlns='http://www.netapp.com/filer/admin'>
<results status="passed"><attributes-list><volume-attributes>

That does not work for me. I guess it's a NetApp version issue. 🙁

It may be so. It seems better to make the specification changeable in version.
https://github.com/pepabo/go-netapp/blob/master/netapp/netapp.go#L79

Confirmed 7mode API is different even though the version and xmlns are the same.