github.com/annwntech/go-micro/v2@v2.9.5/util/kubernetes/client/options.go (about) 1 package client 2 3 type CreateOptions struct { 4 Namespace string 5 } 6 7 type GetOptions struct { 8 Namespace string 9 Labels map[string]string 10 } 11 type UpdateOptions struct { 12 Namespace string 13 } 14 type DeleteOptions struct { 15 Namespace string 16 } 17 type ListOptions struct { 18 Namespace string 19 } 20 21 type LogOptions struct { 22 Namespace string 23 Params map[string]string 24 } 25 26 type WatchOptions struct { 27 Namespace string 28 Params map[string]string 29 } 30 31 type CreateOption func(*CreateOptions) 32 type GetOption func(*GetOptions) 33 type UpdateOption func(*UpdateOptions) 34 type DeleteOption func(*DeleteOptions) 35 type ListOption func(*ListOptions) 36 type LogOption func(*LogOptions) 37 type WatchOption func(*WatchOptions) 38 39 // LogParams provides additional params for logs 40 func LogParams(p map[string]string) LogOption { 41 return func(l *LogOptions) { 42 l.Params = p 43 } 44 } 45 46 // WatchParams used for watch params 47 func WatchParams(p map[string]string) WatchOption { 48 return func(w *WatchOptions) { 49 w.Params = p 50 } 51 } 52 53 // CreateNamespace sets the namespace for creating a resource 54 func CreateNamespace(ns string) CreateOption { 55 return func(o *CreateOptions) { 56 o.Namespace = SerializeResourceName(ns) 57 } 58 } 59 60 // GetNamespace sets the namespace for getting a resource 61 func GetNamespace(ns string) GetOption { 62 return func(o *GetOptions) { 63 o.Namespace = SerializeResourceName(ns) 64 } 65 } 66 67 // GetLabels sets the labels for when getting a resource 68 func GetLabels(ls map[string]string) GetOption { 69 return func(o *GetOptions) { 70 o.Labels = ls 71 } 72 } 73 74 // UpdateNamespace sets the namespace for updating a resource 75 func UpdateNamespace(ns string) UpdateOption { 76 return func(o *UpdateOptions) { 77 o.Namespace = SerializeResourceName(ns) 78 } 79 } 80 81 // DeleteNamespace sets the namespace for deleting a resource 82 func DeleteNamespace(ns string) DeleteOption { 83 return func(o *DeleteOptions) { 84 o.Namespace = SerializeResourceName(ns) 85 } 86 } 87 88 // ListNamespace sets the namespace for listing resources 89 func ListNamespace(ns string) ListOption { 90 return func(o *ListOptions) { 91 o.Namespace = SerializeResourceName(ns) 92 } 93 } 94 95 // LogNamespace sets the namespace for logging a resource 96 func LogNamespace(ns string) LogOption { 97 return func(o *LogOptions) { 98 o.Namespace = SerializeResourceName(ns) 99 } 100 } 101 102 // WatchNamespace sets the namespace for watching a resource 103 func WatchNamespace(ns string) WatchOption { 104 return func(o *WatchOptions) { 105 o.Namespace = SerializeResourceName(ns) 106 } 107 }