001package io.prometheus.metrics.exporter.pushgateway;
002
003public enum Scheme {
004  HTTP("http"),
005  HTTPS("https");
006
007  private final String name;
008
009  Scheme(String name) {
010    this.name = name;
011  }
012
013  @Override
014  public String toString() {
015    return name;
016  }
017
018  public static Scheme fromString(String name) {
019    switch (name) {
020      case "http":
021        return HTTP;
022      case "https":
023        return HTTPS;
024      default:
025        throw new IllegalArgumentException(
026            name + ": Unsupported scheme. Expecting 'http' or 'https'.");
027    }
028  }
029}