-
Notifications
You must be signed in to change notification settings - Fork 95
/
api_dangling.go
58 lines (48 loc) · 1.35 KB
/
api_dangling.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
48
49
50
51
52
53
54
55
56
57
58
// SPDX-License-Identifier: Apache-2.0
//
// The OpenSearch Contributors require contributions made to
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.
package opensearchapi
import (
"context"
)
type danglingClient struct {
apiClient *Client
}
// Delete executes a delete dangling request with the required DanglingDeleteReq
func (c danglingClient) Delete(ctx context.Context, req DanglingDeleteReq) (*DanglingDeleteResp, error) {
var (
data DanglingDeleteResp
err error
)
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
return &data, err
}
return &data, nil
}
// Import executes an import dangling request with the required DanglingImportReq
func (c danglingClient) Import(ctx context.Context, req DanglingImportReq) (*DanglingImportResp, error) {
var (
data DanglingImportResp
err error
)
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
return &data, err
}
return &data, nil
}
// Get executes a /_dangling request with the optional DanglingGetReq
func (c danglingClient) Get(ctx context.Context, req *DanglingGetReq) (*DanglingGetResp, error) {
if req == nil {
req = &DanglingGetReq{}
}
var (
data DanglingGetResp
err error
)
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
return &data, err
}
return &data, nil
}