identity_classic.go

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