github.com/newrelic/newrelic-client-go@v1.1.0/pkg/region/region_constants.go (about) 1 package region 2 3 import ( 4 "strings" 5 ) 6 7 const ( 8 // US represents New Relic's US-based production deployment. 9 US Name = "US" 10 11 // EU represents New Relic's EU-based production deployment. 12 EU Name = "EU" 13 14 // Staging represents New Relic's US-based staging deployment. 15 // This is for internal New Relic use only. 16 Staging Name = "Staging" 17 18 // Local represents a local development environment. 19 Local Name = "Local" 20 ) 21 22 // Regions defines the service URLs that make up the various environments. 23 var Regions = map[Name]*Region{ 24 US: { 25 name: "US", 26 infrastructureBaseURL: "https://infra-api.newrelic.com/v2", 27 insightsBaseURL: "https://insights-collector.newrelic.com/v1", 28 insightsKeysBaseURL: "https://insights.newrelic.com/internal_api/1", 29 logsBaseURL: "https://log-api.newrelic.com/log/v1", 30 nerdGraphBaseURL: "https://api.newrelic.com/graphql", 31 restBaseURL: "https://api.newrelic.com/v2", 32 syntheticsBaseURL: "https://synthetics.newrelic.com/synthetics/api", 33 }, 34 EU: { 35 name: "EU", 36 infrastructureBaseURL: "https://infra-api.eu.newrelic.com/v2", 37 insightsBaseURL: "https://insights-collector.eu01.nr-data.net/v1", 38 insightsKeysBaseURL: "https://insights.eu.newrelic.com/internal_api/1", 39 logsBaseURL: "https://log-api.eu.newrelic.com/log/v1", 40 nerdGraphBaseURL: "https://api.eu.newrelic.com/graphql", 41 restBaseURL: "https://api.eu.newrelic.com/v2", 42 syntheticsBaseURL: "https://synthetics.eu.newrelic.com/synthetics/api", 43 }, 44 Staging: { 45 name: "Staging", 46 infrastructureBaseURL: "https://staging-infra-api.newrelic.com/v2", 47 insightsBaseURL: "https://staging-insights-collector.newrelic.com/v1", 48 insightsKeysBaseURL: "https://staging-insights.newrelic.com/internal_api/1", 49 logsBaseURL: "https://staging-log-api.newrelic.com/log/v1", 50 nerdGraphBaseURL: "https://staging-api.newrelic.com/graphql", 51 restBaseURL: "https://staging-api.newrelic.com/v2", 52 syntheticsBaseURL: "https://staging-synthetics.newrelic.com/synthetics/api", 53 }, 54 Local: { 55 name: "Local", 56 infrastructureBaseURL: "http://localhost:3000/v2", 57 insightsBaseURL: "http://localhost:3000/v1", 58 insightsKeysBaseURL: "http://localhost:3000/internal_api/1", 59 logsBaseURL: "http://localhost:3000/log/v1", 60 nerdGraphBaseURL: "http://localhost:3000/graphql", 61 restBaseURL: "http://localhost:3000/v2", 62 syntheticsBaseURL: "http://localhost:3000/synthetics/api", 63 }, 64 } 65 66 // Default represents the region returned if nothing was specified 67 const Default Name = US 68 69 // Parse takes a Region string and returns a RegionType 70 func Parse(r string) (Name, error) { 71 switch strings.ToLower(r) { 72 case "us": 73 return US, nil 74 case "eu": 75 return EU, nil 76 case "staging": 77 return Staging, nil 78 case "local": 79 return Local, nil 80 default: 81 return "", UnknownError{Message: r} 82 } 83 } 84 85 func Get(r Name) (*Region, error) { 86 if reg, ok := Regions[r]; ok { 87 ret := *reg // Make a copy 88 return &ret, nil 89 } 90 91 return Regions[Default], UnknownUsingDefaultError{Message: r.String()} 92 }