(ctx context.Context, labels map[string]string)
| 145 | } |
| 146 | |
| 147 | func (c *container) SetLabels(ctx context.Context, labels map[string]string) (map[string]string, error) { |
| 148 | ctx, span := tracing.StartSpan(ctx, "container.SetLabels", |
| 149 | tracing.WithAttribute("container.id", c.id), |
| 150 | ) |
| 151 | defer span.End() |
| 152 | container := containers.Container{ |
| 153 | ID: c.id, |
| 154 | Labels: labels, |
| 155 | } |
| 156 | |
| 157 | var paths []string |
| 158 | // mask off paths so we only muck with the labels encountered in labels. |
| 159 | // Labels not in the passed in argument will be left alone. |
| 160 | for k := range labels { |
| 161 | paths = append(paths, strings.Join([]string{"labels", k}, ".")) |
| 162 | } |
| 163 | |
| 164 | r, err := c.client.ContainerService().Update(ctx, container, paths...) |
| 165 | if err != nil { |
| 166 | return nil, err |
| 167 | } |
| 168 | return r.Labels, nil |
| 169 | } |
| 170 | |
| 171 | // Spec returns the current OCI specification for the container |
| 172 | func (c *container) Spec(ctx context.Context) (*oci.Spec, error) { |
nothing calls this directly
no test coverage detected