identity_classic.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright 2015 Google Inc. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. // +build appengine
  5. package internal
  6. import (
  7. "appengine"
  8. netcontext "golang.org/x/net/context"
  9. )
  10. func init() {
  11. appengineStandard = true
  12. }
  13. func DefaultVersionHostname(ctx netcontext.Context) string {
  14. c := fromContext(ctx)
  15. if c == nil {
  16. panic(errNotAppEngineContext)
  17. }
  18. return appengine.DefaultVersionHostname(c)
  19. }
  20. func Datacenter(_ netcontext.Context) string { return appengine.Datacenter() }
  21. func ServerSoftware() string { return appengine.ServerSoftware() }
  22. func InstanceID() string { return appengine.InstanceID() }
  23. func IsDevAppServer() bool { return appengine.IsDevAppServer() }
  24. func RequestID(ctx netcontext.Context) string {
  25. c := fromContext(ctx)
  26. if c == nil {
  27. panic(errNotAppEngineContext)
  28. }
  29. return appengine.RequestID(c)
  30. }
  31. func ModuleName(ctx netcontext.Context) string {
  32. c := fromContext(ctx)
  33. if c == nil {
  34. panic(errNotAppEngineContext)
  35. }
  36. return appengine.ModuleName(c)
  37. }
  38. func VersionID(ctx netcontext.Context) string {
  39. c := fromContext(ctx)
  40. if c == nil {
  41. panic(errNotAppEngineContext)
  42. }
  43. return appengine.VersionID(c)
  44. }
  45. func fullyQualifiedAppID(ctx netcontext.Context) string {
  46. c := fromContext(ctx)
  47. if c == nil {
  48. panic(errNotAppEngineContext)
  49. }
  50. return c.FullyQualifiedAppID()
  51. }