Skip to content

Commit

Permalink
SnapshotDeleteRequest use []string instead of string
Browse files Browse the repository at this point in the history
Signed-off-by: Jakob Hahn <[email protected]>
  • Loading branch information
Jakob3xD committed Mar 2, 2023
1 parent 3e065d1 commit d08fffd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Bumps `github.com/aws/aws-sdk-go` from 1.44.45 to 1.44.132

### Changed
- SnapshotDeleteRequest use []string instead of string ([#237](https://github.com/opensearch-project/opensearch-go/pull/237))
- Workflow improvements ([#242](https://github.com/opensearch-project/opensearch-go/pull/242))

### Deprecated
Expand All @@ -40,4 +41,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Security


[Unreleased]: https://github.com/opensearch-project/opensearch-go/compare/2.1...HEAD
[Unreleased]: https://github.com/opensearch-project/opensearch-go/compare/2.1...HEAD
10 changes: 5 additions & 5 deletions opensearchapi/api.snapshot.delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
)

func newSnapshotDeleteFunc(t Transport) SnapshotDelete {
return func(repository string, snapshot string, o ...func(*SnapshotDeleteRequest)) (*Response, error) {
return func(repository string, snapshot []string, o ...func(*SnapshotDeleteRequest)) (*Response, error) {
var r = SnapshotDeleteRequest{Repository: repository, Snapshot: snapshot}
for _, f := range o {
f(&r)
Expand All @@ -48,13 +48,13 @@ func newSnapshotDeleteFunc(t Transport) SnapshotDelete {
// SnapshotDelete deletes a snapshot.
//
//
type SnapshotDelete func(repository string, snapshot string, o ...func(*SnapshotDeleteRequest)) (*Response, error)
type SnapshotDelete func(repository string, snapshot []string, o ...func(*SnapshotDeleteRequest)) (*Response, error)

// SnapshotDeleteRequest configures the Snapshot Delete API request.
//
type SnapshotDeleteRequest struct {
Repository string
Snapshot string
Snapshot []string

MasterTimeout time.Duration
ClusterManagerTimeout time.Duration
Expand All @@ -80,13 +80,13 @@ func (r SnapshotDeleteRequest) Do(ctx context.Context, transport Transport) (*Re

method = "DELETE"

path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(r.Snapshot))
path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(strings.Join(r.Snapshot, ",")))
path.WriteString("/")
path.WriteString("_snapshot")
path.WriteString("/")
path.WriteString(r.Repository)
path.WriteString("/")
path.WriteString(r.Snapshot)
path.WriteString(strings.Join(r.Snapshot, ","))

params = make(map[string]string)

Expand Down

0 comments on commit d08fffd

Please sign in to comment.