This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
/
mpc_transactions_aip.go
72 lines (64 loc) · 1.81 KB
/
mpc_transactions_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Code generated by protoc-gen-go-aip. DO NOT EDIT.
//
// versions:
// protoc-gen-go-aip development
// protoc (unknown)
// source: coinbase/cloud/mpc_transactions/v1/mpc_transactions.proto
package v1
import (
fmt "fmt"
resourcename "go.einride.tech/aip/resourcename"
strings "strings"
)
type MPCTransactionResourceName struct {
PoolId string
MpcWalletId string
MpcTransactionId string
}
func (n MPCTransactionResourceName) Validate() error {
if n.PoolId == "" {
return fmt.Errorf("pool_id: empty")
}
if strings.IndexByte(n.PoolId, '/') != -1 {
return fmt.Errorf("pool_id: contains illegal character '/'")
}
if n.MpcWalletId == "" {
return fmt.Errorf("mpc_wallet_id: empty")
}
if strings.IndexByte(n.MpcWalletId, '/') != -1 {
return fmt.Errorf("mpc_wallet_id: contains illegal character '/'")
}
if n.MpcTransactionId == "" {
return fmt.Errorf("mpc_transaction_id: empty")
}
if strings.IndexByte(n.MpcTransactionId, '/') != -1 {
return fmt.Errorf("mpc_transaction_id: contains illegal character '/'")
}
return nil
}
func (n MPCTransactionResourceName) ContainsWildcard() bool {
return false || n.PoolId == "-" || n.MpcWalletId == "-" || n.MpcTransactionId == "-"
}
func (n MPCTransactionResourceName) String() string {
return resourcename.Sprint(
"pools/{pool_id}/mpcWallets/{mpc_wallet_id}/mpcTransactions/{mpc_transaction_id}",
n.PoolId,
n.MpcWalletId,
n.MpcTransactionId,
)
}
func (n MPCTransactionResourceName) MarshalString() (string, error) {
if err := n.Validate(); err != nil {
return "", err
}
return n.String(), nil
}
func (n *MPCTransactionResourceName) UnmarshalString(name string) error {
return resourcename.Sscan(
name,
"pools/{pool_id}/mpcWallets/{mpc_wallet_id}/mpcTransactions/{mpc_transaction_id}",
&n.PoolId,
&n.MpcWalletId,
&n.MpcTransactionId,
)
}