This example shows how to use the client with typed and unstructured objects to retrieve an object.
()
| 78 | |
| 79 | // This example shows how to use the client with typed and unstructured objects to retrieve an object. |
| 80 | func ExampleClient_get() { |
| 81 | // Using a typed object. |
| 82 | pod := &corev1.Pod{} |
| 83 | // c is a created client. |
| 84 | _ = c.Get(context.Background(), client.ObjectKey{ |
| 85 | Namespace: "namespace", |
| 86 | Name: "name", |
| 87 | }, pod) |
| 88 | |
| 89 | // Using a unstructured object. |
| 90 | u := &unstructured.Unstructured{} |
| 91 | u.SetGroupVersionKind(schema.GroupVersionKind{ |
| 92 | Group: "apps", |
| 93 | Kind: "Deployment", |
| 94 | Version: "v1", |
| 95 | }) |
| 96 | _ = c.Get(context.Background(), client.ObjectKey{ |
| 97 | Namespace: "namespace", |
| 98 | Name: "name", |
| 99 | }, u) |
| 100 | } |
| 101 | |
| 102 | // This example shows how to use the client with typed and unstructured objects to create objects. |
| 103 | func ExampleClient_create() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…