GetLabel gets a label value from namespace store If there is no default label, an empty string returned with nil error
(ctx context.Context, label string)
| 647 | // GetLabel gets a label value from namespace store |
| 648 | // If there is no default label, an empty string returned with nil error |
| 649 | func (c *Client) GetLabel(ctx context.Context, label string) (string, error) { |
| 650 | ns, err := namespaces.NamespaceRequired(ctx) |
| 651 | if err != nil { |
| 652 | if c.defaultns == "" { |
| 653 | return "", err |
| 654 | } |
| 655 | ns = c.defaultns |
| 656 | } |
| 657 | |
| 658 | srv := c.NamespaceService() |
| 659 | labels, err := srv.Labels(ctx, ns) |
| 660 | if err != nil { |
| 661 | return "", err |
| 662 | } |
| 663 | |
| 664 | value := labels[label] |
| 665 | return value, nil |
| 666 | } |
| 667 | |
| 668 | // Subscribe to events that match one or more of the provided filters. |
| 669 | // |
no test coverage detected