mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-22 10:53:05 +00:00
sync: resync vendor folder
This commit is contained in:
parent
29ea990f7c
commit
1b8c2a3e22
108
Godeps/Godeps.json
generated
108
Godeps/Godeps.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/client-go",
|
"ImportPath": "k8s.io/client-go",
|
||||||
"GoVersion": "go1.8",
|
"GoVersion": "go1.7",
|
||||||
"GodepVersion": "v79",
|
"GodepVersion": "v79",
|
||||||
"Packages": [
|
"Packages": [
|
||||||
"./..."
|
"./..."
|
||||||
@ -8,14 +8,17 @@
|
|||||||
"Deps": [
|
"Deps": [
|
||||||
{
|
{
|
||||||
"ImportPath": "cloud.google.com/go/compute/metadata",
|
"ImportPath": "cloud.google.com/go/compute/metadata",
|
||||||
|
"Comment": "v0.1.0-115-g3b1ae45",
|
||||||
"Rev": "3b1ae45394a234c385be014e9a488f2bb6eef821"
|
"Rev": "3b1ae45394a234c385be014e9a488f2bb6eef821"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "cloud.google.com/go/internal",
|
"ImportPath": "cloud.google.com/go/internal",
|
||||||
|
"Comment": "v0.1.0-115-g3b1ae45",
|
||||||
"Rev": "3b1ae45394a234c385be014e9a488f2bb6eef821"
|
"Rev": "3b1ae45394a234c385be014e9a488f2bb6eef821"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/PuerkitoBio/purell",
|
"ImportPath": "github.com/PuerkitoBio/purell",
|
||||||
|
"Comment": "v1.0.0",
|
||||||
"Rev": "8a290539e2e8629dbc4e6bad948158f790ec31f4"
|
"Rev": "8a290539e2e8629dbc4e6bad948158f790ec31f4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -44,14 +47,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/coreos/pkg/health",
|
"ImportPath": "github.com/coreos/pkg/health",
|
||||||
|
"Comment": "v2-8-gfa29b1d",
|
||||||
"Rev": "fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8"
|
"Rev": "fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/coreos/pkg/httputil",
|
"ImportPath": "github.com/coreos/pkg/httputil",
|
||||||
|
"Comment": "v2-8-gfa29b1d",
|
||||||
"Rev": "fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8"
|
"Rev": "fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/coreos/pkg/timeutil",
|
"ImportPath": "github.com/coreos/pkg/timeutil",
|
||||||
|
"Comment": "v2-8-gfa29b1d",
|
||||||
"Rev": "fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8"
|
"Rev": "fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -60,22 +66,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/distribution/digest",
|
"ImportPath": "github.com/docker/distribution/digest",
|
||||||
|
"Comment": "v2.4.0-rc.1-38-gcd27f17",
|
||||||
"Rev": "cd27f179f2c10c5d300e6d09025b538c475b0d51"
|
"Rev": "cd27f179f2c10c5d300e6d09025b538c475b0d51"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/distribution/reference",
|
"ImportPath": "github.com/docker/distribution/reference",
|
||||||
|
"Comment": "v2.4.0-rc.1-38-gcd27f17",
|
||||||
"Rev": "cd27f179f2c10c5d300e6d09025b538c475b0d51"
|
"Rev": "cd27f179f2c10c5d300e6d09025b538c475b0d51"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/emicklei/go-restful",
|
"ImportPath": "github.com/emicklei/go-restful",
|
||||||
|
"Comment": "2.2.0-4-gff4f55a",
|
||||||
"Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46"
|
"Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/emicklei/go-restful-swagger12",
|
"ImportPath": "github.com/emicklei/go-restful-swagger12",
|
||||||
|
"Comment": "1.0.1",
|
||||||
"Rev": "dcef7f55730566d41eae5db10e7d6981829720f6"
|
"Rev": "dcef7f55730566d41eae5db10e7d6981829720f6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/emicklei/go-restful/log",
|
"ImportPath": "github.com/emicklei/go-restful/log",
|
||||||
|
"Comment": "2.2.0-4-gff4f55a",
|
||||||
"Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46"
|
"Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -108,10 +119,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/gogo/protobuf/proto",
|
"ImportPath": "github.com/gogo/protobuf/proto",
|
||||||
|
"Comment": "v0.4-3-gc0656ed",
|
||||||
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
|
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/gogo/protobuf/sortkeys",
|
"ImportPath": "github.com/gogo/protobuf/sortkeys",
|
||||||
|
"Comment": "v0.4-3-gc0656ed",
|
||||||
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
|
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -136,6 +149,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/imdario/mergo",
|
"ImportPath": "github.com/imdario/mergo",
|
||||||
|
"Comment": "0.1.3-8-g6633656",
|
||||||
"Rev": "6633656539c1639d9d78127b7d47c622b5d7b6dc"
|
"Rev": "6633656539c1639d9d78127b7d47c622b5d7b6dc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -168,6 +182,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/stretchr/testify/assert",
|
"ImportPath": "github.com/stretchr/testify/assert",
|
||||||
|
"Comment": "v1.0-88-ge3a8ff8",
|
||||||
"Rev": "e3a8ff8ce36581f87a15341206f205b1da467059"
|
"Rev": "e3a8ff8ce36581f87a15341206f205b1da467059"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -268,6 +283,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "gopkg.in/inf.v0",
|
"ImportPath": "gopkg.in/inf.v0",
|
||||||
|
"Comment": "v0.9.0",
|
||||||
"Rev": "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4"
|
"Rev": "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -276,183 +292,183 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/testing",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/testing",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
|
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced",
|
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
|
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
|
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
|
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
|
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
|
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/fields",
|
"ImportPath": "k8s.io/apimachinery/pkg/fields",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/labels",
|
"ImportPath": "k8s.io/apimachinery/pkg/labels",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/openapi",
|
"ImportPath": "k8s.io/apimachinery/pkg/openapi",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
|
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/selection",
|
"ImportPath": "k8s.io/apimachinery/pkg/selection",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/types",
|
"ImportPath": "k8s.io/apimachinery/pkg/types",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/rand",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/rand",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
|
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/version",
|
"ImportPath": "k8s.io/apimachinery/pkg/version",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/watch",
|
"ImportPath": "k8s.io/apimachinery/pkg/watch",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
|
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
|
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "565bae4589e797e6474096f31f9e70a47132d5e5"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
4
vendor/github.com/emicklei/go-restful-swagger12/.travis.yml
generated
vendored
Normal file
4
vendor/github.com/emicklei/go-restful-swagger12/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
language: go
|
||||||
|
|
||||||
|
go:
|
||||||
|
- 1.x
|
@ -1,5 +1,8 @@
|
|||||||
Change history of swagger
|
Change history of swagger
|
||||||
=
|
=
|
||||||
|
2017-01-30
|
||||||
|
- moved from go-restful/swagger to go-restful-swagger12
|
||||||
|
|
||||||
2015-10-16
|
2015-10-16
|
||||||
- add type override mechanism for swagger models (MR 254, nathanejohnson)
|
- add type override mechanism for swagger models (MR 254, nathanejohnson)
|
||||||
- replace uses of wildcard in generated apidocs (issue 251)
|
- replace uses of wildcard in generated apidocs (issue 251)
|
22
vendor/github.com/emicklei/go-restful-swagger12/LICENSE
generated
vendored
Normal file
22
vendor/github.com/emicklei/go-restful-swagger12/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
Copyright (c) 2017 Ernest Micklei
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -1,3 +1,8 @@
|
|||||||
|
# go-restful-swagger12
|
||||||
|
|
||||||
|
[](https://travis-ci.org/emicklei/go-restful-swagger12)
|
||||||
|
[](https://godoc.org/github.com/emicklei/go-restful-swagger12)
|
||||||
|
|
||||||
How to use Swagger UI with go-restful
|
How to use Swagger UI with go-restful
|
||||||
=
|
=
|
||||||
|
|
||||||
@ -74,3 +79,5 @@ Notes
|
|||||||
--
|
--
|
||||||
- The Nickname of an Operation is automatically set by finding the name of the function. You can override it using RouteBuilder.Operation(..)
|
- The Nickname of an Operation is automatically set by finding the name of the function. You can override it using RouteBuilder.Operation(..)
|
||||||
- The WebServices field of swagger.Config can be used to control which service you want to expose and document ; you can have multiple configs and therefore multiple endpoints.
|
- The WebServices field of swagger.Config can be used to control which service you want to expose and document ; you can have multiple configs and therefore multiple endpoints.
|
||||||
|
|
||||||
|
© 2017, ernestmicklei.com. MIT License. Contributions welcome.
|
@ -226,6 +226,9 @@ func (sws SwaggerService) composeDeclaration(ws *restful.WebService, pathPrefix
|
|||||||
pathToRoutes := newOrderedRouteMap()
|
pathToRoutes := newOrderedRouteMap()
|
||||||
for _, other := range ws.Routes() {
|
for _, other := range ws.Routes() {
|
||||||
if strings.HasPrefix(other.Path, pathPrefix) {
|
if strings.HasPrefix(other.Path, pathPrefix) {
|
||||||
|
if len(pathPrefix) > 1 && len(other.Path) > len(pathPrefix) && other.Path[len(pathPrefix)] != '/' {
|
||||||
|
continue
|
||||||
|
}
|
||||||
pathToRoutes.Add(other.Path, other)
|
pathToRoutes.Add(other.Path, other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,14 +293,13 @@ func composeResponseMessages(route restful.Route, decl *ApiDeclaration, config *
|
|||||||
if each.Model != nil {
|
if each.Model != nil {
|
||||||
st := reflect.TypeOf(each.Model)
|
st := reflect.TypeOf(each.Model)
|
||||||
isCollection, st := detectCollectionType(st)
|
isCollection, st := detectCollectionType(st)
|
||||||
|
// collection cannot be in responsemodel
|
||||||
|
if !isCollection {
|
||||||
modelName := modelBuilder{}.keyFrom(st)
|
modelName := modelBuilder{}.keyFrom(st)
|
||||||
if isCollection {
|
|
||||||
modelName = "array[" + modelName + "]"
|
|
||||||
}
|
|
||||||
modelBuilder{Models: &decl.Models, Config: config}.addModel(st, "")
|
modelBuilder{Models: &decl.Models, Config: config}.addModel(st, "")
|
||||||
// reference the model
|
|
||||||
message.ResponseModel = modelName
|
message.ResponseModel = modelName
|
||||||
}
|
}
|
||||||
|
}
|
||||||
messages = append(messages, message)
|
messages = append(messages, message)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@ -331,12 +333,13 @@ func detectCollectionType(st reflect.Type) (bool, reflect.Type) {
|
|||||||
|
|
||||||
// addModelFromSample creates and adds (or overwrites) a Model from a sample resource
|
// addModelFromSample creates and adds (or overwrites) a Model from a sample resource
|
||||||
func (sws SwaggerService) addModelFromSampleTo(operation *Operation, isResponse bool, sample interface{}, models *ModelList) {
|
func (sws SwaggerService) addModelFromSampleTo(operation *Operation, isResponse bool, sample interface{}, models *ModelList) {
|
||||||
|
mb := modelBuilder{Models: models, Config: &sws.config}
|
||||||
if isResponse {
|
if isResponse {
|
||||||
type_, items := asDataType(sample, &sws.config)
|
sampleType, items := asDataType(sample, &sws.config)
|
||||||
operation.Type = type_
|
operation.Type = sampleType
|
||||||
operation.Items = items
|
operation.Items = items
|
||||||
}
|
}
|
||||||
modelBuilder{Models: models, Config: &sws.config}.addModelFrom(sample)
|
mb.addModelFrom(sample)
|
||||||
}
|
}
|
||||||
|
|
||||||
func asSwaggerParameter(param restful.ParameterData) Parameter {
|
func asSwaggerParameter(param restful.ParameterData) Parameter {
|
6
vendor/github.com/emicklei/go-restful/.travis.yml
generated
vendored
Normal file
6
vendor/github.com/emicklei/go-restful/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
language: go
|
||||||
|
|
||||||
|
go:
|
||||||
|
- 1.x
|
||||||
|
|
||||||
|
script: go test -v
|
110
vendor/github.com/emicklei/go-restful/CHANGES.md
generated
vendored
110
vendor/github.com/emicklei/go-restful/CHANGES.md
generated
vendored
@ -1,39 +1,71 @@
|
|||||||
Change history of go-restful
|
Change history of go-restful
|
||||||
=
|
=
|
||||||
|
2017-02-16
|
||||||
|
- solved issue #304, make operation names unique
|
||||||
|
|
||||||
|
2017-01-30
|
||||||
|
|
||||||
|
[IMPORTANT] For swagger users, change your import statement to:
|
||||||
|
swagger "github.com/emicklei/go-restful-swagger12"
|
||||||
|
|
||||||
|
- moved swagger 1.2 code to go-restful-swagger12
|
||||||
|
- created TAG 2.0.0
|
||||||
|
|
||||||
|
2017-01-27
|
||||||
|
|
||||||
|
- remove defer request body close
|
||||||
|
- expose Dispatch for testing filters and Routefunctions
|
||||||
|
- swagger response model cannot be array
|
||||||
|
- created TAG 1.0.0
|
||||||
|
|
||||||
|
2016-12-22
|
||||||
|
|
||||||
|
- (API change) Remove code related to caching request content. Removes SetCacheReadEntity(doCache bool)
|
||||||
|
|
||||||
2016-11-26
|
2016-11-26
|
||||||
|
|
||||||
- Default change! now use CurlyRouter (was RouterJSR311)
|
- Default change! now use CurlyRouter (was RouterJSR311)
|
||||||
- Default change! no more caching of request content
|
- Default change! no more caching of request content
|
||||||
- Default change! do not recover from panics
|
- Default change! do not recover from panics
|
||||||
|
|
||||||
2016-09-22
|
2016-09-22
|
||||||
|
|
||||||
- fix the DefaultRequestContentType feature
|
- fix the DefaultRequestContentType feature
|
||||||
|
|
||||||
2016-02-14
|
2016-02-14
|
||||||
|
|
||||||
- take the qualify factor of the Accept header mediatype into account when deciding the contentype of the response
|
- take the qualify factor of the Accept header mediatype into account when deciding the contentype of the response
|
||||||
- add constructors for custom entity accessors for xml and json
|
- add constructors for custom entity accessors for xml and json
|
||||||
|
|
||||||
2015-09-27
|
2015-09-27
|
||||||
|
|
||||||
- rename new WriteStatusAnd... to WriteHeaderAnd... for consistency
|
- rename new WriteStatusAnd... to WriteHeaderAnd... for consistency
|
||||||
|
|
||||||
2015-09-25
|
2015-09-25
|
||||||
|
|
||||||
- fixed problem with changing Header after WriteHeader (issue 235)
|
- fixed problem with changing Header after WriteHeader (issue 235)
|
||||||
|
|
||||||
2015-09-14
|
2015-09-14
|
||||||
|
|
||||||
- changed behavior of WriteHeader (immediate write) and WriteEntity (no status write)
|
- changed behavior of WriteHeader (immediate write) and WriteEntity (no status write)
|
||||||
- added support for custom EntityReaderWriters.
|
- added support for custom EntityReaderWriters.
|
||||||
|
|
||||||
2015-08-06
|
2015-08-06
|
||||||
|
|
||||||
- add support for reading entities from compressed request content
|
- add support for reading entities from compressed request content
|
||||||
- use sync.Pool for compressors of http response and request body
|
- use sync.Pool for compressors of http response and request body
|
||||||
- add Description to Parameter for documentation in Swagger UI
|
- add Description to Parameter for documentation in Swagger UI
|
||||||
|
|
||||||
2015-03-20
|
2015-03-20
|
||||||
|
|
||||||
- add configurable logging
|
- add configurable logging
|
||||||
|
|
||||||
2015-03-18
|
2015-03-18
|
||||||
|
|
||||||
- if not specified, the Operation is derived from the Route function
|
- if not specified, the Operation is derived from the Route function
|
||||||
|
|
||||||
2015-03-17
|
2015-03-17
|
||||||
|
|
||||||
- expose Parameter creation functions
|
- expose Parameter creation functions
|
||||||
- make trace logger an interface
|
- make trace logger an interface
|
||||||
- fix OPTIONSFilter
|
- fix OPTIONSFilter
|
||||||
@ -42,21 +74,26 @@ Change history of go-restful
|
|||||||
- add Notes to Route
|
- add Notes to Route
|
||||||
|
|
||||||
2014-11-27
|
2014-11-27
|
||||||
|
|
||||||
- (api add) PrettyPrint per response. (as proposed in #167)
|
- (api add) PrettyPrint per response. (as proposed in #167)
|
||||||
|
|
||||||
2014-11-12
|
2014-11-12
|
||||||
|
|
||||||
- (api add) ApiVersion(.) for documentation in Swagger UI
|
- (api add) ApiVersion(.) for documentation in Swagger UI
|
||||||
|
|
||||||
2014-11-10
|
2014-11-10
|
||||||
|
|
||||||
- (api change) struct fields tagged with "description" show up in Swagger UI
|
- (api change) struct fields tagged with "description" show up in Swagger UI
|
||||||
|
|
||||||
2014-10-31
|
2014-10-31
|
||||||
|
|
||||||
- (api change) ReturnsError -> Returns
|
- (api change) ReturnsError -> Returns
|
||||||
- (api add) RouteBuilder.Do(aBuilder) for DRY use of RouteBuilder
|
- (api add) RouteBuilder.Do(aBuilder) for DRY use of RouteBuilder
|
||||||
- fix swagger nested structs
|
- fix swagger nested structs
|
||||||
- sort Swagger response messages by code
|
- sort Swagger response messages by code
|
||||||
|
|
||||||
2014-10-23
|
2014-10-23
|
||||||
|
|
||||||
- (api add) ReturnsError allows you to document Http codes in swagger
|
- (api add) ReturnsError allows you to document Http codes in swagger
|
||||||
- fixed problem with greedy CurlyRouter
|
- fixed problem with greedy CurlyRouter
|
||||||
- (api add) Access-Control-Max-Age in CORS
|
- (api add) Access-Control-Max-Age in CORS
|
||||||
@ -70,102 +107,117 @@ Change history of go-restful
|
|||||||
- (api add) ParameterNamed for detailed documentation
|
- (api add) ParameterNamed for detailed documentation
|
||||||
|
|
||||||
2014-04-16
|
2014-04-16
|
||||||
|
|
||||||
- (api add) expose constructor of Request for testing.
|
- (api add) expose constructor of Request for testing.
|
||||||
|
|
||||||
2014-06-27
|
2014-06-27
|
||||||
|
|
||||||
- (api add) ParameterNamed gives access to a Parameter definition and its data (for further specification).
|
- (api add) ParameterNamed gives access to a Parameter definition and its data (for further specification).
|
||||||
- (api add) SetCacheReadEntity allow scontrol over whether or not the request body is being cached (default true for compatibility reasons).
|
- (api add) SetCacheReadEntity allow scontrol over whether or not the request body is being cached (default true for compatibility reasons).
|
||||||
|
|
||||||
2014-07-03
|
2014-07-03
|
||||||
|
|
||||||
- (api add) CORS can be configured with a list of allowed domains
|
- (api add) CORS can be configured with a list of allowed domains
|
||||||
|
|
||||||
2014-03-12
|
2014-03-12
|
||||||
|
|
||||||
- (api add) Route path parameters can use wildcard or regular expressions. (requires CurlyRouter)
|
- (api add) Route path parameters can use wildcard or regular expressions. (requires CurlyRouter)
|
||||||
|
|
||||||
2014-02-26
|
2014-02-26
|
||||||
|
|
||||||
- (api add) Request now provides information about the matched Route, see method SelectedRoutePath
|
- (api add) Request now provides information about the matched Route, see method SelectedRoutePath
|
||||||
|
|
||||||
2014-02-17
|
2014-02-17
|
||||||
|
|
||||||
- (api change) renamed parameter constants (go-lint checks)
|
- (api change) renamed parameter constants (go-lint checks)
|
||||||
|
|
||||||
2014-01-10
|
2014-01-10
|
||||||
- (api add) support for CloseNotify, see http://golang.org/pkg/net/http/#CloseNotifier
|
|
||||||
|
- (api add) support for CloseNotify, see http://golang.org/pkg/net/http/#CloseNotifier
|
||||||
|
|
||||||
2014-01-07
|
2014-01-07
|
||||||
- (api change) Write* methods in Response now return the error or nil.
|
|
||||||
- added example of serving HTML from a Go template.
|
- (api change) Write* methods in Response now return the error or nil.
|
||||||
- fixed comparing Allowed headers in CORS (is now case-insensitive)
|
- added example of serving HTML from a Go template.
|
||||||
|
- fixed comparing Allowed headers in CORS (is now case-insensitive)
|
||||||
|
|
||||||
2013-11-13
|
2013-11-13
|
||||||
- (api add) Response knows how many bytes are written to the response body.
|
|
||||||
|
- (api add) Response knows how many bytes are written to the response body.
|
||||||
|
|
||||||
2013-10-29
|
2013-10-29
|
||||||
- (api add) RecoverHandler(handler RecoverHandleFunction) to change how panic recovery is handled. Default behavior is to log and return a stacktrace. This may be a security issue as it exposes sourcecode information.
|
|
||||||
|
- (api add) RecoverHandler(handler RecoverHandleFunction) to change how panic recovery is handled. Default behavior is to log and return a stacktrace. This may be a security issue as it exposes sourcecode information.
|
||||||
|
|
||||||
2013-10-04
|
2013-10-04
|
||||||
- (api add) Response knows what HTTP status has been written
|
|
||||||
- (api add) Request can have attributes (map of string->interface, also called request-scoped variables
|
- (api add) Response knows what HTTP status has been written
|
||||||
|
- (api add) Request can have attributes (map of string->interface, also called request-scoped variables
|
||||||
|
|
||||||
2013-09-12
|
2013-09-12
|
||||||
- (api change) Router interface simplified
|
|
||||||
- Implemented CurlyRouter, a Router that does not use|allow regular expressions in paths
|
- (api change) Router interface simplified
|
||||||
|
- Implemented CurlyRouter, a Router that does not use|allow regular expressions in paths
|
||||||
|
|
||||||
2013-08-05
|
2013-08-05
|
||||||
- add OPTIONS support
|
- add OPTIONS support
|
||||||
- add CORS support
|
- add CORS support
|
||||||
|
|
||||||
2013-08-27
|
2013-08-27
|
||||||
- fixed some reported issues (see github)
|
|
||||||
- (api change) deprecated use of WriteError; use WriteErrorString instead
|
- fixed some reported issues (see github)
|
||||||
|
- (api change) deprecated use of WriteError; use WriteErrorString instead
|
||||||
|
|
||||||
2014-04-15
|
2014-04-15
|
||||||
- (fix) v1.0.1 tag: fix Issue 111: WriteErrorString
|
|
||||||
|
- (fix) v1.0.1 tag: fix Issue 111: WriteErrorString
|
||||||
|
|
||||||
2013-08-08
|
2013-08-08
|
||||||
- (api add) Added implementation Container: a WebServices collection with its own http.ServeMux allowing multiple endpoints per program. Existing uses of go-restful will register their services to the DefaultContainer.
|
|
||||||
- (api add) the swagger package has be extended to have a UI per container.
|
- (api add) Added implementation Container: a WebServices collection with its own http.ServeMux allowing multiple endpoints per program. Existing uses of go-restful will register their services to the DefaultContainer.
|
||||||
- if panic is detected then a small stack trace is printed (thanks to runner-mei)
|
- (api add) the swagger package has be extended to have a UI per container.
|
||||||
- (api add) WriteErrorString to Response
|
- if panic is detected then a small stack trace is printed (thanks to runner-mei)
|
||||||
|
- (api add) WriteErrorString to Response
|
||||||
|
|
||||||
Important API changes:
|
Important API changes:
|
||||||
|
|
||||||
- (api remove) package variable DoNotRecover no longer works ; use restful.DefaultContainer.DoNotRecover(true) instead.
|
- (api remove) package variable DoNotRecover no longer works ; use restful.DefaultContainer.DoNotRecover(true) instead.
|
||||||
- (api remove) package variable EnableContentEncoding no longer works ; use restful.DefaultContainer.EnableContentEncoding(true) instead.
|
- (api remove) package variable EnableContentEncoding no longer works ; use restful.DefaultContainer.EnableContentEncoding(true) instead.
|
||||||
|
|
||||||
|
|
||||||
2013-07-06
|
2013-07-06
|
||||||
|
|
||||||
- (api add) Added support for response encoding (gzip and deflate(zlib)). This feature is disabled on default (for backwards compatibility). Use restful.EnableContentEncoding = true in your initialization to enable this feature.
|
- (api add) Added support for response encoding (gzip and deflate(zlib)). This feature is disabled on default (for backwards compatibility). Use restful.EnableContentEncoding = true in your initialization to enable this feature.
|
||||||
|
|
||||||
2013-06-19
|
2013-06-19
|
||||||
|
|
||||||
- (improve) DoNotRecover option, moved request body closer, improved ReadEntity
|
- (improve) DoNotRecover option, moved request body closer, improved ReadEntity
|
||||||
|
|
||||||
2013-06-03
|
2013-06-03
|
||||||
|
|
||||||
- (api change) removed Dispatcher interface, hide PathExpression
|
- (api change) removed Dispatcher interface, hide PathExpression
|
||||||
- changed receiver names of type functions to be more idiomatic Go
|
- changed receiver names of type functions to be more idiomatic Go
|
||||||
|
|
||||||
2013-06-02
|
2013-06-02
|
||||||
|
|
||||||
- (optimize) Cache the RegExp compilation of Paths.
|
- (optimize) Cache the RegExp compilation of Paths.
|
||||||
|
|
||||||
2013-05-22
|
2013-05-22
|
||||||
|
|
||||||
- (api add) Added support for request/response filter functions
|
- (api add) Added support for request/response filter functions
|
||||||
|
|
||||||
2013-05-18
|
2013-05-18
|
||||||
|
|
||||||
|
|
||||||
- (api add) Added feature to change the default Http Request Dispatch function (travis cline)
|
- (api add) Added feature to change the default Http Request Dispatch function (travis cline)
|
||||||
- (api change) Moved Swagger Webservice to swagger package (see example restful-user)
|
- (api change) Moved Swagger Webservice to swagger package (see example restful-user)
|
||||||
|
|
||||||
[2012-11-14 .. 2013-05-18>
|
[2012-11-14 .. 2013-05-18>
|
||||||
|
|
||||||
- See https://github.com/emicklei/go-restful/commits
|
- See https://github.com/emicklei/go-restful/commits
|
||||||
|
|
||||||
2012-11-14
|
2012-11-14
|
||||||
|
|
||||||
- Initial commit
|
- Initial commit
|
||||||
|
|
||||||
|
|
||||||
|
7
vendor/github.com/emicklei/go-restful/Makefile
generated
vendored
Normal file
7
vendor/github.com/emicklei/go-restful/Makefile
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
all: test
|
||||||
|
|
||||||
|
test:
|
||||||
|
go test -v .
|
||||||
|
|
||||||
|
ex:
|
||||||
|
cd examples && ls *.go | xargs go build -o /tmp/ignore
|
24
vendor/github.com/emicklei/go-restful/README.md
generated
vendored
24
vendor/github.com/emicklei/go-restful/README.md
generated
vendored
@ -1,8 +1,13 @@
|
|||||||
go-restful
|
go-restful
|
||||||
==========
|
==========
|
||||||
|
|
||||||
package for building REST-style Web Services using Google Go
|
package for building REST-style Web Services using Google Go
|
||||||
|
|
||||||
|
[](https://travis-ci.org/emicklei/go-restful)
|
||||||
|
[](https://goreportcard.com/report/github.com/emicklei/go-restful)
|
||||||
|
[](https://godoc.org/github.com/emicklei/go-restful)
|
||||||
|
|
||||||
|
- [Code examples](https://github.com/emicklei/go-restful/tree/master/examples)
|
||||||
|
|
||||||
REST asks developers to use HTTP methods explicitly and in a way that's consistent with the protocol definition. This basic REST design principle establishes a one-to-one mapping between create, read, update, and delete (CRUD) operations and HTTP methods. According to this mapping:
|
REST asks developers to use HTTP methods explicitly and in a way that's consistent with the protocol definition. This basic REST design principle establishes a one-to-one mapping between create, read, update, and delete (CRUD) operations and HTTP methods. According to this mapping:
|
||||||
|
|
||||||
- GET = Retrieve a representation of a resource
|
- GET = Retrieve a representation of a resource
|
||||||
@ -40,35 +45,30 @@ func (u UserResource) findUser(request *restful.Request, response *restful.Respo
|
|||||||
|
|
||||||
- Routes for request → function mapping with path parameter (e.g. {id}) support
|
- Routes for request → function mapping with path parameter (e.g. {id}) support
|
||||||
- Configurable router:
|
- Configurable router:
|
||||||
- Routing algorithm after [JSR311](http://jsr311.java.net/nonav/releases/1.1/spec/spec.html) that is implemented using (but does **not** accept) regular expressions (See RouterJSR311 which is used by default)
|
- (default) Fast routing algorithm that allows static elements, regular expressions and dynamic parameters in the URL path (e.g. /meetings/{id} or /static/{subpath:*}
|
||||||
- Fast routing algorithm that allows static elements, regular expressions and dynamic parameters in the URL path (e.g. /meetings/{id} or /static/{subpath:*}, See CurlyRouter)
|
- Routing algorithm after [JSR311](http://jsr311.java.net/nonav/releases/1.1/spec/spec.html) that is implemented using (but does **not** accept) regular expressions
|
||||||
- Request API for reading structs from JSON/XML and accesing parameters (path,query,header)
|
- Request API for reading structs from JSON/XML and accesing parameters (path,query,header)
|
||||||
- Response API for writing structs to JSON/XML and setting headers
|
- Response API for writing structs to JSON/XML and setting headers
|
||||||
|
- Customizable encoding using EntityReaderWriter registration
|
||||||
- Filters for intercepting the request → response flow on Service or Route level
|
- Filters for intercepting the request → response flow on Service or Route level
|
||||||
- Request-scoped variables using attributes
|
- Request-scoped variables using attributes
|
||||||
- Containers for WebServices on different HTTP endpoints
|
- Containers for WebServices on different HTTP endpoints
|
||||||
- Content encoding (gzip,deflate) of request and response payloads
|
- Content encoding (gzip,deflate) of request and response payloads
|
||||||
- Automatic responses on OPTIONS (using a filter)
|
- Automatic responses on OPTIONS (using a filter)
|
||||||
- Automatic CORS request handling (using a filter)
|
- Automatic CORS request handling (using a filter)
|
||||||
- API declaration for Swagger UI (see swagger package)
|
- API declaration for Swagger UI (see [go-restful-swagger12](https://github.com/emicklei/go-restful-swagger12),[go-restful-openapi](https://github.com/emicklei/go-restful-openapi))
|
||||||
- Panic recovery to produce HTTP 500, customizable using RecoverHandler(...)
|
- Panic recovery to produce HTTP 500, customizable using RecoverHandler(...)
|
||||||
- Route errors produce HTTP 404/405/406/415 errors, customizable using ServiceErrorHandler(...)
|
- Route errors produce HTTP 404/405/406/415 errors, customizable using ServiceErrorHandler(...)
|
||||||
- Configurable (trace) logging
|
- Configurable (trace) logging
|
||||||
- Customizable encoding using EntityReaderWriter registration
|
|
||||||
- Customizable gzip/deflate readers and writers using CompressorProvider registration
|
- Customizable gzip/deflate readers and writers using CompressorProvider registration
|
||||||
|
|
||||||
### Resources
|
### Resources
|
||||||
|
|
||||||
- [Documentation on godoc.org](http://godoc.org/github.com/emicklei/go-restful)
|
|
||||||
- [Code examples](https://github.com/emicklei/go-restful/tree/master/examples)
|
|
||||||
- [Example posted on blog](http://ernestmicklei.com/2012/11/go-restful-first-working-example/)
|
- [Example posted on blog](http://ernestmicklei.com/2012/11/go-restful-first-working-example/)
|
||||||
- [Design explained on blog](http://ernestmicklei.com/2012/11/go-restful-api-design/)
|
- [Design explained on blog](http://ernestmicklei.com/2012/11/go-restful-api-design/)
|
||||||
- [sourcegraph](https://sourcegraph.com/github.com/emicklei/go-restful)
|
- [sourcegraph](https://sourcegraph.com/github.com/emicklei/go-restful)
|
||||||
- [gopkg.in](https://gopkg.in/emicklei/go-restful.v1)
|
|
||||||
- [showcase: Mora - MongoDB REST Api server](https://github.com/emicklei/mora)
|
- [showcase: Mora - MongoDB REST Api server](https://github.com/emicklei/mora)
|
||||||
|
|
||||||
[](https://drone.io/github.com/emicklei/go-restful/latest)
|
|
||||||
|
|
||||||
(c) 2012 - 2015, http://ernestmicklei.com. MIT License
|
|
||||||
|
|
||||||
Type ```git shortlog -s``` for a full list of contributors.
|
Type ```git shortlog -s``` for a full list of contributors.
|
||||||
|
|
||||||
|
© 2012 - 2017, http://ernestmicklei.com. MIT License. Contributions are welcome.
|
1
vendor/github.com/emicklei/go-restful/compressors.go
generated
vendored
1
vendor/github.com/emicklei/go-restful/compressors.go
generated
vendored
@ -9,6 +9,7 @@ import (
|
|||||||
"compress/zlib"
|
"compress/zlib"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CompressorProvider describes a component that can provider compressors for the std methods.
|
||||||
type CompressorProvider interface {
|
type CompressorProvider interface {
|
||||||
// Returns a *gzip.Writer which needs to be released later.
|
// Returns a *gzip.Writer which needs to be released later.
|
||||||
// Before using it, call Reset().
|
// Before using it, call Reset().
|
||||||
|
21
vendor/github.com/emicklei/go-restful/container.go
generated
vendored
21
vendor/github.com/emicklei/go-restful/container.go
generated
vendored
@ -32,7 +32,7 @@ type Container struct {
|
|||||||
contentEncodingEnabled bool // default is false
|
contentEncodingEnabled bool // default is false
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewContainer creates a new Container using a new ServeMux and default router (RouterJSR311)
|
// NewContainer creates a new Container using a new ServeMux and default router (CurlyRouter)
|
||||||
func NewContainer() *Container {
|
func NewContainer() *Container {
|
||||||
return &Container{
|
return &Container{
|
||||||
webServices: []*WebService{},
|
webServices: []*WebService{},
|
||||||
@ -74,7 +74,7 @@ func (c *Container) DoNotRecover(doNot bool) {
|
|||||||
c.doNotRecover = doNot
|
c.doNotRecover = doNot
|
||||||
}
|
}
|
||||||
|
|
||||||
// Router changes the default Router (currently RouterJSR311)
|
// Router changes the default Router (currently CurlyRouter)
|
||||||
func (c *Container) Router(aRouter RouteSelector) {
|
func (c *Container) Router(aRouter RouteSelector) {
|
||||||
c.router = aRouter
|
c.router = aRouter
|
||||||
}
|
}
|
||||||
@ -188,6 +188,17 @@ func writeServiceError(err ServiceError, req *Request, resp *Response) {
|
|||||||
resp.WriteErrorString(err.Code, err.Message)
|
resp.WriteErrorString(err.Code, err.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dispatch the incoming Http Request to a matching WebService.
|
||||||
|
func (c *Container) Dispatch(httpWriter http.ResponseWriter, httpRequest *http.Request) {
|
||||||
|
if httpWriter == nil {
|
||||||
|
panic("httpWriter cannot be nil")
|
||||||
|
}
|
||||||
|
if httpRequest == nil {
|
||||||
|
panic("httpRequest cannot be nil")
|
||||||
|
}
|
||||||
|
c.dispatch(httpWriter, httpRequest)
|
||||||
|
}
|
||||||
|
|
||||||
// Dispatch the incoming Http Request to a matching WebService.
|
// Dispatch the incoming Http Request to a matching WebService.
|
||||||
func (c *Container) dispatch(httpWriter http.ResponseWriter, httpRequest *http.Request) {
|
func (c *Container) dispatch(httpWriter http.ResponseWriter, httpRequest *http.Request) {
|
||||||
writer := httpWriter
|
writer := httpWriter
|
||||||
@ -208,12 +219,6 @@ func (c *Container) dispatch(httpWriter http.ResponseWriter, httpRequest *http.R
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
// Install closing the request body (if any)
|
|
||||||
defer func() {
|
|
||||||
if nil != httpRequest.Body {
|
|
||||||
httpRequest.Body.Close()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Detect if compression is needed
|
// Detect if compression is needed
|
||||||
// assume without compression, test for override
|
// assume without compression, test for override
|
||||||
|
2
vendor/github.com/emicklei/go-restful/doc.go
generated
vendored
2
vendor/github.com/emicklei/go-restful/doc.go
generated
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Package restful, a lean package for creating REST-style WebServices without magic.
|
Package restful , a lean package for creating REST-style WebServices without magic.
|
||||||
|
|
||||||
WebServices and Routes
|
WebServices and Routes
|
||||||
|
|
||||||
|
10
vendor/github.com/emicklei/go-restful/install.sh
generated
vendored
10
vendor/github.com/emicklei/go-restful/install.sh
generated
vendored
@ -1,10 +0,0 @@
|
|||||||
go test -test.v ...restful && \
|
|
||||||
go test -test.v ...swagger && \
|
|
||||||
go vet ...restful && \
|
|
||||||
go fmt ...swagger && \
|
|
||||||
go install ...swagger && \
|
|
||||||
go fmt ...restful && \
|
|
||||||
go install ...restful
|
|
||||||
cd examples
|
|
||||||
ls *.go | xargs -I {} go build -o /tmp/ignore {}
|
|
||||||
cd ..
|
|
5
vendor/github.com/emicklei/go-restful/log/log.go
generated
vendored
5
vendor/github.com/emicklei/go-restful/log/log.go
generated
vendored
@ -5,7 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Logger corresponds to a minimal subset of the interface satisfied by stdlib log.Logger
|
// StdLogger corresponds to a minimal subset of the interface satisfied by stdlib log.Logger
|
||||||
type StdLogger interface {
|
type StdLogger interface {
|
||||||
Print(v ...interface{})
|
Print(v ...interface{})
|
||||||
Printf(format string, v ...interface{})
|
Printf(format string, v ...interface{})
|
||||||
@ -18,14 +18,17 @@ func init() {
|
|||||||
SetLogger(stdlog.New(os.Stderr, "[restful] ", stdlog.LstdFlags|stdlog.Lshortfile))
|
SetLogger(stdlog.New(os.Stderr, "[restful] ", stdlog.LstdFlags|stdlog.Lshortfile))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetLogger sets the logger for this package
|
||||||
func SetLogger(customLogger StdLogger) {
|
func SetLogger(customLogger StdLogger) {
|
||||||
Logger = customLogger
|
Logger = customLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print delegates to the Logger
|
||||||
func Print(v ...interface{}) {
|
func Print(v ...interface{}) {
|
||||||
Logger.Print(v...)
|
Logger.Print(v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Printf delegates to the Logger
|
||||||
func Printf(format string, v ...interface{}) {
|
func Printf(format string, v ...interface{}) {
|
||||||
Logger.Printf(format, v...)
|
Logger.Printf(format, v...)
|
||||||
}
|
}
|
||||||
|
23
vendor/github.com/emicklei/go-restful/request.go
generated
vendored
23
vendor/github.com/emicklei/go-restful/request.go
generated
vendored
@ -5,20 +5,15 @@ package restful
|
|||||||
// that can be found in the LICENSE file.
|
// that can be found in the LICENSE file.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"compress/zlib"
|
"compress/zlib"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultRequestContentType string
|
var defaultRequestContentType string
|
||||||
|
|
||||||
var doCacheReadEntityBytes = false
|
|
||||||
|
|
||||||
// Request is a wrapper for a http Request that provides convenience methods
|
// Request is a wrapper for a http Request that provides convenience methods
|
||||||
type Request struct {
|
type Request struct {
|
||||||
Request *http.Request
|
Request *http.Request
|
||||||
bodyContent *[]byte // to cache the request body for multiple reads of ReadEntity
|
|
||||||
pathParameters map[string]string
|
pathParameters map[string]string
|
||||||
attributes map[string]interface{} // for storing request-scoped values
|
attributes map[string]interface{} // for storing request-scoped values
|
||||||
selectedRoutePath string // root path + route path that matched the request, e.g. /meetings/{id}/attendees
|
selectedRoutePath string // root path + route path that matched the request, e.g. /meetings/{id}/attendees
|
||||||
@ -41,12 +36,6 @@ func DefaultRequestContentType(mime string) {
|
|||||||
defaultRequestContentType = mime
|
defaultRequestContentType = mime
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCacheReadEntity controls whether the response data ([]byte) is cached such that ReadEntity is repeatable.
|
|
||||||
// Default is true (due to backwardcompatibility). For better performance, you should set it to false if you don't need it.
|
|
||||||
func SetCacheReadEntity(doCache bool) {
|
|
||||||
doCacheReadEntityBytes = doCache
|
|
||||||
}
|
|
||||||
|
|
||||||
// PathParameter accesses the Path parameter value by its name
|
// PathParameter accesses the Path parameter value by its name
|
||||||
func (r *Request) PathParameter(name string) string {
|
func (r *Request) PathParameter(name string) string {
|
||||||
return r.pathParameters[name]
|
return r.pathParameters[name]
|
||||||
@ -81,18 +70,6 @@ func (r *Request) ReadEntity(entityPointer interface{}) (err error) {
|
|||||||
contentType := r.Request.Header.Get(HEADER_ContentType)
|
contentType := r.Request.Header.Get(HEADER_ContentType)
|
||||||
contentEncoding := r.Request.Header.Get(HEADER_ContentEncoding)
|
contentEncoding := r.Request.Header.Get(HEADER_ContentEncoding)
|
||||||
|
|
||||||
// OLD feature, cache the body for reads
|
|
||||||
if doCacheReadEntityBytes {
|
|
||||||
if r.bodyContent == nil {
|
|
||||||
data, err := ioutil.ReadAll(r.Request.Body)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
r.bodyContent = &data
|
|
||||||
}
|
|
||||||
r.Request.Body = ioutil.NopCloser(bytes.NewReader(*r.bodyContent))
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if the request body needs decompression
|
// check if the request body needs decompression
|
||||||
if ENCODING_GZIP == contentEncoding {
|
if ENCODING_GZIP == contentEncoding {
|
||||||
gzipReader := currentCompressorProvider.AcquireGzipReader()
|
gzipReader := currentCompressorProvider.AcquireGzipReader()
|
||||||
|
5
vendor/github.com/emicklei/go-restful/response.go
generated
vendored
5
vendor/github.com/emicklei/go-restful/response.go
generated
vendored
@ -9,7 +9,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DEPRECATED, use DefaultResponseContentType(mime)
|
// DefaultResponseMimeType is DEPRECATED, use DefaultResponseContentType(mime)
|
||||||
var DefaultResponseMimeType string
|
var DefaultResponseMimeType string
|
||||||
|
|
||||||
//PrettyPrintResponses controls the indentation feature of XML and JSON serialization
|
//PrettyPrintResponses controls the indentation feature of XML and JSON serialization
|
||||||
@ -27,11 +27,12 @@ type Response struct {
|
|||||||
err error // err property is kept when WriteError is called
|
err error // err property is kept when WriteError is called
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a new response based on a http ResponseWriter.
|
// NewResponse creates a new response based on a http ResponseWriter.
|
||||||
func NewResponse(httpWriter http.ResponseWriter) *Response {
|
func NewResponse(httpWriter http.ResponseWriter) *Response {
|
||||||
return &Response{httpWriter, "", []string{}, http.StatusOK, 0, PrettyPrintResponses, nil} // empty content-types
|
return &Response{httpWriter, "", []string{}, http.StatusOK, 0, PrettyPrintResponses, nil} // empty content-types
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DefaultResponseContentType set a default.
|
||||||
// If Accept header matching fails, fall back to this type.
|
// If Accept header matching fails, fall back to this type.
|
||||||
// Valid values are restful.MIME_JSON and restful.MIME_XML
|
// Valid values are restful.MIME_JSON and restful.MIME_XML
|
||||||
// Example:
|
// Example:
|
||||||
|
3
vendor/github.com/emicklei/go-restful/route.go
generated
vendored
3
vendor/github.com/emicklei/go-restful/route.go
generated
vendored
@ -34,6 +34,9 @@ type Route struct {
|
|||||||
ParameterDocs []*Parameter
|
ParameterDocs []*Parameter
|
||||||
ResponseErrors map[int]ResponseError
|
ResponseErrors map[int]ResponseError
|
||||||
ReadSample, WriteSample interface{} // structs that model an example request or response payload
|
ReadSample, WriteSample interface{} // structs that model an example request or response payload
|
||||||
|
|
||||||
|
// Extra information used to store custom information about the route.
|
||||||
|
Metadata map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize for Route
|
// Initialize for Route
|
||||||
|
57
vendor/github.com/emicklei/go-restful/route_builder.go
generated
vendored
57
vendor/github.com/emicklei/go-restful/route_builder.go
generated
vendored
@ -5,10 +5,12 @@ package restful
|
|||||||
// that can be found in the LICENSE file.
|
// that can be found in the LICENSE file.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/emicklei/go-restful/log"
|
"github.com/emicklei/go-restful/log"
|
||||||
)
|
)
|
||||||
@ -22,6 +24,9 @@ type RouteBuilder struct {
|
|||||||
httpMethod string // required
|
httpMethod string // required
|
||||||
function RouteFunction // required
|
function RouteFunction // required
|
||||||
filters []FilterFunction
|
filters []FilterFunction
|
||||||
|
|
||||||
|
typeNameHandleFunc TypeNameHandleFunction // required
|
||||||
|
|
||||||
// documentation
|
// documentation
|
||||||
doc string
|
doc string
|
||||||
notes string
|
notes string
|
||||||
@ -29,6 +34,7 @@ type RouteBuilder struct {
|
|||||||
readSample, writeSample interface{}
|
readSample, writeSample interface{}
|
||||||
parameters []*Parameter
|
parameters []*Parameter
|
||||||
errorMap map[int]ResponseError
|
errorMap map[int]ResponseError
|
||||||
|
metadata map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do evaluates each argument with the RouteBuilder itself.
|
// Do evaluates each argument with the RouteBuilder itself.
|
||||||
@ -92,8 +98,13 @@ func (b *RouteBuilder) Notes(notes string) *RouteBuilder {
|
|||||||
// Reads tells what resource type will be read from the request payload. Optional.
|
// Reads tells what resource type will be read from the request payload. Optional.
|
||||||
// A parameter of type "body" is added ,required is set to true and the dataType is set to the qualified name of the sample's type.
|
// A parameter of type "body" is added ,required is set to true and the dataType is set to the qualified name of the sample's type.
|
||||||
func (b *RouteBuilder) Reads(sample interface{}) *RouteBuilder {
|
func (b *RouteBuilder) Reads(sample interface{}) *RouteBuilder {
|
||||||
|
fn := b.typeNameHandleFunc
|
||||||
|
if fn == nil {
|
||||||
|
fn = reflectTypeName
|
||||||
|
}
|
||||||
|
typeAsName := fn(sample)
|
||||||
|
|
||||||
b.readSample = sample
|
b.readSample = sample
|
||||||
typeAsName := reflect.TypeOf(sample).String()
|
|
||||||
bodyParameter := &Parameter{&ParameterData{Name: "body"}}
|
bodyParameter := &Parameter{&ParameterData{Name: "body"}}
|
||||||
bodyParameter.beBody()
|
bodyParameter.beBody()
|
||||||
bodyParameter.Required(true)
|
bodyParameter.Required(true)
|
||||||
@ -148,6 +159,7 @@ func (b *RouteBuilder) Returns(code int, message string, model interface{}) *Rou
|
|||||||
Code: code,
|
Code: code,
|
||||||
Message: message,
|
Message: message,
|
||||||
Model: model,
|
Model: model,
|
||||||
|
IsDefault: false,
|
||||||
}
|
}
|
||||||
// lazy init because there is no NewRouteBuilder (yet)
|
// lazy init because there is no NewRouteBuilder (yet)
|
||||||
if b.errorMap == nil {
|
if b.errorMap == nil {
|
||||||
@ -157,10 +169,36 @@ func (b *RouteBuilder) Returns(code int, message string, model interface{}) *Rou
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DefaultReturns is a special Returns call that sets the default of the response ; the code is zero.
|
||||||
|
func (b *RouteBuilder) DefaultReturns(message string, model interface{}) *RouteBuilder {
|
||||||
|
b.Returns(0, message, model)
|
||||||
|
// Modify the ResponseError just added/updated
|
||||||
|
re := b.errorMap[0]
|
||||||
|
// errorMap is initialized
|
||||||
|
b.errorMap[0] = ResponseError{
|
||||||
|
Code: re.Code,
|
||||||
|
Message: re.Message,
|
||||||
|
Model: re.Model,
|
||||||
|
IsDefault: true,
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metadata adds or updates a key=value pair to the metadata map.
|
||||||
|
func (b *RouteBuilder) Metadata(key string, value interface{}) *RouteBuilder {
|
||||||
|
if b.metadata == nil {
|
||||||
|
b.metadata = map[string]interface{}{}
|
||||||
|
}
|
||||||
|
b.metadata[key] = value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResponseError represents a response; not necessarily an error.
|
||||||
type ResponseError struct {
|
type ResponseError struct {
|
||||||
Code int
|
Code int
|
||||||
Message string
|
Message string
|
||||||
Model interface{}
|
Model interface{}
|
||||||
|
IsDefault bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *RouteBuilder) servicePath(path string) *RouteBuilder {
|
func (b *RouteBuilder) servicePath(path string) *RouteBuilder {
|
||||||
@ -186,6 +224,13 @@ func (b *RouteBuilder) copyDefaults(rootProduces, rootConsumes []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// typeNameHandler sets the function that will convert types to strings in the parameter
|
||||||
|
// and model definitions.
|
||||||
|
func (b *RouteBuilder) typeNameHandler(handler TypeNameHandleFunction) *RouteBuilder {
|
||||||
|
b.typeNameHandleFunc = handler
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
// Build creates a new Route using the specification details collected by the RouteBuilder
|
// Build creates a new Route using the specification details collected by the RouteBuilder
|
||||||
func (b *RouteBuilder) Build() Route {
|
func (b *RouteBuilder) Build() Route {
|
||||||
pathExpr, err := newPathExpression(b.currentPath)
|
pathExpr, err := newPathExpression(b.currentPath)
|
||||||
@ -217,7 +262,8 @@ func (b *RouteBuilder) Build() Route {
|
|||||||
ParameterDocs: b.parameters,
|
ParameterDocs: b.parameters,
|
||||||
ResponseErrors: b.errorMap,
|
ResponseErrors: b.errorMap,
|
||||||
ReadSample: b.readSample,
|
ReadSample: b.readSample,
|
||||||
WriteSample: b.writeSample}
|
WriteSample: b.writeSample,
|
||||||
|
Metadata: b.metadata}
|
||||||
route.postBuild()
|
route.postBuild()
|
||||||
return route
|
return route
|
||||||
}
|
}
|
||||||
@ -226,6 +272,8 @@ func concatPath(path1, path2 string) string {
|
|||||||
return strings.TrimRight(path1, "/") + "/" + strings.TrimLeft(path2, "/")
|
return strings.TrimRight(path1, "/") + "/" + strings.TrimLeft(path2, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var anonymousFuncCount int32
|
||||||
|
|
||||||
// nameOfFunction returns the short name of the function f for documentation.
|
// nameOfFunction returns the short name of the function f for documentation.
|
||||||
// It uses a runtime feature for debugging ; its value may change for later Go versions.
|
// It uses a runtime feature for debugging ; its value may change for later Go versions.
|
||||||
func nameOfFunction(f interface{}) string {
|
func nameOfFunction(f interface{}) string {
|
||||||
@ -236,5 +284,10 @@ func nameOfFunction(f interface{}) string {
|
|||||||
last = strings.TrimSuffix(last, ")-fm") // Go 1.5
|
last = strings.TrimSuffix(last, ")-fm") // Go 1.5
|
||||||
last = strings.TrimSuffix(last, "·fm") // < Go 1.5
|
last = strings.TrimSuffix(last, "·fm") // < Go 1.5
|
||||||
last = strings.TrimSuffix(last, "-fm") // Go 1.5
|
last = strings.TrimSuffix(last, "-fm") // Go 1.5
|
||||||
|
if last == "func1" { // this could mean conflicts in API docs
|
||||||
|
val := atomic.AddInt32(&anonymousFuncCount, 1)
|
||||||
|
last = "func" + fmt.Sprintf("%d", val)
|
||||||
|
atomic.StoreInt32(&anonymousFuncCount, val)
|
||||||
|
}
|
||||||
return last
|
return last
|
||||||
}
|
}
|
||||||
|
36
vendor/github.com/emicklei/go-restful/web_service.go
generated
vendored
36
vendor/github.com/emicklei/go-restful/web_service.go
generated
vendored
@ -3,6 +3,7 @@ package restful
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/emicklei/go-restful/log"
|
"github.com/emicklei/go-restful/log"
|
||||||
@ -24,6 +25,8 @@ type WebService struct {
|
|||||||
documentation string
|
documentation string
|
||||||
apiVersion string
|
apiVersion string
|
||||||
|
|
||||||
|
typeNameHandleFunc TypeNameHandleFunction
|
||||||
|
|
||||||
dynamicRoutes bool
|
dynamicRoutes bool
|
||||||
|
|
||||||
// protects 'routes' if dynamic routes are enabled
|
// protects 'routes' if dynamic routes are enabled
|
||||||
@ -34,6 +37,25 @@ func (w *WebService) SetDynamicRoutes(enable bool) {
|
|||||||
w.dynamicRoutes = enable
|
w.dynamicRoutes = enable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TypeNameHandleFunction declares functions that can handle translating the name of a sample object
|
||||||
|
// into the restful documentation for the service.
|
||||||
|
type TypeNameHandleFunction func(sample interface{}) string
|
||||||
|
|
||||||
|
// TypeNameHandler sets the function that will convert types to strings in the parameter
|
||||||
|
// and model definitions. If not set, the web service will invoke
|
||||||
|
// reflect.TypeOf(object).String().
|
||||||
|
func (w *WebService) TypeNameHandler(handler TypeNameHandleFunction) *WebService {
|
||||||
|
w.typeNameHandleFunc = handler
|
||||||
|
return w
|
||||||
|
}
|
||||||
|
|
||||||
|
// reflectTypeName is the default TypeNameHandleFunction and for a given object
|
||||||
|
// returns the name that Go identifies it with (e.g. "string" or "v1.Object") via
|
||||||
|
// the reflection API.
|
||||||
|
func reflectTypeName(sample interface{}) string {
|
||||||
|
return reflect.TypeOf(sample).String()
|
||||||
|
}
|
||||||
|
|
||||||
// compilePathExpression ensures that the path is compiled into a RegEx for those routers that need it.
|
// compilePathExpression ensures that the path is compiled into a RegEx for those routers that need it.
|
||||||
func (w *WebService) compilePathExpression() {
|
func (w *WebService) compilePathExpression() {
|
||||||
compiled, err := newPathExpression(w.rootPath)
|
compiled, err := newPathExpression(w.rootPath)
|
||||||
@ -174,7 +196,7 @@ func (w *WebService) RemoveRoute(path, method string) error {
|
|||||||
|
|
||||||
// Method creates a new RouteBuilder and initialize its http method
|
// Method creates a new RouteBuilder and initialize its http method
|
||||||
func (w *WebService) Method(httpMethod string) *RouteBuilder {
|
func (w *WebService) Method(httpMethod string) *RouteBuilder {
|
||||||
return new(RouteBuilder).servicePath(w.rootPath).Method(httpMethod)
|
return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method(httpMethod)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Produces specifies that this WebService can produce one or more MIME types.
|
// Produces specifies that this WebService can produce one or more MIME types.
|
||||||
@ -239,30 +261,30 @@ func (w *WebService) Documentation() string {
|
|||||||
|
|
||||||
// HEAD is a shortcut for .Method("HEAD").Path(subPath)
|
// HEAD is a shortcut for .Method("HEAD").Path(subPath)
|
||||||
func (w *WebService) HEAD(subPath string) *RouteBuilder {
|
func (w *WebService) HEAD(subPath string) *RouteBuilder {
|
||||||
return new(RouteBuilder).servicePath(w.rootPath).Method("HEAD").Path(subPath)
|
return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("HEAD").Path(subPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET is a shortcut for .Method("GET").Path(subPath)
|
// GET is a shortcut for .Method("GET").Path(subPath)
|
||||||
func (w *WebService) GET(subPath string) *RouteBuilder {
|
func (w *WebService) GET(subPath string) *RouteBuilder {
|
||||||
return new(RouteBuilder).servicePath(w.rootPath).Method("GET").Path(subPath)
|
return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("GET").Path(subPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST is a shortcut for .Method("POST").Path(subPath)
|
// POST is a shortcut for .Method("POST").Path(subPath)
|
||||||
func (w *WebService) POST(subPath string) *RouteBuilder {
|
func (w *WebService) POST(subPath string) *RouteBuilder {
|
||||||
return new(RouteBuilder).servicePath(w.rootPath).Method("POST").Path(subPath)
|
return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("POST").Path(subPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT is a shortcut for .Method("PUT").Path(subPath)
|
// PUT is a shortcut for .Method("PUT").Path(subPath)
|
||||||
func (w *WebService) PUT(subPath string) *RouteBuilder {
|
func (w *WebService) PUT(subPath string) *RouteBuilder {
|
||||||
return new(RouteBuilder).servicePath(w.rootPath).Method("PUT").Path(subPath)
|
return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("PUT").Path(subPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PATCH is a shortcut for .Method("PATCH").Path(subPath)
|
// PATCH is a shortcut for .Method("PATCH").Path(subPath)
|
||||||
func (w *WebService) PATCH(subPath string) *RouteBuilder {
|
func (w *WebService) PATCH(subPath string) *RouteBuilder {
|
||||||
return new(RouteBuilder).servicePath(w.rootPath).Method("PATCH").Path(subPath)
|
return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("PATCH").Path(subPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DELETE is a shortcut for .Method("DELETE").Path(subPath)
|
// DELETE is a shortcut for .Method("DELETE").Path(subPath)
|
||||||
func (w *WebService) DELETE(subPath string) *RouteBuilder {
|
func (w *WebService) DELETE(subPath string) *RouteBuilder {
|
||||||
return new(RouteBuilder).servicePath(w.rootPath).Method("DELETE").Path(subPath)
|
return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("DELETE").Path(subPath)
|
||||||
}
|
}
|
||||||
|
117
vendor/github.com/golang/protobuf/proto/decode.go
generated
vendored
117
vendor/github.com/golang/protobuf/proto/decode.go
generated
vendored
@ -61,7 +61,6 @@ var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for
|
|||||||
// int32, int64, uint32, uint64, bool, and enum
|
// int32, int64, uint32, uint64, bool, and enum
|
||||||
// protocol buffer types.
|
// protocol buffer types.
|
||||||
func DecodeVarint(buf []byte) (x uint64, n int) {
|
func DecodeVarint(buf []byte) (x uint64, n int) {
|
||||||
// x, n already 0
|
|
||||||
for shift := uint(0); shift < 64; shift += 7 {
|
for shift := uint(0); shift < 64; shift += 7 {
|
||||||
if n >= len(buf) {
|
if n >= len(buf) {
|
||||||
return 0, 0
|
return 0, 0
|
||||||
@ -78,13 +77,7 @@ func DecodeVarint(buf []byte) (x uint64, n int) {
|
|||||||
return 0, 0
|
return 0, 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeVarint reads a varint-encoded integer from the Buffer.
|
func (p *Buffer) decodeVarintSlow() (x uint64, err error) {
|
||||||
// This is the format for the
|
|
||||||
// int32, int64, uint32, uint64, bool, and enum
|
|
||||||
// protocol buffer types.
|
|
||||||
func (p *Buffer) DecodeVarint() (x uint64, err error) {
|
|
||||||
// x, err already 0
|
|
||||||
|
|
||||||
i := p.index
|
i := p.index
|
||||||
l := len(p.buf)
|
l := len(p.buf)
|
||||||
|
|
||||||
@ -107,6 +100,107 @@ func (p *Buffer) DecodeVarint() (x uint64, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DecodeVarint reads a varint-encoded integer from the Buffer.
|
||||||
|
// This is the format for the
|
||||||
|
// int32, int64, uint32, uint64, bool, and enum
|
||||||
|
// protocol buffer types.
|
||||||
|
func (p *Buffer) DecodeVarint() (x uint64, err error) {
|
||||||
|
i := p.index
|
||||||
|
buf := p.buf
|
||||||
|
|
||||||
|
if i >= len(buf) {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
} else if buf[i] < 0x80 {
|
||||||
|
p.index++
|
||||||
|
return uint64(buf[i]), nil
|
||||||
|
} else if len(buf)-i < 10 {
|
||||||
|
return p.decodeVarintSlow()
|
||||||
|
}
|
||||||
|
|
||||||
|
var b uint64
|
||||||
|
// we already checked the first byte
|
||||||
|
x = uint64(buf[i]) - 0x80
|
||||||
|
i++
|
||||||
|
|
||||||
|
b = uint64(buf[i])
|
||||||
|
i++
|
||||||
|
x += b << 7
|
||||||
|
if b&0x80 == 0 {
|
||||||
|
goto done
|
||||||
|
}
|
||||||
|
x -= 0x80 << 7
|
||||||
|
|
||||||
|
b = uint64(buf[i])
|
||||||
|
i++
|
||||||
|
x += b << 14
|
||||||
|
if b&0x80 == 0 {
|
||||||
|
goto done
|
||||||
|
}
|
||||||
|
x -= 0x80 << 14
|
||||||
|
|
||||||
|
b = uint64(buf[i])
|
||||||
|
i++
|
||||||
|
x += b << 21
|
||||||
|
if b&0x80 == 0 {
|
||||||
|
goto done
|
||||||
|
}
|
||||||
|
x -= 0x80 << 21
|
||||||
|
|
||||||
|
b = uint64(buf[i])
|
||||||
|
i++
|
||||||
|
x += b << 28
|
||||||
|
if b&0x80 == 0 {
|
||||||
|
goto done
|
||||||
|
}
|
||||||
|
x -= 0x80 << 28
|
||||||
|
|
||||||
|
b = uint64(buf[i])
|
||||||
|
i++
|
||||||
|
x += b << 35
|
||||||
|
if b&0x80 == 0 {
|
||||||
|
goto done
|
||||||
|
}
|
||||||
|
x -= 0x80 << 35
|
||||||
|
|
||||||
|
b = uint64(buf[i])
|
||||||
|
i++
|
||||||
|
x += b << 42
|
||||||
|
if b&0x80 == 0 {
|
||||||
|
goto done
|
||||||
|
}
|
||||||
|
x -= 0x80 << 42
|
||||||
|
|
||||||
|
b = uint64(buf[i])
|
||||||
|
i++
|
||||||
|
x += b << 49
|
||||||
|
if b&0x80 == 0 {
|
||||||
|
goto done
|
||||||
|
}
|
||||||
|
x -= 0x80 << 49
|
||||||
|
|
||||||
|
b = uint64(buf[i])
|
||||||
|
i++
|
||||||
|
x += b << 56
|
||||||
|
if b&0x80 == 0 {
|
||||||
|
goto done
|
||||||
|
}
|
||||||
|
x -= 0x80 << 56
|
||||||
|
|
||||||
|
b = uint64(buf[i])
|
||||||
|
i++
|
||||||
|
x += b << 63
|
||||||
|
if b&0x80 == 0 {
|
||||||
|
goto done
|
||||||
|
}
|
||||||
|
// x -= 0x80 << 63 // Always zero.
|
||||||
|
|
||||||
|
return 0, errOverflow
|
||||||
|
|
||||||
|
done:
|
||||||
|
p.index = i
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
// DecodeFixed64 reads a 64-bit integer from the Buffer.
|
// DecodeFixed64 reads a 64-bit integer from the Buffer.
|
||||||
// This is the format for the
|
// This is the format for the
|
||||||
// fixed64, sfixed64, and double protocol buffer types.
|
// fixed64, sfixed64, and double protocol buffer types.
|
||||||
@ -340,6 +434,8 @@ func (p *Buffer) DecodeGroup(pb Message) error {
|
|||||||
// Buffer and places the decoded result in pb. If the struct
|
// Buffer and places the decoded result in pb. If the struct
|
||||||
// underlying pb does not match the data in the buffer, the results can be
|
// underlying pb does not match the data in the buffer, the results can be
|
||||||
// unpredictable.
|
// unpredictable.
|
||||||
|
//
|
||||||
|
// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal.
|
||||||
func (p *Buffer) Unmarshal(pb Message) error {
|
func (p *Buffer) Unmarshal(pb Message) error {
|
||||||
// If the object can unmarshal itself, let it.
|
// If the object can unmarshal itself, let it.
|
||||||
if u, ok := pb.(Unmarshaler); ok {
|
if u, ok := pb.(Unmarshaler); ok {
|
||||||
@ -378,6 +474,11 @@ func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group
|
|||||||
wire := int(u & 0x7)
|
wire := int(u & 0x7)
|
||||||
if wire == WireEndGroup {
|
if wire == WireEndGroup {
|
||||||
if is_group {
|
if is_group {
|
||||||
|
if required > 0 {
|
||||||
|
// Not enough information to determine the exact field.
|
||||||
|
// (See below.)
|
||||||
|
return &RequiredNotSetError{"{Unknown}"}
|
||||||
|
}
|
||||||
return nil // input is satisfied
|
return nil // input is satisfied
|
||||||
}
|
}
|
||||||
return fmt.Errorf("proto: %s: wiretype end group for non-group", st)
|
return fmt.Errorf("proto: %s: wiretype end group for non-group", st)
|
||||||
|
14
vendor/github.com/golang/protobuf/proto/encode.go
generated
vendored
14
vendor/github.com/golang/protobuf/proto/encode.go
generated
vendored
@ -234,10 +234,6 @@ func Marshal(pb Message) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
p := NewBuffer(nil)
|
p := NewBuffer(nil)
|
||||||
err := p.Marshal(pb)
|
err := p.Marshal(pb)
|
||||||
var state errorState
|
|
||||||
if err != nil && !state.shouldContinue(err, nil) {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if p.buf == nil && err == nil {
|
if p.buf == nil && err == nil {
|
||||||
// Return a non-nil slice on success.
|
// Return a non-nil slice on success.
|
||||||
return []byte{}, nil
|
return []byte{}, nil
|
||||||
@ -266,11 +262,8 @@ func (p *Buffer) Marshal(pb Message) error {
|
|||||||
// Can the object marshal itself?
|
// Can the object marshal itself?
|
||||||
if m, ok := pb.(Marshaler); ok {
|
if m, ok := pb.(Marshaler); ok {
|
||||||
data, err := m.Marshal()
|
data, err := m.Marshal()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
p.buf = append(p.buf, data...)
|
p.buf = append(p.buf, data...)
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
t, base, err := getbase(pb)
|
t, base, err := getbase(pb)
|
||||||
@ -282,7 +275,7 @@ func (p *Buffer) Marshal(pb Message) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if collectStats {
|
if collectStats {
|
||||||
stats.Encode++
|
(stats).Encode++ // Parens are to work around a goimports bug.
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(p.buf) > maxMarshalSize {
|
if len(p.buf) > maxMarshalSize {
|
||||||
@ -309,7 +302,7 @@ func Size(pb Message) (n int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if collectStats {
|
if collectStats {
|
||||||
stats.Size++
|
(stats).Size++ // Parens are to work around a goimports bug.
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -1014,7 +1007,6 @@ func size_slice_struct_message(p *Properties, base structPointer) (n int) {
|
|||||||
if p.isMarshaler {
|
if p.isMarshaler {
|
||||||
m := structPointer_Interface(structp, p.stype).(Marshaler)
|
m := structPointer_Interface(structp, p.stype).(Marshaler)
|
||||||
data, _ := m.Marshal()
|
data, _ := m.Marshal()
|
||||||
n += len(p.tagcode)
|
|
||||||
n += sizeRawBytes(data)
|
n += sizeRawBytes(data)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
8
vendor/github.com/golang/protobuf/proto/equal.go
generated
vendored
8
vendor/github.com/golang/protobuf/proto/equal.go
generated
vendored
@ -54,13 +54,17 @@ Equality is defined in this way:
|
|||||||
in a proto3 .proto file, fields are not "set"; specifically,
|
in a proto3 .proto file, fields are not "set"; specifically,
|
||||||
zero length proto3 "bytes" fields are equal (nil == {}).
|
zero length proto3 "bytes" fields are equal (nil == {}).
|
||||||
- Two repeated fields are equal iff their lengths are the same,
|
- Two repeated fields are equal iff their lengths are the same,
|
||||||
and their corresponding elements are equal (a "bytes" field,
|
and their corresponding elements are equal. Note a "bytes" field,
|
||||||
although represented by []byte, is not a repeated field)
|
although represented by []byte, is not a repeated field and the
|
||||||
|
rule for the scalar fields described above applies.
|
||||||
- Two unset fields are equal.
|
- Two unset fields are equal.
|
||||||
- Two unknown field sets are equal if their current
|
- Two unknown field sets are equal if their current
|
||||||
encoded state is equal.
|
encoded state is equal.
|
||||||
- Two extension sets are equal iff they have corresponding
|
- Two extension sets are equal iff they have corresponding
|
||||||
elements that are pairwise equal.
|
elements that are pairwise equal.
|
||||||
|
- Two map fields are equal iff their lengths are the same,
|
||||||
|
and they contain the same set of elements. Zero-length map
|
||||||
|
fields are equal.
|
||||||
- Every other combination of things are not equal.
|
- Every other combination of things are not equal.
|
||||||
|
|
||||||
The return value is undefined if a and b are not protocol buffers.
|
The return value is undefined if a and b are not protocol buffers.
|
||||||
|
31
vendor/github.com/golang/protobuf/proto/extensions.go
generated
vendored
31
vendor/github.com/golang/protobuf/proto/extensions.go
generated
vendored
@ -489,6 +489,37 @@ func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, e
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order.
|
||||||
|
// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing
|
||||||
|
// just the Field field, which defines the extension's field number.
|
||||||
|
func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) {
|
||||||
|
epb, ok := extendable(pb)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("proto: %T is not an extendable proto.Message", pb)
|
||||||
|
}
|
||||||
|
registeredExtensions := RegisteredExtensions(pb)
|
||||||
|
|
||||||
|
emap, mu := epb.extensionsRead()
|
||||||
|
if emap == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
mu.Lock()
|
||||||
|
defer mu.Unlock()
|
||||||
|
extensions := make([]*ExtensionDesc, 0, len(emap))
|
||||||
|
for extid, e := range emap {
|
||||||
|
desc := e.desc
|
||||||
|
if desc == nil {
|
||||||
|
desc = registeredExtensions[extid]
|
||||||
|
if desc == nil {
|
||||||
|
desc = &ExtensionDesc{Field: extid}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extensions = append(extensions, desc)
|
||||||
|
}
|
||||||
|
return extensions, nil
|
||||||
|
}
|
||||||
|
|
||||||
// SetExtension sets the specified extension of pb to the specified value.
|
// SetExtension sets the specified extension of pb to the specified value.
|
||||||
func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error {
|
func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error {
|
||||||
epb, ok := extendable(pb)
|
epb, ok := extendable(pb)
|
||||||
|
2
vendor/github.com/golang/protobuf/proto/lib.go
generated
vendored
2
vendor/github.com/golang/protobuf/proto/lib.go
generated
vendored
@ -308,7 +308,7 @@ func GetStats() Stats { return stats }
|
|||||||
// temporary Buffer and are fine for most applications.
|
// temporary Buffer and are fine for most applications.
|
||||||
type Buffer struct {
|
type Buffer struct {
|
||||||
buf []byte // encode/decode byte stream
|
buf []byte // encode/decode byte stream
|
||||||
index int // write point
|
index int // read point
|
||||||
|
|
||||||
// pools of basic types to amortize allocation.
|
// pools of basic types to amortize allocation.
|
||||||
bools []bool
|
bools []bool
|
||||||
|
10
vendor/github.com/golang/protobuf/proto/properties.go
generated
vendored
10
vendor/github.com/golang/protobuf/proto/properties.go
generated
vendored
@ -844,7 +844,15 @@ func RegisterType(x Message, name string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MessageName returns the fully-qualified proto name for the given message type.
|
// MessageName returns the fully-qualified proto name for the given message type.
|
||||||
func MessageName(x Message) string { return revProtoTypes[reflect.TypeOf(x)] }
|
func MessageName(x Message) string {
|
||||||
|
type xname interface {
|
||||||
|
XXX_MessageName() string
|
||||||
|
}
|
||||||
|
if m, ok := x.(xname); ok {
|
||||||
|
return m.XXX_MessageName()
|
||||||
|
}
|
||||||
|
return revProtoTypes[reflect.TypeOf(x)]
|
||||||
|
}
|
||||||
|
|
||||||
// MessageType returns the message type (pointer to struct) for a named message.
|
// MessageType returns the message type (pointer to struct) for a named message.
|
||||||
func MessageType(name string) reflect.Type { return protoTypes[name] }
|
func MessageType(name string) reflect.Type { return protoTypes[name] }
|
||||||
|
2
vendor/github.com/golang/protobuf/proto/text.go
generated
vendored
2
vendor/github.com/golang/protobuf/proto/text.go
generated
vendored
@ -154,7 +154,7 @@ func (w *textWriter) indent() { w.ind++ }
|
|||||||
|
|
||||||
func (w *textWriter) unindent() {
|
func (w *textWriter) unindent() {
|
||||||
if w.ind == 0 {
|
if w.ind == 0 {
|
||||||
log.Printf("proto: textWriter unindented too far")
|
log.Print("proto: textWriter unindented too far")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.ind--
|
w.ind--
|
||||||
|
23
vendor/github.com/golang/protobuf/proto/text_parser.go
generated
vendored
23
vendor/github.com/golang/protobuf/proto/text_parser.go
generated
vendored
@ -44,6 +44,9 @@ import (
|
|||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Error string emitted when deserializing Any and fields are already set
|
||||||
|
const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set"
|
||||||
|
|
||||||
type ParseError struct {
|
type ParseError struct {
|
||||||
Message string
|
Message string
|
||||||
Line int // 1-based line number
|
Line int // 1-based line number
|
||||||
@ -508,8 +511,16 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return p.errorf("failed to marshal message of type %q: %v", messageName, err)
|
return p.errorf("failed to marshal message of type %q: %v", messageName, err)
|
||||||
}
|
}
|
||||||
|
if fieldSet["type_url"] {
|
||||||
|
return p.errorf(anyRepeatedlyUnpacked, "type_url")
|
||||||
|
}
|
||||||
|
if fieldSet["value"] {
|
||||||
|
return p.errorf(anyRepeatedlyUnpacked, "value")
|
||||||
|
}
|
||||||
sv.FieldByName("TypeUrl").SetString(extName)
|
sv.FieldByName("TypeUrl").SetString(extName)
|
||||||
sv.FieldByName("Value").SetBytes(b)
|
sv.FieldByName("Value").SetBytes(b)
|
||||||
|
fieldSet["type_url"] = true
|
||||||
|
fieldSet["value"] = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,7 +592,11 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
|
|||||||
props = oop.Prop
|
props = oop.Prop
|
||||||
nv := reflect.New(oop.Type.Elem())
|
nv := reflect.New(oop.Type.Elem())
|
||||||
dst = nv.Elem().Field(0)
|
dst = nv.Elem().Field(0)
|
||||||
sv.Field(oop.Field).Set(nv)
|
field := sv.Field(oop.Field)
|
||||||
|
if !field.IsNil() {
|
||||||
|
return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name)
|
||||||
|
}
|
||||||
|
field.Set(nv)
|
||||||
}
|
}
|
||||||
if !dst.IsValid() {
|
if !dst.IsValid() {
|
||||||
return p.errorf("unknown field name %q in %v", name, st)
|
return p.errorf("unknown field name %q in %v", name, st)
|
||||||
@ -781,12 +796,12 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) error {
|
|||||||
fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
|
fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
|
||||||
return p.readAny(fv.Index(fv.Len()-1), props)
|
return p.readAny(fv.Index(fv.Len()-1), props)
|
||||||
case reflect.Bool:
|
case reflect.Bool:
|
||||||
// Either "true", "false", 1 or 0.
|
// true/1/t/True or false/f/0/False.
|
||||||
switch tok.value {
|
switch tok.value {
|
||||||
case "true", "1":
|
case "true", "1", "t", "True":
|
||||||
fv.SetBool(true)
|
fv.SetBool(true)
|
||||||
return nil
|
return nil
|
||||||
case "false", "0":
|
case "false", "0", "f", "False":
|
||||||
fv.SetBool(false)
|
fv.SetBool(false)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
13
vendor/github.com/google/gofuzz/.travis.yml
generated
vendored
13
vendor/github.com/google/gofuzz/.travis.yml
generated
vendored
@ -1,13 +0,0 @@
|
|||||||
language: go
|
|
||||||
|
|
||||||
go:
|
|
||||||
- 1.4
|
|
||||||
- 1.3
|
|
||||||
- 1.2
|
|
||||||
- tip
|
|
||||||
|
|
||||||
install:
|
|
||||||
- if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go test -cover
|
|
67
vendor/github.com/google/gofuzz/CONTRIBUTING.md
generated
vendored
67
vendor/github.com/google/gofuzz/CONTRIBUTING.md
generated
vendored
@ -1,67 +0,0 @@
|
|||||||
# How to contribute #
|
|
||||||
|
|
||||||
We'd love to accept your patches and contributions to this project. There are
|
|
||||||
a just a few small guidelines you need to follow.
|
|
||||||
|
|
||||||
|
|
||||||
## Contributor License Agreement ##
|
|
||||||
|
|
||||||
Contributions to any Google project must be accompanied by a Contributor
|
|
||||||
License Agreement. This is not a copyright **assignment**, it simply gives
|
|
||||||
Google permission to use and redistribute your contributions as part of the
|
|
||||||
project.
|
|
||||||
|
|
||||||
* If you are an individual writing original source code and you're sure you
|
|
||||||
own the intellectual property, then you'll need to sign an [individual
|
|
||||||
CLA][].
|
|
||||||
|
|
||||||
* If you work for a company that wants to allow you to contribute your work,
|
|
||||||
then you'll need to sign a [corporate CLA][].
|
|
||||||
|
|
||||||
You generally only need to submit a CLA once, so if you've already submitted
|
|
||||||
one (even if it was for a different project), you probably don't need to do it
|
|
||||||
again.
|
|
||||||
|
|
||||||
[individual CLA]: https://developers.google.com/open-source/cla/individual
|
|
||||||
[corporate CLA]: https://developers.google.com/open-source/cla/corporate
|
|
||||||
|
|
||||||
|
|
||||||
## Submitting a patch ##
|
|
||||||
|
|
||||||
1. It's generally best to start by opening a new issue describing the bug or
|
|
||||||
feature you're intending to fix. Even if you think it's relatively minor,
|
|
||||||
it's helpful to know what people are working on. Mention in the initial
|
|
||||||
issue that you are planning to work on that bug or feature so that it can
|
|
||||||
be assigned to you.
|
|
||||||
|
|
||||||
1. Follow the normal process of [forking][] the project, and setup a new
|
|
||||||
branch to work in. It's important that each group of changes be done in
|
|
||||||
separate branches in order to ensure that a pull request only includes the
|
|
||||||
commits related to that bug or feature.
|
|
||||||
|
|
||||||
1. Go makes it very simple to ensure properly formatted code, so always run
|
|
||||||
`go fmt` on your code before committing it. You should also run
|
|
||||||
[golint][] over your code. As noted in the [golint readme][], it's not
|
|
||||||
strictly necessary that your code be completely "lint-free", but this will
|
|
||||||
help you find common style issues.
|
|
||||||
|
|
||||||
1. Any significant changes should almost always be accompanied by tests. The
|
|
||||||
project already has good test coverage, so look at some of the existing
|
|
||||||
tests if you're unsure how to go about it. [gocov][] and [gocov-html][]
|
|
||||||
are invaluable tools for seeing which parts of your code aren't being
|
|
||||||
exercised by your tests.
|
|
||||||
|
|
||||||
1. Do your best to have [well-formed commit messages][] for each change.
|
|
||||||
This provides consistency throughout the project, and ensures that commit
|
|
||||||
messages are able to be formatted properly by various git tools.
|
|
||||||
|
|
||||||
1. Finally, push the commits to your fork and submit a [pull request][].
|
|
||||||
|
|
||||||
[forking]: https://help.github.com/articles/fork-a-repo
|
|
||||||
[golint]: https://github.com/golang/lint
|
|
||||||
[golint readme]: https://github.com/golang/lint/blob/master/README
|
|
||||||
[gocov]: https://github.com/axw/gocov
|
|
||||||
[gocov-html]: https://github.com/matm/gocov-html
|
|
||||||
[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
|
||||||
[squash]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits
|
|
||||||
[pull request]: https://help.github.com/articles/creating-a-pull-request
|
|
202
vendor/github.com/google/gofuzz/LICENSE
generated
vendored
202
vendor/github.com/google/gofuzz/LICENSE
generated
vendored
@ -1,202 +0,0 @@
|
|||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
71
vendor/github.com/google/gofuzz/README.md
generated
vendored
71
vendor/github.com/google/gofuzz/README.md
generated
vendored
@ -1,71 +0,0 @@
|
|||||||
gofuzz
|
|
||||||
======
|
|
||||||
|
|
||||||
gofuzz is a library for populating go objects with random values.
|
|
||||||
|
|
||||||
[](https://godoc.org/github.com/google/gofuzz)
|
|
||||||
[](https://travis-ci.org/google/gofuzz)
|
|
||||||
|
|
||||||
This is useful for testing:
|
|
||||||
|
|
||||||
* Do your project's objects really serialize/unserialize correctly in all cases?
|
|
||||||
* Is there an incorrectly formatted object that will cause your project to panic?
|
|
||||||
|
|
||||||
Import with ```import "github.com/google/gofuzz"```
|
|
||||||
|
|
||||||
You can use it on single variables:
|
|
||||||
```go
|
|
||||||
f := fuzz.New()
|
|
||||||
var myInt int
|
|
||||||
f.Fuzz(&myInt) // myInt gets a random value.
|
|
||||||
```
|
|
||||||
|
|
||||||
You can use it on maps:
|
|
||||||
```go
|
|
||||||
f := fuzz.New().NilChance(0).NumElements(1, 1)
|
|
||||||
var myMap map[ComplexKeyType]string
|
|
||||||
f.Fuzz(&myMap) // myMap will have exactly one element.
|
|
||||||
```
|
|
||||||
|
|
||||||
Customize the chance of getting a nil pointer:
|
|
||||||
```go
|
|
||||||
f := fuzz.New().NilChance(.5)
|
|
||||||
var fancyStruct struct {
|
|
||||||
A, B, C, D *string
|
|
||||||
}
|
|
||||||
f.Fuzz(&fancyStruct) // About half the pointers should be set.
|
|
||||||
```
|
|
||||||
|
|
||||||
You can even customize the randomization completely if needed:
|
|
||||||
```go
|
|
||||||
type MyEnum string
|
|
||||||
const (
|
|
||||||
A MyEnum = "A"
|
|
||||||
B MyEnum = "B"
|
|
||||||
)
|
|
||||||
type MyInfo struct {
|
|
||||||
Type MyEnum
|
|
||||||
AInfo *string
|
|
||||||
BInfo *string
|
|
||||||
}
|
|
||||||
|
|
||||||
f := fuzz.New().NilChance(0).Funcs(
|
|
||||||
func(e *MyInfo, c fuzz.Continue) {
|
|
||||||
switch c.Intn(2) {
|
|
||||||
case 0:
|
|
||||||
e.Type = A
|
|
||||||
c.Fuzz(&e.AInfo)
|
|
||||||
case 1:
|
|
||||||
e.Type = B
|
|
||||||
c.Fuzz(&e.BInfo)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
var myObject MyInfo
|
|
||||||
f.Fuzz(&myObject) // Type will correspond to whether A or B info is set.
|
|
||||||
```
|
|
||||||
|
|
||||||
See more examples in ```example_test.go```.
|
|
||||||
|
|
||||||
Happy testing!
|
|
18
vendor/github.com/google/gofuzz/doc.go
generated
vendored
18
vendor/github.com/google/gofuzz/doc.go
generated
vendored
@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Package fuzz is a library for populating go objects with random values.
|
|
||||||
package fuzz
|
|
453
vendor/github.com/google/gofuzz/fuzz.go
generated
vendored
453
vendor/github.com/google/gofuzz/fuzz.go
generated
vendored
@ -1,453 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package fuzz
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"math/rand"
|
|
||||||
"reflect"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// fuzzFuncMap is a map from a type to a fuzzFunc that handles that type.
|
|
||||||
type fuzzFuncMap map[reflect.Type]reflect.Value
|
|
||||||
|
|
||||||
// Fuzzer knows how to fill any object with random fields.
|
|
||||||
type Fuzzer struct {
|
|
||||||
fuzzFuncs fuzzFuncMap
|
|
||||||
defaultFuzzFuncs fuzzFuncMap
|
|
||||||
r *rand.Rand
|
|
||||||
nilChance float64
|
|
||||||
minElements int
|
|
||||||
maxElements int
|
|
||||||
}
|
|
||||||
|
|
||||||
// New returns a new Fuzzer. Customize your Fuzzer further by calling Funcs,
|
|
||||||
// RandSource, NilChance, or NumElements in any order.
|
|
||||||
func New() *Fuzzer {
|
|
||||||
f := &Fuzzer{
|
|
||||||
defaultFuzzFuncs: fuzzFuncMap{
|
|
||||||
reflect.TypeOf(&time.Time{}): reflect.ValueOf(fuzzTime),
|
|
||||||
},
|
|
||||||
|
|
||||||
fuzzFuncs: fuzzFuncMap{},
|
|
||||||
r: rand.New(rand.NewSource(time.Now().UnixNano())),
|
|
||||||
nilChance: .2,
|
|
||||||
minElements: 1,
|
|
||||||
maxElements: 10,
|
|
||||||
}
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
|
|
||||||
// Funcs adds each entry in fuzzFuncs as a custom fuzzing function.
|
|
||||||
//
|
|
||||||
// Each entry in fuzzFuncs must be a function taking two parameters.
|
|
||||||
// The first parameter must be a pointer or map. It is the variable that
|
|
||||||
// function will fill with random data. The second parameter must be a
|
|
||||||
// fuzz.Continue, which will provide a source of randomness and a way
|
|
||||||
// to automatically continue fuzzing smaller pieces of the first parameter.
|
|
||||||
//
|
|
||||||
// These functions are called sensibly, e.g., if you wanted custom string
|
|
||||||
// fuzzing, the function `func(s *string, c fuzz.Continue)` would get
|
|
||||||
// called and passed the address of strings. Maps and pointers will always
|
|
||||||
// be made/new'd for you, ignoring the NilChange option. For slices, it
|
|
||||||
// doesn't make much sense to pre-create them--Fuzzer doesn't know how
|
|
||||||
// long you want your slice--so take a pointer to a slice, and make it
|
|
||||||
// yourself. (If you don't want your map/pointer type pre-made, take a
|
|
||||||
// pointer to it, and make it yourself.) See the examples for a range of
|
|
||||||
// custom functions.
|
|
||||||
func (f *Fuzzer) Funcs(fuzzFuncs ...interface{}) *Fuzzer {
|
|
||||||
for i := range fuzzFuncs {
|
|
||||||
v := reflect.ValueOf(fuzzFuncs[i])
|
|
||||||
if v.Kind() != reflect.Func {
|
|
||||||
panic("Need only funcs!")
|
|
||||||
}
|
|
||||||
t := v.Type()
|
|
||||||
if t.NumIn() != 2 || t.NumOut() != 0 {
|
|
||||||
panic("Need 2 in and 0 out params!")
|
|
||||||
}
|
|
||||||
argT := t.In(0)
|
|
||||||
switch argT.Kind() {
|
|
||||||
case reflect.Ptr, reflect.Map:
|
|
||||||
default:
|
|
||||||
panic("fuzzFunc must take pointer or map type")
|
|
||||||
}
|
|
||||||
if t.In(1) != reflect.TypeOf(Continue{}) {
|
|
||||||
panic("fuzzFunc's second parameter must be type fuzz.Continue")
|
|
||||||
}
|
|
||||||
f.fuzzFuncs[argT] = v
|
|
||||||
}
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
|
|
||||||
// RandSource causes f to get values from the given source of randomness.
|
|
||||||
// Use if you want deterministic fuzzing.
|
|
||||||
func (f *Fuzzer) RandSource(s rand.Source) *Fuzzer {
|
|
||||||
f.r = rand.New(s)
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
|
|
||||||
// NilChance sets the probability of creating a nil pointer, map, or slice to
|
|
||||||
// 'p'. 'p' should be between 0 (no nils) and 1 (all nils), inclusive.
|
|
||||||
func (f *Fuzzer) NilChance(p float64) *Fuzzer {
|
|
||||||
if p < 0 || p > 1 {
|
|
||||||
panic("p should be between 0 and 1, inclusive.")
|
|
||||||
}
|
|
||||||
f.nilChance = p
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
|
|
||||||
// NumElements sets the minimum and maximum number of elements that will be
|
|
||||||
// added to a non-nil map or slice.
|
|
||||||
func (f *Fuzzer) NumElements(atLeast, atMost int) *Fuzzer {
|
|
||||||
if atLeast > atMost {
|
|
||||||
panic("atLeast must be <= atMost")
|
|
||||||
}
|
|
||||||
if atLeast < 0 {
|
|
||||||
panic("atLeast must be >= 0")
|
|
||||||
}
|
|
||||||
f.minElements = atLeast
|
|
||||||
f.maxElements = atMost
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *Fuzzer) genElementCount() int {
|
|
||||||
if f.minElements == f.maxElements {
|
|
||||||
return f.minElements
|
|
||||||
}
|
|
||||||
return f.minElements + f.r.Intn(f.maxElements-f.minElements+1)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *Fuzzer) genShouldFill() bool {
|
|
||||||
return f.r.Float64() > f.nilChance
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fuzz recursively fills all of obj's fields with something random. First
|
|
||||||
// this tries to find a custom fuzz function (see Funcs). If there is no
|
|
||||||
// custom function this tests whether the object implements fuzz.Interface and,
|
|
||||||
// if so, calls Fuzz on it to fuzz itself. If that fails, this will see if
|
|
||||||
// there is a default fuzz function provided by this package. If all of that
|
|
||||||
// fails, this will generate random values for all primitive fields and then
|
|
||||||
// recurse for all non-primitives.
|
|
||||||
//
|
|
||||||
// Not safe for cyclic or tree-like structs!
|
|
||||||
//
|
|
||||||
// obj must be a pointer. Only exported (public) fields can be set (thanks, golang :/ )
|
|
||||||
// Intended for tests, so will panic on bad input or unimplemented fields.
|
|
||||||
func (f *Fuzzer) Fuzz(obj interface{}) {
|
|
||||||
v := reflect.ValueOf(obj)
|
|
||||||
if v.Kind() != reflect.Ptr {
|
|
||||||
panic("needed ptr!")
|
|
||||||
}
|
|
||||||
v = v.Elem()
|
|
||||||
f.doFuzz(v, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FuzzNoCustom is just like Fuzz, except that any custom fuzz function for
|
|
||||||
// obj's type will not be called and obj will not be tested for fuzz.Interface
|
|
||||||
// conformance. This applies only to obj and not other instances of obj's
|
|
||||||
// type.
|
|
||||||
// Not safe for cyclic or tree-like structs!
|
|
||||||
// obj must be a pointer. Only exported (public) fields can be set (thanks, golang :/ )
|
|
||||||
// Intended for tests, so will panic on bad input or unimplemented fields.
|
|
||||||
func (f *Fuzzer) FuzzNoCustom(obj interface{}) {
|
|
||||||
v := reflect.ValueOf(obj)
|
|
||||||
if v.Kind() != reflect.Ptr {
|
|
||||||
panic("needed ptr!")
|
|
||||||
}
|
|
||||||
v = v.Elem()
|
|
||||||
f.doFuzz(v, flagNoCustomFuzz)
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Do not try to find a custom fuzz function. Does not apply recursively.
|
|
||||||
flagNoCustomFuzz uint64 = 1 << iota
|
|
||||||
)
|
|
||||||
|
|
||||||
func (f *Fuzzer) doFuzz(v reflect.Value, flags uint64) {
|
|
||||||
if !v.CanSet() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if flags&flagNoCustomFuzz == 0 {
|
|
||||||
// Check for both pointer and non-pointer custom functions.
|
|
||||||
if v.CanAddr() && f.tryCustom(v.Addr()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if f.tryCustom(v) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if fn, ok := fillFuncMap[v.Kind()]; ok {
|
|
||||||
fn(v, f.r)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
switch v.Kind() {
|
|
||||||
case reflect.Map:
|
|
||||||
if f.genShouldFill() {
|
|
||||||
v.Set(reflect.MakeMap(v.Type()))
|
|
||||||
n := f.genElementCount()
|
|
||||||
for i := 0; i < n; i++ {
|
|
||||||
key := reflect.New(v.Type().Key()).Elem()
|
|
||||||
f.doFuzz(key, 0)
|
|
||||||
val := reflect.New(v.Type().Elem()).Elem()
|
|
||||||
f.doFuzz(val, 0)
|
|
||||||
v.SetMapIndex(key, val)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
v.Set(reflect.Zero(v.Type()))
|
|
||||||
case reflect.Ptr:
|
|
||||||
if f.genShouldFill() {
|
|
||||||
v.Set(reflect.New(v.Type().Elem()))
|
|
||||||
f.doFuzz(v.Elem(), 0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
v.Set(reflect.Zero(v.Type()))
|
|
||||||
case reflect.Slice:
|
|
||||||
if f.genShouldFill() {
|
|
||||||
n := f.genElementCount()
|
|
||||||
v.Set(reflect.MakeSlice(v.Type(), n, n))
|
|
||||||
for i := 0; i < n; i++ {
|
|
||||||
f.doFuzz(v.Index(i), 0)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
v.Set(reflect.Zero(v.Type()))
|
|
||||||
case reflect.Array:
|
|
||||||
if f.genShouldFill() {
|
|
||||||
n := v.Len()
|
|
||||||
for i := 0; i < n; i++ {
|
|
||||||
f.doFuzz(v.Index(i), 0)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
v.Set(reflect.Zero(v.Type()))
|
|
||||||
case reflect.Struct:
|
|
||||||
for i := 0; i < v.NumField(); i++ {
|
|
||||||
f.doFuzz(v.Field(i), 0)
|
|
||||||
}
|
|
||||||
case reflect.Chan:
|
|
||||||
fallthrough
|
|
||||||
case reflect.Func:
|
|
||||||
fallthrough
|
|
||||||
case reflect.Interface:
|
|
||||||
fallthrough
|
|
||||||
default:
|
|
||||||
panic(fmt.Sprintf("Can't handle %#v", v.Interface()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// tryCustom searches for custom handlers, and returns true iff it finds a match
|
|
||||||
// and successfully randomizes v.
|
|
||||||
func (f *Fuzzer) tryCustom(v reflect.Value) bool {
|
|
||||||
// First: see if we have a fuzz function for it.
|
|
||||||
doCustom, ok := f.fuzzFuncs[v.Type()]
|
|
||||||
if !ok {
|
|
||||||
// Second: see if it can fuzz itself.
|
|
||||||
if v.CanInterface() {
|
|
||||||
intf := v.Interface()
|
|
||||||
if fuzzable, ok := intf.(Interface); ok {
|
|
||||||
fuzzable.Fuzz(Continue{f: f, Rand: f.r})
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Finally: see if there is a default fuzz function.
|
|
||||||
doCustom, ok = f.defaultFuzzFuncs[v.Type()]
|
|
||||||
if !ok {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v.Kind() {
|
|
||||||
case reflect.Ptr:
|
|
||||||
if v.IsNil() {
|
|
||||||
if !v.CanSet() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
v.Set(reflect.New(v.Type().Elem()))
|
|
||||||
}
|
|
||||||
case reflect.Map:
|
|
||||||
if v.IsNil() {
|
|
||||||
if !v.CanSet() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
v.Set(reflect.MakeMap(v.Type()))
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
doCustom.Call([]reflect.Value{v, reflect.ValueOf(Continue{
|
|
||||||
f: f,
|
|
||||||
Rand: f.r,
|
|
||||||
})})
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Interface represents an object that knows how to fuzz itself. Any time we
|
|
||||||
// find a type that implements this interface we will delegate the act of
|
|
||||||
// fuzzing itself.
|
|
||||||
type Interface interface {
|
|
||||||
Fuzz(c Continue)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Continue can be passed to custom fuzzing functions to allow them to use
|
|
||||||
// the correct source of randomness and to continue fuzzing their members.
|
|
||||||
type Continue struct {
|
|
||||||
f *Fuzzer
|
|
||||||
|
|
||||||
// For convenience, Continue implements rand.Rand via embedding.
|
|
||||||
// Use this for generating any randomness if you want your fuzzing
|
|
||||||
// to be repeatable for a given seed.
|
|
||||||
*rand.Rand
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fuzz continues fuzzing obj. obj must be a pointer.
|
|
||||||
func (c Continue) Fuzz(obj interface{}) {
|
|
||||||
v := reflect.ValueOf(obj)
|
|
||||||
if v.Kind() != reflect.Ptr {
|
|
||||||
panic("needed ptr!")
|
|
||||||
}
|
|
||||||
v = v.Elem()
|
|
||||||
c.f.doFuzz(v, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FuzzNoCustom continues fuzzing obj, except that any custom fuzz function for
|
|
||||||
// obj's type will not be called and obj will not be tested for fuzz.Interface
|
|
||||||
// conformance. This applies only to obj and not other instances of obj's
|
|
||||||
// type.
|
|
||||||
func (c Continue) FuzzNoCustom(obj interface{}) {
|
|
||||||
v := reflect.ValueOf(obj)
|
|
||||||
if v.Kind() != reflect.Ptr {
|
|
||||||
panic("needed ptr!")
|
|
||||||
}
|
|
||||||
v = v.Elem()
|
|
||||||
c.f.doFuzz(v, flagNoCustomFuzz)
|
|
||||||
}
|
|
||||||
|
|
||||||
// RandString makes a random string up to 20 characters long. The returned string
|
|
||||||
// may include a variety of (valid) UTF-8 encodings.
|
|
||||||
func (c Continue) RandString() string {
|
|
||||||
return randString(c.Rand)
|
|
||||||
}
|
|
||||||
|
|
||||||
// RandUint64 makes random 64 bit numbers.
|
|
||||||
// Weirdly, rand doesn't have a function that gives you 64 random bits.
|
|
||||||
func (c Continue) RandUint64() uint64 {
|
|
||||||
return randUint64(c.Rand)
|
|
||||||
}
|
|
||||||
|
|
||||||
// RandBool returns true or false randomly.
|
|
||||||
func (c Continue) RandBool() bool {
|
|
||||||
return randBool(c.Rand)
|
|
||||||
}
|
|
||||||
|
|
||||||
func fuzzInt(v reflect.Value, r *rand.Rand) {
|
|
||||||
v.SetInt(int64(randUint64(r)))
|
|
||||||
}
|
|
||||||
|
|
||||||
func fuzzUint(v reflect.Value, r *rand.Rand) {
|
|
||||||
v.SetUint(randUint64(r))
|
|
||||||
}
|
|
||||||
|
|
||||||
func fuzzTime(t *time.Time, c Continue) {
|
|
||||||
var sec, nsec int64
|
|
||||||
// Allow for about 1000 years of random time values, which keeps things
|
|
||||||
// like JSON parsing reasonably happy.
|
|
||||||
sec = c.Rand.Int63n(1000 * 365 * 24 * 60 * 60)
|
|
||||||
c.Fuzz(&nsec)
|
|
||||||
*t = time.Unix(sec, nsec)
|
|
||||||
}
|
|
||||||
|
|
||||||
var fillFuncMap = map[reflect.Kind]func(reflect.Value, *rand.Rand){
|
|
||||||
reflect.Bool: func(v reflect.Value, r *rand.Rand) {
|
|
||||||
v.SetBool(randBool(r))
|
|
||||||
},
|
|
||||||
reflect.Int: fuzzInt,
|
|
||||||
reflect.Int8: fuzzInt,
|
|
||||||
reflect.Int16: fuzzInt,
|
|
||||||
reflect.Int32: fuzzInt,
|
|
||||||
reflect.Int64: fuzzInt,
|
|
||||||
reflect.Uint: fuzzUint,
|
|
||||||
reflect.Uint8: fuzzUint,
|
|
||||||
reflect.Uint16: fuzzUint,
|
|
||||||
reflect.Uint32: fuzzUint,
|
|
||||||
reflect.Uint64: fuzzUint,
|
|
||||||
reflect.Uintptr: fuzzUint,
|
|
||||||
reflect.Float32: func(v reflect.Value, r *rand.Rand) {
|
|
||||||
v.SetFloat(float64(r.Float32()))
|
|
||||||
},
|
|
||||||
reflect.Float64: func(v reflect.Value, r *rand.Rand) {
|
|
||||||
v.SetFloat(r.Float64())
|
|
||||||
},
|
|
||||||
reflect.Complex64: func(v reflect.Value, r *rand.Rand) {
|
|
||||||
panic("unimplemented")
|
|
||||||
},
|
|
||||||
reflect.Complex128: func(v reflect.Value, r *rand.Rand) {
|
|
||||||
panic("unimplemented")
|
|
||||||
},
|
|
||||||
reflect.String: func(v reflect.Value, r *rand.Rand) {
|
|
||||||
v.SetString(randString(r))
|
|
||||||
},
|
|
||||||
reflect.UnsafePointer: func(v reflect.Value, r *rand.Rand) {
|
|
||||||
panic("unimplemented")
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// randBool returns true or false randomly.
|
|
||||||
func randBool(r *rand.Rand) bool {
|
|
||||||
if r.Int()&1 == 1 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
type charRange struct {
|
|
||||||
first, last rune
|
|
||||||
}
|
|
||||||
|
|
||||||
// choose returns a random unicode character from the given range, using the
|
|
||||||
// given randomness source.
|
|
||||||
func (r *charRange) choose(rand *rand.Rand) rune {
|
|
||||||
count := int64(r.last - r.first)
|
|
||||||
return r.first + rune(rand.Int63n(count))
|
|
||||||
}
|
|
||||||
|
|
||||||
var unicodeRanges = []charRange{
|
|
||||||
{' ', '~'}, // ASCII characters
|
|
||||||
{'\u00a0', '\u02af'}, // Multi-byte encoded characters
|
|
||||||
{'\u4e00', '\u9fff'}, // Common CJK (even longer encodings)
|
|
||||||
}
|
|
||||||
|
|
||||||
// randString makes a random string up to 20 characters long. The returned string
|
|
||||||
// may include a variety of (valid) UTF-8 encodings.
|
|
||||||
func randString(r *rand.Rand) string {
|
|
||||||
n := r.Intn(20)
|
|
||||||
runes := make([]rune, n)
|
|
||||||
for i := range runes {
|
|
||||||
runes[i] = unicodeRanges[r.Intn(len(unicodeRanges))].choose(r)
|
|
||||||
}
|
|
||||||
return string(runes)
|
|
||||||
}
|
|
||||||
|
|
||||||
// randUint64 makes random 64 bit numbers.
|
|
||||||
// Weirdly, rand doesn't have a function that gives you 64 random bits.
|
|
||||||
func randUint64(r *rand.Rand) uint64 {
|
|
||||||
return uint64(r.Uint32())<<32 | uint64(r.Uint32())
|
|
||||||
}
|
|
18
vendor/google.golang.org/appengine/.travis.yml
generated
vendored
18
vendor/google.golang.org/appengine/.travis.yml
generated
vendored
@ -1,18 +0,0 @@
|
|||||||
language: go
|
|
||||||
|
|
||||||
go:
|
|
||||||
- 1.6.3
|
|
||||||
- 1.7rc6
|
|
||||||
|
|
||||||
install:
|
|
||||||
- go get -v -t -d google.golang.org/appengine/...
|
|
||||||
- mkdir sdk
|
|
||||||
- curl -o sdk.zip "https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-1.9.40.zip"
|
|
||||||
- unzip sdk.zip -d sdk
|
|
||||||
- export APPENGINE_DEV_APPSERVER=$(pwd)/sdk/go_appengine/dev_appserver.py
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go version
|
|
||||||
- go test -v google.golang.org/appengine/...
|
|
||||||
- go test -v -race google.golang.org/appengine/...
|
|
||||||
- sdk/go_appengine/goapp test -v google.golang.org/appengine/...
|
|
202
vendor/google.golang.org/appengine/LICENSE
generated
vendored
202
vendor/google.golang.org/appengine/LICENSE
generated
vendored
@ -1,202 +0,0 @@
|
|||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
71
vendor/google.golang.org/appengine/README.md
generated
vendored
71
vendor/google.golang.org/appengine/README.md
generated
vendored
@ -1,71 +0,0 @@
|
|||||||
# Go App Engine packages
|
|
||||||
|
|
||||||
[](https://travis-ci.org/golang/appengine)
|
|
||||||
|
|
||||||
This repository supports the Go runtime on App Engine,
|
|
||||||
including both the standard App Engine and the
|
|
||||||
"App Engine flexible environment" (formerly known as "Managed VMs").
|
|
||||||
It provides APIs for interacting with App Engine services.
|
|
||||||
Its canonical import path is `google.golang.org/appengine`.
|
|
||||||
|
|
||||||
See https://cloud.google.com/appengine/docs/go/
|
|
||||||
for more information.
|
|
||||||
|
|
||||||
File issue reports and feature requests on the [Google App Engine issue
|
|
||||||
tracker](https://code.google.com/p/googleappengine/issues/entry?template=Go%20defect).
|
|
||||||
|
|
||||||
## Directory structure
|
|
||||||
The top level directory of this repository is the `appengine` package. It
|
|
||||||
contains the
|
|
||||||
basic APIs (e.g. `appengine.NewContext`) that apply across APIs. Specific API
|
|
||||||
packages are in subdirectories (e.g. `datastore`).
|
|
||||||
|
|
||||||
There is an `internal` subdirectory that contains service protocol buffers,
|
|
||||||
plus packages required for connectivity to make API calls. App Engine apps
|
|
||||||
should not directly import any package under `internal`.
|
|
||||||
|
|
||||||
## Updating a Go App Engine app
|
|
||||||
|
|
||||||
This section describes how to update an older Go App Engine app to use
|
|
||||||
these packages. A provided tool, `aefix`, can help automate steps 2 and 3
|
|
||||||
(run `go get google.golang.org/appengine/cmd/aefix` to install it), but
|
|
||||||
read the details below since `aefix` can't perform all the changes.
|
|
||||||
|
|
||||||
### 1. Update YAML files (App Engine flexible environment / Managed VMs only)
|
|
||||||
|
|
||||||
The `app.yaml` file (and YAML files for modules) should have these new lines added:
|
|
||||||
```
|
|
||||||
vm: true
|
|
||||||
```
|
|
||||||
See https://cloud.google.com/appengine/docs/go/modules/#Go_Instance_scaling_and_class for details.
|
|
||||||
|
|
||||||
### 2. Update import paths
|
|
||||||
|
|
||||||
The import paths for App Engine packages are now fully qualified, based at `google.golang.org/appengine`.
|
|
||||||
You will need to update your code to use import paths starting with that; for instance,
|
|
||||||
code importing `appengine/datastore` will now need to import `google.golang.org/appengine/datastore`.
|
|
||||||
|
|
||||||
### 3. Update code using deprecated, removed or modified APIs
|
|
||||||
|
|
||||||
Most App Engine services are available with exactly the same API.
|
|
||||||
A few APIs were cleaned up, and some are not available yet.
|
|
||||||
This list summarises the differences:
|
|
||||||
|
|
||||||
* `appengine.Context` has been replaced with the `Context` type from `golang.org/x/net/context`.
|
|
||||||
* Logging methods that were on `appengine.Context` are now functions in `google.golang.org/appengine/log`.
|
|
||||||
* `appengine.Timeout` has been removed. Use `context.WithTimeout` instead.
|
|
||||||
* `appengine.Datacenter` now takes a `context.Context` argument.
|
|
||||||
* `datastore.PropertyLoadSaver` has been simplified to use slices in place of channels.
|
|
||||||
* `delay.Call` now returns an error.
|
|
||||||
* `search.FieldLoadSaver` now handles document metadata.
|
|
||||||
* `urlfetch.Transport` no longer has a Deadline field; set a deadline on the
|
|
||||||
`context.Context` instead.
|
|
||||||
* `aetest` no longer declares its own Context type, and uses the standard one instead.
|
|
||||||
* `taskqueue.QueueStats` no longer takes a maxTasks argument. That argument has been
|
|
||||||
deprecated and unused for a long time.
|
|
||||||
* `appengine.BackendHostname` and `appengine.BackendInstance` were for the deprecated backends feature.
|
|
||||||
Use `appengine.ModuleHostname`and `appengine.ModuleName` instead.
|
|
||||||
* Most of `appengine/file` and parts of `appengine/blobstore` are deprecated.
|
|
||||||
Use [Google Cloud Storage](https://godoc.org/google.golang.org/cloud/storage) instead.
|
|
||||||
* `appengine/socket` is not required on App Engine flexible environment / Managed VMs.
|
|
||||||
Use the standard `net` package instead.
|
|
112
vendor/google.golang.org/appengine/appengine.go
generated
vendored
112
vendor/google.golang.org/appengine/appengine.go
generated
vendored
@ -1,112 +0,0 @@
|
|||||||
// Copyright 2011 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// Package appengine provides basic functionality for Google App Engine.
|
|
||||||
//
|
|
||||||
// For more information on how to write Go apps for Google App Engine, see:
|
|
||||||
// https://cloud.google.com/appengine/docs/go/
|
|
||||||
package appengine
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
|
|
||||||
"google.golang.org/appengine/internal"
|
|
||||||
)
|
|
||||||
|
|
||||||
// The gophers party all night; the rabbits provide the beats.
|
|
||||||
|
|
||||||
// Main is the principal entry point for an app running in App Engine.
|
|
||||||
//
|
|
||||||
// On App Engine Flexible it installs a trivial health checker if one isn't
|
|
||||||
// already registered, and starts listening on port 8080 (overridden by the
|
|
||||||
// $PORT environment variable).
|
|
||||||
//
|
|
||||||
// See https://cloud.google.com/appengine/docs/flexible/custom-runtimes#health_check_requests
|
|
||||||
// for details on how to do your own health checking.
|
|
||||||
//
|
|
||||||
// Main is not yet supported on App Engine Standard.
|
|
||||||
//
|
|
||||||
// Main never returns.
|
|
||||||
//
|
|
||||||
// Main is designed so that the app's main package looks like this:
|
|
||||||
//
|
|
||||||
// package main
|
|
||||||
//
|
|
||||||
// import (
|
|
||||||
// "google.golang.org/appengine"
|
|
||||||
//
|
|
||||||
// _ "myapp/package0"
|
|
||||||
// _ "myapp/package1"
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// func main() {
|
|
||||||
// appengine.Main()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// The "myapp/packageX" packages are expected to register HTTP handlers
|
|
||||||
// in their init functions.
|
|
||||||
func Main() {
|
|
||||||
internal.Main()
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsDevAppServer reports whether the App Engine app is running in the
|
|
||||||
// development App Server.
|
|
||||||
func IsDevAppServer() bool {
|
|
||||||
return internal.IsDevAppServer()
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewContext returns a context for an in-flight HTTP request.
|
|
||||||
// This function is cheap.
|
|
||||||
func NewContext(req *http.Request) context.Context {
|
|
||||||
return WithContext(context.Background(), req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithContext returns a copy of the parent context
|
|
||||||
// and associates it with an in-flight HTTP request.
|
|
||||||
// This function is cheap.
|
|
||||||
func WithContext(parent context.Context, req *http.Request) context.Context {
|
|
||||||
return internal.WithContext(parent, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(dsymonds): Add a Call function here? Otherwise other packages can't access internal.Call.
|
|
||||||
|
|
||||||
// BlobKey is a key for a blobstore blob.
|
|
||||||
//
|
|
||||||
// Conceptually, this type belongs in the blobstore package, but it lives in
|
|
||||||
// the appengine package to avoid a circular dependency: blobstore depends on
|
|
||||||
// datastore, and datastore needs to refer to the BlobKey type.
|
|
||||||
type BlobKey string
|
|
||||||
|
|
||||||
// GeoPoint represents a location as latitude/longitude in degrees.
|
|
||||||
type GeoPoint struct {
|
|
||||||
Lat, Lng float64
|
|
||||||
}
|
|
||||||
|
|
||||||
// Valid returns whether a GeoPoint is within [-90, 90] latitude and [-180, 180] longitude.
|
|
||||||
func (g GeoPoint) Valid() bool {
|
|
||||||
return -90 <= g.Lat && g.Lat <= 90 && -180 <= g.Lng && g.Lng <= 180
|
|
||||||
}
|
|
||||||
|
|
||||||
// APICallFunc defines a function type for handling an API call.
|
|
||||||
// See WithCallOverride.
|
|
||||||
type APICallFunc func(ctx context.Context, service, method string, in, out proto.Message) error
|
|
||||||
|
|
||||||
// WithAPICallFunc returns a copy of the parent context
|
|
||||||
// that will cause API calls to invoke f instead of their normal operation.
|
|
||||||
//
|
|
||||||
// This is intended for advanced users only.
|
|
||||||
func WithAPICallFunc(ctx context.Context, f APICallFunc) context.Context {
|
|
||||||
return internal.WithCallOverride(ctx, internal.CallOverrideFunc(f))
|
|
||||||
}
|
|
||||||
|
|
||||||
// APICall performs an API call.
|
|
||||||
//
|
|
||||||
// This is not intended for general use; it is exported for use in conjunction
|
|
||||||
// with WithAPICallFunc.
|
|
||||||
func APICall(ctx context.Context, service, method string, in, out proto.Message) error {
|
|
||||||
return internal.Call(ctx, service, method, in, out)
|
|
||||||
}
|
|
20
vendor/google.golang.org/appengine/appengine_vm.go
generated
vendored
20
vendor/google.golang.org/appengine/appengine_vm.go
generated
vendored
@ -1,20 +0,0 @@
|
|||||||
// Copyright 2015 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !appengine
|
|
||||||
|
|
||||||
package appengine
|
|
||||||
|
|
||||||
import (
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
|
|
||||||
"google.golang.org/appengine/internal"
|
|
||||||
)
|
|
||||||
|
|
||||||
// BackgroundContext returns a context not associated with a request.
|
|
||||||
// This should only be used when not servicing a request.
|
|
||||||
// This only works in App Engine "flexible environment".
|
|
||||||
func BackgroundContext() context.Context {
|
|
||||||
return internal.BackgroundContext()
|
|
||||||
}
|
|
46
vendor/google.golang.org/appengine/errors.go
generated
vendored
46
vendor/google.golang.org/appengine/errors.go
generated
vendored
@ -1,46 +0,0 @@
|
|||||||
// Copyright 2011 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// This file provides error functions for common API failure modes.
|
|
||||||
|
|
||||||
package appengine
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"google.golang.org/appengine/internal"
|
|
||||||
)
|
|
||||||
|
|
||||||
// IsOverQuota reports whether err represents an API call failure
|
|
||||||
// due to insufficient available quota.
|
|
||||||
func IsOverQuota(err error) bool {
|
|
||||||
callErr, ok := err.(*internal.CallError)
|
|
||||||
return ok && callErr.Code == 4
|
|
||||||
}
|
|
||||||
|
|
||||||
// MultiError is returned by batch operations when there are errors with
|
|
||||||
// particular elements. Errors will be in a one-to-one correspondence with
|
|
||||||
// the input elements; successful elements will have a nil entry.
|
|
||||||
type MultiError []error
|
|
||||||
|
|
||||||
func (m MultiError) Error() string {
|
|
||||||
s, n := "", 0
|
|
||||||
for _, e := range m {
|
|
||||||
if e != nil {
|
|
||||||
if n == 0 {
|
|
||||||
s = e.Error()
|
|
||||||
}
|
|
||||||
n++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch n {
|
|
||||||
case 0:
|
|
||||||
return "(0 errors)"
|
|
||||||
case 1:
|
|
||||||
return s
|
|
||||||
case 2:
|
|
||||||
return s + " (and 1 other error)"
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("%s (and %d other errors)", s, n-1)
|
|
||||||
}
|
|
142
vendor/google.golang.org/appengine/identity.go
generated
vendored
142
vendor/google.golang.org/appengine/identity.go
generated
vendored
@ -1,142 +0,0 @@
|
|||||||
// Copyright 2011 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package appengine
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
|
|
||||||
"google.golang.org/appengine/internal"
|
|
||||||
pb "google.golang.org/appengine/internal/app_identity"
|
|
||||||
modpb "google.golang.org/appengine/internal/modules"
|
|
||||||
)
|
|
||||||
|
|
||||||
// AppID returns the application ID for the current application.
|
|
||||||
// The string will be a plain application ID (e.g. "appid"), with a
|
|
||||||
// domain prefix for custom domain deployments (e.g. "example.com:appid").
|
|
||||||
func AppID(c context.Context) string { return internal.AppID(c) }
|
|
||||||
|
|
||||||
// DefaultVersionHostname returns the standard hostname of the default version
|
|
||||||
// of the current application (e.g. "my-app.appspot.com"). This is suitable for
|
|
||||||
// use in constructing URLs.
|
|
||||||
func DefaultVersionHostname(c context.Context) string {
|
|
||||||
return internal.DefaultVersionHostname(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ModuleName returns the module name of the current instance.
|
|
||||||
func ModuleName(c context.Context) string {
|
|
||||||
return internal.ModuleName(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ModuleHostname returns a hostname of a module instance.
|
|
||||||
// If module is the empty string, it refers to the module of the current instance.
|
|
||||||
// If version is empty, it refers to the version of the current instance if valid,
|
|
||||||
// or the default version of the module of the current instance.
|
|
||||||
// If instance is empty, ModuleHostname returns the load-balancing hostname.
|
|
||||||
func ModuleHostname(c context.Context, module, version, instance string) (string, error) {
|
|
||||||
req := &modpb.GetHostnameRequest{}
|
|
||||||
if module != "" {
|
|
||||||
req.Module = &module
|
|
||||||
}
|
|
||||||
if version != "" {
|
|
||||||
req.Version = &version
|
|
||||||
}
|
|
||||||
if instance != "" {
|
|
||||||
req.Instance = &instance
|
|
||||||
}
|
|
||||||
res := &modpb.GetHostnameResponse{}
|
|
||||||
if err := internal.Call(c, "modules", "GetHostname", req, res); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return *res.Hostname, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// VersionID returns the version ID for the current application.
|
|
||||||
// It will be of the form "X.Y", where X is specified in app.yaml,
|
|
||||||
// and Y is a number generated when each version of the app is uploaded.
|
|
||||||
// It does not include a module name.
|
|
||||||
func VersionID(c context.Context) string { return internal.VersionID(c) }
|
|
||||||
|
|
||||||
// InstanceID returns a mostly-unique identifier for this instance.
|
|
||||||
func InstanceID() string { return internal.InstanceID() }
|
|
||||||
|
|
||||||
// Datacenter returns an identifier for the datacenter that the instance is running in.
|
|
||||||
func Datacenter(c context.Context) string { return internal.Datacenter(c) }
|
|
||||||
|
|
||||||
// ServerSoftware returns the App Engine release version.
|
|
||||||
// In production, it looks like "Google App Engine/X.Y.Z".
|
|
||||||
// In the development appserver, it looks like "Development/X.Y".
|
|
||||||
func ServerSoftware() string { return internal.ServerSoftware() }
|
|
||||||
|
|
||||||
// RequestID returns a string that uniquely identifies the request.
|
|
||||||
func RequestID(c context.Context) string { return internal.RequestID(c) }
|
|
||||||
|
|
||||||
// AccessToken generates an OAuth2 access token for the specified scopes on
|
|
||||||
// behalf of service account of this application. This token will expire after
|
|
||||||
// the returned time.
|
|
||||||
func AccessToken(c context.Context, scopes ...string) (token string, expiry time.Time, err error) {
|
|
||||||
req := &pb.GetAccessTokenRequest{Scope: scopes}
|
|
||||||
res := &pb.GetAccessTokenResponse{}
|
|
||||||
|
|
||||||
err = internal.Call(c, "app_identity_service", "GetAccessToken", req, res)
|
|
||||||
if err != nil {
|
|
||||||
return "", time.Time{}, err
|
|
||||||
}
|
|
||||||
return res.GetAccessToken(), time.Unix(res.GetExpirationTime(), 0), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certificate represents a public certificate for the app.
|
|
||||||
type Certificate struct {
|
|
||||||
KeyName string
|
|
||||||
Data []byte // PEM-encoded X.509 certificate
|
|
||||||
}
|
|
||||||
|
|
||||||
// PublicCertificates retrieves the public certificates for the app.
|
|
||||||
// They can be used to verify a signature returned by SignBytes.
|
|
||||||
func PublicCertificates(c context.Context) ([]Certificate, error) {
|
|
||||||
req := &pb.GetPublicCertificateForAppRequest{}
|
|
||||||
res := &pb.GetPublicCertificateForAppResponse{}
|
|
||||||
if err := internal.Call(c, "app_identity_service", "GetPublicCertificatesForApp", req, res); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
var cs []Certificate
|
|
||||||
for _, pc := range res.PublicCertificateList {
|
|
||||||
cs = append(cs, Certificate{
|
|
||||||
KeyName: pc.GetKeyName(),
|
|
||||||
Data: []byte(pc.GetX509CertificatePem()),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return cs, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServiceAccount returns a string representing the service account name, in
|
|
||||||
// the form of an email address (typically app_id@appspot.gserviceaccount.com).
|
|
||||||
func ServiceAccount(c context.Context) (string, error) {
|
|
||||||
req := &pb.GetServiceAccountNameRequest{}
|
|
||||||
res := &pb.GetServiceAccountNameResponse{}
|
|
||||||
|
|
||||||
err := internal.Call(c, "app_identity_service", "GetServiceAccountName", req, res)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return res.GetServiceAccountName(), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignBytes signs bytes using a private key unique to your application.
|
|
||||||
func SignBytes(c context.Context, bytes []byte) (keyName string, signature []byte, err error) {
|
|
||||||
req := &pb.SignForAppRequest{BytesToSign: bytes}
|
|
||||||
res := &pb.SignForAppResponse{}
|
|
||||||
|
|
||||||
if err := internal.Call(c, "app_identity_service", "SignForApp", req, res); err != nil {
|
|
||||||
return "", nil, err
|
|
||||||
}
|
|
||||||
return res.GetKeyName(), res.GetSignatureBytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
internal.RegisterErrorCodeMap("app_identity_service", pb.AppIdentityServiceError_ErrorCode_name)
|
|
||||||
internal.RegisterErrorCodeMap("modules", modpb.ModulesServiceError_ErrorCode_name)
|
|
||||||
}
|
|
646
vendor/google.golang.org/appengine/internal/api.go
generated
vendored
646
vendor/google.golang.org/appengine/internal/api.go
generated
vendored
@ -1,646 +0,0 @@
|
|||||||
// Copyright 2011 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !appengine
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"net"
|
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"os"
|
|
||||||
"runtime"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"sync"
|
|
||||||
"sync/atomic"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
netcontext "golang.org/x/net/context"
|
|
||||||
|
|
||||||
basepb "google.golang.org/appengine/internal/base"
|
|
||||||
logpb "google.golang.org/appengine/internal/log"
|
|
||||||
remotepb "google.golang.org/appengine/internal/remote_api"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
apiPath = "/rpc_http"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
// Incoming headers.
|
|
||||||
ticketHeader = http.CanonicalHeaderKey("X-AppEngine-API-Ticket")
|
|
||||||
dapperHeader = http.CanonicalHeaderKey("X-Google-DapperTraceInfo")
|
|
||||||
traceHeader = http.CanonicalHeaderKey("X-Cloud-Trace-Context")
|
|
||||||
curNamespaceHeader = http.CanonicalHeaderKey("X-AppEngine-Current-Namespace")
|
|
||||||
userIPHeader = http.CanonicalHeaderKey("X-AppEngine-User-IP")
|
|
||||||
remoteAddrHeader = http.CanonicalHeaderKey("X-AppEngine-Remote-Addr")
|
|
||||||
|
|
||||||
// Outgoing headers.
|
|
||||||
apiEndpointHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Endpoint")
|
|
||||||
apiEndpointHeaderValue = []string{"app-engine-apis"}
|
|
||||||
apiMethodHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Method")
|
|
||||||
apiMethodHeaderValue = []string{"/VMRemoteAPI.CallRemoteAPI"}
|
|
||||||
apiDeadlineHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Deadline")
|
|
||||||
apiContentType = http.CanonicalHeaderKey("Content-Type")
|
|
||||||
apiContentTypeValue = []string{"application/octet-stream"}
|
|
||||||
logFlushHeader = http.CanonicalHeaderKey("X-AppEngine-Log-Flush-Count")
|
|
||||||
|
|
||||||
apiHTTPClient = &http.Client{
|
|
||||||
Transport: &http.Transport{
|
|
||||||
Proxy: http.ProxyFromEnvironment,
|
|
||||||
Dial: limitDial,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func apiURL() *url.URL {
|
|
||||||
host, port := "appengine.googleapis.internal", "10001"
|
|
||||||
if h := os.Getenv("API_HOST"); h != "" {
|
|
||||||
host = h
|
|
||||||
}
|
|
||||||
if p := os.Getenv("API_PORT"); p != "" {
|
|
||||||
port = p
|
|
||||||
}
|
|
||||||
return &url.URL{
|
|
||||||
Scheme: "http",
|
|
||||||
Host: host + ":" + port,
|
|
||||||
Path: apiPath,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleHTTP(w http.ResponseWriter, r *http.Request) {
|
|
||||||
c := &context{
|
|
||||||
req: r,
|
|
||||||
outHeader: w.Header(),
|
|
||||||
apiURL: apiURL(),
|
|
||||||
}
|
|
||||||
stopFlushing := make(chan int)
|
|
||||||
|
|
||||||
ctxs.Lock()
|
|
||||||
ctxs.m[r] = c
|
|
||||||
ctxs.Unlock()
|
|
||||||
defer func() {
|
|
||||||
ctxs.Lock()
|
|
||||||
delete(ctxs.m, r)
|
|
||||||
ctxs.Unlock()
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Patch up RemoteAddr so it looks reasonable.
|
|
||||||
if addr := r.Header.Get(userIPHeader); addr != "" {
|
|
||||||
r.RemoteAddr = addr
|
|
||||||
} else if addr = r.Header.Get(remoteAddrHeader); addr != "" {
|
|
||||||
r.RemoteAddr = addr
|
|
||||||
} else {
|
|
||||||
// Should not normally reach here, but pick a sensible default anyway.
|
|
||||||
r.RemoteAddr = "127.0.0.1"
|
|
||||||
}
|
|
||||||
// The address in the headers will most likely be of these forms:
|
|
||||||
// 123.123.123.123
|
|
||||||
// 2001:db8::1
|
|
||||||
// net/http.Request.RemoteAddr is specified to be in "IP:port" form.
|
|
||||||
if _, _, err := net.SplitHostPort(r.RemoteAddr); err != nil {
|
|
||||||
// Assume the remote address is only a host; add a default port.
|
|
||||||
r.RemoteAddr = net.JoinHostPort(r.RemoteAddr, "80")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start goroutine responsible for flushing app logs.
|
|
||||||
// This is done after adding c to ctx.m (and stopped before removing it)
|
|
||||||
// because flushing logs requires making an API call.
|
|
||||||
go c.logFlusher(stopFlushing)
|
|
||||||
|
|
||||||
executeRequestSafely(c, r)
|
|
||||||
c.outHeader = nil // make sure header changes aren't respected any more
|
|
||||||
|
|
||||||
stopFlushing <- 1 // any logging beyond this point will be dropped
|
|
||||||
|
|
||||||
// Flush any pending logs asynchronously.
|
|
||||||
c.pendingLogs.Lock()
|
|
||||||
flushes := c.pendingLogs.flushes
|
|
||||||
if len(c.pendingLogs.lines) > 0 {
|
|
||||||
flushes++
|
|
||||||
}
|
|
||||||
c.pendingLogs.Unlock()
|
|
||||||
go c.flushLog(false)
|
|
||||||
w.Header().Set(logFlushHeader, strconv.Itoa(flushes))
|
|
||||||
|
|
||||||
// Avoid nil Write call if c.Write is never called.
|
|
||||||
if c.outCode != 0 {
|
|
||||||
w.WriteHeader(c.outCode)
|
|
||||||
}
|
|
||||||
if c.outBody != nil {
|
|
||||||
w.Write(c.outBody)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func executeRequestSafely(c *context, r *http.Request) {
|
|
||||||
defer func() {
|
|
||||||
if x := recover(); x != nil {
|
|
||||||
logf(c, 4, "%s", renderPanic(x)) // 4 == critical
|
|
||||||
c.outCode = 500
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
http.DefaultServeMux.ServeHTTP(c, r)
|
|
||||||
}
|
|
||||||
|
|
||||||
func renderPanic(x interface{}) string {
|
|
||||||
buf := make([]byte, 16<<10) // 16 KB should be plenty
|
|
||||||
buf = buf[:runtime.Stack(buf, false)]
|
|
||||||
|
|
||||||
// Remove the first few stack frames:
|
|
||||||
// this func
|
|
||||||
// the recover closure in the caller
|
|
||||||
// That will root the stack trace at the site of the panic.
|
|
||||||
const (
|
|
||||||
skipStart = "internal.renderPanic"
|
|
||||||
skipFrames = 2
|
|
||||||
)
|
|
||||||
start := bytes.Index(buf, []byte(skipStart))
|
|
||||||
p := start
|
|
||||||
for i := 0; i < skipFrames*2 && p+1 < len(buf); i++ {
|
|
||||||
p = bytes.IndexByte(buf[p+1:], '\n') + p + 1
|
|
||||||
if p < 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if p >= 0 {
|
|
||||||
// buf[start:p+1] is the block to remove.
|
|
||||||
// Copy buf[p+1:] over buf[start:] and shrink buf.
|
|
||||||
copy(buf[start:], buf[p+1:])
|
|
||||||
buf = buf[:len(buf)-(p+1-start)]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add panic heading.
|
|
||||||
head := fmt.Sprintf("panic: %v\n\n", x)
|
|
||||||
if len(head) > len(buf) {
|
|
||||||
// Extremely unlikely to happen.
|
|
||||||
return head
|
|
||||||
}
|
|
||||||
copy(buf[len(head):], buf)
|
|
||||||
copy(buf, head)
|
|
||||||
|
|
||||||
return string(buf)
|
|
||||||
}
|
|
||||||
|
|
||||||
var ctxs = struct {
|
|
||||||
sync.Mutex
|
|
||||||
m map[*http.Request]*context
|
|
||||||
bg *context // background context, lazily initialized
|
|
||||||
// dec is used by tests to decorate the netcontext.Context returned
|
|
||||||
// for a given request. This allows tests to add overrides (such as
|
|
||||||
// WithAppIDOverride) to the context. The map is nil outside tests.
|
|
||||||
dec map[*http.Request]func(netcontext.Context) netcontext.Context
|
|
||||||
}{
|
|
||||||
m: make(map[*http.Request]*context),
|
|
||||||
}
|
|
||||||
|
|
||||||
// context represents the context of an in-flight HTTP request.
|
|
||||||
// It implements the appengine.Context and http.ResponseWriter interfaces.
|
|
||||||
type context struct {
|
|
||||||
req *http.Request
|
|
||||||
|
|
||||||
outCode int
|
|
||||||
outHeader http.Header
|
|
||||||
outBody []byte
|
|
||||||
|
|
||||||
pendingLogs struct {
|
|
||||||
sync.Mutex
|
|
||||||
lines []*logpb.UserAppLogLine
|
|
||||||
flushes int
|
|
||||||
}
|
|
||||||
|
|
||||||
apiURL *url.URL
|
|
||||||
}
|
|
||||||
|
|
||||||
var contextKey = "holds a *context"
|
|
||||||
|
|
||||||
func fromContext(ctx netcontext.Context) *context {
|
|
||||||
c, _ := ctx.Value(&contextKey).(*context)
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func withContext(parent netcontext.Context, c *context) netcontext.Context {
|
|
||||||
ctx := netcontext.WithValue(parent, &contextKey, c)
|
|
||||||
if ns := c.req.Header.Get(curNamespaceHeader); ns != "" {
|
|
||||||
ctx = withNamespace(ctx, ns)
|
|
||||||
}
|
|
||||||
return ctx
|
|
||||||
}
|
|
||||||
|
|
||||||
func toContext(c *context) netcontext.Context {
|
|
||||||
return withContext(netcontext.Background(), c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func IncomingHeaders(ctx netcontext.Context) http.Header {
|
|
||||||
if c := fromContext(ctx); c != nil {
|
|
||||||
return c.req.Header
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func WithContext(parent netcontext.Context, req *http.Request) netcontext.Context {
|
|
||||||
ctxs.Lock()
|
|
||||||
c := ctxs.m[req]
|
|
||||||
d := ctxs.dec[req]
|
|
||||||
ctxs.Unlock()
|
|
||||||
|
|
||||||
if d != nil {
|
|
||||||
parent = d(parent)
|
|
||||||
}
|
|
||||||
|
|
||||||
if c == nil {
|
|
||||||
// Someone passed in an http.Request that is not in-flight.
|
|
||||||
// We panic here rather than panicking at a later point
|
|
||||||
// so that stack traces will be more sensible.
|
|
||||||
log.Panic("appengine: NewContext passed an unknown http.Request")
|
|
||||||
}
|
|
||||||
return withContext(parent, c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func BackgroundContext() netcontext.Context {
|
|
||||||
ctxs.Lock()
|
|
||||||
defer ctxs.Unlock()
|
|
||||||
|
|
||||||
if ctxs.bg != nil {
|
|
||||||
return toContext(ctxs.bg)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute background security ticket.
|
|
||||||
appID := partitionlessAppID()
|
|
||||||
escAppID := strings.Replace(strings.Replace(appID, ":", "_", -1), ".", "_", -1)
|
|
||||||
majVersion := VersionID(nil)
|
|
||||||
if i := strings.Index(majVersion, "."); i > 0 {
|
|
||||||
majVersion = majVersion[:i]
|
|
||||||
}
|
|
||||||
ticket := fmt.Sprintf("%s/%s.%s.%s", escAppID, ModuleName(nil), majVersion, InstanceID())
|
|
||||||
|
|
||||||
ctxs.bg = &context{
|
|
||||||
req: &http.Request{
|
|
||||||
Header: http.Header{
|
|
||||||
ticketHeader: []string{ticket},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
apiURL: apiURL(),
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(dsymonds): Wire up the shutdown handler to do a final flush.
|
|
||||||
go ctxs.bg.logFlusher(make(chan int))
|
|
||||||
|
|
||||||
return toContext(ctxs.bg)
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterTestRequest registers the HTTP request req for testing, such that
|
|
||||||
// any API calls are sent to the provided URL. It returns a closure to delete
|
|
||||||
// the registration.
|
|
||||||
// It should only be used by aetest package.
|
|
||||||
func RegisterTestRequest(req *http.Request, apiURL *url.URL, decorate func(netcontext.Context) netcontext.Context) func() {
|
|
||||||
c := &context{
|
|
||||||
req: req,
|
|
||||||
apiURL: apiURL,
|
|
||||||
}
|
|
||||||
ctxs.Lock()
|
|
||||||
defer ctxs.Unlock()
|
|
||||||
if _, ok := ctxs.m[req]; ok {
|
|
||||||
log.Panic("req already associated with context")
|
|
||||||
}
|
|
||||||
if _, ok := ctxs.dec[req]; ok {
|
|
||||||
log.Panic("req already associated with context")
|
|
||||||
}
|
|
||||||
if ctxs.dec == nil {
|
|
||||||
ctxs.dec = make(map[*http.Request]func(netcontext.Context) netcontext.Context)
|
|
||||||
}
|
|
||||||
ctxs.m[req] = c
|
|
||||||
ctxs.dec[req] = decorate
|
|
||||||
|
|
||||||
return func() {
|
|
||||||
ctxs.Lock()
|
|
||||||
delete(ctxs.m, req)
|
|
||||||
delete(ctxs.dec, req)
|
|
||||||
ctxs.Unlock()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var errTimeout = &CallError{
|
|
||||||
Detail: "Deadline exceeded",
|
|
||||||
Code: int32(remotepb.RpcError_CANCELLED),
|
|
||||||
Timeout: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *context) Header() http.Header { return c.outHeader }
|
|
||||||
|
|
||||||
// Copied from $GOROOT/src/pkg/net/http/transfer.go. Some response status
|
|
||||||
// codes do not permit a response body (nor response entity headers such as
|
|
||||||
// Content-Length, Content-Type, etc).
|
|
||||||
func bodyAllowedForStatus(status int) bool {
|
|
||||||
switch {
|
|
||||||
case status >= 100 && status <= 199:
|
|
||||||
return false
|
|
||||||
case status == 204:
|
|
||||||
return false
|
|
||||||
case status == 304:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *context) Write(b []byte) (int, error) {
|
|
||||||
if c.outCode == 0 {
|
|
||||||
c.WriteHeader(http.StatusOK)
|
|
||||||
}
|
|
||||||
if len(b) > 0 && !bodyAllowedForStatus(c.outCode) {
|
|
||||||
return 0, http.ErrBodyNotAllowed
|
|
||||||
}
|
|
||||||
c.outBody = append(c.outBody, b...)
|
|
||||||
return len(b), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *context) WriteHeader(code int) {
|
|
||||||
if c.outCode != 0 {
|
|
||||||
logf(c, 3, "WriteHeader called multiple times on request.") // error level
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.outCode = code
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *context) post(body []byte, timeout time.Duration) (b []byte, err error) {
|
|
||||||
hreq := &http.Request{
|
|
||||||
Method: "POST",
|
|
||||||
URL: c.apiURL,
|
|
||||||
Header: http.Header{
|
|
||||||
apiEndpointHeader: apiEndpointHeaderValue,
|
|
||||||
apiMethodHeader: apiMethodHeaderValue,
|
|
||||||
apiContentType: apiContentTypeValue,
|
|
||||||
apiDeadlineHeader: []string{strconv.FormatFloat(timeout.Seconds(), 'f', -1, 64)},
|
|
||||||
},
|
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(body)),
|
|
||||||
ContentLength: int64(len(body)),
|
|
||||||
Host: c.apiURL.Host,
|
|
||||||
}
|
|
||||||
if info := c.req.Header.Get(dapperHeader); info != "" {
|
|
||||||
hreq.Header.Set(dapperHeader, info)
|
|
||||||
}
|
|
||||||
if info := c.req.Header.Get(traceHeader); info != "" {
|
|
||||||
hreq.Header.Set(traceHeader, info)
|
|
||||||
}
|
|
||||||
|
|
||||||
tr := apiHTTPClient.Transport.(*http.Transport)
|
|
||||||
|
|
||||||
var timedOut int32 // atomic; set to 1 if timed out
|
|
||||||
t := time.AfterFunc(timeout, func() {
|
|
||||||
atomic.StoreInt32(&timedOut, 1)
|
|
||||||
tr.CancelRequest(hreq)
|
|
||||||
})
|
|
||||||
defer t.Stop()
|
|
||||||
defer func() {
|
|
||||||
// Check if timeout was exceeded.
|
|
||||||
if atomic.LoadInt32(&timedOut) != 0 {
|
|
||||||
err = errTimeout
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
hresp, err := apiHTTPClient.Do(hreq)
|
|
||||||
if err != nil {
|
|
||||||
return nil, &CallError{
|
|
||||||
Detail: fmt.Sprintf("service bridge HTTP failed: %v", err),
|
|
||||||
Code: int32(remotepb.RpcError_UNKNOWN),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
defer hresp.Body.Close()
|
|
||||||
hrespBody, err := ioutil.ReadAll(hresp.Body)
|
|
||||||
if hresp.StatusCode != 200 {
|
|
||||||
return nil, &CallError{
|
|
||||||
Detail: fmt.Sprintf("service bridge returned HTTP %d (%q)", hresp.StatusCode, hrespBody),
|
|
||||||
Code: int32(remotepb.RpcError_UNKNOWN),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return nil, &CallError{
|
|
||||||
Detail: fmt.Sprintf("service bridge response bad: %v", err),
|
|
||||||
Code: int32(remotepb.RpcError_UNKNOWN),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hrespBody, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Call(ctx netcontext.Context, service, method string, in, out proto.Message) error {
|
|
||||||
if ns := NamespaceFromContext(ctx); ns != "" {
|
|
||||||
if fn, ok := NamespaceMods[service]; ok {
|
|
||||||
fn(in, ns)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if f, ctx, ok := callOverrideFromContext(ctx); ok {
|
|
||||||
return f(ctx, service, method, in, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle already-done contexts quickly.
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return ctx.Err()
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
|
|
||||||
c := fromContext(ctx)
|
|
||||||
if c == nil {
|
|
||||||
// Give a good error message rather than a panic lower down.
|
|
||||||
return errors.New("not an App Engine context")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply transaction modifications if we're in a transaction.
|
|
||||||
if t := transactionFromContext(ctx); t != nil {
|
|
||||||
if t.finished {
|
|
||||||
return errors.New("transaction context has expired")
|
|
||||||
}
|
|
||||||
applyTransaction(in, &t.transaction)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default RPC timeout is 60s.
|
|
||||||
timeout := 60 * time.Second
|
|
||||||
if deadline, ok := ctx.Deadline(); ok {
|
|
||||||
timeout = deadline.Sub(time.Now())
|
|
||||||
}
|
|
||||||
|
|
||||||
data, err := proto.Marshal(in)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
ticket := c.req.Header.Get(ticketHeader)
|
|
||||||
req := &remotepb.Request{
|
|
||||||
ServiceName: &service,
|
|
||||||
Method: &method,
|
|
||||||
Request: data,
|
|
||||||
RequestId: &ticket,
|
|
||||||
}
|
|
||||||
hreqBody, err := proto.Marshal(req)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
hrespBody, err := c.post(hreqBody, timeout)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
res := &remotepb.Response{}
|
|
||||||
if err := proto.Unmarshal(hrespBody, res); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if res.RpcError != nil {
|
|
||||||
ce := &CallError{
|
|
||||||
Detail: res.RpcError.GetDetail(),
|
|
||||||
Code: *res.RpcError.Code,
|
|
||||||
}
|
|
||||||
switch remotepb.RpcError_ErrorCode(ce.Code) {
|
|
||||||
case remotepb.RpcError_CANCELLED, remotepb.RpcError_DEADLINE_EXCEEDED:
|
|
||||||
ce.Timeout = true
|
|
||||||
}
|
|
||||||
return ce
|
|
||||||
}
|
|
||||||
if res.ApplicationError != nil {
|
|
||||||
return &APIError{
|
|
||||||
Service: *req.ServiceName,
|
|
||||||
Detail: res.ApplicationError.GetDetail(),
|
|
||||||
Code: *res.ApplicationError.Code,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if res.Exception != nil || res.JavaException != nil {
|
|
||||||
// This shouldn't happen, but let's be defensive.
|
|
||||||
return &CallError{
|
|
||||||
Detail: "service bridge returned exception",
|
|
||||||
Code: int32(remotepb.RpcError_UNKNOWN),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return proto.Unmarshal(res.Response, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *context) Request() *http.Request {
|
|
||||||
return c.req
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *context) addLogLine(ll *logpb.UserAppLogLine) {
|
|
||||||
// Truncate long log lines.
|
|
||||||
// TODO(dsymonds): Check if this is still necessary.
|
|
||||||
const lim = 8 << 10
|
|
||||||
if len(*ll.Message) > lim {
|
|
||||||
suffix := fmt.Sprintf("...(length %d)", len(*ll.Message))
|
|
||||||
ll.Message = proto.String((*ll.Message)[:lim-len(suffix)] + suffix)
|
|
||||||
}
|
|
||||||
|
|
||||||
c.pendingLogs.Lock()
|
|
||||||
c.pendingLogs.lines = append(c.pendingLogs.lines, ll)
|
|
||||||
c.pendingLogs.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
var logLevelName = map[int64]string{
|
|
||||||
0: "DEBUG",
|
|
||||||
1: "INFO",
|
|
||||||
2: "WARNING",
|
|
||||||
3: "ERROR",
|
|
||||||
4: "CRITICAL",
|
|
||||||
}
|
|
||||||
|
|
||||||
func logf(c *context, level int64, format string, args ...interface{}) {
|
|
||||||
s := fmt.Sprintf(format, args...)
|
|
||||||
s = strings.TrimRight(s, "\n") // Remove any trailing newline characters.
|
|
||||||
c.addLogLine(&logpb.UserAppLogLine{
|
|
||||||
TimestampUsec: proto.Int64(time.Now().UnixNano() / 1e3),
|
|
||||||
Level: &level,
|
|
||||||
Message: &s,
|
|
||||||
})
|
|
||||||
log.Print(logLevelName[level] + ": " + s)
|
|
||||||
}
|
|
||||||
|
|
||||||
// flushLog attempts to flush any pending logs to the appserver.
|
|
||||||
// It should not be called concurrently.
|
|
||||||
func (c *context) flushLog(force bool) (flushed bool) {
|
|
||||||
c.pendingLogs.Lock()
|
|
||||||
// Grab up to 30 MB. We can get away with up to 32 MB, but let's be cautious.
|
|
||||||
n, rem := 0, 30<<20
|
|
||||||
for ; n < len(c.pendingLogs.lines); n++ {
|
|
||||||
ll := c.pendingLogs.lines[n]
|
|
||||||
// Each log line will require about 3 bytes of overhead.
|
|
||||||
nb := proto.Size(ll) + 3
|
|
||||||
if nb > rem {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
rem -= nb
|
|
||||||
}
|
|
||||||
lines := c.pendingLogs.lines[:n]
|
|
||||||
c.pendingLogs.lines = c.pendingLogs.lines[n:]
|
|
||||||
c.pendingLogs.Unlock()
|
|
||||||
|
|
||||||
if len(lines) == 0 && !force {
|
|
||||||
// Nothing to flush.
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
rescueLogs := false
|
|
||||||
defer func() {
|
|
||||||
if rescueLogs {
|
|
||||||
c.pendingLogs.Lock()
|
|
||||||
c.pendingLogs.lines = append(lines, c.pendingLogs.lines...)
|
|
||||||
c.pendingLogs.Unlock()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
buf, err := proto.Marshal(&logpb.UserAppLogGroup{
|
|
||||||
LogLine: lines,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("internal.flushLog: marshaling UserAppLogGroup: %v", err)
|
|
||||||
rescueLogs = true
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
req := &logpb.FlushRequest{
|
|
||||||
Logs: buf,
|
|
||||||
}
|
|
||||||
res := &basepb.VoidProto{}
|
|
||||||
c.pendingLogs.Lock()
|
|
||||||
c.pendingLogs.flushes++
|
|
||||||
c.pendingLogs.Unlock()
|
|
||||||
if err := Call(toContext(c), "logservice", "Flush", req, res); err != nil {
|
|
||||||
log.Printf("internal.flushLog: Flush RPC: %v", err)
|
|
||||||
rescueLogs = true
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Log flushing parameters.
|
|
||||||
flushInterval = 1 * time.Second
|
|
||||||
forceFlushInterval = 60 * time.Second
|
|
||||||
)
|
|
||||||
|
|
||||||
func (c *context) logFlusher(stop <-chan int) {
|
|
||||||
lastFlush := time.Now()
|
|
||||||
tick := time.NewTicker(flushInterval)
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-stop:
|
|
||||||
// Request finished.
|
|
||||||
tick.Stop()
|
|
||||||
return
|
|
||||||
case <-tick.C:
|
|
||||||
force := time.Now().Sub(lastFlush) > forceFlushInterval
|
|
||||||
if c.flushLog(force) {
|
|
||||||
lastFlush = time.Now()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func ContextForTesting(req *http.Request) netcontext.Context {
|
|
||||||
return toContext(&context{req: req})
|
|
||||||
}
|
|
159
vendor/google.golang.org/appengine/internal/api_classic.go
generated
vendored
159
vendor/google.golang.org/appengine/internal/api_classic.go
generated
vendored
@ -1,159 +0,0 @@
|
|||||||
// Copyright 2015 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build appengine
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"appengine"
|
|
||||||
"appengine_internal"
|
|
||||||
basepb "appengine_internal/base"
|
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
netcontext "golang.org/x/net/context"
|
|
||||||
)
|
|
||||||
|
|
||||||
var contextKey = "holds an appengine.Context"
|
|
||||||
|
|
||||||
func fromContext(ctx netcontext.Context) appengine.Context {
|
|
||||||
c, _ := ctx.Value(&contextKey).(appengine.Context)
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is only for classic App Engine adapters.
|
|
||||||
func ClassicContextFromContext(ctx netcontext.Context) appengine.Context {
|
|
||||||
return fromContext(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func withContext(parent netcontext.Context, c appengine.Context) netcontext.Context {
|
|
||||||
ctx := netcontext.WithValue(parent, &contextKey, c)
|
|
||||||
|
|
||||||
s := &basepb.StringProto{}
|
|
||||||
c.Call("__go__", "GetNamespace", &basepb.VoidProto{}, s, nil)
|
|
||||||
if ns := s.GetValue(); ns != "" {
|
|
||||||
ctx = NamespacedContext(ctx, ns)
|
|
||||||
}
|
|
||||||
|
|
||||||
return ctx
|
|
||||||
}
|
|
||||||
|
|
||||||
func IncomingHeaders(ctx netcontext.Context) http.Header {
|
|
||||||
if c := fromContext(ctx); c != nil {
|
|
||||||
if req, ok := c.Request().(*http.Request); ok {
|
|
||||||
return req.Header
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func WithContext(parent netcontext.Context, req *http.Request) netcontext.Context {
|
|
||||||
c := appengine.NewContext(req)
|
|
||||||
return withContext(parent, c)
|
|
||||||
}
|
|
||||||
|
|
||||||
type testingContext struct {
|
|
||||||
appengine.Context
|
|
||||||
|
|
||||||
req *http.Request
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testingContext) FullyQualifiedAppID() string { return "dev~testcontext" }
|
|
||||||
func (t *testingContext) Call(service, method string, _, _ appengine_internal.ProtoMessage, _ *appengine_internal.CallOptions) error {
|
|
||||||
if service == "__go__" && method == "GetNamespace" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return fmt.Errorf("testingContext: unsupported Call")
|
|
||||||
}
|
|
||||||
func (t *testingContext) Request() interface{} { return t.req }
|
|
||||||
|
|
||||||
func ContextForTesting(req *http.Request) netcontext.Context {
|
|
||||||
return withContext(netcontext.Background(), &testingContext{req: req})
|
|
||||||
}
|
|
||||||
|
|
||||||
func Call(ctx netcontext.Context, service, method string, in, out proto.Message) error {
|
|
||||||
if ns := NamespaceFromContext(ctx); ns != "" {
|
|
||||||
if fn, ok := NamespaceMods[service]; ok {
|
|
||||||
fn(in, ns)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if f, ctx, ok := callOverrideFromContext(ctx); ok {
|
|
||||||
return f(ctx, service, method, in, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle already-done contexts quickly.
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return ctx.Err()
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
|
|
||||||
c := fromContext(ctx)
|
|
||||||
if c == nil {
|
|
||||||
// Give a good error message rather than a panic lower down.
|
|
||||||
return errors.New("not an App Engine context")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply transaction modifications if we're in a transaction.
|
|
||||||
if t := transactionFromContext(ctx); t != nil {
|
|
||||||
if t.finished {
|
|
||||||
return errors.New("transaction context has expired")
|
|
||||||
}
|
|
||||||
applyTransaction(in, &t.transaction)
|
|
||||||
}
|
|
||||||
|
|
||||||
var opts *appengine_internal.CallOptions
|
|
||||||
if d, ok := ctx.Deadline(); ok {
|
|
||||||
opts = &appengine_internal.CallOptions{
|
|
||||||
Timeout: d.Sub(time.Now()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
err := c.Call(service, method, in, out, opts)
|
|
||||||
switch v := err.(type) {
|
|
||||||
case *appengine_internal.APIError:
|
|
||||||
return &APIError{
|
|
||||||
Service: v.Service,
|
|
||||||
Detail: v.Detail,
|
|
||||||
Code: v.Code,
|
|
||||||
}
|
|
||||||
case *appengine_internal.CallError:
|
|
||||||
return &CallError{
|
|
||||||
Detail: v.Detail,
|
|
||||||
Code: v.Code,
|
|
||||||
Timeout: v.Timeout,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleHTTP(w http.ResponseWriter, r *http.Request) {
|
|
||||||
panic("handleHTTP called; this should be impossible")
|
|
||||||
}
|
|
||||||
|
|
||||||
func logf(c appengine.Context, level int64, format string, args ...interface{}) {
|
|
||||||
var fn func(format string, args ...interface{})
|
|
||||||
switch level {
|
|
||||||
case 0:
|
|
||||||
fn = c.Debugf
|
|
||||||
case 1:
|
|
||||||
fn = c.Infof
|
|
||||||
case 2:
|
|
||||||
fn = c.Warningf
|
|
||||||
case 3:
|
|
||||||
fn = c.Errorf
|
|
||||||
case 4:
|
|
||||||
fn = c.Criticalf
|
|
||||||
default:
|
|
||||||
// This shouldn't happen.
|
|
||||||
fn = c.Criticalf
|
|
||||||
}
|
|
||||||
fn(format, args...)
|
|
||||||
}
|
|
86
vendor/google.golang.org/appengine/internal/api_common.go
generated
vendored
86
vendor/google.golang.org/appengine/internal/api_common.go
generated
vendored
@ -1,86 +0,0 @@
|
|||||||
// Copyright 2015 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
netcontext "golang.org/x/net/context"
|
|
||||||
)
|
|
||||||
|
|
||||||
type CallOverrideFunc func(ctx netcontext.Context, service, method string, in, out proto.Message) error
|
|
||||||
|
|
||||||
var callOverrideKey = "holds []CallOverrideFunc"
|
|
||||||
|
|
||||||
func WithCallOverride(ctx netcontext.Context, f CallOverrideFunc) netcontext.Context {
|
|
||||||
// We avoid appending to any existing call override
|
|
||||||
// so we don't risk overwriting a popped stack below.
|
|
||||||
var cofs []CallOverrideFunc
|
|
||||||
if uf, ok := ctx.Value(&callOverrideKey).([]CallOverrideFunc); ok {
|
|
||||||
cofs = append(cofs, uf...)
|
|
||||||
}
|
|
||||||
cofs = append(cofs, f)
|
|
||||||
return netcontext.WithValue(ctx, &callOverrideKey, cofs)
|
|
||||||
}
|
|
||||||
|
|
||||||
func callOverrideFromContext(ctx netcontext.Context) (CallOverrideFunc, netcontext.Context, bool) {
|
|
||||||
cofs, _ := ctx.Value(&callOverrideKey).([]CallOverrideFunc)
|
|
||||||
if len(cofs) == 0 {
|
|
||||||
return nil, nil, false
|
|
||||||
}
|
|
||||||
// We found a list of overrides; grab the last, and reconstitute a
|
|
||||||
// context that will hide it.
|
|
||||||
f := cofs[len(cofs)-1]
|
|
||||||
ctx = netcontext.WithValue(ctx, &callOverrideKey, cofs[:len(cofs)-1])
|
|
||||||
return f, ctx, true
|
|
||||||
}
|
|
||||||
|
|
||||||
type logOverrideFunc func(level int64, format string, args ...interface{})
|
|
||||||
|
|
||||||
var logOverrideKey = "holds a logOverrideFunc"
|
|
||||||
|
|
||||||
func WithLogOverride(ctx netcontext.Context, f logOverrideFunc) netcontext.Context {
|
|
||||||
return netcontext.WithValue(ctx, &logOverrideKey, f)
|
|
||||||
}
|
|
||||||
|
|
||||||
var appIDOverrideKey = "holds a string, being the full app ID"
|
|
||||||
|
|
||||||
func WithAppIDOverride(ctx netcontext.Context, appID string) netcontext.Context {
|
|
||||||
return netcontext.WithValue(ctx, &appIDOverrideKey, appID)
|
|
||||||
}
|
|
||||||
|
|
||||||
var namespaceKey = "holds the namespace string"
|
|
||||||
|
|
||||||
func withNamespace(ctx netcontext.Context, ns string) netcontext.Context {
|
|
||||||
return netcontext.WithValue(ctx, &namespaceKey, ns)
|
|
||||||
}
|
|
||||||
|
|
||||||
func NamespaceFromContext(ctx netcontext.Context) string {
|
|
||||||
// If there's no namespace, return the empty string.
|
|
||||||
ns, _ := ctx.Value(&namespaceKey).(string)
|
|
||||||
return ns
|
|
||||||
}
|
|
||||||
|
|
||||||
// FullyQualifiedAppID returns the fully-qualified application ID.
|
|
||||||
// This may contain a partition prefix (e.g. "s~" for High Replication apps),
|
|
||||||
// or a domain prefix (e.g. "example.com:").
|
|
||||||
func FullyQualifiedAppID(ctx netcontext.Context) string {
|
|
||||||
if id, ok := ctx.Value(&appIDOverrideKey).(string); ok {
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
return fullyQualifiedAppID(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Logf(ctx netcontext.Context, level int64, format string, args ...interface{}) {
|
|
||||||
if f, ok := ctx.Value(&logOverrideKey).(logOverrideFunc); ok {
|
|
||||||
f(level, format, args...)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
logf(fromContext(ctx), level, format, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NamespacedContext wraps a Context to support namespaces.
|
|
||||||
func NamespacedContext(ctx netcontext.Context, namespace string) netcontext.Context {
|
|
||||||
return withNamespace(ctx, namespace)
|
|
||||||
}
|
|
28
vendor/google.golang.org/appengine/internal/app_id.go
generated
vendored
28
vendor/google.golang.org/appengine/internal/app_id.go
generated
vendored
@ -1,28 +0,0 @@
|
|||||||
// Copyright 2011 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func parseFullAppID(appid string) (partition, domain, displayID string) {
|
|
||||||
if i := strings.Index(appid, "~"); i != -1 {
|
|
||||||
partition, appid = appid[:i], appid[i+1:]
|
|
||||||
}
|
|
||||||
if i := strings.Index(appid, ":"); i != -1 {
|
|
||||||
domain, appid = appid[:i], appid[i+1:]
|
|
||||||
}
|
|
||||||
return partition, domain, appid
|
|
||||||
}
|
|
||||||
|
|
||||||
// appID returns "appid" or "domain.com:appid".
|
|
||||||
func appID(fullAppID string) string {
|
|
||||||
_, dom, dis := parseFullAppID(fullAppID)
|
|
||||||
if dom != "" {
|
|
||||||
return dom + ":" + dis
|
|
||||||
}
|
|
||||||
return dis
|
|
||||||
}
|
|
296
vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.pb.go
generated
vendored
296
vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.pb.go
generated
vendored
@ -1,296 +0,0 @@
|
|||||||
// Code generated by protoc-gen-go.
|
|
||||||
// source: google.golang.org/appengine/internal/app_identity/app_identity_service.proto
|
|
||||||
// DO NOT EDIT!
|
|
||||||
|
|
||||||
/*
|
|
||||||
Package app_identity is a generated protocol buffer package.
|
|
||||||
|
|
||||||
It is generated from these files:
|
|
||||||
google.golang.org/appengine/internal/app_identity/app_identity_service.proto
|
|
||||||
|
|
||||||
It has these top-level messages:
|
|
||||||
AppIdentityServiceError
|
|
||||||
SignForAppRequest
|
|
||||||
SignForAppResponse
|
|
||||||
GetPublicCertificateForAppRequest
|
|
||||||
PublicCertificate
|
|
||||||
GetPublicCertificateForAppResponse
|
|
||||||
GetServiceAccountNameRequest
|
|
||||||
GetServiceAccountNameResponse
|
|
||||||
GetAccessTokenRequest
|
|
||||||
GetAccessTokenResponse
|
|
||||||
GetDefaultGcsBucketNameRequest
|
|
||||||
GetDefaultGcsBucketNameResponse
|
|
||||||
*/
|
|
||||||
package app_identity
|
|
||||||
|
|
||||||
import proto "github.com/golang/protobuf/proto"
|
|
||||||
import fmt "fmt"
|
|
||||||
import math "math"
|
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ = proto.Marshal
|
|
||||||
var _ = fmt.Errorf
|
|
||||||
var _ = math.Inf
|
|
||||||
|
|
||||||
type AppIdentityServiceError_ErrorCode int32
|
|
||||||
|
|
||||||
const (
|
|
||||||
AppIdentityServiceError_SUCCESS AppIdentityServiceError_ErrorCode = 0
|
|
||||||
AppIdentityServiceError_UNKNOWN_SCOPE AppIdentityServiceError_ErrorCode = 9
|
|
||||||
AppIdentityServiceError_BLOB_TOO_LARGE AppIdentityServiceError_ErrorCode = 1000
|
|
||||||
AppIdentityServiceError_DEADLINE_EXCEEDED AppIdentityServiceError_ErrorCode = 1001
|
|
||||||
AppIdentityServiceError_NOT_A_VALID_APP AppIdentityServiceError_ErrorCode = 1002
|
|
||||||
AppIdentityServiceError_UNKNOWN_ERROR AppIdentityServiceError_ErrorCode = 1003
|
|
||||||
AppIdentityServiceError_NOT_ALLOWED AppIdentityServiceError_ErrorCode = 1005
|
|
||||||
AppIdentityServiceError_NOT_IMPLEMENTED AppIdentityServiceError_ErrorCode = 1006
|
|
||||||
)
|
|
||||||
|
|
||||||
var AppIdentityServiceError_ErrorCode_name = map[int32]string{
|
|
||||||
0: "SUCCESS",
|
|
||||||
9: "UNKNOWN_SCOPE",
|
|
||||||
1000: "BLOB_TOO_LARGE",
|
|
||||||
1001: "DEADLINE_EXCEEDED",
|
|
||||||
1002: "NOT_A_VALID_APP",
|
|
||||||
1003: "UNKNOWN_ERROR",
|
|
||||||
1005: "NOT_ALLOWED",
|
|
||||||
1006: "NOT_IMPLEMENTED",
|
|
||||||
}
|
|
||||||
var AppIdentityServiceError_ErrorCode_value = map[string]int32{
|
|
||||||
"SUCCESS": 0,
|
|
||||||
"UNKNOWN_SCOPE": 9,
|
|
||||||
"BLOB_TOO_LARGE": 1000,
|
|
||||||
"DEADLINE_EXCEEDED": 1001,
|
|
||||||
"NOT_A_VALID_APP": 1002,
|
|
||||||
"UNKNOWN_ERROR": 1003,
|
|
||||||
"NOT_ALLOWED": 1005,
|
|
||||||
"NOT_IMPLEMENTED": 1006,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x AppIdentityServiceError_ErrorCode) Enum() *AppIdentityServiceError_ErrorCode {
|
|
||||||
p := new(AppIdentityServiceError_ErrorCode)
|
|
||||||
*p = x
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
func (x AppIdentityServiceError_ErrorCode) String() string {
|
|
||||||
return proto.EnumName(AppIdentityServiceError_ErrorCode_name, int32(x))
|
|
||||||
}
|
|
||||||
func (x *AppIdentityServiceError_ErrorCode) UnmarshalJSON(data []byte) error {
|
|
||||||
value, err := proto.UnmarshalJSONEnum(AppIdentityServiceError_ErrorCode_value, data, "AppIdentityServiceError_ErrorCode")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
*x = AppIdentityServiceError_ErrorCode(value)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppIdentityServiceError struct {
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *AppIdentityServiceError) Reset() { *m = AppIdentityServiceError{} }
|
|
||||||
func (m *AppIdentityServiceError) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*AppIdentityServiceError) ProtoMessage() {}
|
|
||||||
|
|
||||||
type SignForAppRequest struct {
|
|
||||||
BytesToSign []byte `protobuf:"bytes,1,opt,name=bytes_to_sign" json:"bytes_to_sign,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SignForAppRequest) Reset() { *m = SignForAppRequest{} }
|
|
||||||
func (m *SignForAppRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*SignForAppRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *SignForAppRequest) GetBytesToSign() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.BytesToSign
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type SignForAppResponse struct {
|
|
||||||
KeyName *string `protobuf:"bytes,1,opt,name=key_name" json:"key_name,omitempty"`
|
|
||||||
SignatureBytes []byte `protobuf:"bytes,2,opt,name=signature_bytes" json:"signature_bytes,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SignForAppResponse) Reset() { *m = SignForAppResponse{} }
|
|
||||||
func (m *SignForAppResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*SignForAppResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *SignForAppResponse) GetKeyName() string {
|
|
||||||
if m != nil && m.KeyName != nil {
|
|
||||||
return *m.KeyName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SignForAppResponse) GetSignatureBytes() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.SignatureBytes
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetPublicCertificateForAppRequest struct {
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetPublicCertificateForAppRequest) Reset() { *m = GetPublicCertificateForAppRequest{} }
|
|
||||||
func (m *GetPublicCertificateForAppRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetPublicCertificateForAppRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
type PublicCertificate struct {
|
|
||||||
KeyName *string `protobuf:"bytes,1,opt,name=key_name" json:"key_name,omitempty"`
|
|
||||||
X509CertificatePem *string `protobuf:"bytes,2,opt,name=x509_certificate_pem" json:"x509_certificate_pem,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PublicCertificate) Reset() { *m = PublicCertificate{} }
|
|
||||||
func (m *PublicCertificate) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*PublicCertificate) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *PublicCertificate) GetKeyName() string {
|
|
||||||
if m != nil && m.KeyName != nil {
|
|
||||||
return *m.KeyName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PublicCertificate) GetX509CertificatePem() string {
|
|
||||||
if m != nil && m.X509CertificatePem != nil {
|
|
||||||
return *m.X509CertificatePem
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetPublicCertificateForAppResponse struct {
|
|
||||||
PublicCertificateList []*PublicCertificate `protobuf:"bytes,1,rep,name=public_certificate_list" json:"public_certificate_list,omitempty"`
|
|
||||||
MaxClientCacheTimeInSecond *int64 `protobuf:"varint,2,opt,name=max_client_cache_time_in_second" json:"max_client_cache_time_in_second,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetPublicCertificateForAppResponse) Reset() { *m = GetPublicCertificateForAppResponse{} }
|
|
||||||
func (m *GetPublicCertificateForAppResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetPublicCertificateForAppResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetPublicCertificateForAppResponse) GetPublicCertificateList() []*PublicCertificate {
|
|
||||||
if m != nil {
|
|
||||||
return m.PublicCertificateList
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetPublicCertificateForAppResponse) GetMaxClientCacheTimeInSecond() int64 {
|
|
||||||
if m != nil && m.MaxClientCacheTimeInSecond != nil {
|
|
||||||
return *m.MaxClientCacheTimeInSecond
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetServiceAccountNameRequest struct {
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetServiceAccountNameRequest) Reset() { *m = GetServiceAccountNameRequest{} }
|
|
||||||
func (m *GetServiceAccountNameRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetServiceAccountNameRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
type GetServiceAccountNameResponse struct {
|
|
||||||
ServiceAccountName *string `protobuf:"bytes,1,opt,name=service_account_name" json:"service_account_name,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetServiceAccountNameResponse) Reset() { *m = GetServiceAccountNameResponse{} }
|
|
||||||
func (m *GetServiceAccountNameResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetServiceAccountNameResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetServiceAccountNameResponse) GetServiceAccountName() string {
|
|
||||||
if m != nil && m.ServiceAccountName != nil {
|
|
||||||
return *m.ServiceAccountName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetAccessTokenRequest struct {
|
|
||||||
Scope []string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty"`
|
|
||||||
ServiceAccountId *int64 `protobuf:"varint,2,opt,name=service_account_id" json:"service_account_id,omitempty"`
|
|
||||||
ServiceAccountName *string `protobuf:"bytes,3,opt,name=service_account_name" json:"service_account_name,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetAccessTokenRequest) Reset() { *m = GetAccessTokenRequest{} }
|
|
||||||
func (m *GetAccessTokenRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetAccessTokenRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetAccessTokenRequest) GetScope() []string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Scope
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetAccessTokenRequest) GetServiceAccountId() int64 {
|
|
||||||
if m != nil && m.ServiceAccountId != nil {
|
|
||||||
return *m.ServiceAccountId
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetAccessTokenRequest) GetServiceAccountName() string {
|
|
||||||
if m != nil && m.ServiceAccountName != nil {
|
|
||||||
return *m.ServiceAccountName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetAccessTokenResponse struct {
|
|
||||||
AccessToken *string `protobuf:"bytes,1,opt,name=access_token" json:"access_token,omitempty"`
|
|
||||||
ExpirationTime *int64 `protobuf:"varint,2,opt,name=expiration_time" json:"expiration_time,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetAccessTokenResponse) Reset() { *m = GetAccessTokenResponse{} }
|
|
||||||
func (m *GetAccessTokenResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetAccessTokenResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetAccessTokenResponse) GetAccessToken() string {
|
|
||||||
if m != nil && m.AccessToken != nil {
|
|
||||||
return *m.AccessToken
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetAccessTokenResponse) GetExpirationTime() int64 {
|
|
||||||
if m != nil && m.ExpirationTime != nil {
|
|
||||||
return *m.ExpirationTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetDefaultGcsBucketNameRequest struct {
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetDefaultGcsBucketNameRequest) Reset() { *m = GetDefaultGcsBucketNameRequest{} }
|
|
||||||
func (m *GetDefaultGcsBucketNameRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetDefaultGcsBucketNameRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
type GetDefaultGcsBucketNameResponse struct {
|
|
||||||
DefaultGcsBucketName *string `protobuf:"bytes,1,opt,name=default_gcs_bucket_name" json:"default_gcs_bucket_name,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetDefaultGcsBucketNameResponse) Reset() { *m = GetDefaultGcsBucketNameResponse{} }
|
|
||||||
func (m *GetDefaultGcsBucketNameResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetDefaultGcsBucketNameResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetDefaultGcsBucketNameResponse) GetDefaultGcsBucketName() string {
|
|
||||||
if m != nil && m.DefaultGcsBucketName != nil {
|
|
||||||
return *m.DefaultGcsBucketName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
}
|
|
64
vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.proto
generated
vendored
64
vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.proto
generated
vendored
@ -1,64 +0,0 @@
|
|||||||
syntax = "proto2";
|
|
||||||
option go_package = "app_identity";
|
|
||||||
|
|
||||||
package appengine;
|
|
||||||
|
|
||||||
message AppIdentityServiceError {
|
|
||||||
enum ErrorCode {
|
|
||||||
SUCCESS = 0;
|
|
||||||
UNKNOWN_SCOPE = 9;
|
|
||||||
BLOB_TOO_LARGE = 1000;
|
|
||||||
DEADLINE_EXCEEDED = 1001;
|
|
||||||
NOT_A_VALID_APP = 1002;
|
|
||||||
UNKNOWN_ERROR = 1003;
|
|
||||||
NOT_ALLOWED = 1005;
|
|
||||||
NOT_IMPLEMENTED = 1006;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message SignForAppRequest {
|
|
||||||
optional bytes bytes_to_sign = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SignForAppResponse {
|
|
||||||
optional string key_name = 1;
|
|
||||||
optional bytes signature_bytes = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetPublicCertificateForAppRequest {
|
|
||||||
}
|
|
||||||
|
|
||||||
message PublicCertificate {
|
|
||||||
optional string key_name = 1;
|
|
||||||
optional string x509_certificate_pem = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetPublicCertificateForAppResponse {
|
|
||||||
repeated PublicCertificate public_certificate_list = 1;
|
|
||||||
optional int64 max_client_cache_time_in_second = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetServiceAccountNameRequest {
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetServiceAccountNameResponse {
|
|
||||||
optional string service_account_name = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetAccessTokenRequest {
|
|
||||||
repeated string scope = 1;
|
|
||||||
optional int64 service_account_id = 2;
|
|
||||||
optional string service_account_name = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetAccessTokenResponse {
|
|
||||||
optional string access_token = 1;
|
|
||||||
optional int64 expiration_time = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetDefaultGcsBucketNameRequest {
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetDefaultGcsBucketNameResponse {
|
|
||||||
optional string default_gcs_bucket_name = 1;
|
|
||||||
}
|
|
133
vendor/google.golang.org/appengine/internal/base/api_base.pb.go
generated
vendored
133
vendor/google.golang.org/appengine/internal/base/api_base.pb.go
generated
vendored
@ -1,133 +0,0 @@
|
|||||||
// Code generated by protoc-gen-go.
|
|
||||||
// source: google.golang.org/appengine/internal/base/api_base.proto
|
|
||||||
// DO NOT EDIT!
|
|
||||||
|
|
||||||
/*
|
|
||||||
Package base is a generated protocol buffer package.
|
|
||||||
|
|
||||||
It is generated from these files:
|
|
||||||
google.golang.org/appengine/internal/base/api_base.proto
|
|
||||||
|
|
||||||
It has these top-level messages:
|
|
||||||
StringProto
|
|
||||||
Integer32Proto
|
|
||||||
Integer64Proto
|
|
||||||
BoolProto
|
|
||||||
DoubleProto
|
|
||||||
BytesProto
|
|
||||||
VoidProto
|
|
||||||
*/
|
|
||||||
package base
|
|
||||||
|
|
||||||
import proto "github.com/golang/protobuf/proto"
|
|
||||||
import fmt "fmt"
|
|
||||||
import math "math"
|
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ = proto.Marshal
|
|
||||||
var _ = fmt.Errorf
|
|
||||||
var _ = math.Inf
|
|
||||||
|
|
||||||
type StringProto struct {
|
|
||||||
Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *StringProto) Reset() { *m = StringProto{} }
|
|
||||||
func (m *StringProto) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*StringProto) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *StringProto) GetValue() string {
|
|
||||||
if m != nil && m.Value != nil {
|
|
||||||
return *m.Value
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type Integer32Proto struct {
|
|
||||||
Value *int32 `protobuf:"varint,1,req,name=value" json:"value,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Integer32Proto) Reset() { *m = Integer32Proto{} }
|
|
||||||
func (m *Integer32Proto) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*Integer32Proto) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *Integer32Proto) GetValue() int32 {
|
|
||||||
if m != nil && m.Value != nil {
|
|
||||||
return *m.Value
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type Integer64Proto struct {
|
|
||||||
Value *int64 `protobuf:"varint,1,req,name=value" json:"value,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Integer64Proto) Reset() { *m = Integer64Proto{} }
|
|
||||||
func (m *Integer64Proto) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*Integer64Proto) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *Integer64Proto) GetValue() int64 {
|
|
||||||
if m != nil && m.Value != nil {
|
|
||||||
return *m.Value
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type BoolProto struct {
|
|
||||||
Value *bool `protobuf:"varint,1,req,name=value" json:"value,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *BoolProto) Reset() { *m = BoolProto{} }
|
|
||||||
func (m *BoolProto) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*BoolProto) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *BoolProto) GetValue() bool {
|
|
||||||
if m != nil && m.Value != nil {
|
|
||||||
return *m.Value
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
type DoubleProto struct {
|
|
||||||
Value *float64 `protobuf:"fixed64,1,req,name=value" json:"value,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *DoubleProto) Reset() { *m = DoubleProto{} }
|
|
||||||
func (m *DoubleProto) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*DoubleProto) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *DoubleProto) GetValue() float64 {
|
|
||||||
if m != nil && m.Value != nil {
|
|
||||||
return *m.Value
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type BytesProto struct {
|
|
||||||
Value []byte `protobuf:"bytes,1,req,name=value" json:"value,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *BytesProto) Reset() { *m = BytesProto{} }
|
|
||||||
func (m *BytesProto) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*BytesProto) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *BytesProto) GetValue() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.Value
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type VoidProto struct {
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *VoidProto) Reset() { *m = VoidProto{} }
|
|
||||||
func (m *VoidProto) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*VoidProto) ProtoMessage() {}
|
|
33
vendor/google.golang.org/appengine/internal/base/api_base.proto
generated
vendored
33
vendor/google.golang.org/appengine/internal/base/api_base.proto
generated
vendored
@ -1,33 +0,0 @@
|
|||||||
// Built-in base types for API calls. Primarily useful as return types.
|
|
||||||
|
|
||||||
syntax = "proto2";
|
|
||||||
option go_package = "base";
|
|
||||||
|
|
||||||
package appengine.base;
|
|
||||||
|
|
||||||
message StringProto {
|
|
||||||
required string value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Integer32Proto {
|
|
||||||
required int32 value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Integer64Proto {
|
|
||||||
required int64 value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message BoolProto {
|
|
||||||
required bool value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DoubleProto {
|
|
||||||
required double value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message BytesProto {
|
|
||||||
required bytes value = 1 [ctype=CORD];
|
|
||||||
}
|
|
||||||
|
|
||||||
message VoidProto {
|
|
||||||
}
|
|
2778
vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go
generated
vendored
2778
vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
541
vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto
generated
vendored
541
vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto
generated
vendored
@ -1,541 +0,0 @@
|
|||||||
syntax = "proto2";
|
|
||||||
option go_package = "datastore";
|
|
||||||
|
|
||||||
package appengine;
|
|
||||||
|
|
||||||
message Action{}
|
|
||||||
|
|
||||||
message PropertyValue {
|
|
||||||
optional int64 int64Value = 1;
|
|
||||||
optional bool booleanValue = 2;
|
|
||||||
optional string stringValue = 3;
|
|
||||||
optional double doubleValue = 4;
|
|
||||||
|
|
||||||
optional group PointValue = 5 {
|
|
||||||
required double x = 6;
|
|
||||||
required double y = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
optional group UserValue = 8 {
|
|
||||||
required string email = 9;
|
|
||||||
required string auth_domain = 10;
|
|
||||||
optional string nickname = 11;
|
|
||||||
optional string federated_identity = 21;
|
|
||||||
optional string federated_provider = 22;
|
|
||||||
}
|
|
||||||
|
|
||||||
optional group ReferenceValue = 12 {
|
|
||||||
required string app = 13;
|
|
||||||
optional string name_space = 20;
|
|
||||||
repeated group PathElement = 14 {
|
|
||||||
required string type = 15;
|
|
||||||
optional int64 id = 16;
|
|
||||||
optional string name = 17;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message Property {
|
|
||||||
enum Meaning {
|
|
||||||
NO_MEANING = 0;
|
|
||||||
BLOB = 14;
|
|
||||||
TEXT = 15;
|
|
||||||
BYTESTRING = 16;
|
|
||||||
|
|
||||||
ATOM_CATEGORY = 1;
|
|
||||||
ATOM_LINK = 2;
|
|
||||||
ATOM_TITLE = 3;
|
|
||||||
ATOM_CONTENT = 4;
|
|
||||||
ATOM_SUMMARY = 5;
|
|
||||||
ATOM_AUTHOR = 6;
|
|
||||||
|
|
||||||
GD_WHEN = 7;
|
|
||||||
GD_EMAIL = 8;
|
|
||||||
GEORSS_POINT = 9;
|
|
||||||
GD_IM = 10;
|
|
||||||
|
|
||||||
GD_PHONENUMBER = 11;
|
|
||||||
GD_POSTALADDRESS = 12;
|
|
||||||
|
|
||||||
GD_RATING = 13;
|
|
||||||
|
|
||||||
BLOBKEY = 17;
|
|
||||||
ENTITY_PROTO = 19;
|
|
||||||
|
|
||||||
INDEX_VALUE = 18;
|
|
||||||
};
|
|
||||||
|
|
||||||
optional Meaning meaning = 1 [default = NO_MEANING];
|
|
||||||
optional string meaning_uri = 2;
|
|
||||||
|
|
||||||
required string name = 3;
|
|
||||||
|
|
||||||
required PropertyValue value = 5;
|
|
||||||
|
|
||||||
required bool multiple = 4;
|
|
||||||
|
|
||||||
optional bool searchable = 6 [default=false];
|
|
||||||
|
|
||||||
enum FtsTokenizationOption {
|
|
||||||
HTML = 1;
|
|
||||||
ATOM = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
optional FtsTokenizationOption fts_tokenization_option = 8;
|
|
||||||
|
|
||||||
optional string locale = 9 [default = "en"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message Path {
|
|
||||||
repeated group Element = 1 {
|
|
||||||
required string type = 2;
|
|
||||||
optional int64 id = 3;
|
|
||||||
optional string name = 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message Reference {
|
|
||||||
required string app = 13;
|
|
||||||
optional string name_space = 20;
|
|
||||||
required Path path = 14;
|
|
||||||
}
|
|
||||||
|
|
||||||
message User {
|
|
||||||
required string email = 1;
|
|
||||||
required string auth_domain = 2;
|
|
||||||
optional string nickname = 3;
|
|
||||||
optional string federated_identity = 6;
|
|
||||||
optional string federated_provider = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
message EntityProto {
|
|
||||||
required Reference key = 13;
|
|
||||||
required Path entity_group = 16;
|
|
||||||
optional User owner = 17;
|
|
||||||
|
|
||||||
enum Kind {
|
|
||||||
GD_CONTACT = 1;
|
|
||||||
GD_EVENT = 2;
|
|
||||||
GD_MESSAGE = 3;
|
|
||||||
}
|
|
||||||
optional Kind kind = 4;
|
|
||||||
optional string kind_uri = 5;
|
|
||||||
|
|
||||||
repeated Property property = 14;
|
|
||||||
repeated Property raw_property = 15;
|
|
||||||
|
|
||||||
optional int32 rank = 18;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CompositeProperty {
|
|
||||||
required int64 index_id = 1;
|
|
||||||
repeated string value = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Index {
|
|
||||||
required string entity_type = 1;
|
|
||||||
required bool ancestor = 5;
|
|
||||||
repeated group Property = 2 {
|
|
||||||
required string name = 3;
|
|
||||||
enum Direction {
|
|
||||||
ASCENDING = 1;
|
|
||||||
DESCENDING = 2;
|
|
||||||
}
|
|
||||||
optional Direction direction = 4 [default = ASCENDING];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message CompositeIndex {
|
|
||||||
required string app_id = 1;
|
|
||||||
required int64 id = 2;
|
|
||||||
required Index definition = 3;
|
|
||||||
|
|
||||||
enum State {
|
|
||||||
WRITE_ONLY = 1;
|
|
||||||
READ_WRITE = 2;
|
|
||||||
DELETED = 3;
|
|
||||||
ERROR = 4;
|
|
||||||
}
|
|
||||||
required State state = 4;
|
|
||||||
|
|
||||||
optional bool only_use_if_required = 6 [default = false];
|
|
||||||
}
|
|
||||||
|
|
||||||
message IndexPostfix {
|
|
||||||
message IndexValue {
|
|
||||||
required string property_name = 1;
|
|
||||||
required PropertyValue value = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
repeated IndexValue index_value = 1;
|
|
||||||
|
|
||||||
optional Reference key = 2;
|
|
||||||
|
|
||||||
optional bool before = 3 [default=true];
|
|
||||||
}
|
|
||||||
|
|
||||||
message IndexPosition {
|
|
||||||
optional string key = 1;
|
|
||||||
|
|
||||||
optional bool before = 2 [default=true];
|
|
||||||
}
|
|
||||||
|
|
||||||
message Snapshot {
|
|
||||||
enum Status {
|
|
||||||
INACTIVE = 0;
|
|
||||||
ACTIVE = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
required int64 ts = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message InternalHeader {
|
|
||||||
optional string qos = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Transaction {
|
|
||||||
optional InternalHeader header = 4;
|
|
||||||
required fixed64 handle = 1;
|
|
||||||
required string app = 2;
|
|
||||||
optional bool mark_changes = 3 [default = false];
|
|
||||||
}
|
|
||||||
|
|
||||||
message Query {
|
|
||||||
optional InternalHeader header = 39;
|
|
||||||
|
|
||||||
required string app = 1;
|
|
||||||
optional string name_space = 29;
|
|
||||||
|
|
||||||
optional string kind = 3;
|
|
||||||
optional Reference ancestor = 17;
|
|
||||||
|
|
||||||
repeated group Filter = 4 {
|
|
||||||
enum Operator {
|
|
||||||
LESS_THAN = 1;
|
|
||||||
LESS_THAN_OR_EQUAL = 2;
|
|
||||||
GREATER_THAN = 3;
|
|
||||||
GREATER_THAN_OR_EQUAL = 4;
|
|
||||||
EQUAL = 5;
|
|
||||||
IN = 6;
|
|
||||||
EXISTS = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
required Operator op = 6;
|
|
||||||
repeated Property property = 14;
|
|
||||||
}
|
|
||||||
|
|
||||||
optional string search_query = 8;
|
|
||||||
|
|
||||||
repeated group Order = 9 {
|
|
||||||
enum Direction {
|
|
||||||
ASCENDING = 1;
|
|
||||||
DESCENDING = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
required string property = 10;
|
|
||||||
optional Direction direction = 11 [default = ASCENDING];
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Hint {
|
|
||||||
ORDER_FIRST = 1;
|
|
||||||
ANCESTOR_FIRST = 2;
|
|
||||||
FILTER_FIRST = 3;
|
|
||||||
}
|
|
||||||
optional Hint hint = 18;
|
|
||||||
|
|
||||||
optional int32 count = 23;
|
|
||||||
|
|
||||||
optional int32 offset = 12 [default = 0];
|
|
||||||
|
|
||||||
optional int32 limit = 16;
|
|
||||||
|
|
||||||
optional CompiledCursor compiled_cursor = 30;
|
|
||||||
optional CompiledCursor end_compiled_cursor = 31;
|
|
||||||
|
|
||||||
repeated CompositeIndex composite_index = 19;
|
|
||||||
|
|
||||||
optional bool require_perfect_plan = 20 [default = false];
|
|
||||||
|
|
||||||
optional bool keys_only = 21 [default = false];
|
|
||||||
|
|
||||||
optional Transaction transaction = 22;
|
|
||||||
|
|
||||||
optional bool compile = 25 [default = false];
|
|
||||||
|
|
||||||
optional int64 failover_ms = 26;
|
|
||||||
|
|
||||||
optional bool strong = 32;
|
|
||||||
|
|
||||||
repeated string property_name = 33;
|
|
||||||
|
|
||||||
repeated string group_by_property_name = 34;
|
|
||||||
|
|
||||||
optional bool distinct = 24;
|
|
||||||
|
|
||||||
optional int64 min_safe_time_seconds = 35;
|
|
||||||
|
|
||||||
repeated string safe_replica_name = 36;
|
|
||||||
|
|
||||||
optional bool persist_offset = 37 [default=false];
|
|
||||||
}
|
|
||||||
|
|
||||||
message CompiledQuery {
|
|
||||||
required group PrimaryScan = 1 {
|
|
||||||
optional string index_name = 2;
|
|
||||||
|
|
||||||
optional string start_key = 3;
|
|
||||||
optional bool start_inclusive = 4;
|
|
||||||
optional string end_key = 5;
|
|
||||||
optional bool end_inclusive = 6;
|
|
||||||
|
|
||||||
repeated string start_postfix_value = 22;
|
|
||||||
repeated string end_postfix_value = 23;
|
|
||||||
|
|
||||||
optional int64 end_unapplied_log_timestamp_us = 19;
|
|
||||||
}
|
|
||||||
|
|
||||||
repeated group MergeJoinScan = 7 {
|
|
||||||
required string index_name = 8;
|
|
||||||
|
|
||||||
repeated string prefix_value = 9;
|
|
||||||
|
|
||||||
optional bool value_prefix = 20 [default=false];
|
|
||||||
}
|
|
||||||
|
|
||||||
optional Index index_def = 21;
|
|
||||||
|
|
||||||
optional int32 offset = 10 [default = 0];
|
|
||||||
|
|
||||||
optional int32 limit = 11;
|
|
||||||
|
|
||||||
required bool keys_only = 12;
|
|
||||||
|
|
||||||
repeated string property_name = 24;
|
|
||||||
|
|
||||||
optional int32 distinct_infix_size = 25;
|
|
||||||
|
|
||||||
optional group EntityFilter = 13 {
|
|
||||||
optional bool distinct = 14 [default=false];
|
|
||||||
|
|
||||||
optional string kind = 17;
|
|
||||||
optional Reference ancestor = 18;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message CompiledCursor {
|
|
||||||
optional group Position = 2 {
|
|
||||||
optional string start_key = 27;
|
|
||||||
|
|
||||||
repeated group IndexValue = 29 {
|
|
||||||
optional string property = 30;
|
|
||||||
required PropertyValue value = 31;
|
|
||||||
}
|
|
||||||
|
|
||||||
optional Reference key = 32;
|
|
||||||
|
|
||||||
optional bool start_inclusive = 28 [default=true];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message Cursor {
|
|
||||||
required fixed64 cursor = 1;
|
|
||||||
|
|
||||||
optional string app = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Error {
|
|
||||||
enum ErrorCode {
|
|
||||||
BAD_REQUEST = 1;
|
|
||||||
CONCURRENT_TRANSACTION = 2;
|
|
||||||
INTERNAL_ERROR = 3;
|
|
||||||
NEED_INDEX = 4;
|
|
||||||
TIMEOUT = 5;
|
|
||||||
PERMISSION_DENIED = 6;
|
|
||||||
BIGTABLE_ERROR = 7;
|
|
||||||
COMMITTED_BUT_STILL_APPLYING = 8;
|
|
||||||
CAPABILITY_DISABLED = 9;
|
|
||||||
TRY_ALTERNATE_BACKEND = 10;
|
|
||||||
SAFE_TIME_TOO_OLD = 11;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message Cost {
|
|
||||||
optional int32 index_writes = 1;
|
|
||||||
optional int32 index_write_bytes = 2;
|
|
||||||
optional int32 entity_writes = 3;
|
|
||||||
optional int32 entity_write_bytes = 4;
|
|
||||||
optional group CommitCost = 5 {
|
|
||||||
optional int32 requested_entity_puts = 6;
|
|
||||||
optional int32 requested_entity_deletes = 7;
|
|
||||||
};
|
|
||||||
optional int32 approximate_storage_delta = 8;
|
|
||||||
optional int32 id_sequence_updates = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetRequest {
|
|
||||||
optional InternalHeader header = 6;
|
|
||||||
|
|
||||||
repeated Reference key = 1;
|
|
||||||
optional Transaction transaction = 2;
|
|
||||||
|
|
||||||
optional int64 failover_ms = 3;
|
|
||||||
|
|
||||||
optional bool strong = 4;
|
|
||||||
|
|
||||||
optional bool allow_deferred = 5 [default=false];
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetResponse {
|
|
||||||
repeated group Entity = 1 {
|
|
||||||
optional EntityProto entity = 2;
|
|
||||||
optional Reference key = 4;
|
|
||||||
|
|
||||||
optional int64 version = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
repeated Reference deferred = 5;
|
|
||||||
|
|
||||||
optional bool in_order = 6 [default=true];
|
|
||||||
}
|
|
||||||
|
|
||||||
message PutRequest {
|
|
||||||
optional InternalHeader header = 11;
|
|
||||||
|
|
||||||
repeated EntityProto entity = 1;
|
|
||||||
optional Transaction transaction = 2;
|
|
||||||
repeated CompositeIndex composite_index = 3;
|
|
||||||
|
|
||||||
optional bool trusted = 4 [default = false];
|
|
||||||
|
|
||||||
optional bool force = 7 [default = false];
|
|
||||||
|
|
||||||
optional bool mark_changes = 8 [default = false];
|
|
||||||
repeated Snapshot snapshot = 9;
|
|
||||||
|
|
||||||
enum AutoIdPolicy {
|
|
||||||
CURRENT = 0;
|
|
||||||
SEQUENTIAL = 1;
|
|
||||||
}
|
|
||||||
optional AutoIdPolicy auto_id_policy = 10 [default = CURRENT];
|
|
||||||
}
|
|
||||||
|
|
||||||
message PutResponse {
|
|
||||||
repeated Reference key = 1;
|
|
||||||
optional Cost cost = 2;
|
|
||||||
repeated int64 version = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TouchRequest {
|
|
||||||
optional InternalHeader header = 10;
|
|
||||||
|
|
||||||
repeated Reference key = 1;
|
|
||||||
repeated CompositeIndex composite_index = 2;
|
|
||||||
optional bool force = 3 [default = false];
|
|
||||||
repeated Snapshot snapshot = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TouchResponse {
|
|
||||||
optional Cost cost = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DeleteRequest {
|
|
||||||
optional InternalHeader header = 10;
|
|
||||||
|
|
||||||
repeated Reference key = 6;
|
|
||||||
optional Transaction transaction = 5;
|
|
||||||
|
|
||||||
optional bool trusted = 4 [default = false];
|
|
||||||
|
|
||||||
optional bool force = 7 [default = false];
|
|
||||||
|
|
||||||
optional bool mark_changes = 8 [default = false];
|
|
||||||
repeated Snapshot snapshot = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DeleteResponse {
|
|
||||||
optional Cost cost = 1;
|
|
||||||
repeated int64 version = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message NextRequest {
|
|
||||||
optional InternalHeader header = 5;
|
|
||||||
|
|
||||||
required Cursor cursor = 1;
|
|
||||||
optional int32 count = 2;
|
|
||||||
|
|
||||||
optional int32 offset = 4 [default = 0];
|
|
||||||
|
|
||||||
optional bool compile = 3 [default = false];
|
|
||||||
}
|
|
||||||
|
|
||||||
message QueryResult {
|
|
||||||
optional Cursor cursor = 1;
|
|
||||||
|
|
||||||
repeated EntityProto result = 2;
|
|
||||||
|
|
||||||
optional int32 skipped_results = 7;
|
|
||||||
|
|
||||||
required bool more_results = 3;
|
|
||||||
|
|
||||||
optional bool keys_only = 4;
|
|
||||||
|
|
||||||
optional bool index_only = 9;
|
|
||||||
|
|
||||||
optional bool small_ops = 10;
|
|
||||||
|
|
||||||
optional CompiledQuery compiled_query = 5;
|
|
||||||
|
|
||||||
optional CompiledCursor compiled_cursor = 6;
|
|
||||||
|
|
||||||
repeated CompositeIndex index = 8;
|
|
||||||
|
|
||||||
repeated int64 version = 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AllocateIdsRequest {
|
|
||||||
optional InternalHeader header = 4;
|
|
||||||
|
|
||||||
optional Reference model_key = 1;
|
|
||||||
|
|
||||||
optional int64 size = 2;
|
|
||||||
|
|
||||||
optional int64 max = 3;
|
|
||||||
|
|
||||||
repeated Reference reserve = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AllocateIdsResponse {
|
|
||||||
required int64 start = 1;
|
|
||||||
required int64 end = 2;
|
|
||||||
optional Cost cost = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CompositeIndices {
|
|
||||||
repeated CompositeIndex index = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AddActionsRequest {
|
|
||||||
optional InternalHeader header = 3;
|
|
||||||
|
|
||||||
required Transaction transaction = 1;
|
|
||||||
repeated Action action = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AddActionsResponse {
|
|
||||||
}
|
|
||||||
|
|
||||||
message BeginTransactionRequest {
|
|
||||||
optional InternalHeader header = 3;
|
|
||||||
|
|
||||||
required string app = 1;
|
|
||||||
optional bool allow_multiple_eg = 2 [default = false];
|
|
||||||
}
|
|
||||||
|
|
||||||
message CommitResponse {
|
|
||||||
optional Cost cost = 1;
|
|
||||||
|
|
||||||
repeated group Version = 3 {
|
|
||||||
required Reference root_entity_key = 4;
|
|
||||||
required int64 version = 5;
|
|
||||||
}
|
|
||||||
}
|
|
14
vendor/google.golang.org/appengine/internal/identity.go
generated
vendored
14
vendor/google.golang.org/appengine/internal/identity.go
generated
vendored
@ -1,14 +0,0 @@
|
|||||||
// Copyright 2011 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
import netcontext "golang.org/x/net/context"
|
|
||||||
|
|
||||||
// These functions are implementations of the wrapper functions
|
|
||||||
// in ../appengine/identity.go. See that file for commentary.
|
|
||||||
|
|
||||||
func AppID(c netcontext.Context) string {
|
|
||||||
return appID(FullyQualifiedAppID(c))
|
|
||||||
}
|
|
27
vendor/google.golang.org/appengine/internal/identity_classic.go
generated
vendored
27
vendor/google.golang.org/appengine/internal/identity_classic.go
generated
vendored
@ -1,27 +0,0 @@
|
|||||||
// Copyright 2015 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build appengine
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"appengine"
|
|
||||||
|
|
||||||
netcontext "golang.org/x/net/context"
|
|
||||||
)
|
|
||||||
|
|
||||||
func DefaultVersionHostname(ctx netcontext.Context) string {
|
|
||||||
return appengine.DefaultVersionHostname(fromContext(ctx))
|
|
||||||
}
|
|
||||||
|
|
||||||
func RequestID(ctx netcontext.Context) string { return appengine.RequestID(fromContext(ctx)) }
|
|
||||||
func Datacenter(_ netcontext.Context) string { return appengine.Datacenter() }
|
|
||||||
func ServerSoftware() string { return appengine.ServerSoftware() }
|
|
||||||
func ModuleName(ctx netcontext.Context) string { return appengine.ModuleName(fromContext(ctx)) }
|
|
||||||
func VersionID(ctx netcontext.Context) string { return appengine.VersionID(fromContext(ctx)) }
|
|
||||||
func InstanceID() string { return appengine.InstanceID() }
|
|
||||||
func IsDevAppServer() bool { return appengine.IsDevAppServer() }
|
|
||||||
|
|
||||||
func fullyQualifiedAppID(ctx netcontext.Context) string { return fromContext(ctx).FullyQualifiedAppID() }
|
|
97
vendor/google.golang.org/appengine/internal/identity_vm.go
generated
vendored
97
vendor/google.golang.org/appengine/internal/identity_vm.go
generated
vendored
@ -1,97 +0,0 @@
|
|||||||
// Copyright 2011 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !appengine
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
netcontext "golang.org/x/net/context"
|
|
||||||
)
|
|
||||||
|
|
||||||
// These functions are implementations of the wrapper functions
|
|
||||||
// in ../appengine/identity.go. See that file for commentary.
|
|
||||||
|
|
||||||
const (
|
|
||||||
hDefaultVersionHostname = "X-AppEngine-Default-Version-Hostname"
|
|
||||||
hRequestLogId = "X-AppEngine-Request-Log-Id"
|
|
||||||
hDatacenter = "X-AppEngine-Datacenter"
|
|
||||||
)
|
|
||||||
|
|
||||||
func ctxHeaders(ctx netcontext.Context) http.Header {
|
|
||||||
return fromContext(ctx).Request().Header
|
|
||||||
}
|
|
||||||
|
|
||||||
func DefaultVersionHostname(ctx netcontext.Context) string {
|
|
||||||
return ctxHeaders(ctx).Get(hDefaultVersionHostname)
|
|
||||||
}
|
|
||||||
|
|
||||||
func RequestID(ctx netcontext.Context) string {
|
|
||||||
return ctxHeaders(ctx).Get(hRequestLogId)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Datacenter(ctx netcontext.Context) string {
|
|
||||||
return ctxHeaders(ctx).Get(hDatacenter)
|
|
||||||
}
|
|
||||||
|
|
||||||
func ServerSoftware() string {
|
|
||||||
// TODO(dsymonds): Remove fallback when we've verified this.
|
|
||||||
if s := os.Getenv("SERVER_SOFTWARE"); s != "" {
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
return "Google App Engine/1.x.x"
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(dsymonds): Remove the metadata fetches.
|
|
||||||
|
|
||||||
func ModuleName(_ netcontext.Context) string {
|
|
||||||
if s := os.Getenv("GAE_MODULE_NAME"); s != "" {
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
return string(mustGetMetadata("instance/attributes/gae_backend_name"))
|
|
||||||
}
|
|
||||||
|
|
||||||
func VersionID(_ netcontext.Context) string {
|
|
||||||
if s1, s2 := os.Getenv("GAE_MODULE_VERSION"), os.Getenv("GAE_MINOR_VERSION"); s1 != "" && s2 != "" {
|
|
||||||
return s1 + "." + s2
|
|
||||||
}
|
|
||||||
return string(mustGetMetadata("instance/attributes/gae_backend_version")) + "." + string(mustGetMetadata("instance/attributes/gae_backend_minor_version"))
|
|
||||||
}
|
|
||||||
|
|
||||||
func InstanceID() string {
|
|
||||||
if s := os.Getenv("GAE_MODULE_INSTANCE"); s != "" {
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
return string(mustGetMetadata("instance/attributes/gae_backend_instance"))
|
|
||||||
}
|
|
||||||
|
|
||||||
func partitionlessAppID() string {
|
|
||||||
// gae_project has everything except the partition prefix.
|
|
||||||
appID := os.Getenv("GAE_LONG_APP_ID")
|
|
||||||
if appID == "" {
|
|
||||||
appID = string(mustGetMetadata("instance/attributes/gae_project"))
|
|
||||||
}
|
|
||||||
return appID
|
|
||||||
}
|
|
||||||
|
|
||||||
func fullyQualifiedAppID(_ netcontext.Context) string {
|
|
||||||
appID := partitionlessAppID()
|
|
||||||
|
|
||||||
part := os.Getenv("GAE_PARTITION")
|
|
||||||
if part == "" {
|
|
||||||
part = string(mustGetMetadata("instance/attributes/gae_partition"))
|
|
||||||
}
|
|
||||||
|
|
||||||
if part != "" {
|
|
||||||
appID = part + "~" + appID
|
|
||||||
}
|
|
||||||
return appID
|
|
||||||
}
|
|
||||||
|
|
||||||
func IsDevAppServer() bool {
|
|
||||||
return os.Getenv("RUN_WITH_DEVAPPSERVER") != ""
|
|
||||||
}
|
|
110
vendor/google.golang.org/appengine/internal/internal.go
generated
vendored
110
vendor/google.golang.org/appengine/internal/internal.go
generated
vendored
@ -1,110 +0,0 @@
|
|||||||
// Copyright 2011 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// Package internal provides support for package appengine.
|
|
||||||
//
|
|
||||||
// Programs should not use this package directly. Its API is not stable.
|
|
||||||
// Use packages appengine and appengine/* instead.
|
|
||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
|
|
||||||
remotepb "google.golang.org/appengine/internal/remote_api"
|
|
||||||
)
|
|
||||||
|
|
||||||
// errorCodeMaps is a map of service name to the error code map for the service.
|
|
||||||
var errorCodeMaps = make(map[string]map[int32]string)
|
|
||||||
|
|
||||||
// RegisterErrorCodeMap is called from API implementations to register their
|
|
||||||
// error code map. This should only be called from init functions.
|
|
||||||
func RegisterErrorCodeMap(service string, m map[int32]string) {
|
|
||||||
errorCodeMaps[service] = m
|
|
||||||
}
|
|
||||||
|
|
||||||
type timeoutCodeKey struct {
|
|
||||||
service string
|
|
||||||
code int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// timeoutCodes is the set of service+code pairs that represent timeouts.
|
|
||||||
var timeoutCodes = make(map[timeoutCodeKey]bool)
|
|
||||||
|
|
||||||
func RegisterTimeoutErrorCode(service string, code int32) {
|
|
||||||
timeoutCodes[timeoutCodeKey{service, code}] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// APIError is the type returned by appengine.Context's Call method
|
|
||||||
// when an API call fails in an API-specific way. This may be, for instance,
|
|
||||||
// a taskqueue API call failing with TaskQueueServiceError::UNKNOWN_QUEUE.
|
|
||||||
type APIError struct {
|
|
||||||
Service string
|
|
||||||
Detail string
|
|
||||||
Code int32 // API-specific error code
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *APIError) Error() string {
|
|
||||||
if e.Code == 0 {
|
|
||||||
if e.Detail == "" {
|
|
||||||
return "APIError <empty>"
|
|
||||||
}
|
|
||||||
return e.Detail
|
|
||||||
}
|
|
||||||
s := fmt.Sprintf("API error %d", e.Code)
|
|
||||||
if m, ok := errorCodeMaps[e.Service]; ok {
|
|
||||||
s += " (" + e.Service + ": " + m[e.Code] + ")"
|
|
||||||
} else {
|
|
||||||
// Shouldn't happen, but provide a bit more detail if it does.
|
|
||||||
s = e.Service + " " + s
|
|
||||||
}
|
|
||||||
if e.Detail != "" {
|
|
||||||
s += ": " + e.Detail
|
|
||||||
}
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *APIError) IsTimeout() bool {
|
|
||||||
return timeoutCodes[timeoutCodeKey{e.Service, e.Code}]
|
|
||||||
}
|
|
||||||
|
|
||||||
// CallError is the type returned by appengine.Context's Call method when an
|
|
||||||
// API call fails in a generic way, such as RpcError::CAPABILITY_DISABLED.
|
|
||||||
type CallError struct {
|
|
||||||
Detail string
|
|
||||||
Code int32
|
|
||||||
// TODO: Remove this if we get a distinguishable error code.
|
|
||||||
Timeout bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *CallError) Error() string {
|
|
||||||
var msg string
|
|
||||||
switch remotepb.RpcError_ErrorCode(e.Code) {
|
|
||||||
case remotepb.RpcError_UNKNOWN:
|
|
||||||
return e.Detail
|
|
||||||
case remotepb.RpcError_OVER_QUOTA:
|
|
||||||
msg = "Over quota"
|
|
||||||
case remotepb.RpcError_CAPABILITY_DISABLED:
|
|
||||||
msg = "Capability disabled"
|
|
||||||
case remotepb.RpcError_CANCELLED:
|
|
||||||
msg = "Canceled"
|
|
||||||
default:
|
|
||||||
msg = fmt.Sprintf("Call error %d", e.Code)
|
|
||||||
}
|
|
||||||
s := msg + ": " + e.Detail
|
|
||||||
if e.Timeout {
|
|
||||||
s += " (timeout)"
|
|
||||||
}
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *CallError) IsTimeout() bool {
|
|
||||||
return e.Timeout
|
|
||||||
}
|
|
||||||
|
|
||||||
// NamespaceMods is a map from API service to a function that will mutate an RPC request to attach a namespace.
|
|
||||||
// The function should be prepared to be called on the same message more than once; it should only modify the
|
|
||||||
// RPC request the first time.
|
|
||||||
var NamespaceMods = make(map[string]func(m proto.Message, namespace string))
|
|
899
vendor/google.golang.org/appengine/internal/log/log_service.pb.go
generated
vendored
899
vendor/google.golang.org/appengine/internal/log/log_service.pb.go
generated
vendored
@ -1,899 +0,0 @@
|
|||||||
// Code generated by protoc-gen-go.
|
|
||||||
// source: google.golang.org/appengine/internal/log/log_service.proto
|
|
||||||
// DO NOT EDIT!
|
|
||||||
|
|
||||||
/*
|
|
||||||
Package log is a generated protocol buffer package.
|
|
||||||
|
|
||||||
It is generated from these files:
|
|
||||||
google.golang.org/appengine/internal/log/log_service.proto
|
|
||||||
|
|
||||||
It has these top-level messages:
|
|
||||||
LogServiceError
|
|
||||||
UserAppLogLine
|
|
||||||
UserAppLogGroup
|
|
||||||
FlushRequest
|
|
||||||
SetStatusRequest
|
|
||||||
LogOffset
|
|
||||||
LogLine
|
|
||||||
RequestLog
|
|
||||||
LogModuleVersion
|
|
||||||
LogReadRequest
|
|
||||||
LogReadResponse
|
|
||||||
LogUsageRecord
|
|
||||||
LogUsageRequest
|
|
||||||
LogUsageResponse
|
|
||||||
*/
|
|
||||||
package log
|
|
||||||
|
|
||||||
import proto "github.com/golang/protobuf/proto"
|
|
||||||
import fmt "fmt"
|
|
||||||
import math "math"
|
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ = proto.Marshal
|
|
||||||
var _ = fmt.Errorf
|
|
||||||
var _ = math.Inf
|
|
||||||
|
|
||||||
type LogServiceError_ErrorCode int32
|
|
||||||
|
|
||||||
const (
|
|
||||||
LogServiceError_OK LogServiceError_ErrorCode = 0
|
|
||||||
LogServiceError_INVALID_REQUEST LogServiceError_ErrorCode = 1
|
|
||||||
LogServiceError_STORAGE_ERROR LogServiceError_ErrorCode = 2
|
|
||||||
)
|
|
||||||
|
|
||||||
var LogServiceError_ErrorCode_name = map[int32]string{
|
|
||||||
0: "OK",
|
|
||||||
1: "INVALID_REQUEST",
|
|
||||||
2: "STORAGE_ERROR",
|
|
||||||
}
|
|
||||||
var LogServiceError_ErrorCode_value = map[string]int32{
|
|
||||||
"OK": 0,
|
|
||||||
"INVALID_REQUEST": 1,
|
|
||||||
"STORAGE_ERROR": 2,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x LogServiceError_ErrorCode) Enum() *LogServiceError_ErrorCode {
|
|
||||||
p := new(LogServiceError_ErrorCode)
|
|
||||||
*p = x
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
func (x LogServiceError_ErrorCode) String() string {
|
|
||||||
return proto.EnumName(LogServiceError_ErrorCode_name, int32(x))
|
|
||||||
}
|
|
||||||
func (x *LogServiceError_ErrorCode) UnmarshalJSON(data []byte) error {
|
|
||||||
value, err := proto.UnmarshalJSONEnum(LogServiceError_ErrorCode_value, data, "LogServiceError_ErrorCode")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
*x = LogServiceError_ErrorCode(value)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogServiceError struct {
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogServiceError) Reset() { *m = LogServiceError{} }
|
|
||||||
func (m *LogServiceError) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*LogServiceError) ProtoMessage() {}
|
|
||||||
|
|
||||||
type UserAppLogLine struct {
|
|
||||||
TimestampUsec *int64 `protobuf:"varint,1,req,name=timestamp_usec" json:"timestamp_usec,omitempty"`
|
|
||||||
Level *int64 `protobuf:"varint,2,req,name=level" json:"level,omitempty"`
|
|
||||||
Message *string `protobuf:"bytes,3,req,name=message" json:"message,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *UserAppLogLine) Reset() { *m = UserAppLogLine{} }
|
|
||||||
func (m *UserAppLogLine) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*UserAppLogLine) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *UserAppLogLine) GetTimestampUsec() int64 {
|
|
||||||
if m != nil && m.TimestampUsec != nil {
|
|
||||||
return *m.TimestampUsec
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *UserAppLogLine) GetLevel() int64 {
|
|
||||||
if m != nil && m.Level != nil {
|
|
||||||
return *m.Level
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *UserAppLogLine) GetMessage() string {
|
|
||||||
if m != nil && m.Message != nil {
|
|
||||||
return *m.Message
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserAppLogGroup struct {
|
|
||||||
LogLine []*UserAppLogLine `protobuf:"bytes,2,rep,name=log_line" json:"log_line,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *UserAppLogGroup) Reset() { *m = UserAppLogGroup{} }
|
|
||||||
func (m *UserAppLogGroup) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*UserAppLogGroup) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *UserAppLogGroup) GetLogLine() []*UserAppLogLine {
|
|
||||||
if m != nil {
|
|
||||||
return m.LogLine
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type FlushRequest struct {
|
|
||||||
Logs []byte `protobuf:"bytes,1,opt,name=logs" json:"logs,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *FlushRequest) Reset() { *m = FlushRequest{} }
|
|
||||||
func (m *FlushRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*FlushRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *FlushRequest) GetLogs() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.Logs
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type SetStatusRequest struct {
|
|
||||||
Status *string `protobuf:"bytes,1,req,name=status" json:"status,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SetStatusRequest) Reset() { *m = SetStatusRequest{} }
|
|
||||||
func (m *SetStatusRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*SetStatusRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *SetStatusRequest) GetStatus() string {
|
|
||||||
if m != nil && m.Status != nil {
|
|
||||||
return *m.Status
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogOffset struct {
|
|
||||||
RequestId []byte `protobuf:"bytes,1,opt,name=request_id" json:"request_id,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogOffset) Reset() { *m = LogOffset{} }
|
|
||||||
func (m *LogOffset) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*LogOffset) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *LogOffset) GetRequestId() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.RequestId
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogLine struct {
|
|
||||||
Time *int64 `protobuf:"varint,1,req,name=time" json:"time,omitempty"`
|
|
||||||
Level *int32 `protobuf:"varint,2,req,name=level" json:"level,omitempty"`
|
|
||||||
LogMessage *string `protobuf:"bytes,3,req,name=log_message" json:"log_message,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogLine) Reset() { *m = LogLine{} }
|
|
||||||
func (m *LogLine) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*LogLine) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *LogLine) GetTime() int64 {
|
|
||||||
if m != nil && m.Time != nil {
|
|
||||||
return *m.Time
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogLine) GetLevel() int32 {
|
|
||||||
if m != nil && m.Level != nil {
|
|
||||||
return *m.Level
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogLine) GetLogMessage() string {
|
|
||||||
if m != nil && m.LogMessage != nil {
|
|
||||||
return *m.LogMessage
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type RequestLog struct {
|
|
||||||
AppId *string `protobuf:"bytes,1,req,name=app_id" json:"app_id,omitempty"`
|
|
||||||
ModuleId *string `protobuf:"bytes,37,opt,name=module_id,def=default" json:"module_id,omitempty"`
|
|
||||||
VersionId *string `protobuf:"bytes,2,req,name=version_id" json:"version_id,omitempty"`
|
|
||||||
RequestId []byte `protobuf:"bytes,3,req,name=request_id" json:"request_id,omitempty"`
|
|
||||||
Offset *LogOffset `protobuf:"bytes,35,opt,name=offset" json:"offset,omitempty"`
|
|
||||||
Ip *string `protobuf:"bytes,4,req,name=ip" json:"ip,omitempty"`
|
|
||||||
Nickname *string `protobuf:"bytes,5,opt,name=nickname" json:"nickname,omitempty"`
|
|
||||||
StartTime *int64 `protobuf:"varint,6,req,name=start_time" json:"start_time,omitempty"`
|
|
||||||
EndTime *int64 `protobuf:"varint,7,req,name=end_time" json:"end_time,omitempty"`
|
|
||||||
Latency *int64 `protobuf:"varint,8,req,name=latency" json:"latency,omitempty"`
|
|
||||||
Mcycles *int64 `protobuf:"varint,9,req,name=mcycles" json:"mcycles,omitempty"`
|
|
||||||
Method *string `protobuf:"bytes,10,req,name=method" json:"method,omitempty"`
|
|
||||||
Resource *string `protobuf:"bytes,11,req,name=resource" json:"resource,omitempty"`
|
|
||||||
HttpVersion *string `protobuf:"bytes,12,req,name=http_version" json:"http_version,omitempty"`
|
|
||||||
Status *int32 `protobuf:"varint,13,req,name=status" json:"status,omitempty"`
|
|
||||||
ResponseSize *int64 `protobuf:"varint,14,req,name=response_size" json:"response_size,omitempty"`
|
|
||||||
Referrer *string `protobuf:"bytes,15,opt,name=referrer" json:"referrer,omitempty"`
|
|
||||||
UserAgent *string `protobuf:"bytes,16,opt,name=user_agent" json:"user_agent,omitempty"`
|
|
||||||
UrlMapEntry *string `protobuf:"bytes,17,req,name=url_map_entry" json:"url_map_entry,omitempty"`
|
|
||||||
Combined *string `protobuf:"bytes,18,req,name=combined" json:"combined,omitempty"`
|
|
||||||
ApiMcycles *int64 `protobuf:"varint,19,opt,name=api_mcycles" json:"api_mcycles,omitempty"`
|
|
||||||
Host *string `protobuf:"bytes,20,opt,name=host" json:"host,omitempty"`
|
|
||||||
Cost *float64 `protobuf:"fixed64,21,opt,name=cost" json:"cost,omitempty"`
|
|
||||||
TaskQueueName *string `protobuf:"bytes,22,opt,name=task_queue_name" json:"task_queue_name,omitempty"`
|
|
||||||
TaskName *string `protobuf:"bytes,23,opt,name=task_name" json:"task_name,omitempty"`
|
|
||||||
WasLoadingRequest *bool `protobuf:"varint,24,opt,name=was_loading_request" json:"was_loading_request,omitempty"`
|
|
||||||
PendingTime *int64 `protobuf:"varint,25,opt,name=pending_time" json:"pending_time,omitempty"`
|
|
||||||
ReplicaIndex *int32 `protobuf:"varint,26,opt,name=replica_index,def=-1" json:"replica_index,omitempty"`
|
|
||||||
Finished *bool `protobuf:"varint,27,opt,name=finished,def=1" json:"finished,omitempty"`
|
|
||||||
CloneKey []byte `protobuf:"bytes,28,opt,name=clone_key" json:"clone_key,omitempty"`
|
|
||||||
Line []*LogLine `protobuf:"bytes,29,rep,name=line" json:"line,omitempty"`
|
|
||||||
LinesIncomplete *bool `protobuf:"varint,36,opt,name=lines_incomplete" json:"lines_incomplete,omitempty"`
|
|
||||||
AppEngineRelease []byte `protobuf:"bytes,38,opt,name=app_engine_release" json:"app_engine_release,omitempty"`
|
|
||||||
ExitReason *int32 `protobuf:"varint,30,opt,name=exit_reason" json:"exit_reason,omitempty"`
|
|
||||||
WasThrottledForTime *bool `protobuf:"varint,31,opt,name=was_throttled_for_time" json:"was_throttled_for_time,omitempty"`
|
|
||||||
WasThrottledForRequests *bool `protobuf:"varint,32,opt,name=was_throttled_for_requests" json:"was_throttled_for_requests,omitempty"`
|
|
||||||
ThrottledTime *int64 `protobuf:"varint,33,opt,name=throttled_time" json:"throttled_time,omitempty"`
|
|
||||||
ServerName []byte `protobuf:"bytes,34,opt,name=server_name" json:"server_name,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) Reset() { *m = RequestLog{} }
|
|
||||||
func (m *RequestLog) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*RequestLog) ProtoMessage() {}
|
|
||||||
|
|
||||||
const Default_RequestLog_ModuleId string = "default"
|
|
||||||
const Default_RequestLog_ReplicaIndex int32 = -1
|
|
||||||
const Default_RequestLog_Finished bool = true
|
|
||||||
|
|
||||||
func (m *RequestLog) GetAppId() string {
|
|
||||||
if m != nil && m.AppId != nil {
|
|
||||||
return *m.AppId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetModuleId() string {
|
|
||||||
if m != nil && m.ModuleId != nil {
|
|
||||||
return *m.ModuleId
|
|
||||||
}
|
|
||||||
return Default_RequestLog_ModuleId
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetVersionId() string {
|
|
||||||
if m != nil && m.VersionId != nil {
|
|
||||||
return *m.VersionId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetRequestId() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.RequestId
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetOffset() *LogOffset {
|
|
||||||
if m != nil {
|
|
||||||
return m.Offset
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetIp() string {
|
|
||||||
if m != nil && m.Ip != nil {
|
|
||||||
return *m.Ip
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetNickname() string {
|
|
||||||
if m != nil && m.Nickname != nil {
|
|
||||||
return *m.Nickname
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetStartTime() int64 {
|
|
||||||
if m != nil && m.StartTime != nil {
|
|
||||||
return *m.StartTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetEndTime() int64 {
|
|
||||||
if m != nil && m.EndTime != nil {
|
|
||||||
return *m.EndTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetLatency() int64 {
|
|
||||||
if m != nil && m.Latency != nil {
|
|
||||||
return *m.Latency
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetMcycles() int64 {
|
|
||||||
if m != nil && m.Mcycles != nil {
|
|
||||||
return *m.Mcycles
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetMethod() string {
|
|
||||||
if m != nil && m.Method != nil {
|
|
||||||
return *m.Method
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetResource() string {
|
|
||||||
if m != nil && m.Resource != nil {
|
|
||||||
return *m.Resource
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetHttpVersion() string {
|
|
||||||
if m != nil && m.HttpVersion != nil {
|
|
||||||
return *m.HttpVersion
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetStatus() int32 {
|
|
||||||
if m != nil && m.Status != nil {
|
|
||||||
return *m.Status
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetResponseSize() int64 {
|
|
||||||
if m != nil && m.ResponseSize != nil {
|
|
||||||
return *m.ResponseSize
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetReferrer() string {
|
|
||||||
if m != nil && m.Referrer != nil {
|
|
||||||
return *m.Referrer
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetUserAgent() string {
|
|
||||||
if m != nil && m.UserAgent != nil {
|
|
||||||
return *m.UserAgent
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetUrlMapEntry() string {
|
|
||||||
if m != nil && m.UrlMapEntry != nil {
|
|
||||||
return *m.UrlMapEntry
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetCombined() string {
|
|
||||||
if m != nil && m.Combined != nil {
|
|
||||||
return *m.Combined
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetApiMcycles() int64 {
|
|
||||||
if m != nil && m.ApiMcycles != nil {
|
|
||||||
return *m.ApiMcycles
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetHost() string {
|
|
||||||
if m != nil && m.Host != nil {
|
|
||||||
return *m.Host
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetCost() float64 {
|
|
||||||
if m != nil && m.Cost != nil {
|
|
||||||
return *m.Cost
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetTaskQueueName() string {
|
|
||||||
if m != nil && m.TaskQueueName != nil {
|
|
||||||
return *m.TaskQueueName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetTaskName() string {
|
|
||||||
if m != nil && m.TaskName != nil {
|
|
||||||
return *m.TaskName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetWasLoadingRequest() bool {
|
|
||||||
if m != nil && m.WasLoadingRequest != nil {
|
|
||||||
return *m.WasLoadingRequest
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetPendingTime() int64 {
|
|
||||||
if m != nil && m.PendingTime != nil {
|
|
||||||
return *m.PendingTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetReplicaIndex() int32 {
|
|
||||||
if m != nil && m.ReplicaIndex != nil {
|
|
||||||
return *m.ReplicaIndex
|
|
||||||
}
|
|
||||||
return Default_RequestLog_ReplicaIndex
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetFinished() bool {
|
|
||||||
if m != nil && m.Finished != nil {
|
|
||||||
return *m.Finished
|
|
||||||
}
|
|
||||||
return Default_RequestLog_Finished
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetCloneKey() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.CloneKey
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetLine() []*LogLine {
|
|
||||||
if m != nil {
|
|
||||||
return m.Line
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetLinesIncomplete() bool {
|
|
||||||
if m != nil && m.LinesIncomplete != nil {
|
|
||||||
return *m.LinesIncomplete
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetAppEngineRelease() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.AppEngineRelease
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetExitReason() int32 {
|
|
||||||
if m != nil && m.ExitReason != nil {
|
|
||||||
return *m.ExitReason
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetWasThrottledForTime() bool {
|
|
||||||
if m != nil && m.WasThrottledForTime != nil {
|
|
||||||
return *m.WasThrottledForTime
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetWasThrottledForRequests() bool {
|
|
||||||
if m != nil && m.WasThrottledForRequests != nil {
|
|
||||||
return *m.WasThrottledForRequests
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetThrottledTime() int64 {
|
|
||||||
if m != nil && m.ThrottledTime != nil {
|
|
||||||
return *m.ThrottledTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RequestLog) GetServerName() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.ServerName
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogModuleVersion struct {
|
|
||||||
ModuleId *string `protobuf:"bytes,1,opt,name=module_id,def=default" json:"module_id,omitempty"`
|
|
||||||
VersionId *string `protobuf:"bytes,2,opt,name=version_id" json:"version_id,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogModuleVersion) Reset() { *m = LogModuleVersion{} }
|
|
||||||
func (m *LogModuleVersion) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*LogModuleVersion) ProtoMessage() {}
|
|
||||||
|
|
||||||
const Default_LogModuleVersion_ModuleId string = "default"
|
|
||||||
|
|
||||||
func (m *LogModuleVersion) GetModuleId() string {
|
|
||||||
if m != nil && m.ModuleId != nil {
|
|
||||||
return *m.ModuleId
|
|
||||||
}
|
|
||||||
return Default_LogModuleVersion_ModuleId
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogModuleVersion) GetVersionId() string {
|
|
||||||
if m != nil && m.VersionId != nil {
|
|
||||||
return *m.VersionId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogReadRequest struct {
|
|
||||||
AppId *string `protobuf:"bytes,1,req,name=app_id" json:"app_id,omitempty"`
|
|
||||||
VersionId []string `protobuf:"bytes,2,rep,name=version_id" json:"version_id,omitempty"`
|
|
||||||
ModuleVersion []*LogModuleVersion `protobuf:"bytes,19,rep,name=module_version" json:"module_version,omitempty"`
|
|
||||||
StartTime *int64 `protobuf:"varint,3,opt,name=start_time" json:"start_time,omitempty"`
|
|
||||||
EndTime *int64 `protobuf:"varint,4,opt,name=end_time" json:"end_time,omitempty"`
|
|
||||||
Offset *LogOffset `protobuf:"bytes,5,opt,name=offset" json:"offset,omitempty"`
|
|
||||||
RequestId [][]byte `protobuf:"bytes,6,rep,name=request_id" json:"request_id,omitempty"`
|
|
||||||
MinimumLogLevel *int32 `protobuf:"varint,7,opt,name=minimum_log_level" json:"minimum_log_level,omitempty"`
|
|
||||||
IncludeIncomplete *bool `protobuf:"varint,8,opt,name=include_incomplete" json:"include_incomplete,omitempty"`
|
|
||||||
Count *int64 `protobuf:"varint,9,opt,name=count" json:"count,omitempty"`
|
|
||||||
CombinedLogRegex *string `protobuf:"bytes,14,opt,name=combined_log_regex" json:"combined_log_regex,omitempty"`
|
|
||||||
HostRegex *string `protobuf:"bytes,15,opt,name=host_regex" json:"host_regex,omitempty"`
|
|
||||||
ReplicaIndex *int32 `protobuf:"varint,16,opt,name=replica_index" json:"replica_index,omitempty"`
|
|
||||||
IncludeAppLogs *bool `protobuf:"varint,10,opt,name=include_app_logs" json:"include_app_logs,omitempty"`
|
|
||||||
AppLogsPerRequest *int32 `protobuf:"varint,17,opt,name=app_logs_per_request" json:"app_logs_per_request,omitempty"`
|
|
||||||
IncludeHost *bool `protobuf:"varint,11,opt,name=include_host" json:"include_host,omitempty"`
|
|
||||||
IncludeAll *bool `protobuf:"varint,12,opt,name=include_all" json:"include_all,omitempty"`
|
|
||||||
CacheIterator *bool `protobuf:"varint,13,opt,name=cache_iterator" json:"cache_iterator,omitempty"`
|
|
||||||
NumShards *int32 `protobuf:"varint,18,opt,name=num_shards" json:"num_shards,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) Reset() { *m = LogReadRequest{} }
|
|
||||||
func (m *LogReadRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*LogReadRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetAppId() string {
|
|
||||||
if m != nil && m.AppId != nil {
|
|
||||||
return *m.AppId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetVersionId() []string {
|
|
||||||
if m != nil {
|
|
||||||
return m.VersionId
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetModuleVersion() []*LogModuleVersion {
|
|
||||||
if m != nil {
|
|
||||||
return m.ModuleVersion
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetStartTime() int64 {
|
|
||||||
if m != nil && m.StartTime != nil {
|
|
||||||
return *m.StartTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetEndTime() int64 {
|
|
||||||
if m != nil && m.EndTime != nil {
|
|
||||||
return *m.EndTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetOffset() *LogOffset {
|
|
||||||
if m != nil {
|
|
||||||
return m.Offset
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetRequestId() [][]byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.RequestId
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetMinimumLogLevel() int32 {
|
|
||||||
if m != nil && m.MinimumLogLevel != nil {
|
|
||||||
return *m.MinimumLogLevel
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetIncludeIncomplete() bool {
|
|
||||||
if m != nil && m.IncludeIncomplete != nil {
|
|
||||||
return *m.IncludeIncomplete
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetCount() int64 {
|
|
||||||
if m != nil && m.Count != nil {
|
|
||||||
return *m.Count
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetCombinedLogRegex() string {
|
|
||||||
if m != nil && m.CombinedLogRegex != nil {
|
|
||||||
return *m.CombinedLogRegex
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetHostRegex() string {
|
|
||||||
if m != nil && m.HostRegex != nil {
|
|
||||||
return *m.HostRegex
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetReplicaIndex() int32 {
|
|
||||||
if m != nil && m.ReplicaIndex != nil {
|
|
||||||
return *m.ReplicaIndex
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetIncludeAppLogs() bool {
|
|
||||||
if m != nil && m.IncludeAppLogs != nil {
|
|
||||||
return *m.IncludeAppLogs
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetAppLogsPerRequest() int32 {
|
|
||||||
if m != nil && m.AppLogsPerRequest != nil {
|
|
||||||
return *m.AppLogsPerRequest
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetIncludeHost() bool {
|
|
||||||
if m != nil && m.IncludeHost != nil {
|
|
||||||
return *m.IncludeHost
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetIncludeAll() bool {
|
|
||||||
if m != nil && m.IncludeAll != nil {
|
|
||||||
return *m.IncludeAll
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetCacheIterator() bool {
|
|
||||||
if m != nil && m.CacheIterator != nil {
|
|
||||||
return *m.CacheIterator
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadRequest) GetNumShards() int32 {
|
|
||||||
if m != nil && m.NumShards != nil {
|
|
||||||
return *m.NumShards
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogReadResponse struct {
|
|
||||||
Log []*RequestLog `protobuf:"bytes,1,rep,name=log" json:"log,omitempty"`
|
|
||||||
Offset *LogOffset `protobuf:"bytes,2,opt,name=offset" json:"offset,omitempty"`
|
|
||||||
LastEndTime *int64 `protobuf:"varint,3,opt,name=last_end_time" json:"last_end_time,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadResponse) Reset() { *m = LogReadResponse{} }
|
|
||||||
func (m *LogReadResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*LogReadResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *LogReadResponse) GetLog() []*RequestLog {
|
|
||||||
if m != nil {
|
|
||||||
return m.Log
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadResponse) GetOffset() *LogOffset {
|
|
||||||
if m != nil {
|
|
||||||
return m.Offset
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogReadResponse) GetLastEndTime() int64 {
|
|
||||||
if m != nil && m.LastEndTime != nil {
|
|
||||||
return *m.LastEndTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogUsageRecord struct {
|
|
||||||
VersionId *string `protobuf:"bytes,1,opt,name=version_id" json:"version_id,omitempty"`
|
|
||||||
StartTime *int32 `protobuf:"varint,2,opt,name=start_time" json:"start_time,omitempty"`
|
|
||||||
EndTime *int32 `protobuf:"varint,3,opt,name=end_time" json:"end_time,omitempty"`
|
|
||||||
Count *int64 `protobuf:"varint,4,opt,name=count" json:"count,omitempty"`
|
|
||||||
TotalSize *int64 `protobuf:"varint,5,opt,name=total_size" json:"total_size,omitempty"`
|
|
||||||
Records *int32 `protobuf:"varint,6,opt,name=records" json:"records,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRecord) Reset() { *m = LogUsageRecord{} }
|
|
||||||
func (m *LogUsageRecord) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*LogUsageRecord) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *LogUsageRecord) GetVersionId() string {
|
|
||||||
if m != nil && m.VersionId != nil {
|
|
||||||
return *m.VersionId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRecord) GetStartTime() int32 {
|
|
||||||
if m != nil && m.StartTime != nil {
|
|
||||||
return *m.StartTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRecord) GetEndTime() int32 {
|
|
||||||
if m != nil && m.EndTime != nil {
|
|
||||||
return *m.EndTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRecord) GetCount() int64 {
|
|
||||||
if m != nil && m.Count != nil {
|
|
||||||
return *m.Count
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRecord) GetTotalSize() int64 {
|
|
||||||
if m != nil && m.TotalSize != nil {
|
|
||||||
return *m.TotalSize
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRecord) GetRecords() int32 {
|
|
||||||
if m != nil && m.Records != nil {
|
|
||||||
return *m.Records
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogUsageRequest struct {
|
|
||||||
AppId *string `protobuf:"bytes,1,req,name=app_id" json:"app_id,omitempty"`
|
|
||||||
VersionId []string `protobuf:"bytes,2,rep,name=version_id" json:"version_id,omitempty"`
|
|
||||||
StartTime *int32 `protobuf:"varint,3,opt,name=start_time" json:"start_time,omitempty"`
|
|
||||||
EndTime *int32 `protobuf:"varint,4,opt,name=end_time" json:"end_time,omitempty"`
|
|
||||||
ResolutionHours *uint32 `protobuf:"varint,5,opt,name=resolution_hours,def=1" json:"resolution_hours,omitempty"`
|
|
||||||
CombineVersions *bool `protobuf:"varint,6,opt,name=combine_versions" json:"combine_versions,omitempty"`
|
|
||||||
UsageVersion *int32 `protobuf:"varint,7,opt,name=usage_version" json:"usage_version,omitempty"`
|
|
||||||
VersionsOnly *bool `protobuf:"varint,8,opt,name=versions_only" json:"versions_only,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRequest) Reset() { *m = LogUsageRequest{} }
|
|
||||||
func (m *LogUsageRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*LogUsageRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
const Default_LogUsageRequest_ResolutionHours uint32 = 1
|
|
||||||
|
|
||||||
func (m *LogUsageRequest) GetAppId() string {
|
|
||||||
if m != nil && m.AppId != nil {
|
|
||||||
return *m.AppId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRequest) GetVersionId() []string {
|
|
||||||
if m != nil {
|
|
||||||
return m.VersionId
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRequest) GetStartTime() int32 {
|
|
||||||
if m != nil && m.StartTime != nil {
|
|
||||||
return *m.StartTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRequest) GetEndTime() int32 {
|
|
||||||
if m != nil && m.EndTime != nil {
|
|
||||||
return *m.EndTime
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRequest) GetResolutionHours() uint32 {
|
|
||||||
if m != nil && m.ResolutionHours != nil {
|
|
||||||
return *m.ResolutionHours
|
|
||||||
}
|
|
||||||
return Default_LogUsageRequest_ResolutionHours
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRequest) GetCombineVersions() bool {
|
|
||||||
if m != nil && m.CombineVersions != nil {
|
|
||||||
return *m.CombineVersions
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRequest) GetUsageVersion() int32 {
|
|
||||||
if m != nil && m.UsageVersion != nil {
|
|
||||||
return *m.UsageVersion
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageRequest) GetVersionsOnly() bool {
|
|
||||||
if m != nil && m.VersionsOnly != nil {
|
|
||||||
return *m.VersionsOnly
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogUsageResponse struct {
|
|
||||||
Usage []*LogUsageRecord `protobuf:"bytes,1,rep,name=usage" json:"usage,omitempty"`
|
|
||||||
Summary *LogUsageRecord `protobuf:"bytes,2,opt,name=summary" json:"summary,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageResponse) Reset() { *m = LogUsageResponse{} }
|
|
||||||
func (m *LogUsageResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*LogUsageResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *LogUsageResponse) GetUsage() []*LogUsageRecord {
|
|
||||||
if m != nil {
|
|
||||||
return m.Usage
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LogUsageResponse) GetSummary() *LogUsageRecord {
|
|
||||||
if m != nil {
|
|
||||||
return m.Summary
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
}
|
|
150
vendor/google.golang.org/appengine/internal/log/log_service.proto
generated
vendored
150
vendor/google.golang.org/appengine/internal/log/log_service.proto
generated
vendored
@ -1,150 +0,0 @@
|
|||||||
syntax = "proto2";
|
|
||||||
option go_package = "log";
|
|
||||||
|
|
||||||
package appengine;
|
|
||||||
|
|
||||||
message LogServiceError {
|
|
||||||
enum ErrorCode {
|
|
||||||
OK = 0;
|
|
||||||
INVALID_REQUEST = 1;
|
|
||||||
STORAGE_ERROR = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message UserAppLogLine {
|
|
||||||
required int64 timestamp_usec = 1;
|
|
||||||
required int64 level = 2;
|
|
||||||
required string message = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message UserAppLogGroup {
|
|
||||||
repeated UserAppLogLine log_line = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message FlushRequest {
|
|
||||||
optional bytes logs = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SetStatusRequest {
|
|
||||||
required string status = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
message LogOffset {
|
|
||||||
optional bytes request_id = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LogLine {
|
|
||||||
required int64 time = 1;
|
|
||||||
required int32 level = 2;
|
|
||||||
required string log_message = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RequestLog {
|
|
||||||
required string app_id = 1;
|
|
||||||
optional string module_id = 37 [default="default"];
|
|
||||||
required string version_id = 2;
|
|
||||||
required bytes request_id = 3;
|
|
||||||
optional LogOffset offset = 35;
|
|
||||||
required string ip = 4;
|
|
||||||
optional string nickname = 5;
|
|
||||||
required int64 start_time = 6;
|
|
||||||
required int64 end_time = 7;
|
|
||||||
required int64 latency = 8;
|
|
||||||
required int64 mcycles = 9;
|
|
||||||
required string method = 10;
|
|
||||||
required string resource = 11;
|
|
||||||
required string http_version = 12;
|
|
||||||
required int32 status = 13;
|
|
||||||
required int64 response_size = 14;
|
|
||||||
optional string referrer = 15;
|
|
||||||
optional string user_agent = 16;
|
|
||||||
required string url_map_entry = 17;
|
|
||||||
required string combined = 18;
|
|
||||||
optional int64 api_mcycles = 19;
|
|
||||||
optional string host = 20;
|
|
||||||
optional double cost = 21;
|
|
||||||
|
|
||||||
optional string task_queue_name = 22;
|
|
||||||
optional string task_name = 23;
|
|
||||||
|
|
||||||
optional bool was_loading_request = 24;
|
|
||||||
optional int64 pending_time = 25;
|
|
||||||
optional int32 replica_index = 26 [default = -1];
|
|
||||||
optional bool finished = 27 [default = true];
|
|
||||||
optional bytes clone_key = 28;
|
|
||||||
|
|
||||||
repeated LogLine line = 29;
|
|
||||||
|
|
||||||
optional bool lines_incomplete = 36;
|
|
||||||
optional bytes app_engine_release = 38;
|
|
||||||
|
|
||||||
optional int32 exit_reason = 30;
|
|
||||||
optional bool was_throttled_for_time = 31;
|
|
||||||
optional bool was_throttled_for_requests = 32;
|
|
||||||
optional int64 throttled_time = 33;
|
|
||||||
|
|
||||||
optional bytes server_name = 34;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LogModuleVersion {
|
|
||||||
optional string module_id = 1 [default="default"];
|
|
||||||
optional string version_id = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LogReadRequest {
|
|
||||||
required string app_id = 1;
|
|
||||||
repeated string version_id = 2;
|
|
||||||
repeated LogModuleVersion module_version = 19;
|
|
||||||
|
|
||||||
optional int64 start_time = 3;
|
|
||||||
optional int64 end_time = 4;
|
|
||||||
optional LogOffset offset = 5;
|
|
||||||
repeated bytes request_id = 6;
|
|
||||||
|
|
||||||
optional int32 minimum_log_level = 7;
|
|
||||||
optional bool include_incomplete = 8;
|
|
||||||
optional int64 count = 9;
|
|
||||||
|
|
||||||
optional string combined_log_regex = 14;
|
|
||||||
optional string host_regex = 15;
|
|
||||||
optional int32 replica_index = 16;
|
|
||||||
|
|
||||||
optional bool include_app_logs = 10;
|
|
||||||
optional int32 app_logs_per_request = 17;
|
|
||||||
optional bool include_host = 11;
|
|
||||||
optional bool include_all = 12;
|
|
||||||
optional bool cache_iterator = 13;
|
|
||||||
optional int32 num_shards = 18;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LogReadResponse {
|
|
||||||
repeated RequestLog log = 1;
|
|
||||||
optional LogOffset offset = 2;
|
|
||||||
optional int64 last_end_time = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LogUsageRecord {
|
|
||||||
optional string version_id = 1;
|
|
||||||
optional int32 start_time = 2;
|
|
||||||
optional int32 end_time = 3;
|
|
||||||
optional int64 count = 4;
|
|
||||||
optional int64 total_size = 5;
|
|
||||||
optional int32 records = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LogUsageRequest {
|
|
||||||
required string app_id = 1;
|
|
||||||
repeated string version_id = 2;
|
|
||||||
optional int32 start_time = 3;
|
|
||||||
optional int32 end_time = 4;
|
|
||||||
optional uint32 resolution_hours = 5 [default = 1];
|
|
||||||
optional bool combine_versions = 6;
|
|
||||||
optional int32 usage_version = 7;
|
|
||||||
optional bool versions_only = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LogUsageResponse {
|
|
||||||
repeated LogUsageRecord usage = 1;
|
|
||||||
optional LogUsageRecord summary = 2;
|
|
||||||
}
|
|
15
vendor/google.golang.org/appengine/internal/main.go
generated
vendored
15
vendor/google.golang.org/appengine/internal/main.go
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
// Copyright 2011 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build appengine
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"appengine_internal"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Main() {
|
|
||||||
appengine_internal.Main()
|
|
||||||
}
|
|
44
vendor/google.golang.org/appengine/internal/main_vm.go
generated
vendored
44
vendor/google.golang.org/appengine/internal/main_vm.go
generated
vendored
@ -1,44 +0,0 @@
|
|||||||
// Copyright 2011 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !appengine
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Main() {
|
|
||||||
installHealthChecker(http.DefaultServeMux)
|
|
||||||
|
|
||||||
port := "8080"
|
|
||||||
if s := os.Getenv("PORT"); s != "" {
|
|
||||||
port = s
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := http.ListenAndServe(":"+port, http.HandlerFunc(handleHTTP)); err != nil {
|
|
||||||
log.Fatalf("http.ListenAndServe: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func installHealthChecker(mux *http.ServeMux) {
|
|
||||||
// If no health check handler has been installed by this point, add a trivial one.
|
|
||||||
const healthPath = "/_ah/health"
|
|
||||||
hreq := &http.Request{
|
|
||||||
Method: "GET",
|
|
||||||
URL: &url.URL{
|
|
||||||
Path: healthPath,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
if _, pat := mux.Handler(hreq); pat != healthPath {
|
|
||||||
mux.HandleFunc(healthPath, func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
io.WriteString(w, "ok")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
61
vendor/google.golang.org/appengine/internal/metadata.go
generated
vendored
61
vendor/google.golang.org/appengine/internal/metadata.go
generated
vendored
@ -1,61 +0,0 @@
|
|||||||
// Copyright 2014 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
// This file has code for accessing metadata.
|
|
||||||
//
|
|
||||||
// References:
|
|
||||||
// https://cloud.google.com/compute/docs/metadata
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
metadataHost = "metadata"
|
|
||||||
metadataPath = "/computeMetadata/v1/"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
metadataRequestHeaders = http.Header{
|
|
||||||
"Metadata-Flavor": []string{"Google"},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// TODO(dsymonds): Do we need to support default values, like Python?
|
|
||||||
func mustGetMetadata(key string) []byte {
|
|
||||||
b, err := getMetadata(key)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Metadata fetch failed: %v", err)
|
|
||||||
}
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func getMetadata(key string) ([]byte, error) {
|
|
||||||
// TODO(dsymonds): May need to use url.Parse to support keys with query args.
|
|
||||||
req := &http.Request{
|
|
||||||
Method: "GET",
|
|
||||||
URL: &url.URL{
|
|
||||||
Scheme: "http",
|
|
||||||
Host: metadataHost,
|
|
||||||
Path: metadataPath + key,
|
|
||||||
},
|
|
||||||
Header: metadataRequestHeaders,
|
|
||||||
Host: metadataHost,
|
|
||||||
}
|
|
||||||
resp, err := http.DefaultClient.Do(req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
if resp.StatusCode != 200 {
|
|
||||||
return nil, fmt.Errorf("metadata server returned HTTP %d", resp.StatusCode)
|
|
||||||
}
|
|
||||||
return ioutil.ReadAll(resp.Body)
|
|
||||||
}
|
|
375
vendor/google.golang.org/appengine/internal/modules/modules_service.pb.go
generated
vendored
375
vendor/google.golang.org/appengine/internal/modules/modules_service.pb.go
generated
vendored
@ -1,375 +0,0 @@
|
|||||||
// Code generated by protoc-gen-go.
|
|
||||||
// source: google.golang.org/appengine/internal/modules/modules_service.proto
|
|
||||||
// DO NOT EDIT!
|
|
||||||
|
|
||||||
/*
|
|
||||||
Package modules is a generated protocol buffer package.
|
|
||||||
|
|
||||||
It is generated from these files:
|
|
||||||
google.golang.org/appengine/internal/modules/modules_service.proto
|
|
||||||
|
|
||||||
It has these top-level messages:
|
|
||||||
ModulesServiceError
|
|
||||||
GetModulesRequest
|
|
||||||
GetModulesResponse
|
|
||||||
GetVersionsRequest
|
|
||||||
GetVersionsResponse
|
|
||||||
GetDefaultVersionRequest
|
|
||||||
GetDefaultVersionResponse
|
|
||||||
GetNumInstancesRequest
|
|
||||||
GetNumInstancesResponse
|
|
||||||
SetNumInstancesRequest
|
|
||||||
SetNumInstancesResponse
|
|
||||||
StartModuleRequest
|
|
||||||
StartModuleResponse
|
|
||||||
StopModuleRequest
|
|
||||||
StopModuleResponse
|
|
||||||
GetHostnameRequest
|
|
||||||
GetHostnameResponse
|
|
||||||
*/
|
|
||||||
package modules
|
|
||||||
|
|
||||||
import proto "github.com/golang/protobuf/proto"
|
|
||||||
import fmt "fmt"
|
|
||||||
import math "math"
|
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ = proto.Marshal
|
|
||||||
var _ = fmt.Errorf
|
|
||||||
var _ = math.Inf
|
|
||||||
|
|
||||||
type ModulesServiceError_ErrorCode int32
|
|
||||||
|
|
||||||
const (
|
|
||||||
ModulesServiceError_OK ModulesServiceError_ErrorCode = 0
|
|
||||||
ModulesServiceError_INVALID_MODULE ModulesServiceError_ErrorCode = 1
|
|
||||||
ModulesServiceError_INVALID_VERSION ModulesServiceError_ErrorCode = 2
|
|
||||||
ModulesServiceError_INVALID_INSTANCES ModulesServiceError_ErrorCode = 3
|
|
||||||
ModulesServiceError_TRANSIENT_ERROR ModulesServiceError_ErrorCode = 4
|
|
||||||
ModulesServiceError_UNEXPECTED_STATE ModulesServiceError_ErrorCode = 5
|
|
||||||
)
|
|
||||||
|
|
||||||
var ModulesServiceError_ErrorCode_name = map[int32]string{
|
|
||||||
0: "OK",
|
|
||||||
1: "INVALID_MODULE",
|
|
||||||
2: "INVALID_VERSION",
|
|
||||||
3: "INVALID_INSTANCES",
|
|
||||||
4: "TRANSIENT_ERROR",
|
|
||||||
5: "UNEXPECTED_STATE",
|
|
||||||
}
|
|
||||||
var ModulesServiceError_ErrorCode_value = map[string]int32{
|
|
||||||
"OK": 0,
|
|
||||||
"INVALID_MODULE": 1,
|
|
||||||
"INVALID_VERSION": 2,
|
|
||||||
"INVALID_INSTANCES": 3,
|
|
||||||
"TRANSIENT_ERROR": 4,
|
|
||||||
"UNEXPECTED_STATE": 5,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x ModulesServiceError_ErrorCode) Enum() *ModulesServiceError_ErrorCode {
|
|
||||||
p := new(ModulesServiceError_ErrorCode)
|
|
||||||
*p = x
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
func (x ModulesServiceError_ErrorCode) String() string {
|
|
||||||
return proto.EnumName(ModulesServiceError_ErrorCode_name, int32(x))
|
|
||||||
}
|
|
||||||
func (x *ModulesServiceError_ErrorCode) UnmarshalJSON(data []byte) error {
|
|
||||||
value, err := proto.UnmarshalJSONEnum(ModulesServiceError_ErrorCode_value, data, "ModulesServiceError_ErrorCode")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
*x = ModulesServiceError_ErrorCode(value)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type ModulesServiceError struct {
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *ModulesServiceError) Reset() { *m = ModulesServiceError{} }
|
|
||||||
func (m *ModulesServiceError) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*ModulesServiceError) ProtoMessage() {}
|
|
||||||
|
|
||||||
type GetModulesRequest struct {
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetModulesRequest) Reset() { *m = GetModulesRequest{} }
|
|
||||||
func (m *GetModulesRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetModulesRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
type GetModulesResponse struct {
|
|
||||||
Module []string `protobuf:"bytes,1,rep,name=module" json:"module,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetModulesResponse) Reset() { *m = GetModulesResponse{} }
|
|
||||||
func (m *GetModulesResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetModulesResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetModulesResponse) GetModule() []string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Module
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetVersionsRequest struct {
|
|
||||||
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetVersionsRequest) Reset() { *m = GetVersionsRequest{} }
|
|
||||||
func (m *GetVersionsRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetVersionsRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetVersionsRequest) GetModule() string {
|
|
||||||
if m != nil && m.Module != nil {
|
|
||||||
return *m.Module
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetVersionsResponse struct {
|
|
||||||
Version []string `protobuf:"bytes,1,rep,name=version" json:"version,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetVersionsResponse) Reset() { *m = GetVersionsResponse{} }
|
|
||||||
func (m *GetVersionsResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetVersionsResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetVersionsResponse) GetVersion() []string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Version
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetDefaultVersionRequest struct {
|
|
||||||
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetDefaultVersionRequest) Reset() { *m = GetDefaultVersionRequest{} }
|
|
||||||
func (m *GetDefaultVersionRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetDefaultVersionRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetDefaultVersionRequest) GetModule() string {
|
|
||||||
if m != nil && m.Module != nil {
|
|
||||||
return *m.Module
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetDefaultVersionResponse struct {
|
|
||||||
Version *string `protobuf:"bytes,1,req,name=version" json:"version,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetDefaultVersionResponse) Reset() { *m = GetDefaultVersionResponse{} }
|
|
||||||
func (m *GetDefaultVersionResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetDefaultVersionResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetDefaultVersionResponse) GetVersion() string {
|
|
||||||
if m != nil && m.Version != nil {
|
|
||||||
return *m.Version
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetNumInstancesRequest struct {
|
|
||||||
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
|
||||||
Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetNumInstancesRequest) Reset() { *m = GetNumInstancesRequest{} }
|
|
||||||
func (m *GetNumInstancesRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetNumInstancesRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetNumInstancesRequest) GetModule() string {
|
|
||||||
if m != nil && m.Module != nil {
|
|
||||||
return *m.Module
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetNumInstancesRequest) GetVersion() string {
|
|
||||||
if m != nil && m.Version != nil {
|
|
||||||
return *m.Version
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetNumInstancesResponse struct {
|
|
||||||
Instances *int64 `protobuf:"varint,1,req,name=instances" json:"instances,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetNumInstancesResponse) Reset() { *m = GetNumInstancesResponse{} }
|
|
||||||
func (m *GetNumInstancesResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetNumInstancesResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetNumInstancesResponse) GetInstances() int64 {
|
|
||||||
if m != nil && m.Instances != nil {
|
|
||||||
return *m.Instances
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type SetNumInstancesRequest struct {
|
|
||||||
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
|
||||||
Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"`
|
|
||||||
Instances *int64 `protobuf:"varint,3,req,name=instances" json:"instances,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SetNumInstancesRequest) Reset() { *m = SetNumInstancesRequest{} }
|
|
||||||
func (m *SetNumInstancesRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*SetNumInstancesRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *SetNumInstancesRequest) GetModule() string {
|
|
||||||
if m != nil && m.Module != nil {
|
|
||||||
return *m.Module
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SetNumInstancesRequest) GetVersion() string {
|
|
||||||
if m != nil && m.Version != nil {
|
|
||||||
return *m.Version
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SetNumInstancesRequest) GetInstances() int64 {
|
|
||||||
if m != nil && m.Instances != nil {
|
|
||||||
return *m.Instances
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type SetNumInstancesResponse struct {
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SetNumInstancesResponse) Reset() { *m = SetNumInstancesResponse{} }
|
|
||||||
func (m *SetNumInstancesResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*SetNumInstancesResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
type StartModuleRequest struct {
|
|
||||||
Module *string `protobuf:"bytes,1,req,name=module" json:"module,omitempty"`
|
|
||||||
Version *string `protobuf:"bytes,2,req,name=version" json:"version,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *StartModuleRequest) Reset() { *m = StartModuleRequest{} }
|
|
||||||
func (m *StartModuleRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*StartModuleRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *StartModuleRequest) GetModule() string {
|
|
||||||
if m != nil && m.Module != nil {
|
|
||||||
return *m.Module
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *StartModuleRequest) GetVersion() string {
|
|
||||||
if m != nil && m.Version != nil {
|
|
||||||
return *m.Version
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type StartModuleResponse struct {
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *StartModuleResponse) Reset() { *m = StartModuleResponse{} }
|
|
||||||
func (m *StartModuleResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*StartModuleResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
type StopModuleRequest struct {
|
|
||||||
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
|
||||||
Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *StopModuleRequest) Reset() { *m = StopModuleRequest{} }
|
|
||||||
func (m *StopModuleRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*StopModuleRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *StopModuleRequest) GetModule() string {
|
|
||||||
if m != nil && m.Module != nil {
|
|
||||||
return *m.Module
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *StopModuleRequest) GetVersion() string {
|
|
||||||
if m != nil && m.Version != nil {
|
|
||||||
return *m.Version
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type StopModuleResponse struct {
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *StopModuleResponse) Reset() { *m = StopModuleResponse{} }
|
|
||||||
func (m *StopModuleResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*StopModuleResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
type GetHostnameRequest struct {
|
|
||||||
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
|
||||||
Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"`
|
|
||||||
Instance *string `protobuf:"bytes,3,opt,name=instance" json:"instance,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetHostnameRequest) Reset() { *m = GetHostnameRequest{} }
|
|
||||||
func (m *GetHostnameRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetHostnameRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetHostnameRequest) GetModule() string {
|
|
||||||
if m != nil && m.Module != nil {
|
|
||||||
return *m.Module
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetHostnameRequest) GetVersion() string {
|
|
||||||
if m != nil && m.Version != nil {
|
|
||||||
return *m.Version
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetHostnameRequest) GetInstance() string {
|
|
||||||
if m != nil && m.Instance != nil {
|
|
||||||
return *m.Instance
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetHostnameResponse struct {
|
|
||||||
Hostname *string `protobuf:"bytes,1,req,name=hostname" json:"hostname,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *GetHostnameResponse) Reset() { *m = GetHostnameResponse{} }
|
|
||||||
func (m *GetHostnameResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*GetHostnameResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *GetHostnameResponse) GetHostname() string {
|
|
||||||
if m != nil && m.Hostname != nil {
|
|
||||||
return *m.Hostname
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
}
|
|
80
vendor/google.golang.org/appengine/internal/modules/modules_service.proto
generated
vendored
80
vendor/google.golang.org/appengine/internal/modules/modules_service.proto
generated
vendored
@ -1,80 +0,0 @@
|
|||||||
syntax = "proto2";
|
|
||||||
option go_package = "modules";
|
|
||||||
|
|
||||||
package appengine;
|
|
||||||
|
|
||||||
message ModulesServiceError {
|
|
||||||
enum ErrorCode {
|
|
||||||
OK = 0;
|
|
||||||
INVALID_MODULE = 1;
|
|
||||||
INVALID_VERSION = 2;
|
|
||||||
INVALID_INSTANCES = 3;
|
|
||||||
TRANSIENT_ERROR = 4;
|
|
||||||
UNEXPECTED_STATE = 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetModulesRequest {
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetModulesResponse {
|
|
||||||
repeated string module = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetVersionsRequest {
|
|
||||||
optional string module = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetVersionsResponse {
|
|
||||||
repeated string version = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetDefaultVersionRequest {
|
|
||||||
optional string module = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetDefaultVersionResponse {
|
|
||||||
required string version = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetNumInstancesRequest {
|
|
||||||
optional string module = 1;
|
|
||||||
optional string version = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetNumInstancesResponse {
|
|
||||||
required int64 instances = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SetNumInstancesRequest {
|
|
||||||
optional string module = 1;
|
|
||||||
optional string version = 2;
|
|
||||||
required int64 instances = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SetNumInstancesResponse {}
|
|
||||||
|
|
||||||
message StartModuleRequest {
|
|
||||||
required string module = 1;
|
|
||||||
required string version = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message StartModuleResponse {}
|
|
||||||
|
|
||||||
message StopModuleRequest {
|
|
||||||
optional string module = 1;
|
|
||||||
optional string version = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message StopModuleResponse {}
|
|
||||||
|
|
||||||
message GetHostnameRequest {
|
|
||||||
optional string module = 1;
|
|
||||||
optional string version = 2;
|
|
||||||
optional string instance = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetHostnameResponse {
|
|
||||||
required string hostname = 1;
|
|
||||||
}
|
|
||||||
|
|
56
vendor/google.golang.org/appengine/internal/net.go
generated
vendored
56
vendor/google.golang.org/appengine/internal/net.go
generated
vendored
@ -1,56 +0,0 @@
|
|||||||
// Copyright 2014 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
// This file implements a network dialer that limits the number of concurrent connections.
|
|
||||||
// It is only used for API calls.
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"net"
|
|
||||||
"runtime"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var limitSem = make(chan int, 100) // TODO(dsymonds): Use environment variable.
|
|
||||||
|
|
||||||
func limitRelease() {
|
|
||||||
// non-blocking
|
|
||||||
select {
|
|
||||||
case <-limitSem:
|
|
||||||
default:
|
|
||||||
// This should not normally happen.
|
|
||||||
log.Print("appengine: unbalanced limitSem release!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func limitDial(network, addr string) (net.Conn, error) {
|
|
||||||
limitSem <- 1
|
|
||||||
|
|
||||||
// Dial with a timeout in case the API host is MIA.
|
|
||||||
// The connection should normally be very fast.
|
|
||||||
conn, err := net.DialTimeout(network, addr, 500*time.Millisecond)
|
|
||||||
if err != nil {
|
|
||||||
limitRelease()
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
lc := &limitConn{Conn: conn}
|
|
||||||
runtime.SetFinalizer(lc, (*limitConn).Close) // shouldn't usually be required
|
|
||||||
return lc, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type limitConn struct {
|
|
||||||
close sync.Once
|
|
||||||
net.Conn
|
|
||||||
}
|
|
||||||
|
|
||||||
func (lc *limitConn) Close() error {
|
|
||||||
defer lc.close.Do(func() {
|
|
||||||
limitRelease()
|
|
||||||
runtime.SetFinalizer(lc, nil)
|
|
||||||
})
|
|
||||||
return lc.Conn.Close()
|
|
||||||
}
|
|
40
vendor/google.golang.org/appengine/internal/regen.sh
generated
vendored
40
vendor/google.golang.org/appengine/internal/regen.sh
generated
vendored
@ -1,40 +0,0 @@
|
|||||||
#!/bin/bash -e
|
|
||||||
#
|
|
||||||
# This script rebuilds the generated code for the protocol buffers.
|
|
||||||
# To run this you will need protoc and goprotobuf installed;
|
|
||||||
# see https://github.com/golang/protobuf for instructions.
|
|
||||||
|
|
||||||
PKG=google.golang.org/appengine
|
|
||||||
|
|
||||||
function die() {
|
|
||||||
echo 1>&2 $*
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Sanity check that the right tools are accessible.
|
|
||||||
for tool in go protoc protoc-gen-go; do
|
|
||||||
q=$(which $tool) || die "didn't find $tool"
|
|
||||||
echo 1>&2 "$tool: $q"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo -n 1>&2 "finding package dir... "
|
|
||||||
pkgdir=$(go list -f '{{.Dir}}' $PKG)
|
|
||||||
echo 1>&2 $pkgdir
|
|
||||||
base=$(echo $pkgdir | sed "s,/$PKG\$,,")
|
|
||||||
echo 1>&2 "base: $base"
|
|
||||||
cd $base
|
|
||||||
|
|
||||||
# Run protoc once per package.
|
|
||||||
for dir in $(find $PKG/internal -name '*.proto' | xargs dirname | sort | uniq); do
|
|
||||||
echo 1>&2 "* $dir"
|
|
||||||
protoc --go_out=. $dir/*.proto
|
|
||||||
done
|
|
||||||
|
|
||||||
for f in $(find $PKG/internal -name '*.pb.go'); do
|
|
||||||
# Remove proto.RegisterEnum calls.
|
|
||||||
# These cause duplicate registration panics when these packages
|
|
||||||
# are used on classic App Engine. proto.RegisterEnum only affects
|
|
||||||
# parsing the text format; we don't care about that.
|
|
||||||
# https://code.google.com/p/googleappengine/issues/detail?id=11670#c17
|
|
||||||
sed -i '/proto.RegisterEnum/d' $f
|
|
||||||
done
|
|
231
vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go
generated
vendored
231
vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go
generated
vendored
@ -1,231 +0,0 @@
|
|||||||
// Code generated by protoc-gen-go.
|
|
||||||
// source: google.golang.org/appengine/internal/remote_api/remote_api.proto
|
|
||||||
// DO NOT EDIT!
|
|
||||||
|
|
||||||
/*
|
|
||||||
Package remote_api is a generated protocol buffer package.
|
|
||||||
|
|
||||||
It is generated from these files:
|
|
||||||
google.golang.org/appengine/internal/remote_api/remote_api.proto
|
|
||||||
|
|
||||||
It has these top-level messages:
|
|
||||||
Request
|
|
||||||
ApplicationError
|
|
||||||
RpcError
|
|
||||||
Response
|
|
||||||
*/
|
|
||||||
package remote_api
|
|
||||||
|
|
||||||
import proto "github.com/golang/protobuf/proto"
|
|
||||||
import fmt "fmt"
|
|
||||||
import math "math"
|
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ = proto.Marshal
|
|
||||||
var _ = fmt.Errorf
|
|
||||||
var _ = math.Inf
|
|
||||||
|
|
||||||
type RpcError_ErrorCode int32
|
|
||||||
|
|
||||||
const (
|
|
||||||
RpcError_UNKNOWN RpcError_ErrorCode = 0
|
|
||||||
RpcError_CALL_NOT_FOUND RpcError_ErrorCode = 1
|
|
||||||
RpcError_PARSE_ERROR RpcError_ErrorCode = 2
|
|
||||||
RpcError_SECURITY_VIOLATION RpcError_ErrorCode = 3
|
|
||||||
RpcError_OVER_QUOTA RpcError_ErrorCode = 4
|
|
||||||
RpcError_REQUEST_TOO_LARGE RpcError_ErrorCode = 5
|
|
||||||
RpcError_CAPABILITY_DISABLED RpcError_ErrorCode = 6
|
|
||||||
RpcError_FEATURE_DISABLED RpcError_ErrorCode = 7
|
|
||||||
RpcError_BAD_REQUEST RpcError_ErrorCode = 8
|
|
||||||
RpcError_RESPONSE_TOO_LARGE RpcError_ErrorCode = 9
|
|
||||||
RpcError_CANCELLED RpcError_ErrorCode = 10
|
|
||||||
RpcError_REPLAY_ERROR RpcError_ErrorCode = 11
|
|
||||||
RpcError_DEADLINE_EXCEEDED RpcError_ErrorCode = 12
|
|
||||||
)
|
|
||||||
|
|
||||||
var RpcError_ErrorCode_name = map[int32]string{
|
|
||||||
0: "UNKNOWN",
|
|
||||||
1: "CALL_NOT_FOUND",
|
|
||||||
2: "PARSE_ERROR",
|
|
||||||
3: "SECURITY_VIOLATION",
|
|
||||||
4: "OVER_QUOTA",
|
|
||||||
5: "REQUEST_TOO_LARGE",
|
|
||||||
6: "CAPABILITY_DISABLED",
|
|
||||||
7: "FEATURE_DISABLED",
|
|
||||||
8: "BAD_REQUEST",
|
|
||||||
9: "RESPONSE_TOO_LARGE",
|
|
||||||
10: "CANCELLED",
|
|
||||||
11: "REPLAY_ERROR",
|
|
||||||
12: "DEADLINE_EXCEEDED",
|
|
||||||
}
|
|
||||||
var RpcError_ErrorCode_value = map[string]int32{
|
|
||||||
"UNKNOWN": 0,
|
|
||||||
"CALL_NOT_FOUND": 1,
|
|
||||||
"PARSE_ERROR": 2,
|
|
||||||
"SECURITY_VIOLATION": 3,
|
|
||||||
"OVER_QUOTA": 4,
|
|
||||||
"REQUEST_TOO_LARGE": 5,
|
|
||||||
"CAPABILITY_DISABLED": 6,
|
|
||||||
"FEATURE_DISABLED": 7,
|
|
||||||
"BAD_REQUEST": 8,
|
|
||||||
"RESPONSE_TOO_LARGE": 9,
|
|
||||||
"CANCELLED": 10,
|
|
||||||
"REPLAY_ERROR": 11,
|
|
||||||
"DEADLINE_EXCEEDED": 12,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x RpcError_ErrorCode) Enum() *RpcError_ErrorCode {
|
|
||||||
p := new(RpcError_ErrorCode)
|
|
||||||
*p = x
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
func (x RpcError_ErrorCode) String() string {
|
|
||||||
return proto.EnumName(RpcError_ErrorCode_name, int32(x))
|
|
||||||
}
|
|
||||||
func (x *RpcError_ErrorCode) UnmarshalJSON(data []byte) error {
|
|
||||||
value, err := proto.UnmarshalJSONEnum(RpcError_ErrorCode_value, data, "RpcError_ErrorCode")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
*x = RpcError_ErrorCode(value)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type Request struct {
|
|
||||||
ServiceName *string `protobuf:"bytes,2,req,name=service_name" json:"service_name,omitempty"`
|
|
||||||
Method *string `protobuf:"bytes,3,req,name=method" json:"method,omitempty"`
|
|
||||||
Request []byte `protobuf:"bytes,4,req,name=request" json:"request,omitempty"`
|
|
||||||
RequestId *string `protobuf:"bytes,5,opt,name=request_id" json:"request_id,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Request) Reset() { *m = Request{} }
|
|
||||||
func (m *Request) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*Request) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *Request) GetServiceName() string {
|
|
||||||
if m != nil && m.ServiceName != nil {
|
|
||||||
return *m.ServiceName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Request) GetMethod() string {
|
|
||||||
if m != nil && m.Method != nil {
|
|
||||||
return *m.Method
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Request) GetRequest() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.Request
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Request) GetRequestId() string {
|
|
||||||
if m != nil && m.RequestId != nil {
|
|
||||||
return *m.RequestId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type ApplicationError struct {
|
|
||||||
Code *int32 `protobuf:"varint,1,req,name=code" json:"code,omitempty"`
|
|
||||||
Detail *string `protobuf:"bytes,2,req,name=detail" json:"detail,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *ApplicationError) Reset() { *m = ApplicationError{} }
|
|
||||||
func (m *ApplicationError) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*ApplicationError) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *ApplicationError) GetCode() int32 {
|
|
||||||
if m != nil && m.Code != nil {
|
|
||||||
return *m.Code
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *ApplicationError) GetDetail() string {
|
|
||||||
if m != nil && m.Detail != nil {
|
|
||||||
return *m.Detail
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type RpcError struct {
|
|
||||||
Code *int32 `protobuf:"varint,1,req,name=code" json:"code,omitempty"`
|
|
||||||
Detail *string `protobuf:"bytes,2,opt,name=detail" json:"detail,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RpcError) Reset() { *m = RpcError{} }
|
|
||||||
func (m *RpcError) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*RpcError) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *RpcError) GetCode() int32 {
|
|
||||||
if m != nil && m.Code != nil {
|
|
||||||
return *m.Code
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RpcError) GetDetail() string {
|
|
||||||
if m != nil && m.Detail != nil {
|
|
||||||
return *m.Detail
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type Response struct {
|
|
||||||
Response []byte `protobuf:"bytes,1,opt,name=response" json:"response,omitempty"`
|
|
||||||
Exception []byte `protobuf:"bytes,2,opt,name=exception" json:"exception,omitempty"`
|
|
||||||
ApplicationError *ApplicationError `protobuf:"bytes,3,opt,name=application_error" json:"application_error,omitempty"`
|
|
||||||
JavaException []byte `protobuf:"bytes,4,opt,name=java_exception" json:"java_exception,omitempty"`
|
|
||||||
RpcError *RpcError `protobuf:"bytes,5,opt,name=rpc_error" json:"rpc_error,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Response) Reset() { *m = Response{} }
|
|
||||||
func (m *Response) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*Response) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *Response) GetResponse() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.Response
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Response) GetException() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.Exception
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Response) GetApplicationError() *ApplicationError {
|
|
||||||
if m != nil {
|
|
||||||
return m.ApplicationError
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Response) GetJavaException() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.JavaException
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Response) GetRpcError() *RpcError {
|
|
||||||
if m != nil {
|
|
||||||
return m.RpcError
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
}
|
|
44
vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto
generated
vendored
44
vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto
generated
vendored
@ -1,44 +0,0 @@
|
|||||||
syntax = "proto2";
|
|
||||||
option go_package = "remote_api";
|
|
||||||
|
|
||||||
package remote_api;
|
|
||||||
|
|
||||||
message Request {
|
|
||||||
required string service_name = 2;
|
|
||||||
required string method = 3;
|
|
||||||
required bytes request = 4;
|
|
||||||
optional string request_id = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message ApplicationError {
|
|
||||||
required int32 code = 1;
|
|
||||||
required string detail = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RpcError {
|
|
||||||
enum ErrorCode {
|
|
||||||
UNKNOWN = 0;
|
|
||||||
CALL_NOT_FOUND = 1;
|
|
||||||
PARSE_ERROR = 2;
|
|
||||||
SECURITY_VIOLATION = 3;
|
|
||||||
OVER_QUOTA = 4;
|
|
||||||
REQUEST_TOO_LARGE = 5;
|
|
||||||
CAPABILITY_DISABLED = 6;
|
|
||||||
FEATURE_DISABLED = 7;
|
|
||||||
BAD_REQUEST = 8;
|
|
||||||
RESPONSE_TOO_LARGE = 9;
|
|
||||||
CANCELLED = 10;
|
|
||||||
REPLAY_ERROR = 11;
|
|
||||||
DEADLINE_EXCEEDED = 12;
|
|
||||||
}
|
|
||||||
required int32 code = 1;
|
|
||||||
optional string detail = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Response {
|
|
||||||
optional bytes response = 1;
|
|
||||||
optional bytes exception = 2;
|
|
||||||
optional ApplicationError application_error = 3;
|
|
||||||
optional bytes java_exception = 4;
|
|
||||||
optional RpcError rpc_error = 5;
|
|
||||||
}
|
|
107
vendor/google.golang.org/appengine/internal/transaction.go
generated
vendored
107
vendor/google.golang.org/appengine/internal/transaction.go
generated
vendored
@ -1,107 +0,0 @@
|
|||||||
// Copyright 2014 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package internal
|
|
||||||
|
|
||||||
// This file implements hooks for applying datastore transactions.
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"reflect"
|
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
netcontext "golang.org/x/net/context"
|
|
||||||
|
|
||||||
basepb "google.golang.org/appengine/internal/base"
|
|
||||||
pb "google.golang.org/appengine/internal/datastore"
|
|
||||||
)
|
|
||||||
|
|
||||||
var transactionSetters = make(map[reflect.Type]reflect.Value)
|
|
||||||
|
|
||||||
// RegisterTransactionSetter registers a function that sets transaction information
|
|
||||||
// in a protocol buffer message. f should be a function with two arguments,
|
|
||||||
// the first being a protocol buffer type, and the second being *datastore.Transaction.
|
|
||||||
func RegisterTransactionSetter(f interface{}) {
|
|
||||||
v := reflect.ValueOf(f)
|
|
||||||
transactionSetters[v.Type().In(0)] = v
|
|
||||||
}
|
|
||||||
|
|
||||||
// applyTransaction applies the transaction t to message pb
|
|
||||||
// by using the relevant setter passed to RegisterTransactionSetter.
|
|
||||||
func applyTransaction(pb proto.Message, t *pb.Transaction) {
|
|
||||||
v := reflect.ValueOf(pb)
|
|
||||||
if f, ok := transactionSetters[v.Type()]; ok {
|
|
||||||
f.Call([]reflect.Value{v, reflect.ValueOf(t)})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var transactionKey = "used for *Transaction"
|
|
||||||
|
|
||||||
func transactionFromContext(ctx netcontext.Context) *transaction {
|
|
||||||
t, _ := ctx.Value(&transactionKey).(*transaction)
|
|
||||||
return t
|
|
||||||
}
|
|
||||||
|
|
||||||
func withTransaction(ctx netcontext.Context, t *transaction) netcontext.Context {
|
|
||||||
return netcontext.WithValue(ctx, &transactionKey, t)
|
|
||||||
}
|
|
||||||
|
|
||||||
type transaction struct {
|
|
||||||
transaction pb.Transaction
|
|
||||||
finished bool
|
|
||||||
}
|
|
||||||
|
|
||||||
var ErrConcurrentTransaction = errors.New("internal: concurrent transaction")
|
|
||||||
|
|
||||||
func RunTransactionOnce(c netcontext.Context, f func(netcontext.Context) error, xg bool) error {
|
|
||||||
if transactionFromContext(c) != nil {
|
|
||||||
return errors.New("nested transactions are not supported")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Begin the transaction.
|
|
||||||
t := &transaction{}
|
|
||||||
req := &pb.BeginTransactionRequest{
|
|
||||||
App: proto.String(FullyQualifiedAppID(c)),
|
|
||||||
}
|
|
||||||
if xg {
|
|
||||||
req.AllowMultipleEg = proto.Bool(true)
|
|
||||||
}
|
|
||||||
if err := Call(c, "datastore_v3", "BeginTransaction", req, &t.transaction); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call f, rolling back the transaction if f returns a non-nil error, or panics.
|
|
||||||
// The panic is not recovered.
|
|
||||||
defer func() {
|
|
||||||
if t.finished {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
t.finished = true
|
|
||||||
// Ignore the error return value, since we are already returning a non-nil
|
|
||||||
// error (or we're panicking).
|
|
||||||
Call(c, "datastore_v3", "Rollback", &t.transaction, &basepb.VoidProto{})
|
|
||||||
}()
|
|
||||||
if err := f(withTransaction(c, t)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
t.finished = true
|
|
||||||
|
|
||||||
// Commit the transaction.
|
|
||||||
res := &pb.CommitResponse{}
|
|
||||||
err := Call(c, "datastore_v3", "Commit", &t.transaction, res)
|
|
||||||
if ae, ok := err.(*APIError); ok {
|
|
||||||
/* TODO: restore this conditional
|
|
||||||
if appengine.IsDevAppServer() {
|
|
||||||
*/
|
|
||||||
// The Python Dev AppServer raises an ApplicationError with error code 2 (which is
|
|
||||||
// Error.CONCURRENT_TRANSACTION) and message "Concurrency exception.".
|
|
||||||
if ae.Code == int32(pb.Error_BAD_REQUEST) && ae.Detail == "ApplicationError: 2 Concurrency exception." {
|
|
||||||
return ErrConcurrentTransaction
|
|
||||||
}
|
|
||||||
if ae.Code == int32(pb.Error_CONCURRENT_TRANSACTION) {
|
|
||||||
return ErrConcurrentTransaction
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
25
vendor/google.golang.org/appengine/namespace.go
generated
vendored
25
vendor/google.golang.org/appengine/namespace.go
generated
vendored
@ -1,25 +0,0 @@
|
|||||||
// Copyright 2012 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package appengine
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"regexp"
|
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
|
|
||||||
"google.golang.org/appengine/internal"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Namespace returns a replacement context that operates within the given namespace.
|
|
||||||
func Namespace(c context.Context, namespace string) (context.Context, error) {
|
|
||||||
if !validNamespace.MatchString(namespace) {
|
|
||||||
return nil, fmt.Errorf("appengine: namespace %q does not match /%s/", namespace, validNamespace)
|
|
||||||
}
|
|
||||||
return internal.NamespacedContext(c, namespace), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// validNamespace matches valid namespace names.
|
|
||||||
var validNamespace = regexp.MustCompile(`^[0-9A-Za-z._-]{0,100}$`)
|
|
20
vendor/google.golang.org/appengine/timeout.go
generated
vendored
20
vendor/google.golang.org/appengine/timeout.go
generated
vendored
@ -1,20 +0,0 @@
|
|||||||
// Copyright 2013 Google Inc. All rights reserved.
|
|
||||||
// Use of this source code is governed by the Apache 2.0
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package appengine
|
|
||||||
|
|
||||||
import "golang.org/x/net/context"
|
|
||||||
|
|
||||||
// IsTimeoutError reports whether err is a timeout error.
|
|
||||||
func IsTimeoutError(err error) bool {
|
|
||||||
if err == context.DeadlineExceeded {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if t, ok := err.(interface {
|
|
||||||
IsTimeout() bool
|
|
||||||
}); ok {
|
|
||||||
return t.IsTimeout()
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user