forked from hpe-storage/nimble-golang-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filters.go
40 lines (33 loc) · 1013 Bytes
/
filters.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
// Copyright 2020 Hewlett Packard Enterprise Development LP
package main
import (
"fmt"
"github.com/hpe-storage/nimble-golang-sdk/pkg/client/v1/nimbleos"
"github.com/hpe-storage/nimble-golang-sdk/pkg/param"
"github.com/hpe-storage/nimble-golang-sdk/pkg/service"
)
func main() {
// login to Array, get groupService instance
groupService, err := service.NewNsGroupService("1.1.1.1", "xxx", "xxx", "v1", false)
if err != nil {
fmt.Printf("NewGroupService(): Unable to connect to group, err: %v", err.Error())
}
defer groupService.LogoutService()
// set debug
groupService.SetDebug()
// get volume service instance
volSvc := groupService.GetVolumeService()
// init param
sfilter := ¶m.GetParams{}
// set search filter
f := ¶m.SearchFilter{
FieldName: nimbleos.VolumeFields.Name,
Operator: param.EQUALS.String(),
Value: "GetVolume",
}
// apply the filter
sfilter.WithSearchFilter(f)
//GetVolumes
volumes, err := volSvc.GetVolumes(sfilter)
fmt.Printf("%v", volumes)
}