identity_classic.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. //go:build appengine
  5. // +build appengine
  6. package internal
  7. import (
  8. "context"
  9. "appengine"
  10. )
  11. func init() {
  12. appengineStandard = true
  13. }
  14. func DefaultVersionHostname(ctx context.Context) string {
  15. c := fromContext(ctx)
  16. if c == nil {
  17. panic(errNotAppEngineContext)
  18. }
  19. return appengine.DefaultVersionHostname(c)
  20. }
  21. func Datacenter(_ context.Context) string { return appengine.Datacenter() }
  22. func ServerSoftware() string { return appengine.ServerSoftware() }
  23. func InstanceID() string { return appengine.InstanceID() }
  24. func IsDevAppServer() bool { return appengine.IsDevAppServer() }
  25. func RequestID(ctx context.Context) string {
  26. c := fromContext(ctx)
  27. if c == nil {
  28. panic(errNotAppEngineContext)
  29. }
  30. return appengine.RequestID(c)
  31. }
  32. func ModuleName(ctx context.Context) string {
  33. c := fromContext(ctx)
  34. if c == nil {
  35. panic(errNotAppEngineContext)
  36. }
  37. return appengine.ModuleName(c)
  38. }
  39. func VersionID(ctx context.Context) string {
  40. c := fromContext(ctx)
  41. if c == nil {
  42. panic(errNotAppEngineContext)
  43. }
  44. return appengine.VersionID(c)
  45. }
  46. func fullyQualifiedAppID(ctx context.Context) string {
  47. c := fromContext(ctx)
  48. if c == nil {
  49. panic(errNotAppEngineContext)
  50. }
  51. return c.FullyQualifiedAppID()
  52. }