Skip to content

Commit 422fd58

Browse files
committed
feat(sfs) print snaplockExpiryTime for update cmd
1 parent 2d1e7f8 commit 422fd58

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

internal/cmd/beta/sfs/snapshot/update/update.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ func outputResult(p *print.Printer, outputFormat, snapshotLabel, resourcePoolLab
146146
snapshotLabel,
147147
resourcePoolLabel,
148148
)
149+
150+
if resp.ResourcePoolSnapshot.SnaplockExpiryTime.IsSet() && resp.ResourcePoolSnapshot.SnaplockExpiryTime.Get() != nil {
151+
p.Outputf("Snaplock expiry time: %s\n", utils.ConvertTimePToDateTimeString(resp.ResourcePoolSnapshot.SnaplockExpiryTime.Get()))
152+
}
153+
149154
return nil
150155
})
151156
}

internal/cmd/beta/sfs/snapshot/update/update_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package update
33
import (
44
"context"
55
"testing"
6+
"time"
67

78
"github.com/google/go-cmp/cmp"
89
"github.com/google/go-cmp/cmp/cmpopts"
@@ -235,6 +236,17 @@ func TestOutputResult(t *testing.T) {
235236
},
236237
wantErr: false,
237238
},
239+
{
240+
name: "set snaplock expiry time",
241+
args: args{
242+
resp: &sfs.UpdateResourcePoolSnapshotResponse{
243+
ResourcePoolSnapshot: &sfs.ResourcePoolSnapshot{
244+
SnaplockExpiryTime: *sfs.NewNullableTime(utils.Ptr(time.Now())),
245+
},
246+
},
247+
},
248+
wantErr: false,
249+
},
238250
}
239251
params := testparams.NewTestParams()
240252

0 commit comments

Comments
 (0)