001 002package com.commercetools.history.defaultconfig; 003 004import io.vrap.rmf.base.client.ServiceRegionConfig; 005 006public enum ServiceRegion implements ServiceRegionConfig { 007 008 GCP_EUROPE_WEST1(new RegionHosts("https://history.europe-west1.gcp.commercetools.com/", 009 "https://auth.europe-west1.gcp.commercetools.com")), 010 GCP_US_CENTRAL1(new RegionHosts("https://history.us-central1.gcp.commercetools.com/", 011 "https://auth.us-central1.gcp.commercetools.com")),; 012 013 public static class RegionHosts { 014 private final String apiUrl; 015 private final String authUrl; 016 017 private RegionHosts(String apiUrl, String authUrl) { 018 this.apiUrl = apiUrl; 019 this.authUrl = authUrl; 020 } 021 } 022 023 private final RegionHosts regionHosts; 024 025 ServiceRegion(RegionHosts regionHosts) { 026 this.regionHosts = regionHosts; 027 } 028 029 public String getApiUrl() { 030 return regionHosts.apiUrl; 031 } 032 033 public String getAuthUrl() { 034 return regionHosts.authUrl; 035 } 036 037 public String getOAuthTokenUrl() { 038 return regionHosts.authUrl + "/oauth/token"; 039 } 040}