@@ -92,7 +92,43 @@ type createOperation struct {
9292}
9393
9494func (op * createOperation ) Description () string {
95- return "Create object"
95+ u , err := toUnstructured (op .object )
96+ if err != nil {
97+ return "Create object (unknown)"
98+ }
99+ return fmt .Sprintf ("Create object %s/%s/%s/%s" , u .GetAPIVersion (), u .GetKind (), u .GetNamespace (), u .GetName ())
100+ }
101+
102+ func (op * createOperation ) GetName () string {
103+ u , err := toUnstructured (op .object )
104+ if err != nil {
105+ return ""
106+ }
107+ return u .GetName ()
108+ }
109+
110+ func (op * createOperation ) SetName (name string ) {
111+ u , err := toUnstructured (op .object )
112+ if err != nil {
113+ return
114+ }
115+ u .SetName (name )
116+ op .object = u
117+ }
118+
119+ func (op * createOperation ) SetNamePrefix (prefix string ) {
120+ name := op .GetName ()
121+ if name != "" {
122+ op .SetName (prefix + name )
123+ }
124+ }
125+
126+ func (op * createOperation ) GetNamespace () string {
127+ u , err := toUnstructured (op .object )
128+ if err != nil {
129+ return ""
130+ }
131+ return u .GetNamespace ()
96132}
97133
98134func (op * createOperation ) WithSubresource (subresource string ) {
@@ -127,6 +163,22 @@ func (op *deleteOperation) WithSubresource(subresource string) {
127163 op .subresource = subresource
128164}
129165
166+ func (op * deleteOperation ) GetName () string {
167+ return op .name
168+ }
169+
170+ func (op * deleteOperation ) SetName (name string ) {
171+ op .name = name
172+ }
173+
174+ func (op * deleteOperation ) SetNamePrefix (prefix string ) {
175+ op .name = prefix + op .name
176+ }
177+
178+ func (op * deleteOperation ) GetNamespace () string {
179+ return op .namespace
180+ }
181+
130182type patchOperation struct {
131183 // Object coordinates for patch and delete.
132184 apiVersion string
@@ -146,6 +198,19 @@ type patchOperation struct {
146198 ignoreHookError bool
147199}
148200
201+ func (op * patchOperation ) GetName () string {
202+ return op .name
203+ }
204+ func (op * patchOperation ) SetName (name string ) {
205+ op .name = name
206+ }
207+ func (op * patchOperation ) SetNamePrefix (prefix string ) {
208+ op .name = prefix + op .name
209+ }
210+ func (op * patchOperation ) GetNamespace () string {
211+ return op .namespace
212+ }
213+
149214func (op * patchOperation ) Description () string {
150215 return fmt .Sprintf ("Filter object %s/%s/%s/%s" , op .apiVersion , op .kind , op .namespace , op .name )
151216}
0 commit comments