Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pubsub): add support for snapshot labels #6835

Merged
merged 4 commits into from Oct 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions pubsub/snapshot.go
Expand Up @@ -43,17 +43,15 @@ func (s *Snapshot) ID() string {
return s.name[slash+1:]
}

// SetLabels replaces the current set of labels completely with the new set.
// SetLabels set or replaces the labels on a given snapshot.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set -> sets? Clearly I am a dubious provider of docstring advice.

func (s *Snapshot) SetLabels(ctx context.Context, label map[string]string) (*SnapshotConfig, error) {
var fields []string
fields = append(fields, "labels")
sc, err := s.c.subc.UpdateSnapshot(ctx, &pb.UpdateSnapshotRequest{
Snapshot: &pb.Snapshot{
Name: s.name,
Labels: label,
},
UpdateMask: &fmpb.FieldMask{
Paths: fields,
Paths: []string{"labels"},
},
})
if err != nil {
Expand Down