-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreq.go
More file actions
58 lines (46 loc) · 1.64 KB
/
Copy pathreq.go
File metadata and controls
58 lines (46 loc) · 1.64 KB
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: MPL-2.0
// Copyright (c) 2025 Daniel Schmidt
package gnmi
import "time"
// Req represents a gNMI request modifier
//
// This struct is used to apply request-specific options via functional modifiers.
// Operation parameters (paths, operations) are passed directly to methods.
//
// Example:
//
// // Get with custom encoding and timeout
// res, err := client.Get(ctx, paths,
// gnmi.Encoding("proto"),
// gnmi.Timeout(30*time.Second))
type Req struct {
// Encoding specifies the data encoding
// Valid values: json, json_ietf (default), proto, ascii, bytes
Encoding string
// Timeout is the request-specific timeout
// Overrides client default timeout if set
Timeout time.Duration
}
// SetOperationType represents the type of Set operation
type SetOperationType string
const (
// OperationUpdate modifies existing configuration, creating it if it doesn't exist
OperationUpdate SetOperationType = "update"
// OperationReplace removes existing configuration before applying new value
OperationReplace SetOperationType = "replace"
// OperationDelete removes configuration at the specified path
OperationDelete SetOperationType = "delete"
)
// SetOperation represents a single gNMI Set operation (Update, Replace, or Delete)
type SetOperation struct {
// OperationType specifies the operation type (update, replace, delete)
OperationType SetOperationType
// Path is the gNMI path
Path string
// Value is the JSON value for Update/Replace operations
// Empty for Delete operations
Value string
// Encoding specifies the value encoding
// Valid values: json, json_ietf (default), proto, ascii, bytes
Encoding string
}