This example shows how to use the client with typed and unstructured objects to patch objects' status.
()
| 238 | |
| 239 | // This example shows how to use the client with typed and unstructured objects to patch objects' status. |
| 240 | func ExampleClient_patchStatus() { |
| 241 | u := &unstructured.Unstructured{} |
| 242 | u.Object = map[string]any{ |
| 243 | "metadata": map[string]any{ |
| 244 | "name": "foo", |
| 245 | "namespace": "namespace", |
| 246 | }, |
| 247 | } |
| 248 | u.SetGroupVersionKind(schema.GroupVersionKind{ |
| 249 | Group: "batch", |
| 250 | Version: "v1beta1", |
| 251 | Kind: "CronJob", |
| 252 | }) |
| 253 | patch := []byte(fmt.Sprintf(`{"status":{"lastScheduleTime":"%s"}}`, time.Now().Format(time.RFC3339))) |
| 254 | _ = c.Status().Patch(context.Background(), u, client.RawPatch(types.MergePatchType, patch)) |
| 255 | } |
| 256 | |
| 257 | // This example shows how to use the client with typed and unstructured objects to delete objects. |
| 258 | func ExampleClient_delete() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…