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