(obj *unstructured.Unstructured, opts metav1.UpdateOptions, subresources ...string)
| 130 | } |
| 131 | |
| 132 | func (c *dynamicResourceClient) Update(obj *unstructured.Unstructured, opts metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error) { |
| 133 | accessor, err := meta.Accessor(obj) |
| 134 | if err != nil { |
| 135 | return nil, err |
| 136 | } |
| 137 | name := accessor.GetName() |
| 138 | if len(name) == 0 { |
| 139 | return nil, fmt.Errorf("name is required") |
| 140 | } |
| 141 | outBytes, err := runtime.Encode(unstructured.UnstructuredJSONScheme, obj) |
| 142 | if err != nil { |
| 143 | return nil, err |
| 144 | } |
| 145 | |
| 146 | result := c.client.client. |
| 147 | Put(). |
| 148 | AbsPath(append(c.makeURLSegments(name), subresources...)...). |
| 149 | Body(outBytes). |
| 150 | SpecificallyVersionedParams(&opts, dynamicParameterCodec, versionV1). |
| 151 | Do() |
| 152 | if err := result.Error(); err != nil { |
| 153 | return nil, err |
| 154 | } |
| 155 | |
| 156 | retBytes, err := result.Raw() |
| 157 | if err != nil { |
| 158 | return nil, err |
| 159 | } |
| 160 | uncastObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, retBytes) |
| 161 | if err != nil { |
| 162 | return nil, err |
| 163 | } |
| 164 | return uncastObj.(*unstructured.Unstructured), nil |
| 165 | } |
| 166 | |
| 167 | func (c *dynamicResourceClient) UpdateStatus(obj *unstructured.Unstructured, opts metav1.UpdateOptions) (*unstructured.Unstructured, error) { |
| 168 | accessor, err := meta.Accessor(obj) |
nothing calls this directly
no test coverage detected