-
Notifications
You must be signed in to change notification settings - Fork 5
/
protocol_aip.go
54 lines (46 loc) 路 1.08 KB
/
protocol_aip.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
// Code generated by protoc-gen-go-aip. DO NOT EDIT.
//
// versions:
// protoc-gen-go-aip development
// protoc (unknown)
// source: coinbase/staking/orchestration/v1/protocol.proto
package v1
import (
fmt "fmt"
resourcename "go.einride.tech/aip/resourcename"
strings "strings"
)
type ProtocolResourceName struct {
Protocol string
}
func (n ProtocolResourceName) Validate() error {
if n.Protocol == "" {
return fmt.Errorf("protocol: empty")
}
if strings.IndexByte(n.Protocol, '/') != -1 {
return fmt.Errorf("protocol: contains illegal character '/'")
}
return nil
}
func (n ProtocolResourceName) ContainsWildcard() bool {
return false || n.Protocol == "-"
}
func (n ProtocolResourceName) String() string {
return resourcename.Sprint(
"protocols/{protocol}",
n.Protocol,
)
}
func (n ProtocolResourceName) MarshalString() (string, error) {
if err := n.Validate(); err != nil {
return "", err
}
return n.String(), nil
}
func (n *ProtocolResourceName) UnmarshalString(name string) error {
return resourcename.Sscan(
name,
"protocols/{protocol}",
&n.Protocol,
)
}