-
Notifications
You must be signed in to change notification settings - Fork 20
/
list_snapshot_tags.go
47 lines (38 loc) · 1.62 KB
/
list_snapshot_tags.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
/*******************************************************************************
* IBM Confidential
* OCO Source Materials
* IBM Cloud Container Service, 5737-D43
* (C) Copyright IBM Corp. 2018, 2019 All Rights Reserved.
* The source code for this program is not published or otherwise divested of
* its trade secrets, irrespective of what has been deposited with
* the U.S. Copyright Office.
******************************************************************************/
package vpcvolume
import (
"github.com/IBM/ibmcloud-storage-volume-lib/lib/utils"
"github.com/IBM/ibmcloud-storage-volume-lib/volume-providers/vpc/vpcclient/client"
"github.com/IBM/ibmcloud-storage-volume-lib/volume-providers/vpc/vpcclient/models"
"go.uber.org/zap"
"time"
)
// ListSnapshotTags GETs /volumes/snapshots/tags
func (ss *SnapshotService) ListSnapshotTags(volumeID string, snapshotID string, ctxLogger *zap.Logger) (*[]string, error) {
ctxLogger.Debug("Entry Backend ListSnapshotTags")
defer ctxLogger.Debug("Exit Backend ListSnapshotTags")
defer util.TimeTracker("ListSnapshotTags", time.Now())
operation := &client.Operation{
Name: "ListSnapshotTags",
Method: "GET",
PathPattern: snapshotTagsPath,
}
var tags []string
var apiErr models.Error
request := ss.client.NewRequest(operation)
ctxLogger.Info("Equivalent curl command", zap.Reflect("URL", request.URL()), zap.Reflect("Operation", operation))
req := request.PathParameter(volumeIDParam, volumeID).PathParameter(snapshotIDParam, snapshotID).JSONSuccess(&tags).JSONError(&apiErr)
_, err := req.Invoke()
if err != nil {
return nil, err
}
return &tags, nil
}