vendor: cloud.google.com/go/logging v1.7.0
full diff: https://github.com/googleapis/google-cloud-go/compare/logging/v1.4.2...logging/v1.7.0 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
64609120d8
commit
b11bdb9212
141 changed files with 9277 additions and 2190 deletions
15
vendor.mod
15
vendor.mod
|
@ -7,8 +7,8 @@ module github.com/docker/docker
|
|||
go 1.18
|
||||
|
||||
require (
|
||||
cloud.google.com/go/compute/metadata v0.2.1
|
||||
cloud.google.com/go/logging v1.4.2
|
||||
cloud.google.com/go/compute/metadata v0.2.3
|
||||
cloud.google.com/go/logging v1.7.0
|
||||
code.cloudfoundry.org/clock v1.0.0
|
||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20221118232415-3345c89a7c72
|
||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1
|
||||
|
@ -99,15 +99,16 @@ require (
|
|||
golang.org/x/sys v0.8.0
|
||||
golang.org/x/text v0.9.0
|
||||
golang.org/x/time v0.3.0
|
||||
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e
|
||||
google.golang.org/grpc v1.50.1
|
||||
google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec
|
||||
google.golang.org/grpc v1.53.0
|
||||
gotest.tools/v3 v3.4.0
|
||||
resenje.org/singleflight v0.3.0
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.104.0 // indirect
|
||||
cloud.google.com/go/compute v1.12.1 // indirect
|
||||
cloud.google.com/go v0.107.0 // indirect
|
||||
cloud.google.com/go/compute v1.18.0 // indirect
|
||||
cloud.google.com/go/longrunning v0.3.0 // indirect
|
||||
github.com/agext/levenshtein v1.2.3 // indirect
|
||||
github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2 // indirect
|
||||
github.com/armon/go-metrics v0.4.1 // indirect
|
||||
|
@ -197,7 +198,7 @@ require (
|
|||
go.uber.org/zap v1.21.0 // indirect
|
||||
golang.org/x/crypto v0.2.0 // indirect
|
||||
golang.org/x/oauth2 v0.5.0 // indirect
|
||||
google.golang.org/api v0.102.0 // indirect
|
||||
google.golang.org/api v0.110.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
|
|
96
vendor.sum
96
vendor.sum
|
@ -21,28 +21,26 @@ cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKV
|
|||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
||||
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
||||
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
|
||||
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
|
||||
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
|
||||
cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
|
||||
cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
|
||||
cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
|
||||
cloud.google.com/go v0.104.0 h1:gSmWO7DY1vOm0MVU6DNXM11BWHHsTUmsC5cv1fuW5X8=
|
||||
cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA=
|
||||
cloud.google.com/go v0.107.0 h1:qkj22L7bgkl6vIeZDlOY2po43Mx/TIa2Wsa7VR+PEww=
|
||||
cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I=
|
||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
||||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
||||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
||||
cloud.google.com/go/compute v1.12.1 h1:gKVJMEyqV5c/UnpzjjQbo3Rjvvqpr9B1DFSbJC4OXr0=
|
||||
cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU=
|
||||
cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48=
|
||||
cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM=
|
||||
cloud.google.com/go/compute v1.18.0 h1:FEigFqoDbys2cvFkZ9Fjq4gnHBP55anJ0yQyau2f9oY=
|
||||
cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs=
|
||||
cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
|
||||
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
|
||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
||||
cloud.google.com/go/logging v1.4.2 h1:Mu2Q75VBDQlW1HlBMjTX4X84UFR73G1TiLlRYc/b7tA=
|
||||
cloud.google.com/go/logging v1.4.2/go.mod h1:jco9QZSx8HiVVqLJReq7z7bVdj0P1Jb9PDFs63T+axo=
|
||||
cloud.google.com/go/iam v0.11.0 h1:kwCWfKwB6ePZoZnGLwrd3B6Ru/agoHANTUBWpVNIdnM=
|
||||
cloud.google.com/go/logging v1.7.0 h1:CJYxlNNNNAMkHp9em/YEXcfJg+rPDg7YfwoRpMU+t5I=
|
||||
cloud.google.com/go/logging v1.7.0/go.mod h1:3xjP2CjkM3ZkO73aj4ASA5wRPGGCRrPIAeNqVNkzY8M=
|
||||
cloud.google.com/go/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs=
|
||||
cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc=
|
||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||
|
@ -298,7 +296,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
|
|||
github.com/cloudflare/cfssl v0.0.0-20180323000720-5d63dbd981b5 h1:PqZ3bA4yzwywivzk7PBQWngJp2/PAS0bWRZerKteicY=
|
||||
github.com/cloudflare/cfssl v0.0.0-20180323000720-5d63dbd981b5/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
|
||||
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
|
@ -535,7 +532,6 @@ github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT
|
|||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
|
||||
|
@ -669,7 +665,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt
|
|||
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
||||
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
|
||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
|
@ -751,7 +746,6 @@ github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
|
|||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
|
@ -759,10 +753,6 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf
|
|||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/rpmpack v0.0.0-20191226140753-aa36bfddb3a0/go.mod h1:RaTPr0KUf2K7fnZYLNDrr8rxAamWs3iNywJLtQ2AzBg=
|
||||
|
@ -1470,8 +1460,6 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
|||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
||||
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
|
||||
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
||||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.25.0/go.mod h1:E5NNboN0UqSAki0Atn9kVwaN7I+l25gGxDqBueo/74E=
|
||||
|
@ -1582,7 +1570,6 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl
|
|||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
|
@ -1592,8 +1579,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
|
|||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
|
@ -1648,17 +1633,12 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R
|
|||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
|
@ -1678,13 +1658,6 @@ golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4Iltr
|
|||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
||||
golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s=
|
||||
|
@ -1775,7 +1748,6 @@ golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200916030750-2334cc1a136f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200917073148-efd3b9a0ff20/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
@ -1788,22 +1760,16 @@ golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
@ -1923,13 +1889,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
|
|||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
||||
golang.org/x/tools v0.0.0-20200916195026-c9a70fc28ce3/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
|
||||
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
|
@ -1970,14 +1931,8 @@ google.golang.org/api v0.25.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M
|
|||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
||||
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
|
||||
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
|
||||
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
|
||||
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
|
||||
google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
|
||||
google.golang.org/api v0.46.0/go.mod h1:ceL4oozhkAiTID8XMmJBsIxID/9wMXJVVFXPg4ylg3I=
|
||||
google.golang.org/api v0.102.0 h1:JxJl2qQ85fRMPNvlZY/enexbxpCjLwGhZUtgfGeQ51I=
|
||||
google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo=
|
||||
google.golang.org/api v0.110.0 h1:l+rh0KYUooe9JGbGVx71tbFo4SMbMTXK3I3ia2QSEeU=
|
||||
google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
|
@ -2029,22 +1984,10 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
|
|||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
|
||||
google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A=
|
||||
google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A=
|
||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
|
||||
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e h1:S9GbmC1iCgvbLyAokVCwiO6tVIrU9Y7c5oMx1V/ki/Y=
|
||||
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s=
|
||||
google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec h1:6rwgChOSUfpzJF2/KnLgo+gMaxGpujStSkPWrbhXArU=
|
||||
google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw=
|
||||
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||
google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
|
||||
|
@ -2064,22 +2007,17 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa
|
|||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
|
||||
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||
google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
|
||||
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||
google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY=
|
||||
google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
||||
google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc=
|
||||
google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
|
|
13
vendor/cloud.google.com/go/.release-please-manifest-individual.json
generated
vendored
Normal file
13
vendor/cloud.google.com/go/.release-please-manifest-individual.json
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"bigquery": "1.43.0",
|
||||
"bigtable": "1.18.0",
|
||||
"datastore": "1.9.0",
|
||||
"errorreporting": "0.2.0",
|
||||
"firestore": "1.8.0",
|
||||
"logging": "1.5.0",
|
||||
"profiler": "0.3.0",
|
||||
"pubsub": "1.26.0",
|
||||
"pubsublite": "1.4.1",
|
||||
"spanner": "1.40.0",
|
||||
"storage": "1.28.0"
|
||||
}
|
220
vendor/cloud.google.com/go/.release-please-manifest-submodules.json
generated
vendored
220
vendor/cloud.google.com/go/.release-please-manifest-submodules.json
generated
vendored
|
@ -1,111 +1,115 @@
|
|||
{
|
||||
"accessapproval": "1.3.0",
|
||||
"accesscontextmanager": "1.2.0",
|
||||
"aiplatform": "1.17.0",
|
||||
"analytics": "0.9.0",
|
||||
"apigateway": "1.2.0",
|
||||
"apigeeconnect": "1.2.0",
|
||||
"apigeeregistry": "0.2.0",
|
||||
"apikeys": "0.1.0",
|
||||
"appengine": "1.3.0",
|
||||
"area120": "0.4.0",
|
||||
"artifactregistry": "1.4.0",
|
||||
"asset": "1.4.0",
|
||||
"assuredworkloads": "1.2.0",
|
||||
"automl": "1.4.0",
|
||||
"baremetalsolution": "0.2.0",
|
||||
"batch": "0.1.0",
|
||||
"beyondcorp": "0.1.0",
|
||||
"billing": "1.2.0",
|
||||
"binaryauthorization": "1.0.0",
|
||||
"certificatemanager": "0.2.1",
|
||||
"channel": "1.7.0",
|
||||
"cloudbuild": "1.2.0",
|
||||
"clouddms": "1.2.0",
|
||||
"cloudtasks": "1.4.0",
|
||||
"compute": "1.9.0",
|
||||
"contactcenterinsights": "1.2.3",
|
||||
"container": "1.3.1",
|
||||
"containeranalysis": "0.4.0",
|
||||
"datacatalog": "1.3.1",
|
||||
"dataflow": "0.5.1",
|
||||
"dataform": "0.2.0",
|
||||
"datafusion": "1.3.0",
|
||||
"datalabeling": "0.3.0",
|
||||
"dataplex": "1.1.0",
|
||||
"dataproc": "1.5.0",
|
||||
"dataqna": "0.4.0",
|
||||
"datastream": "1.0.0",
|
||||
"deploy": "1.2.1",
|
||||
"dialogflow": "1.12.1",
|
||||
"dlp": "1.4.0",
|
||||
"documentai": "1.5.0",
|
||||
"domains": "0.5.0",
|
||||
"essentialcontacts": "1.2.0",
|
||||
"eventarc": "1.6.0",
|
||||
"filestore": "1.2.0",
|
||||
"functions": "1.5.0",
|
||||
"gaming": "1.3.1",
|
||||
"gkebackup": "0.1.0",
|
||||
"gkeconnect": "0.3.0",
|
||||
"gkehub": "0.8.0",
|
||||
"gkemulticloud": "0.2.0",
|
||||
"accessapproval": "1.5.0",
|
||||
"accesscontextmanager": "1.5.0",
|
||||
"aiplatform": "1.25.0",
|
||||
"analytics": "0.12.0",
|
||||
"apigateway": "1.4.0",
|
||||
"apigeeconnect": "1.4.0",
|
||||
"apigeeregistry": "0.2.1",
|
||||
"apikeys": "0.2.0",
|
||||
"appengine": "1.5.0",
|
||||
"area120": "0.6.0",
|
||||
"artifactregistry": "1.9.0",
|
||||
"asset": "1.10.0",
|
||||
"assuredworkloads": "1.9.0",
|
||||
"automl": "1.8.0",
|
||||
"baremetalsolution": "0.4.0",
|
||||
"batch": "0.4.0",
|
||||
"beyondcorp": "0.3.0",
|
||||
"billing": "1.7.0",
|
||||
"binaryauthorization": "1.4.0",
|
||||
"certificatemanager": "1.4.0",
|
||||
"channel": "1.9.0",
|
||||
"cloudbuild": "1.5.0",
|
||||
"clouddms": "1.4.0",
|
||||
"cloudtasks": "1.8.0",
|
||||
"compute": "1.12.1",
|
||||
"compute/metadata": "0.2.1",
|
||||
"contactcenterinsights": "1.4.0",
|
||||
"container": "1.8.0",
|
||||
"containeranalysis": "0.6.0",
|
||||
"datacatalog": "1.8.1",
|
||||
"dataflow": "0.7.0",
|
||||
"dataform": "0.5.0",
|
||||
"datafusion": "1.5.0",
|
||||
"datalabeling": "0.6.0",
|
||||
"dataplex": "1.4.0",
|
||||
"dataproc": "1.8.0",
|
||||
"dataqna": "0.6.0",
|
||||
"datastream": "1.5.0",
|
||||
"deploy": "1.5.0",
|
||||
"dialogflow": "1.20.0",
|
||||
"dlp": "1.7.0",
|
||||
"documentai": "1.11.0",
|
||||
"domains": "0.7.0",
|
||||
"edgecontainer": "0.2.0",
|
||||
"essentialcontacts": "1.4.0",
|
||||
"eventarc": "1.9.0",
|
||||
"filestore": "1.4.0",
|
||||
"functions": "1.9.0",
|
||||
"gaming": "1.8.0",
|
||||
"gkebackup": "0.3.0",
|
||||
"gkeconnect": "0.6.0",
|
||||
"gkehub": "0.10.0",
|
||||
"gkemulticloud": "0.4.0",
|
||||
"grafeas": "0.2.0",
|
||||
"gsuiteaddons": "1.2.0",
|
||||
"iam": "0.3.0",
|
||||
"iap": "1.3.0",
|
||||
"ids": "1.0.0",
|
||||
"iot": "1.2.0",
|
||||
"kms": "1.4.0",
|
||||
"language": "1.3.0",
|
||||
"lifesciences": "0.4.0",
|
||||
"managedidentities": "1.2.0",
|
||||
"mediatranslation": "0.3.0",
|
||||
"memcache": "1.3.0",
|
||||
"metastore": "1.3.0",
|
||||
"monitoring": "1.6.0",
|
||||
"networkconnectivity": "1.2.0",
|
||||
"networkmanagement": "1.3.0",
|
||||
"networksecurity": "0.3.1",
|
||||
"notebooks": "1.0.0",
|
||||
"optimization": "1.0.0",
|
||||
"orchestration": "1.2.0",
|
||||
"orgpolicy": "1.3.0",
|
||||
"osconfig": "1.6.0",
|
||||
"oslogin": "1.3.0",
|
||||
"phishingprotection": "0.4.0",
|
||||
"policytroubleshooter": "1.2.0",
|
||||
"privatecatalog": "0.4.0",
|
||||
"recaptchaenterprise/v2": "2.0.1",
|
||||
"recommendationengine": "0.3.0",
|
||||
"recommender": "1.4.0",
|
||||
"redis": "1.6.0",
|
||||
"resourcemanager": "1.2.0",
|
||||
"resourcesettings": "1.2.0",
|
||||
"retail": "1.5.0",
|
||||
"run": "0.1.1",
|
||||
"scheduler": "1.3.0",
|
||||
"secretmanager": "1.5.0",
|
||||
"security": "1.4.1",
|
||||
"securitycenter": "1.10.0",
|
||||
"servicecontrol": "1.3.0",
|
||||
"servicedirectory": "1.3.0",
|
||||
"servicemanagement": "1.3.1",
|
||||
"serviceusage": "1.2.0",
|
||||
"shell": "1.2.0",
|
||||
"speech": "1.5.0",
|
||||
"storagetransfer": "1.3.0",
|
||||
"talent": "1.0.0",
|
||||
"texttospeech": "1.3.0",
|
||||
"tpu": "1.2.0",
|
||||
"trace": "1.2.0",
|
||||
"translate": "1.2.0",
|
||||
"video": "1.7.0",
|
||||
"videointelligence": "1.4.0",
|
||||
"vision/v2": "2.1.0",
|
||||
"vmmigration": "1.1.0",
|
||||
"vpcaccess": "1.2.0",
|
||||
"webrisk": "1.3.0",
|
||||
"websecurityscanner": "1.2.0",
|
||||
"workflows": "1.5.0"
|
||||
"gsuiteaddons": "1.4.0",
|
||||
"iam": "0.7.0",
|
||||
"iap": "1.5.0",
|
||||
"ids": "1.2.0",
|
||||
"iot": "1.4.0",
|
||||
"kms": "1.6.0",
|
||||
"language": "1.8.0",
|
||||
"lifesciences": "0.6.0",
|
||||
"longrunning": "0.3.0",
|
||||
"managedidentities": "1.4.0",
|
||||
"maps": "0.0.0",
|
||||
"mediatranslation": "0.6.0",
|
||||
"memcache": "1.7.0",
|
||||
"metastore": "1.8.0",
|
||||
"monitoring": "1.9.0",
|
||||
"networkconnectivity": "1.8.0",
|
||||
"networkmanagement": "1.5.0",
|
||||
"networksecurity": "0.6.0",
|
||||
"notebooks": "1.5.0",
|
||||
"optimization": "1.2.0",
|
||||
"orchestration": "1.4.0",
|
||||
"orgpolicy": "1.5.0",
|
||||
"osconfig": "1.10.0",
|
||||
"oslogin": "1.7.0",
|
||||
"phishingprotection": "0.6.0",
|
||||
"policytroubleshooter": "1.4.0",
|
||||
"privatecatalog": "0.6.0",
|
||||
"recaptchaenterprise/v2": "2.5.0",
|
||||
"recommendationengine": "0.6.0",
|
||||
"recommender": "1.8.0",
|
||||
"redis": "1.10.0",
|
||||
"resourcemanager": "1.4.0",
|
||||
"resourcesettings": "1.4.0",
|
||||
"retail": "1.11.0",
|
||||
"run": "0.4.0",
|
||||
"scheduler": "1.7.0",
|
||||
"secretmanager": "1.9.0",
|
||||
"security": "1.10.0",
|
||||
"securitycenter": "1.16.0",
|
||||
"servicecontrol": "1.5.0",
|
||||
"servicedirectory": "1.7.0",
|
||||
"servicemanagement": "1.5.0",
|
||||
"serviceusage": "1.4.0",
|
||||
"shell": "1.4.0",
|
||||
"speech": "1.9.0",
|
||||
"storagetransfer": "1.6.0",
|
||||
"talent": "1.4.1",
|
||||
"texttospeech": "1.5.0",
|
||||
"tpu": "1.4.0",
|
||||
"trace": "1.4.0",
|
||||
"translate": "1.4.0",
|
||||
"video": "1.10.0",
|
||||
"videointelligence": "1.9.0",
|
||||
"vision/v2": "2.5.0",
|
||||
"vmmigration": "1.3.0",
|
||||
"vpcaccess": "1.5.0",
|
||||
"webrisk": "1.7.0",
|
||||
"websecurityscanner": "1.4.0",
|
||||
"workflows": "1.9.0"
|
||||
}
|
||||
|
|
2
vendor/cloud.google.com/go/.release-please-manifest.json
generated
vendored
2
vendor/cloud.google.com/go/.release-please-manifest.json
generated
vendored
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
".": "0.104.0"
|
||||
".": "0.107.0"
|
||||
}
|
||||
|
|
14
vendor/cloud.google.com/go/CHANGES.md
generated
vendored
14
vendor/cloud.google.com/go/CHANGES.md
generated
vendored
|
@ -1,5 +1,19 @@
|
|||
# Changes
|
||||
|
||||
## [0.107.0](https://github.com/googleapis/google-cloud-go/compare/v0.106.0...v0.107.0) (2022-11-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **routing:** Start generating apiv2 ([#7011](https://github.com/googleapis/google-cloud-go/issues/7011)) ([66e8e27](https://github.com/googleapis/google-cloud-go/commit/66e8e2717b2593f4e5640ecb97344bb1d5e5fc0b))
|
||||
|
||||
## [0.106.0](https://github.com/googleapis/google-cloud-go/compare/v0.105.0...v0.106.0) (2022-11-09)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **debugger:** rewrite signatures in terms of new location ([3c4b2b3](https://github.com/googleapis/google-cloud-go/commit/3c4b2b34565795537aac1661e6af2442437e34ad))
|
||||
|
||||
## [0.104.0](https://github.com/googleapis/google-cloud-go/compare/v0.103.0...v0.104.0) (2022-08-24)
|
||||
|
||||
|
||||
|
|
2
vendor/cloud.google.com/go/compute/internal/version.go
generated
vendored
2
vendor/cloud.google.com/go/compute/internal/version.go
generated
vendored
|
@ -15,4 +15,4 @@
|
|||
package internal
|
||||
|
||||
// Version is the current tagged release of the library.
|
||||
const Version = "1.12.1"
|
||||
const Version = "1.18.0"
|
||||
|
|
14
vendor/cloud.google.com/go/compute/metadata/CHANGES.md
generated
vendored
14
vendor/cloud.google.com/go/compute/metadata/CHANGES.md
generated
vendored
|
@ -1,5 +1,19 @@
|
|||
# Changes
|
||||
|
||||
## [0.2.3](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.2.2...compute/metadata/v0.2.3) (2022-12-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compute/metadata:** Switch DNS lookup to an absolute lookup ([119b410](https://github.com/googleapis/google-cloud-go/commit/119b41060c7895e45e48aee5621ad35607c4d021)), refs [#7165](https://github.com/googleapis/google-cloud-go/issues/7165)
|
||||
|
||||
## [0.2.2](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.2.1...compute/metadata/v0.2.2) (2022-12-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compute/metadata:** Set IdleConnTimeout for http.Client ([#7084](https://github.com/googleapis/google-cloud-go/issues/7084)) ([766516a](https://github.com/googleapis/google-cloud-go/commit/766516aaf3816bfb3159efeea65aa3d1d205a3e2)), refs [#5430](https://github.com/googleapis/google-cloud-go/issues/5430)
|
||||
|
||||
## [0.1.0] (2022-10-26)
|
||||
|
||||
Initial release of metadata being it's own module.
|
||||
|
|
3
vendor/cloud.google.com/go/compute/metadata/metadata.go
generated
vendored
3
vendor/cloud.google.com/go/compute/metadata/metadata.go
generated
vendored
|
@ -70,6 +70,7 @@ func newDefaultHTTPClient() *http.Client {
|
|||
Timeout: 2 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).Dial,
|
||||
IdleConnTimeout: 60 * time.Second,
|
||||
},
|
||||
Timeout: 5 * time.Second,
|
||||
}
|
||||
|
@ -146,7 +147,7 @@ func testOnGCE() bool {
|
|||
|
||||
go func() {
|
||||
resolver := &net.Resolver{}
|
||||
addrs, err := resolver.LookupHost(ctx, "metadata.google.internal")
|
||||
addrs, err := resolver.LookupHost(ctx, "metadata.google.internal.")
|
||||
if err != nil || len(addrs) == 0 {
|
||||
resc <- false
|
||||
return
|
||||
|
|
38
vendor/cloud.google.com/go/doc.go
generated
vendored
38
vendor/cloud.google.com/go/doc.go
generated
vendored
|
@ -22,6 +22,24 @@ of sub-packages.
|
|||
All clients in sub-packages are configurable via client options. These options are
|
||||
described here: https://godoc.org/google.golang.org/api/option.
|
||||
|
||||
## Endpoint Override
|
||||
|
||||
Endpoint configuration is used to specify the URL to which requests are
|
||||
sent. It is used for services that support or require regional endpoints, as well
|
||||
as for other use cases such as [testing against fake
|
||||
servers](https://github.com/googleapis/google-cloud-go/blob/main/testing.md#testing-grpc-services-using-fakes).
|
||||
|
||||
For example, the Vertex AI service recommends that you configure the endpoint to the
|
||||
location with the features you want that is closest to your physical location or the
|
||||
location of your users. There is no global endpoint for Vertex AI. See
|
||||
[Vertex AI - Locations](https://cloud.google.com/vertex-ai/docs/general/locations)
|
||||
for more details. The following example demonstrates configuring a Vertex AI client
|
||||
with a regional endpoint:
|
||||
|
||||
ctx := context.Background()
|
||||
endpoint := "us-central1-aiplatform.googleapis.com:443"
|
||||
client, err := aiplatform.NewDatasetClient(ctx, option.WithEndpoint(endpoint))
|
||||
|
||||
# Authentication and Authorization
|
||||
|
||||
All the clients in sub-packages support authentication via Google Application Default
|
||||
|
@ -164,15 +182,16 @@ For HTTP logging, set the GODEBUG environment variable to "http2debug=1" or "htt
|
|||
# Inspecting errors
|
||||
|
||||
Most of the errors returned by the generated clients are wrapped in an
|
||||
`apierror.APIError` (https://pkg.go.dev/github.com/googleapis/gax-go/v2/apierror)
|
||||
and can be further unwrapped into a `grpc.Status` or `googleapi.Error` depending
|
||||
[github.com/googleapis/gax-go/v2/apierror.APIError] and can be further unwrapped
|
||||
into a [google.golang.org/grpc/status.Status] or
|
||||
[google.golang.org/api/googleapi.Error] depending
|
||||
on the transport used to make the call (gRPC or REST). Converting your errors to
|
||||
these types can be a useful way to get more information about what went wrong
|
||||
while debugging.
|
||||
|
||||
`apierror.APIError` gives access to specific details in the
|
||||
error. The transport-specific errors can still be unwrapped using the
|
||||
`apierror.APIError`.
|
||||
[github.com/googleapis/gax-go/v2/apierror.APIError] gives access to specific
|
||||
details in the error. The transport-specific errors can still be unwrapped using
|
||||
the [github.com/googleapis/gax-go/v2/apierror.APIError].
|
||||
|
||||
if err != nil {
|
||||
var ae *apierror.APIError
|
||||
|
@ -182,8 +201,8 @@ error. The transport-specific errors can still be unwrapped using the
|
|||
}
|
||||
}
|
||||
|
||||
If the gRPC transport was used, the `grpc.Status` can still be parsed using the
|
||||
`status.FromError` function.
|
||||
If the gRPC transport was used, the [google.golang.org/grpc/status.Status] can
|
||||
still be parsed using the [google.golang.org/grpc/status.FromError] function.
|
||||
|
||||
if err != nil {
|
||||
if s, ok := status.FromError(err); ok {
|
||||
|
@ -194,8 +213,9 @@ If the gRPC transport was used, the `grpc.Status` can still be parsed using the
|
|||
}
|
||||
}
|
||||
|
||||
If the REST transport was used, the `googleapi.Error` can be parsed in a similar
|
||||
way.
|
||||
If the REST transport was used, the [google.golang.org/api/googleapi.Error] can
|
||||
be parsed in a similar way, allowing access to details such as the HTTP response
|
||||
code.
|
||||
|
||||
if err != nil {
|
||||
var gerr *googleapi.Error
|
||||
|
|
19
vendor/cloud.google.com/go/internal/version/update_version.sh
generated
vendored
19
vendor/cloud.google.com/go/internal/version/update_version.sh
generated
vendored
|
@ -1,19 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# 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.
|
||||
|
||||
today=$(date +%Y%m%d)
|
||||
|
||||
sed -i -r -e 's/const Repo = "([0-9]{8})"/const Repo = "'$today'"/' $GOFILE
|
||||
|
71
vendor/cloud.google.com/go/internal/version/version.go
generated
vendored
71
vendor/cloud.google.com/go/internal/version/version.go
generated
vendored
|
@ -1,71 +0,0 @@
|
|||
// Copyright 2016 Google LLC
|
||||
//
|
||||
// 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.
|
||||
|
||||
//go:generate ./update_version.sh
|
||||
|
||||
// Package version contains version information for Google Cloud Client
|
||||
// Libraries for Go, as reported in request headers.
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
// Repo is the current version of the client libraries in this
|
||||
// repo. It should be a date in YYYYMMDD format.
|
||||
const Repo = "20201104"
|
||||
|
||||
// Go returns the Go runtime version. The returned string
|
||||
// has no whitespace.
|
||||
func Go() string {
|
||||
return goVersion
|
||||
}
|
||||
|
||||
var goVersion = goVer(runtime.Version())
|
||||
|
||||
const develPrefix = "devel +"
|
||||
|
||||
func goVer(s string) string {
|
||||
if strings.HasPrefix(s, develPrefix) {
|
||||
s = s[len(develPrefix):]
|
||||
if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
|
||||
s = s[:p]
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
if strings.HasPrefix(s, "go1") {
|
||||
s = s[2:]
|
||||
var prerelease string
|
||||
if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
|
||||
s, prerelease = s[:p], s[p:]
|
||||
}
|
||||
if strings.HasSuffix(s, ".") {
|
||||
s += "0"
|
||||
} else if strings.Count(s, ".") < 2 {
|
||||
s += ".0"
|
||||
}
|
||||
if prerelease != "" {
|
||||
s += "-" + prerelease
|
||||
}
|
||||
return s
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func notSemverRune(r rune) bool {
|
||||
return !strings.ContainsRune("0123456789.", r)
|
||||
}
|
49
vendor/cloud.google.com/go/logging/CHANGES.md
generated
vendored
49
vendor/cloud.google.com/go/logging/CHANGES.md
generated
vendored
|
@ -1,5 +1,54 @@
|
|||
# Changes
|
||||
|
||||
## [1.7.0](https://github.com/googleapis/google-cloud-go/compare/logging/v1.6.1...logging/v1.7.0) (2023-02-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **logging:** Add (*Logger). StandardLoggerFromTemplate() method. ([#7261](https://github.com/googleapis/google-cloud-go/issues/7261)) ([533ecbb](https://github.com/googleapis/google-cloud-go/commit/533ecbb19a2833e667ad139a6604fd40dfb43cdc))
|
||||
* **logging:** Add REST client ([06a54a1](https://github.com/googleapis/google-cloud-go/commit/06a54a16a5866cce966547c51e203b9e09a25bc0))
|
||||
* **logging:** Rewrite signatures and type in terms of new location ([620e6d8](https://github.com/googleapis/google-cloud-go/commit/620e6d828ad8641663ae351bfccfe46281e817ad))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **logging:** Correctly populate SourceLocation when logging via (*Logger).StandardLogger ([#7320](https://github.com/googleapis/google-cloud-go/issues/7320)) ([1a0bd13](https://github.com/googleapis/google-cloud-go/commit/1a0bd13b88569826f4ee6528e9cdb59fd26914fa))
|
||||
* **logging:** Fix typo in README.md ([#7297](https://github.com/googleapis/google-cloud-go/issues/7297)) ([82aa2ee](https://github.com/googleapis/google-cloud-go/commit/82aa2ee9381f793bd731f1b6789fc18e4b671bd7))
|
||||
|
||||
## [1.6.1](https://github.com/googleapis/google-cloud-go/compare/logging/v1.6.0...logging/v1.6.1) (2022-12-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **logging:** downgrade some dependencies ([7540152](https://github.com/googleapis/google-cloud-go/commit/754015236d5af7c82a75da218b71a87b9ead6eb5))
|
||||
|
||||
## [1.6.0](https://github.com/googleapis/google-cloud-go/compare/logging/v1.5.0...logging/v1.6.0) (2022-11-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **logging:** start generating proto stubs ([0eb700d](https://github.com/googleapis/google-cloud-go/commit/0eb700d17c4cac56f59038f0f3ae5a65257a3d38))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **logging:** Fix stdout log http request format ([#7083](https://github.com/googleapis/google-cloud-go/issues/7083)) ([2894e66](https://github.com/googleapis/google-cloud-go/commit/2894e66be7ff7536f725ede453d1834586a361bd))
|
||||
|
||||
## [1.5.0](https://github.com/googleapis/google-cloud-go/compare/logging/v1.4.2...logging/v1.5.0) (2022-06-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **logging:** add better version metadata to calls ([d1ad921](https://github.com/googleapis/google-cloud-go/commit/d1ad921d0322e7ce728ca9d255a3cf0437d26add))
|
||||
* **logging:** set versionClient to module version ([55f0d92](https://github.com/googleapis/google-cloud-go/commit/55f0d92bf112f14b024b4ab0076c9875a17423c9))
|
||||
* **logging:** support structured logging functionality ([#6029](https://github.com/googleapis/google-cloud-go/issues/6029)) ([56f4cdd](https://github.com/googleapis/google-cloud-go/commit/56f4cdd066cc9eaeece2c6fb466d58c3e7c41563))
|
||||
* **logging:** Update Logging API with latest changes ([5af548b](https://github.com/googleapis/google-cloud-go/commit/5af548bee4ffde279727b2e1ad9b072925106a74))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **logging:** remove instance_name resource label ([#5461](https://github.com/googleapis/google-cloud-go/issues/5461)) ([115385f](https://github.com/googleapis/google-cloud-go/commit/115385f066ee54cf35a093749bc2673a17b3fa08))
|
||||
|
||||
### [1.4.2](https://www.github.com/googleapis/google-cloud-go/compare/logging/v1.4.1...logging/v1.4.2) (2021-05-20)
|
||||
|
||||
|
||||
|
|
31
vendor/cloud.google.com/go/logging/README.md
generated
vendored
31
vendor/cloud.google.com/go/logging/README.md
generated
vendored
|
@ -3,8 +3,9 @@
|
|||
- [About Cloud Logging](https://cloud.google.com/logging/)
|
||||
- [API documentation](https://cloud.google.com/logging/docs)
|
||||
- [Go client documentation](https://pkg.go.dev/cloud.google.com/go/logging)
|
||||
- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/logging)
|
||||
- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/main/logging)
|
||||
|
||||
For an interactive tutorial on using the client library in a Go application, click [Guide Me](https://console.cloud.google.com/?walkthrough_id=logging__logging-go).
|
||||
### Example Usage
|
||||
|
||||
First create a `logging.Client` to use throughout your application:
|
||||
|
@ -27,12 +28,38 @@ logger := client.Logger("my-log")
|
|||
logger.Log(logging.Entry{Payload: "something happened!"})
|
||||
```
|
||||
|
||||
Close your client before your program exits, to flush any buffered log entries.
|
||||
If you need to write a critical log entry use synchronous ingestion method.
|
||||
[snip]:# (logging-3)
|
||||
|
||||
```go
|
||||
logger := client.Logger("my-log")
|
||||
logger.LogSync(context.Background(), logging.Entry{Payload: "something happened!"})
|
||||
```
|
||||
|
||||
Close your client before your program exits, to flush any buffered log entries.
|
||||
[snip]:# (logging-4)
|
||||
|
||||
```go
|
||||
err = client.Close()
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
```
|
||||
|
||||
### Logger configuration options
|
||||
|
||||
Creating a Logger using `logging.Logger` accept configuration [LoggerOption](loggeroption.go#L25) arguments. The following options are supported:
|
||||
|
||||
| Configuration option | Arguments | Description |
|
||||
| -------------------- | --------- | ----------- |
|
||||
| CommonLabels | `map[string]string` | The set of labels that will be ingested for all log entries ingested by Logger. |
|
||||
| ConcurrentWriteLimit | `int` | Number of parallel goroutine the Logger will use to ingest logs asynchronously. High number of routines may exhaust API quota. The default is 1. |
|
||||
| DelayThreshold | `time.Duration` | Maximum time a log entry is buffered on client before being ingested. The default is 1 second. |
|
||||
| EntryCountThreshold | `int` | Maximum number of log entries to be buffered on client before being ingested. The default is 1000. |
|
||||
| EntryByteThreshold | `int` | Maximum size in bytes of log entries to be buffered on client before being ingested. The default is 8MiB. |
|
||||
| EntryByteLimit | `int` | Maximum size in bytes of the single write call to ingest log entries. If EntryByteLimit is smaller than EntryByteThreshold, the latter has no effect. The default is zero, meaning there is no limit. |
|
||||
| BufferedByteLimit | `int` | Maximum number of bytes that the Logger will keep in memory before returning ErrOverflow. This option limits the total memory consumption of the Logger (but note that each Logger has its own, separate limit). It is possible to reach BufferedByteLimit even if it is larger than EntryByteThreshold or EntryByteLimit, because calls triggered by the latter two options may be enqueued (and hence occupying memory) while new log entries are being added. |
|
||||
| ContextFunc | `func() (ctx context.Context, afterCall func())` | Callback function to be called to obtain `context.Context` during async log ingestion. |
|
||||
| SourceLocationPopulation | One of `logging.DoNotPopulateSourceLocation`, `logging.PopulateSourceLocationForDebugEntries` or `logging.AlwaysPopulateSourceLocation` | Controls auto-population of the logging.Entry.SourceLocation field when ingesting log entries. Allows to disable population of source location info, allowing it only for log entries at Debug severity or enable it for all log entries. Enabling it for all entries may result in degradation in performance. Use `logging_test.BenchmarkSourceLocationPopulation` to test performance with and without the option. The default is set to `logging.DoNotPopulateSourceLocation`. |
|
||||
| PartialSuccess | | Make each write call to Logging service with [partialSuccess flag](https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write#body.request_body.FIELDS.partial_success) set. The default is to make calls without setting the flag. |
|
||||
| RedirectAsJSON | `io.Writer` | Converts log entries to Jsonified one line string according to the [structured logging format](https://cloud.google.com/logging/docs/structured-logging#special-payload-fields) and writes it to provided `io.Writer`. Users should use this option with `os.Stdout` and `os.Stderr` to leverage the out-of-process ingestion of logs using logging agents that are deployed in Cloud Logging environments. |
|
||||
|
|
2
vendor/cloud.google.com/go/logging/apiv2/README.md
generated
vendored
2
vendor/cloud.google.com/go/logging/apiv2/README.md
generated
vendored
|
@ -6,6 +6,4 @@ This package includes auto-generated clients for the logging v2 API.
|
|||
Use the handwritten logging client (in the parent directory,
|
||||
cloud.google.com/go/logging) in preference to this.
|
||||
|
||||
This code is EXPERIMENTAL and subject to CHANGE AT ANY TIME.
|
||||
|
||||
|
||||
|
|
708
vendor/cloud.google.com/go/logging/apiv2/config_client.go
generated
vendored
708
vendor/cloud.google.com/go/logging/apiv2/config_client.go
generated
vendored
File diff suppressed because it is too large
Load diff
71
vendor/cloud.google.com/go/logging/apiv2/doc.go
generated
vendored
71
vendor/cloud.google.com/go/logging/apiv2/doc.go
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2021 Google LLC
|
||||
// Copyright 2023 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -17,21 +17,65 @@
|
|||
// Package logging is an auto-generated package for the
|
||||
// Cloud Logging API.
|
||||
//
|
||||
// Writes log entries and manages your Cloud Logging configuration. The table
|
||||
// entries below are presented in alphabetical order, not in order of common
|
||||
// use. For explanations of the concepts found in the table entries, read the
|
||||
// documentation at https://cloud.google.com/logging/docs.
|
||||
// Writes log entries and manages your Cloud Logging configuration.
|
||||
//
|
||||
// Use of Context
|
||||
// # General documentation
|
||||
//
|
||||
// For information about setting deadlines, reusing contexts, and more
|
||||
// please visit https://pkg.go.dev/cloud.google.com/go.
|
||||
//
|
||||
// # Example usage
|
||||
//
|
||||
// To get started with this package, create a client.
|
||||
//
|
||||
// ctx := context.Background()
|
||||
// // This snippet has been automatically generated and should be regarded as a code template only.
|
||||
// // It will require modifications to work:
|
||||
// // - It may require correct/in-range values for request initialization.
|
||||
// // - It may require specifying regional endpoints when creating the service client as shown in:
|
||||
// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
|
||||
// c, err := logging.NewClient(ctx)
|
||||
// if err != nil {
|
||||
// // TODO: Handle error.
|
||||
// }
|
||||
// defer c.Close()
|
||||
//
|
||||
// The client will use your default application credentials. Clients should be reused instead of created as needed.
|
||||
// The methods of Client are safe for concurrent use by multiple goroutines.
|
||||
// The returned client must be Closed when it is done being used.
|
||||
//
|
||||
// # Using the Client
|
||||
//
|
||||
// The following is an example of making an API call with the newly created client.
|
||||
//
|
||||
// ctx := context.Background()
|
||||
// // This snippet has been automatically generated and should be regarded as a code template only.
|
||||
// // It will require modifications to work:
|
||||
// // - It may require correct/in-range values for request initialization.
|
||||
// // - It may require specifying regional endpoints when creating the service client as shown in:
|
||||
// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
|
||||
// c, err := logging.NewClient(ctx)
|
||||
// if err != nil {
|
||||
// // TODO: Handle error.
|
||||
// }
|
||||
// defer c.Close()
|
||||
//
|
||||
// req := &loggingpb.DeleteLogRequest{
|
||||
// // TODO: Fill request struct fields.
|
||||
// // See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#DeleteLogRequest.
|
||||
// }
|
||||
// err = c.DeleteLog(ctx, req)
|
||||
// if err != nil {
|
||||
// // TODO: Handle error.
|
||||
// }
|
||||
//
|
||||
// # Use of Context
|
||||
//
|
||||
// The ctx passed to NewClient is used for authentication requests and
|
||||
// for creating the underlying connection, but is not used for subsequent calls.
|
||||
// Individual methods on the client use the ctx given to them.
|
||||
//
|
||||
// To close the open connection, use the Close() method.
|
||||
//
|
||||
// For information about setting deadlines, reusing contexts, and more
|
||||
// please visit pkg.go.dev/cloud.google.com/go.
|
||||
package logging // import "cloud.google.com/go/logging/apiv2"
|
||||
|
||||
import (
|
||||
|
@ -51,7 +95,14 @@ import (
|
|||
type clientHookParams struct{}
|
||||
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
|
||||
|
||||
const versionClient = "20210518"
|
||||
var versionClient string
|
||||
|
||||
func getVersionClient() string {
|
||||
if versionClient == "" {
|
||||
return "UNKNOWN"
|
||||
}
|
||||
return versionClient
|
||||
}
|
||||
|
||||
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
|
||||
out, _ := metadata.FromOutgoingContext(ctx)
|
||||
|
|
15
vendor/cloud.google.com/go/logging/apiv2/gapic_metadata.json
generated
vendored
15
vendor/cloud.google.com/go/logging/apiv2/gapic_metadata.json
generated
vendored
|
@ -10,6 +10,11 @@
|
|||
"grpc": {
|
||||
"libraryClient": "ConfigClient",
|
||||
"rpcs": {
|
||||
"CopyLogEntries": {
|
||||
"methods": [
|
||||
"CopyLogEntries"
|
||||
]
|
||||
},
|
||||
"CreateBucket": {
|
||||
"methods": [
|
||||
"CreateBucket"
|
||||
|
@ -65,6 +70,11 @@
|
|||
"GetExclusion"
|
||||
]
|
||||
},
|
||||
"GetSettings": {
|
||||
"methods": [
|
||||
"GetSettings"
|
||||
]
|
||||
},
|
||||
"GetSink": {
|
||||
"methods": [
|
||||
"GetSink"
|
||||
|
@ -115,6 +125,11 @@
|
|||
"UpdateExclusion"
|
||||
]
|
||||
},
|
||||
"UpdateSettings": {
|
||||
"methods": [
|
||||
"UpdateSettings"
|
||||
]
|
||||
},
|
||||
"UpdateSink": {
|
||||
"methods": [
|
||||
"UpdateSink"
|
||||
|
|
218
vendor/cloud.google.com/go/logging/apiv2/logging_client.go
generated
vendored
218
vendor/cloud.google.com/go/logging/apiv2/logging_client.go
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2021 Google LLC
|
||||
// Copyright 2023 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -23,17 +23,17 @@ import (
|
|||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
|
||||
gax "github.com/googleapis/gax-go/v2"
|
||||
"google.golang.org/api/iterator"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/option/internaloption"
|
||||
gtransport "google.golang.org/api/transport/grpc"
|
||||
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
loggingpb "google.golang.org/genproto/googleapis/logging/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var newClientHook clientHook
|
||||
|
@ -48,13 +48,13 @@ type CallOptions struct {
|
|||
TailLogEntries []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultClientOptions() []option.ClientOption {
|
||||
func defaultGRPCClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
internaloption.WithDefaultEndpoint("logging.googleapis.com:443"),
|
||||
internaloption.WithDefaultMTLSEndpoint("logging.mtls.googleapis.com:443"),
|
||||
internaloption.WithDefaultAudience("https://logging.googleapis.com/"),
|
||||
internaloption.WithDefaultScopes(DefaultAuthScopes()...),
|
||||
option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
|
||||
internaloption.EnableJwtWithScope(),
|
||||
option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
|
||||
grpc.MaxCallRecvMsgSize(math.MaxInt32))),
|
||||
}
|
||||
|
@ -143,32 +143,124 @@ func defaultCallOptions() *CallOptions {
|
|||
}
|
||||
}
|
||||
|
||||
// internalClient is an interface that defines the methods available from Cloud Logging API.
|
||||
type internalClient interface {
|
||||
Close() error
|
||||
setGoogleClientInfo(...string)
|
||||
Connection() *grpc.ClientConn
|
||||
DeleteLog(context.Context, *loggingpb.DeleteLogRequest, ...gax.CallOption) error
|
||||
WriteLogEntries(context.Context, *loggingpb.WriteLogEntriesRequest, ...gax.CallOption) (*loggingpb.WriteLogEntriesResponse, error)
|
||||
ListLogEntries(context.Context, *loggingpb.ListLogEntriesRequest, ...gax.CallOption) *LogEntryIterator
|
||||
ListMonitoredResourceDescriptors(context.Context, *loggingpb.ListMonitoredResourceDescriptorsRequest, ...gax.CallOption) *MonitoredResourceDescriptorIterator
|
||||
ListLogs(context.Context, *loggingpb.ListLogsRequest, ...gax.CallOption) *StringIterator
|
||||
TailLogEntries(context.Context, ...gax.CallOption) (loggingpb.LoggingServiceV2_TailLogEntriesClient, error)
|
||||
}
|
||||
|
||||
// Client is a client for interacting with Cloud Logging API.
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
//
|
||||
// Service for ingesting and querying logs.
|
||||
type Client struct {
|
||||
// The internal transport-dependent client.
|
||||
internalClient internalClient
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *CallOptions
|
||||
}
|
||||
|
||||
// Wrapper methods routed to the internal client.
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *Client) Close() error {
|
||||
return c.internalClient.Close()
|
||||
}
|
||||
|
||||
// setGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *Client) setGoogleClientInfo(keyval ...string) {
|
||||
c.internalClient.setGoogleClientInfo(keyval...)
|
||||
}
|
||||
|
||||
// Connection returns a connection to the API service.
|
||||
//
|
||||
// Deprecated: Connections are now pooled so this method does not always
|
||||
// return the same resource.
|
||||
func (c *Client) Connection() *grpc.ClientConn {
|
||||
return c.internalClient.Connection()
|
||||
}
|
||||
|
||||
// DeleteLog deletes all the log entries in a log for the _Default Log Bucket. The log
|
||||
// reappears if it receives new entries. Log entries written shortly before
|
||||
// the delete operation might not be deleted. Entries received after the
|
||||
// delete operation with a timestamp before the operation will be deleted.
|
||||
func (c *Client) DeleteLog(ctx context.Context, req *loggingpb.DeleteLogRequest, opts ...gax.CallOption) error {
|
||||
return c.internalClient.DeleteLog(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// WriteLogEntries writes log entries to Logging. This API method is the
|
||||
// only way to send log entries to Logging. This method
|
||||
// is used, directly or indirectly, by the Logging agent
|
||||
// (fluentd) and all logging libraries configured to use Logging.
|
||||
// A single request may contain log entries for a maximum of 1000
|
||||
// different resources (projects, organizations, billing accounts or
|
||||
// folders)
|
||||
func (c *Client) WriteLogEntries(ctx context.Context, req *loggingpb.WriteLogEntriesRequest, opts ...gax.CallOption) (*loggingpb.WriteLogEntriesResponse, error) {
|
||||
return c.internalClient.WriteLogEntries(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// ListLogEntries lists log entries. Use this method to retrieve log entries that originated
|
||||
// from a project/folder/organization/billing account. For ways to export log
|
||||
// entries, see Exporting
|
||||
// Logs (at https://cloud.google.com/logging/docs/export).
|
||||
func (c *Client) ListLogEntries(ctx context.Context, req *loggingpb.ListLogEntriesRequest, opts ...gax.CallOption) *LogEntryIterator {
|
||||
return c.internalClient.ListLogEntries(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// ListMonitoredResourceDescriptors lists the descriptors for monitored resource types used by Logging.
|
||||
func (c *Client) ListMonitoredResourceDescriptors(ctx context.Context, req *loggingpb.ListMonitoredResourceDescriptorsRequest, opts ...gax.CallOption) *MonitoredResourceDescriptorIterator {
|
||||
return c.internalClient.ListMonitoredResourceDescriptors(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// ListLogs lists the logs in projects, organizations, folders, or billing accounts.
|
||||
// Only logs that have entries are listed.
|
||||
func (c *Client) ListLogs(ctx context.Context, req *loggingpb.ListLogsRequest, opts ...gax.CallOption) *StringIterator {
|
||||
return c.internalClient.ListLogs(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// TailLogEntries streaming read of log entries as they are ingested. Until the stream is
|
||||
// terminated, it will continue reading logs.
|
||||
func (c *Client) TailLogEntries(ctx context.Context, opts ...gax.CallOption) (loggingpb.LoggingServiceV2_TailLogEntriesClient, error) {
|
||||
return c.internalClient.TailLogEntries(ctx, opts...)
|
||||
}
|
||||
|
||||
// gRPCClient is a client for interacting with Cloud Logging API over gRPC transport.
|
||||
//
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
type Client struct {
|
||||
type gRPCClient struct {
|
||||
// Connection pool of gRPC connections to the service.
|
||||
connPool gtransport.ConnPool
|
||||
|
||||
// flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE
|
||||
disableDeadlines bool
|
||||
|
||||
// Points back to the CallOptions field of the containing Client
|
||||
CallOptions **CallOptions
|
||||
|
||||
// The gRPC API client.
|
||||
client loggingpb.LoggingServiceV2Client
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *CallOptions
|
||||
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewClient creates a new logging service v2 client.
|
||||
// NewClient creates a new logging service v2 client based on gRPC.
|
||||
// The returned client must be Closed when it is done being used to clean up its underlying connections.
|
||||
//
|
||||
// Service for ingesting and querying logs.
|
||||
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
|
||||
clientOpts := defaultClientOptions()
|
||||
|
||||
clientOpts := defaultGRPCClientOptions()
|
||||
if newClientHook != nil {
|
||||
hookOpts, err := newClientHook(ctx, clientHookParams{})
|
||||
if err != nil {
|
||||
|
@ -186,53 +278,54 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &Client{
|
||||
client := Client{CallOptions: defaultCallOptions()}
|
||||
|
||||
c := &gRPCClient{
|
||||
connPool: connPool,
|
||||
disableDeadlines: disableDeadlines,
|
||||
CallOptions: defaultCallOptions(),
|
||||
|
||||
client: loggingpb.NewLoggingServiceV2Client(connPool),
|
||||
CallOptions: &client.CallOptions,
|
||||
}
|
||||
c.setGoogleClientInfo()
|
||||
|
||||
return c, nil
|
||||
client.internalClient = c
|
||||
|
||||
return &client, nil
|
||||
}
|
||||
|
||||
// Connection returns a connection to the API service.
|
||||
//
|
||||
// Deprecated.
|
||||
func (c *Client) Connection() *grpc.ClientConn {
|
||||
// Deprecated: Connections are now pooled so this method does not always
|
||||
// return the same resource.
|
||||
func (c *gRPCClient) Connection() *grpc.ClientConn {
|
||||
return c.connPool.Conn()
|
||||
}
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *Client) Close() error {
|
||||
return c.connPool.Close()
|
||||
}
|
||||
|
||||
// setGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *Client) setGoogleClientInfo(keyval ...string) {
|
||||
func (c *gRPCClient) setGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", versionGo()}, keyval...)
|
||||
kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
|
||||
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version)
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// DeleteLog deletes all the log entries in a log. The log reappears if it receives new
|
||||
// entries. Log entries written shortly before the delete operation might not
|
||||
// be deleted. Entries received after the delete operation with a timestamp
|
||||
// before the operation will be deleted.
|
||||
func (c *Client) DeleteLog(ctx context.Context, req *loggingpb.DeleteLogRequest, opts ...gax.CallOption) error {
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *gRPCClient) Close() error {
|
||||
return c.connPool.Close()
|
||||
}
|
||||
|
||||
func (c *gRPCClient) DeleteLog(ctx context.Context, req *loggingpb.DeleteLogRequest, opts ...gax.CallOption) error {
|
||||
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
|
||||
cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
|
||||
defer cancel()
|
||||
ctx = cctx
|
||||
}
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "log_name", url.QueryEscape(req.GetLogName())))
|
||||
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
|
||||
opts = append(c.CallOptions.DeleteLog[0:len(c.CallOptions.DeleteLog):len(c.CallOptions.DeleteLog)], opts...)
|
||||
opts = append((*c.CallOptions).DeleteLog[0:len((*c.CallOptions).DeleteLog):len((*c.CallOptions).DeleteLog)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
_, err = c.client.DeleteLog(ctx, req, settings.GRPC...)
|
||||
|
@ -241,21 +334,14 @@ func (c *Client) DeleteLog(ctx context.Context, req *loggingpb.DeleteLogRequest,
|
|||
return err
|
||||
}
|
||||
|
||||
// WriteLogEntries writes log entries to Logging. This API method is the
|
||||
// only way to send log entries to Logging. This method
|
||||
// is used, directly or indirectly, by the Logging agent
|
||||
// (fluentd) and all logging libraries configured to use Logging.
|
||||
// A single request may contain log entries for a maximum of 1000
|
||||
// different resources (projects, organizations, billing accounts or
|
||||
// folders)
|
||||
func (c *Client) WriteLogEntries(ctx context.Context, req *loggingpb.WriteLogEntriesRequest, opts ...gax.CallOption) (*loggingpb.WriteLogEntriesResponse, error) {
|
||||
func (c *gRPCClient) WriteLogEntries(ctx context.Context, req *loggingpb.WriteLogEntriesRequest, opts ...gax.CallOption) (*loggingpb.WriteLogEntriesResponse, error) {
|
||||
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
|
||||
cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
|
||||
defer cancel()
|
||||
ctx = cctx
|
||||
}
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.WriteLogEntries[0:len(c.CallOptions.WriteLogEntries):len(c.CallOptions.WriteLogEntries)], opts...)
|
||||
opts = append((*c.CallOptions).WriteLogEntries[0:len((*c.CallOptions).WriteLogEntries):len((*c.CallOptions).WriteLogEntries)], opts...)
|
||||
var resp *loggingpb.WriteLogEntriesResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
|
@ -268,21 +354,19 @@ func (c *Client) WriteLogEntries(ctx context.Context, req *loggingpb.WriteLogEnt
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
// ListLogEntries lists log entries. Use this method to retrieve log entries that originated
|
||||
// from a project/folder/organization/billing account. For ways to export log
|
||||
// entries, see Exporting
|
||||
// Logs (at https://cloud.google.com/logging/docs/export).
|
||||
func (c *Client) ListLogEntries(ctx context.Context, req *loggingpb.ListLogEntriesRequest, opts ...gax.CallOption) *LogEntryIterator {
|
||||
func (c *gRPCClient) ListLogEntries(ctx context.Context, req *loggingpb.ListLogEntriesRequest, opts ...gax.CallOption) *LogEntryIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListLogEntries[0:len(c.CallOptions.ListLogEntries):len(c.CallOptions.ListLogEntries)], opts...)
|
||||
opts = append((*c.CallOptions).ListLogEntries[0:len((*c.CallOptions).ListLogEntries):len((*c.CallOptions).ListLogEntries)], opts...)
|
||||
it := &LogEntryIterator{}
|
||||
req = proto.Clone(req).(*loggingpb.ListLogEntriesRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogEntry, string, error) {
|
||||
var resp *loggingpb.ListLogEntriesResponse
|
||||
resp := &loggingpb.ListLogEntriesResponse{}
|
||||
if pageToken != "" {
|
||||
req.PageToken = pageToken
|
||||
}
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
} else if pageSize != 0 {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
|
@ -305,24 +389,27 @@ func (c *Client) ListLogEntries(ctx context.Context, req *loggingpb.ListLogEntri
|
|||
it.items = append(it.items, items...)
|
||||
return nextPageToken, nil
|
||||
}
|
||||
|
||||
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
|
||||
it.pageInfo.MaxSize = int(req.GetPageSize())
|
||||
it.pageInfo.Token = req.GetPageToken()
|
||||
|
||||
return it
|
||||
}
|
||||
|
||||
// ListMonitoredResourceDescriptors lists the descriptors for monitored resource types used by Logging.
|
||||
func (c *Client) ListMonitoredResourceDescriptors(ctx context.Context, req *loggingpb.ListMonitoredResourceDescriptorsRequest, opts ...gax.CallOption) *MonitoredResourceDescriptorIterator {
|
||||
func (c *gRPCClient) ListMonitoredResourceDescriptors(ctx context.Context, req *loggingpb.ListMonitoredResourceDescriptorsRequest, opts ...gax.CallOption) *MonitoredResourceDescriptorIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListMonitoredResourceDescriptors[0:len(c.CallOptions.ListMonitoredResourceDescriptors):len(c.CallOptions.ListMonitoredResourceDescriptors)], opts...)
|
||||
opts = append((*c.CallOptions).ListMonitoredResourceDescriptors[0:len((*c.CallOptions).ListMonitoredResourceDescriptors):len((*c.CallOptions).ListMonitoredResourceDescriptors)], opts...)
|
||||
it := &MonitoredResourceDescriptorIterator{}
|
||||
req = proto.Clone(req).(*loggingpb.ListMonitoredResourceDescriptorsRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoredrespb.MonitoredResourceDescriptor, string, error) {
|
||||
var resp *loggingpb.ListMonitoredResourceDescriptorsResponse
|
||||
resp := &loggingpb.ListMonitoredResourceDescriptorsResponse{}
|
||||
if pageToken != "" {
|
||||
req.PageToken = pageToken
|
||||
}
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
} else if pageSize != 0 {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
|
@ -345,26 +432,29 @@ func (c *Client) ListMonitoredResourceDescriptors(ctx context.Context, req *logg
|
|||
it.items = append(it.items, items...)
|
||||
return nextPageToken, nil
|
||||
}
|
||||
|
||||
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
|
||||
it.pageInfo.MaxSize = int(req.GetPageSize())
|
||||
it.pageInfo.Token = req.GetPageToken()
|
||||
|
||||
return it
|
||||
}
|
||||
|
||||
// ListLogs lists the logs in projects, organizations, folders, or billing accounts.
|
||||
// Only logs that have entries are listed.
|
||||
func (c *Client) ListLogs(ctx context.Context, req *loggingpb.ListLogsRequest, opts ...gax.CallOption) *StringIterator {
|
||||
func (c *gRPCClient) ListLogs(ctx context.Context, req *loggingpb.ListLogsRequest, opts ...gax.CallOption) *StringIterator {
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
|
||||
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
|
||||
opts = append(c.CallOptions.ListLogs[0:len(c.CallOptions.ListLogs):len(c.CallOptions.ListLogs)], opts...)
|
||||
opts = append((*c.CallOptions).ListLogs[0:len((*c.CallOptions).ListLogs):len((*c.CallOptions).ListLogs)], opts...)
|
||||
it := &StringIterator{}
|
||||
req = proto.Clone(req).(*loggingpb.ListLogsRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]string, string, error) {
|
||||
var resp *loggingpb.ListLogsResponse
|
||||
resp := &loggingpb.ListLogsResponse{}
|
||||
if pageToken != "" {
|
||||
req.PageToken = pageToken
|
||||
}
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
} else if pageSize != 0 {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
|
@ -387,18 +477,18 @@ func (c *Client) ListLogs(ctx context.Context, req *loggingpb.ListLogsRequest, o
|
|||
it.items = append(it.items, items...)
|
||||
return nextPageToken, nil
|
||||
}
|
||||
|
||||
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
|
||||
it.pageInfo.MaxSize = int(req.GetPageSize())
|
||||
it.pageInfo.Token = req.GetPageToken()
|
||||
|
||||
return it
|
||||
}
|
||||
|
||||
// TailLogEntries streaming read of log entries as they are ingested. Until the stream is
|
||||
// terminated, it will continue reading logs.
|
||||
func (c *Client) TailLogEntries(ctx context.Context, opts ...gax.CallOption) (loggingpb.LoggingServiceV2_TailLogEntriesClient, error) {
|
||||
func (c *gRPCClient) TailLogEntries(ctx context.Context, opts ...gax.CallOption) (loggingpb.LoggingServiceV2_TailLogEntriesClient, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.TailLogEntries[0:len(c.CallOptions.TailLogEntries):len(c.CallOptions.TailLogEntries)], opts...)
|
||||
var resp loggingpb.LoggingServiceV2_TailLogEntriesClient
|
||||
opts = append((*c.CallOptions).TailLogEntries[0:len((*c.CallOptions).TailLogEntries):len((*c.CallOptions).TailLogEntries)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.client.TailLogEntries(ctx, settings.GRPC...)
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.12.2
|
||||
// protoc v3.21.9
|
||||
// source: google/logging/v2/log_entry.proto
|
||||
|
||||
package logging
|
||||
package loggingpb
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
|
@ -80,6 +80,7 @@ type LogEntry struct {
|
|||
// The log entry payload, which can be one of multiple types.
|
||||
//
|
||||
// Types that are assignable to Payload:
|
||||
//
|
||||
// *LogEntry_ProtoPayload
|
||||
// *LogEntry_TextPayload
|
||||
// *LogEntry_JsonPayload
|
|
@ -15,10 +15,10 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.12.2
|
||||
// protoc v3.21.9
|
||||
// source: google/logging/v2/logging.proto
|
||||
|
||||
package logging
|
||||
package loggingpb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
@ -420,10 +420,10 @@ type ListLogEntriesRequest struct {
|
|||
//
|
||||
// May alternatively be one or more views:
|
||||
//
|
||||
// * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
//
|
||||
// Projects listed in the `project_ids` field are added to this list.
|
||||
ResourceNames []string `protobuf:"bytes,8,rep,name=resource_names,json=resourceNames,proto3" json:"resource_names,omitempty"`
|
||||
|
@ -737,10 +737,10 @@ type ListLogsRequest struct {
|
|||
PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
|
||||
// Optional. The resource name that owns the logs:
|
||||
//
|
||||
// * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
//
|
||||
// To support legacy queries, it could also be:
|
||||
//
|
||||
|
@ -888,10 +888,10 @@ type TailLogEntriesRequest struct {
|
|||
//
|
||||
// May alternatively be one or more views:
|
||||
//
|
||||
// * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
// - `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
|
||||
ResourceNames []string `protobuf:"bytes,1,rep,name=resource_names,json=resourceNames,proto3" json:"resource_names,omitempty"`
|
||||
// Optional. A filter that chooses which log entries to return. See [Advanced
|
||||
// Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
|
|
@ -15,10 +15,10 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.12.2
|
||||
// protoc v3.21.9
|
||||
// source: google/logging/v2/logging_config.proto
|
||||
|
||||
package logging
|
||||
package loggingpb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
@ -570,6 +570,7 @@ type LogSink struct {
|
|||
// Destination dependent options.
|
||||
//
|
||||
// Types that are assignable to Options:
|
||||
//
|
||||
// *LogSink_BigqueryOptions
|
||||
Options isLogSink_Options `protobuf_oneof:"options"`
|
||||
// Output only. The creation timestamp of the sink.
|
||||
|
@ -1970,11 +1971,11 @@ type UpdateSinkRequest struct {
|
|||
// field on the value of `writer_identity` in the updated sink depends on both
|
||||
// the old and new values of this field:
|
||||
//
|
||||
// + If the old and new values of this field are both false or both true,
|
||||
// - If the old and new values of this field are both false or both true,
|
||||
// then there is no change to the sink's `writer_identity`.
|
||||
// + If the old value is false and the new value is true, then
|
||||
// - If the old value is false and the new value is true, then
|
||||
// `writer_identity` is changed to a unique service account.
|
||||
// + It is an error if the old value is true and the new value is
|
||||
// - It is an error if the old value is true and the new value is
|
||||
// set to false or defaulted to false.
|
||||
UniqueWriterIdentity bool `protobuf:"varint,3,opt,name=unique_writer_identity,json=uniqueWriterIdentity,proto3" json:"unique_writer_identity,omitempty"`
|
||||
// Optional. Field mask that specifies the fields in `sink` that need
|
||||
|
@ -2827,8 +2828,6 @@ type CmekSettings struct {
|
|||
//
|
||||
// `"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key"`
|
||||
//
|
||||
//
|
||||
//
|
||||
// To enable CMEK for the Log Router, set this field to a valid
|
||||
// `kms_key_name` for which the associated service account has the required
|
||||
// cloudkms.cryptoKeyEncrypterDecrypter roles assigned for the key.
|
||||
|
@ -3093,8 +3092,6 @@ type Settings struct {
|
|||
//
|
||||
// `"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key"`
|
||||
//
|
||||
//
|
||||
//
|
||||
// To enable CMEK for the Log Router, set this field to a valid
|
||||
// `kms_key_name` for which the associated service account has the required
|
||||
// `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key.
|
|
@ -15,10 +15,10 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.12.2
|
||||
// protoc v3.21.9
|
||||
// source: google/logging/v2/logging_metrics.proto
|
||||
|
||||
package logging
|
||||
package loggingpb
|
||||
|
||||
import (
|
||||
context "context"
|
166
vendor/cloud.google.com/go/logging/apiv2/metrics_client.go
generated
vendored
166
vendor/cloud.google.com/go/logging/apiv2/metrics_client.go
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2021 Google LLC
|
||||
// Copyright 2023 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -23,16 +23,16 @@ import (
|
|||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
|
||||
gax "github.com/googleapis/gax-go/v2"
|
||||
"google.golang.org/api/iterator"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/option/internaloption"
|
||||
gtransport "google.golang.org/api/transport/grpc"
|
||||
loggingpb "google.golang.org/genproto/googleapis/logging/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var newMetricsClientHook clientHook
|
||||
|
@ -46,13 +46,13 @@ type MetricsCallOptions struct {
|
|||
DeleteLogMetric []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultMetricsClientOptions() []option.ClientOption {
|
||||
func defaultMetricsGRPCClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
internaloption.WithDefaultEndpoint("logging.googleapis.com:443"),
|
||||
internaloption.WithDefaultMTLSEndpoint("logging.mtls.googleapis.com:443"),
|
||||
internaloption.WithDefaultAudience("https://logging.googleapis.com/"),
|
||||
internaloption.WithDefaultScopes(DefaultAuthScopes()...),
|
||||
option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
|
||||
internaloption.EnableJwtWithScope(),
|
||||
option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
|
||||
grpc.MaxCallRecvMsgSize(math.MaxInt32))),
|
||||
}
|
||||
|
@ -116,32 +116,104 @@ func defaultMetricsCallOptions() *MetricsCallOptions {
|
|||
}
|
||||
}
|
||||
|
||||
// internalMetricsClient is an interface that defines the methods available from Cloud Logging API.
|
||||
type internalMetricsClient interface {
|
||||
Close() error
|
||||
setGoogleClientInfo(...string)
|
||||
Connection() *grpc.ClientConn
|
||||
ListLogMetrics(context.Context, *loggingpb.ListLogMetricsRequest, ...gax.CallOption) *LogMetricIterator
|
||||
GetLogMetric(context.Context, *loggingpb.GetLogMetricRequest, ...gax.CallOption) (*loggingpb.LogMetric, error)
|
||||
CreateLogMetric(context.Context, *loggingpb.CreateLogMetricRequest, ...gax.CallOption) (*loggingpb.LogMetric, error)
|
||||
UpdateLogMetric(context.Context, *loggingpb.UpdateLogMetricRequest, ...gax.CallOption) (*loggingpb.LogMetric, error)
|
||||
DeleteLogMetric(context.Context, *loggingpb.DeleteLogMetricRequest, ...gax.CallOption) error
|
||||
}
|
||||
|
||||
// MetricsClient is a client for interacting with Cloud Logging API.
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
//
|
||||
// Service for configuring logs-based metrics.
|
||||
type MetricsClient struct {
|
||||
// The internal transport-dependent client.
|
||||
internalClient internalMetricsClient
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *MetricsCallOptions
|
||||
}
|
||||
|
||||
// Wrapper methods routed to the internal client.
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *MetricsClient) Close() error {
|
||||
return c.internalClient.Close()
|
||||
}
|
||||
|
||||
// setGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *MetricsClient) setGoogleClientInfo(keyval ...string) {
|
||||
c.internalClient.setGoogleClientInfo(keyval...)
|
||||
}
|
||||
|
||||
// Connection returns a connection to the API service.
|
||||
//
|
||||
// Deprecated: Connections are now pooled so this method does not always
|
||||
// return the same resource.
|
||||
func (c *MetricsClient) Connection() *grpc.ClientConn {
|
||||
return c.internalClient.Connection()
|
||||
}
|
||||
|
||||
// ListLogMetrics lists logs-based metrics.
|
||||
func (c *MetricsClient) ListLogMetrics(ctx context.Context, req *loggingpb.ListLogMetricsRequest, opts ...gax.CallOption) *LogMetricIterator {
|
||||
return c.internalClient.ListLogMetrics(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// GetLogMetric gets a logs-based metric.
|
||||
func (c *MetricsClient) GetLogMetric(ctx context.Context, req *loggingpb.GetLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
|
||||
return c.internalClient.GetLogMetric(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// CreateLogMetric creates a logs-based metric.
|
||||
func (c *MetricsClient) CreateLogMetric(ctx context.Context, req *loggingpb.CreateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
|
||||
return c.internalClient.CreateLogMetric(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// UpdateLogMetric creates or updates a logs-based metric.
|
||||
func (c *MetricsClient) UpdateLogMetric(ctx context.Context, req *loggingpb.UpdateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
|
||||
return c.internalClient.UpdateLogMetric(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// DeleteLogMetric deletes a logs-based metric.
|
||||
func (c *MetricsClient) DeleteLogMetric(ctx context.Context, req *loggingpb.DeleteLogMetricRequest, opts ...gax.CallOption) error {
|
||||
return c.internalClient.DeleteLogMetric(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// metricsGRPCClient is a client for interacting with Cloud Logging API over gRPC transport.
|
||||
//
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
type MetricsClient struct {
|
||||
type metricsGRPCClient struct {
|
||||
// Connection pool of gRPC connections to the service.
|
||||
connPool gtransport.ConnPool
|
||||
|
||||
// flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE
|
||||
disableDeadlines bool
|
||||
|
||||
// Points back to the CallOptions field of the containing MetricsClient
|
||||
CallOptions **MetricsCallOptions
|
||||
|
||||
// The gRPC API client.
|
||||
metricsClient loggingpb.MetricsServiceV2Client
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *MetricsCallOptions
|
||||
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewMetricsClient creates a new metrics service v2 client.
|
||||
// NewMetricsClient creates a new metrics service v2 client based on gRPC.
|
||||
// The returned client must be Closed when it is done being used to clean up its underlying connections.
|
||||
//
|
||||
// Service for configuring logs-based metrics.
|
||||
func NewMetricsClient(ctx context.Context, opts ...option.ClientOption) (*MetricsClient, error) {
|
||||
clientOpts := defaultMetricsClientOptions()
|
||||
|
||||
clientOpts := defaultMetricsGRPCClientOptions()
|
||||
if newMetricsClientHook != nil {
|
||||
hookOpts, err := newMetricsClientHook(ctx, clientHookParams{})
|
||||
if err != nil {
|
||||
|
@ -159,53 +231,59 @@ func NewMetricsClient(ctx context.Context, opts ...option.ClientOption) (*Metric
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &MetricsClient{
|
||||
client := MetricsClient{CallOptions: defaultMetricsCallOptions()}
|
||||
|
||||
c := &metricsGRPCClient{
|
||||
connPool: connPool,
|
||||
disableDeadlines: disableDeadlines,
|
||||
CallOptions: defaultMetricsCallOptions(),
|
||||
|
||||
metricsClient: loggingpb.NewMetricsServiceV2Client(connPool),
|
||||
CallOptions: &client.CallOptions,
|
||||
}
|
||||
c.setGoogleClientInfo()
|
||||
|
||||
return c, nil
|
||||
client.internalClient = c
|
||||
|
||||
return &client, nil
|
||||
}
|
||||
|
||||
// Connection returns a connection to the API service.
|
||||
//
|
||||
// Deprecated.
|
||||
func (c *MetricsClient) Connection() *grpc.ClientConn {
|
||||
// Deprecated: Connections are now pooled so this method does not always
|
||||
// return the same resource.
|
||||
func (c *metricsGRPCClient) Connection() *grpc.ClientConn {
|
||||
return c.connPool.Conn()
|
||||
}
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *MetricsClient) Close() error {
|
||||
return c.connPool.Close()
|
||||
}
|
||||
|
||||
// setGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *MetricsClient) setGoogleClientInfo(keyval ...string) {
|
||||
func (c *metricsGRPCClient) setGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", versionGo()}, keyval...)
|
||||
kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
|
||||
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version)
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// ListLogMetrics lists logs-based metrics.
|
||||
func (c *MetricsClient) ListLogMetrics(ctx context.Context, req *loggingpb.ListLogMetricsRequest, opts ...gax.CallOption) *LogMetricIterator {
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *metricsGRPCClient) Close() error {
|
||||
return c.connPool.Close()
|
||||
}
|
||||
|
||||
func (c *metricsGRPCClient) ListLogMetrics(ctx context.Context, req *loggingpb.ListLogMetricsRequest, opts ...gax.CallOption) *LogMetricIterator {
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
|
||||
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
|
||||
opts = append(c.CallOptions.ListLogMetrics[0:len(c.CallOptions.ListLogMetrics):len(c.CallOptions.ListLogMetrics)], opts...)
|
||||
opts = append((*c.CallOptions).ListLogMetrics[0:len((*c.CallOptions).ListLogMetrics):len((*c.CallOptions).ListLogMetrics)], opts...)
|
||||
it := &LogMetricIterator{}
|
||||
req = proto.Clone(req).(*loggingpb.ListLogMetricsRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogMetric, string, error) {
|
||||
var resp *loggingpb.ListLogMetricsResponse
|
||||
resp := &loggingpb.ListLogMetricsResponse{}
|
||||
if pageToken != "" {
|
||||
req.PageToken = pageToken
|
||||
}
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
} else if pageSize != 0 {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
|
@ -228,22 +306,24 @@ func (c *MetricsClient) ListLogMetrics(ctx context.Context, req *loggingpb.ListL
|
|||
it.items = append(it.items, items...)
|
||||
return nextPageToken, nil
|
||||
}
|
||||
|
||||
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
|
||||
it.pageInfo.MaxSize = int(req.GetPageSize())
|
||||
it.pageInfo.Token = req.GetPageToken()
|
||||
|
||||
return it
|
||||
}
|
||||
|
||||
// GetLogMetric gets a logs-based metric.
|
||||
func (c *MetricsClient) GetLogMetric(ctx context.Context, req *loggingpb.GetLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
|
||||
func (c *metricsGRPCClient) GetLogMetric(ctx context.Context, req *loggingpb.GetLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
|
||||
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
|
||||
cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
|
||||
defer cancel()
|
||||
ctx = cctx
|
||||
}
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "metric_name", url.QueryEscape(req.GetMetricName())))
|
||||
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
|
||||
opts = append(c.CallOptions.GetLogMetric[0:len(c.CallOptions.GetLogMetric):len(c.CallOptions.GetLogMetric)], opts...)
|
||||
opts = append((*c.CallOptions).GetLogMetric[0:len((*c.CallOptions).GetLogMetric):len((*c.CallOptions).GetLogMetric)], opts...)
|
||||
var resp *loggingpb.LogMetric
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
|
@ -256,16 +336,16 @@ func (c *MetricsClient) GetLogMetric(ctx context.Context, req *loggingpb.GetLogM
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
// CreateLogMetric creates a logs-based metric.
|
||||
func (c *MetricsClient) CreateLogMetric(ctx context.Context, req *loggingpb.CreateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
|
||||
func (c *metricsGRPCClient) CreateLogMetric(ctx context.Context, req *loggingpb.CreateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
|
||||
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
|
||||
cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
|
||||
defer cancel()
|
||||
ctx = cctx
|
||||
}
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
|
||||
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
|
||||
opts = append(c.CallOptions.CreateLogMetric[0:len(c.CallOptions.CreateLogMetric):len(c.CallOptions.CreateLogMetric)], opts...)
|
||||
opts = append((*c.CallOptions).CreateLogMetric[0:len((*c.CallOptions).CreateLogMetric):len((*c.CallOptions).CreateLogMetric)], opts...)
|
||||
var resp *loggingpb.LogMetric
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
|
@ -278,16 +358,16 @@ func (c *MetricsClient) CreateLogMetric(ctx context.Context, req *loggingpb.Crea
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
// UpdateLogMetric creates or updates a logs-based metric.
|
||||
func (c *MetricsClient) UpdateLogMetric(ctx context.Context, req *loggingpb.UpdateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
|
||||
func (c *metricsGRPCClient) UpdateLogMetric(ctx context.Context, req *loggingpb.UpdateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) {
|
||||
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
|
||||
cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
|
||||
defer cancel()
|
||||
ctx = cctx
|
||||
}
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "metric_name", url.QueryEscape(req.GetMetricName())))
|
||||
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
|
||||
opts = append(c.CallOptions.UpdateLogMetric[0:len(c.CallOptions.UpdateLogMetric):len(c.CallOptions.UpdateLogMetric)], opts...)
|
||||
opts = append((*c.CallOptions).UpdateLogMetric[0:len((*c.CallOptions).UpdateLogMetric):len((*c.CallOptions).UpdateLogMetric)], opts...)
|
||||
var resp *loggingpb.LogMetric
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
|
@ -300,16 +380,16 @@ func (c *MetricsClient) UpdateLogMetric(ctx context.Context, req *loggingpb.Upda
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteLogMetric deletes a logs-based metric.
|
||||
func (c *MetricsClient) DeleteLogMetric(ctx context.Context, req *loggingpb.DeleteLogMetricRequest, opts ...gax.CallOption) error {
|
||||
func (c *metricsGRPCClient) DeleteLogMetric(ctx context.Context, req *loggingpb.DeleteLogMetricRequest, opts ...gax.CallOption) error {
|
||||
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
|
||||
cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
|
||||
defer cancel()
|
||||
ctx = cctx
|
||||
}
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "metric_name", url.QueryEscape(req.GetMetricName())))
|
||||
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
|
||||
opts = append(c.CallOptions.DeleteLogMetric[0:len(c.CallOptions.DeleteLogMetric):len(c.CallOptions.DeleteLogMetric)], opts...)
|
||||
opts = append((*c.CallOptions).DeleteLogMetric[0:len((*c.CallOptions).DeleteLogMetric):len((*c.CallOptions).DeleteLogMetric)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
_, err = c.metricsClient.DeleteLogMetric(ctx, req, settings.GRPC...)
|
||||
|
|
14
vendor/cloud.google.com/go/logging/apiv2/path_funcs.go
generated
vendored
14
vendor/cloud.google.com/go/logging/apiv2/path_funcs.go
generated
vendored
|
@ -17,7 +17,9 @@ package logging
|
|||
// ConfigProjectPath returns the path for the project resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
//
|
||||
// fmt.Sprintf("projects/%s", project)
|
||||
//
|
||||
// instead.
|
||||
func ConfigProjectPath(project string) string {
|
||||
return "" +
|
||||
|
@ -29,7 +31,9 @@ func ConfigProjectPath(project string) string {
|
|||
// ConfigSinkPath returns the path for the sink resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
//
|
||||
// fmt.Sprintf("projects/%s/sinks/%s", project, sink)
|
||||
//
|
||||
// instead.
|
||||
func ConfigSinkPath(project, sink string) string {
|
||||
return "" +
|
||||
|
@ -43,7 +47,9 @@ func ConfigSinkPath(project, sink string) string {
|
|||
// ConfigExclusionPath returns the path for the exclusion resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
//
|
||||
// fmt.Sprintf("projects/%s/exclusions/%s", project, exclusion)
|
||||
//
|
||||
// instead.
|
||||
func ConfigExclusionPath(project, exclusion string) string {
|
||||
return "" +
|
||||
|
@ -57,7 +63,9 @@ func ConfigExclusionPath(project, exclusion string) string {
|
|||
// ProjectPath returns the path for the project resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
//
|
||||
// fmt.Sprintf("projects/%s", project)
|
||||
//
|
||||
// instead.
|
||||
func ProjectPath(project string) string {
|
||||
return "" +
|
||||
|
@ -69,7 +77,9 @@ func ProjectPath(project string) string {
|
|||
// LogPath returns the path for the log resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
//
|
||||
// fmt.Sprintf("projects/%s/logs/%s", project, log)
|
||||
//
|
||||
// instead.
|
||||
func LogPath(project, log string) string {
|
||||
return "" +
|
||||
|
@ -83,7 +93,9 @@ func LogPath(project, log string) string {
|
|||
// MetricsProjectPath returns the path for the project resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
//
|
||||
// fmt.Sprintf("projects/%s", project)
|
||||
//
|
||||
// instead.
|
||||
func MetricsProjectPath(project string) string {
|
||||
return "" +
|
||||
|
@ -95,7 +107,9 @@ func MetricsProjectPath(project string) string {
|
|||
// MetricsMetricPath returns the path for the metric resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
//
|
||||
// fmt.Sprintf("projects/%s/metrics/%s", project, metric)
|
||||
//
|
||||
// instead.
|
||||
func MetricsMetricPath(project, metric string) string {
|
||||
return "" +
|
||||
|
|
23
vendor/cloud.google.com/go/logging/apiv2/version.go
generated
vendored
Normal file
23
vendor/cloud.google.com/go/logging/apiv2/version.go
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2023 Google LLC
|
||||
//
|
||||
// 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.
|
||||
|
||||
// Code generated by gapicgen. DO NOT EDIT.
|
||||
|
||||
package logging
|
||||
|
||||
import "cloud.google.com/go/logging/internal"
|
||||
|
||||
func init() {
|
||||
versionClient = internal.Version
|
||||
}
|
47
vendor/cloud.google.com/go/logging/doc.go
generated
vendored
47
vendor/cloud.google.com/go/logging/doc.go
generated
vendored
|
@ -20,8 +20,7 @@ see package cloud.google.com/go/logging/logadmin.
|
|||
This client uses Logging API v2.
|
||||
See https://cloud.google.com/logging/docs/api/v2/ for an introduction to the API.
|
||||
|
||||
|
||||
Creating a Client
|
||||
# Creating a Client
|
||||
|
||||
Use a Client to interact with the Cloud Logging API.
|
||||
|
||||
|
@ -32,8 +31,7 @@ Use a Client to interact with the Cloud Logging API.
|
|||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
|
||||
Basic Usage
|
||||
# Basic Usage
|
||||
|
||||
For most use cases, you'll want to add log entries to a buffer to be periodically
|
||||
flushed (automatically and asynchronously) to the Cloud Logging service.
|
||||
|
@ -44,8 +42,7 @@ flushed (automatically and asynchronously) to the Cloud Logging service.
|
|||
// Add entry to log buffer
|
||||
lg.Log(logging.Entry{Payload: "something happened!"})
|
||||
|
||||
|
||||
Closing your Client
|
||||
# Closing your Client
|
||||
|
||||
You should call Client.Close before your program exits to flush any buffered log entries to the Cloud Logging service.
|
||||
|
||||
|
@ -55,8 +52,7 @@ You should call Client.Close before your program exits to flush any buffered log
|
|||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
|
||||
Synchronous Logging
|
||||
# Synchronous Logging
|
||||
|
||||
For critical errors, you may want to send your log entries immediately.
|
||||
LogSync is slow and will block until the log entry has been sent, so it is
|
||||
|
@ -67,8 +63,20 @@ not recommended for normal use.
|
|||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
# Redirecting log ingestion
|
||||
|
||||
Payloads
|
||||
For cases when runtime environment supports out-of-process log ingestion,
|
||||
like logging agent, you can opt-in to write log entries to io.Writer instead of
|
||||
ingesting them to Cloud Logging service. Usually, you will use os.Stdout or os.Stderr as
|
||||
writers because Google Cloud logging agents are configured to capture logs from standard output.
|
||||
The entries will be Jsonified and wrote as one line strings following the structured logging format.
|
||||
See https://cloud.google.com/logging/docs/structured-logging#special-payload-fields for the format description.
|
||||
To instruct Logger to redirect log entries add RedirectAsJSON() LoggerOption`s.
|
||||
|
||||
// Create a logger to print structured logs formatted as a single line Json to stdout
|
||||
loggger := client.Logger("test-log", RedirectAsJSON(os.Stdout))
|
||||
|
||||
# Payloads
|
||||
|
||||
An entry payload can be a string, as in the examples above. It can also be any value
|
||||
that can be marshaled to a JSON object, like a map[string]interface{} or a struct:
|
||||
|
@ -84,8 +92,18 @@ If you have a []byte of JSON, wrap it in json.RawMessage:
|
|||
j := []byte(`{"Name": "Bob", "Count": 3}`)
|
||||
lg.Log(logging.Entry{Payload: json.RawMessage(j)})
|
||||
|
||||
If you have proto.Message and want to send it as a protobuf payload, marshal it to anypb.Any:
|
||||
|
||||
The Standard Logger
|
||||
// import
|
||||
func logMessage (m proto.Message) {
|
||||
var payload anypb.Any
|
||||
err := anypb.MarshalFrom(&payload, m)
|
||||
if err != nil {
|
||||
lg.Log(logging.Entry{Payload: payload})
|
||||
}
|
||||
}
|
||||
|
||||
# The Standard Logger
|
||||
|
||||
You may want use a standard log.Logger in your program.
|
||||
|
||||
|
@ -93,8 +111,7 @@ You may want use a standard log.Logger in your program.
|
|||
stdlg := lg.StandardLogger(logging.Info)
|
||||
stdlg.Println("some info")
|
||||
|
||||
|
||||
Log Levels
|
||||
# Log Levels
|
||||
|
||||
An Entry may have one of a number of severity levels associated with it.
|
||||
|
||||
|
@ -103,8 +120,7 @@ An Entry may have one of a number of severity levels associated with it.
|
|||
Severity: logging.Critical,
|
||||
}
|
||||
|
||||
|
||||
Viewing Logs
|
||||
# Viewing Logs
|
||||
|
||||
You can view Cloud logs for projects at
|
||||
https://console.cloud.google.com/logs/viewer. Use the dropdown at the top left. When
|
||||
|
@ -112,8 +128,7 @@ running from a Google Cloud Platform VM, select "GCE VM Instance". Otherwise, se
|
|||
"Google Project" and then the project ID. Logs for organizations, folders and billing
|
||||
accounts can be viewed on the command line with the "gcloud logging read" command.
|
||||
|
||||
|
||||
Grouping Logs by Request
|
||||
# Grouping Logs by Request
|
||||
|
||||
To group all the log entries written during a single HTTP request, create two
|
||||
Loggers, a "parent" and a "child," with different log IDs. Both should be in the same
|
||||
|
|
83
vendor/cloud.google.com/go/logging/instrumentation.go
generated
vendored
Normal file
83
vendor/cloud.google.com/go/logging/instrumentation.go
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// https://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 logging
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
logpb "cloud.google.com/go/logging/apiv2/loggingpb"
|
||||
"cloud.google.com/go/logging/internal"
|
||||
)
|
||||
|
||||
const diagnosticLogID = "diagnostic-log"
|
||||
|
||||
// instrumentationPayload defines telemetry log entry payload for capturing instrumentation info
|
||||
type instrumentationPayload struct {
|
||||
InstrumentationSource []map[string]string `json:"instrumentation_source"`
|
||||
Runtime string `json:"runtime,omitempty"`
|
||||
}
|
||||
|
||||
var (
|
||||
instrumentationInfo = &instrumentationPayload{
|
||||
InstrumentationSource: []map[string]string{
|
||||
{
|
||||
"name": "go",
|
||||
"version": internal.Version,
|
||||
},
|
||||
},
|
||||
Runtime: internal.VersionGo(),
|
||||
}
|
||||
)
|
||||
|
||||
// instrumentLogs appends log entry with library instrumentation info to the
|
||||
// list of log entries on the first function's call.
|
||||
func (l *Logger) instrumentLogs(entries []*logpb.LogEntry) ([]*logpb.LogEntry, bool) {
|
||||
var instrumentationAdded bool
|
||||
|
||||
internal.InstrumentOnce.Do(func() {
|
||||
ie, err := l.instrumentationEntry()
|
||||
if err != nil {
|
||||
// do not retry instrumenting logs if failed creating instrumentation entry
|
||||
return
|
||||
}
|
||||
// populate LogName only when directly ingesting entries
|
||||
if l.redirectOutputWriter == nil {
|
||||
ie.LogName = internal.LogPath(l.client.parent, diagnosticLogID)
|
||||
}
|
||||
entries = append(entries, ie)
|
||||
instrumentationAdded = true
|
||||
})
|
||||
return entries, instrumentationAdded
|
||||
}
|
||||
|
||||
func (l *Logger) instrumentationEntry() (*logpb.LogEntry, error) {
|
||||
ent := Entry{
|
||||
Payload: map[string]*instrumentationPayload{
|
||||
"logging.googleapis.com/diagnostic": instrumentationInfo,
|
||||
},
|
||||
}
|
||||
// pass nil for Logger and 0 for skip levels to ignore auto-population
|
||||
return toLogEntryInternal(ent, nil, l.client.parent, 0)
|
||||
}
|
||||
|
||||
// hasInstrumentation returns true if any of the log entries has diagnostic LogId
|
||||
func hasInstrumentation(entries []*logpb.LogEntry) bool {
|
||||
for _, ent := range entries {
|
||||
if strings.HasSuffix(ent.LogName, diagnosticLogID) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
43
vendor/cloud.google.com/go/logging/internal/common.go
generated
vendored
43
vendor/cloud.google.com/go/logging/internal/common.go
generated
vendored
|
@ -16,7 +16,10 @@ package internal
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -24,6 +27,9 @@ const (
|
|||
ProdAddr = "logging.googleapis.com:443"
|
||||
)
|
||||
|
||||
// InstrumentOnce guards instrumenting logs one time
|
||||
var InstrumentOnce = new(sync.Once)
|
||||
|
||||
// LogPath creates a formatted path from a parent and a logID.
|
||||
func LogPath(parent, logID string) string {
|
||||
logID = strings.Replace(logID, "/", "%2F", -1)
|
||||
|
@ -39,3 +45,40 @@ func LogIDFromPath(parent, path string) string {
|
|||
logID := path[start:]
|
||||
return strings.Replace(logID, "%2F", "/", -1)
|
||||
}
|
||||
|
||||
// VersionGo returns the Go runtime version. The returned string
|
||||
// has no whitespace, suitable for reporting in header.
|
||||
func VersionGo() string {
|
||||
const develPrefix = "devel +"
|
||||
|
||||
s := runtime.Version()
|
||||
if strings.HasPrefix(s, develPrefix) {
|
||||
s = s[len(develPrefix):]
|
||||
if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
|
||||
s = s[:p]
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
notSemverRune := func(r rune) bool {
|
||||
return !strings.ContainsRune("0123456789.", r)
|
||||
}
|
||||
|
||||
if strings.HasPrefix(s, "go1") {
|
||||
s = s[2:]
|
||||
var prerelease string
|
||||
if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
|
||||
s, prerelease = s[:p], s[p:]
|
||||
}
|
||||
if strings.HasSuffix(s, ".") {
|
||||
s += "0"
|
||||
} else if strings.Count(s, ".") < 2 {
|
||||
s += ".0"
|
||||
}
|
||||
if prerelease != "" {
|
||||
s += "-" + prerelease
|
||||
}
|
||||
return s
|
||||
}
|
||||
return "UNKNOWN"
|
||||
}
|
||||
|
|
75
vendor/cloud.google.com/go/logging/internal/environment.go
generated
vendored
Normal file
75
vendor/cloud.google.com/go/logging/internal/environment.go
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// https://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 internal
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/compute/metadata"
|
||||
)
|
||||
|
||||
// ResourceAttributesGetter abstracts environment lookup methods to query for environment variables, metadata attributes and file content.
|
||||
type ResourceAttributesGetter interface {
|
||||
EnvVar(name string) string
|
||||
Metadata(path string) string
|
||||
ReadAll(path string) string
|
||||
}
|
||||
|
||||
var getter ResourceAttributesGetter = &defaultResourceGetter{
|
||||
metaClient: metadata.NewClient(&http.Client{
|
||||
Transport: &http.Transport{
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 1 * time.Second,
|
||||
KeepAlive: 10 * time.Second,
|
||||
}).Dial,
|
||||
},
|
||||
})}
|
||||
|
||||
// ResourceAttributes provides read-only access to the ResourceAtttributesGetter interface implementation.
|
||||
func ResourceAttributes() ResourceAttributesGetter {
|
||||
return getter
|
||||
}
|
||||
|
||||
type defaultResourceGetter struct {
|
||||
metaClient *metadata.Client
|
||||
}
|
||||
|
||||
// EnvVar uses os.LookupEnv() to lookup for environment variable by name.
|
||||
func (g *defaultResourceGetter) EnvVar(name string) string {
|
||||
return os.Getenv(name)
|
||||
}
|
||||
|
||||
// Metadata uses metadata package Client.Get() to lookup for metadata attributes by path.
|
||||
func (g *defaultResourceGetter) Metadata(path string) string {
|
||||
val, err := g.metaClient.Get(path)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(val)
|
||||
}
|
||||
|
||||
// ReadAll reads all content of the file as a string.
|
||||
func (g *defaultResourceGetter) ReadAll(path string) string {
|
||||
bytes, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return string(bytes)
|
||||
}
|
18
vendor/cloud.google.com/go/logging/internal/version.go
generated
vendored
Normal file
18
vendor/cloud.google.com/go/logging/internal/version.go
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// 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 internal
|
||||
|
||||
// Version is the current tagged release of the library.
|
||||
const Version = "1.7.0"
|
189
vendor/cloud.google.com/go/logging/loggeroption.go
generated
vendored
Normal file
189
vendor/cloud.google.com/go/logging/loggeroption.go
generated
vendored
Normal file
|
@ -0,0 +1,189 @@
|
|||
// Copyright 2021 Google LLC
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// https://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 logging
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
// LoggerOption is a configuration option for a Logger.
|
||||
type LoggerOption interface {
|
||||
set(*Logger)
|
||||
}
|
||||
|
||||
// CommonLabels are labels that apply to all log entries written from a Logger,
|
||||
// so that you don't have to repeat them in each log entry's Labels field. If
|
||||
// any of the log entries contains a (key, value) with the same key that is in
|
||||
// CommonLabels, then the entry's (key, value) overrides the one in
|
||||
// CommonLabels.
|
||||
func CommonLabels(m map[string]string) LoggerOption { return commonLabels(m) }
|
||||
|
||||
type commonLabels map[string]string
|
||||
|
||||
func (c commonLabels) set(l *Logger) { l.commonLabels = c }
|
||||
|
||||
// ConcurrentWriteLimit determines how many goroutines will send log entries to the
|
||||
// underlying service. The default is 1. Set ConcurrentWriteLimit to a higher value to
|
||||
// increase throughput.
|
||||
func ConcurrentWriteLimit(n int) LoggerOption { return concurrentWriteLimit(n) }
|
||||
|
||||
type concurrentWriteLimit int
|
||||
|
||||
func (c concurrentWriteLimit) set(l *Logger) { l.bundler.HandlerLimit = int(c) }
|
||||
|
||||
// DelayThreshold is the maximum amount of time that an entry should remain
|
||||
// buffered in memory before a call to the logging service is triggered. Larger
|
||||
// values of DelayThreshold will generally result in fewer calls to the logging
|
||||
// service, while increasing the risk that log entries will be lost if the
|
||||
// process crashes.
|
||||
// The default is DefaultDelayThreshold.
|
||||
func DelayThreshold(d time.Duration) LoggerOption { return delayThreshold(d) }
|
||||
|
||||
type delayThreshold time.Duration
|
||||
|
||||
func (d delayThreshold) set(l *Logger) { l.bundler.DelayThreshold = time.Duration(d) }
|
||||
|
||||
// EntryCountThreshold is the maximum number of entries that will be buffered
|
||||
// in memory before a call to the logging service is triggered. Larger values
|
||||
// will generally result in fewer calls to the logging service, while
|
||||
// increasing both memory consumption and the risk that log entries will be
|
||||
// lost if the process crashes.
|
||||
// The default is DefaultEntryCountThreshold.
|
||||
func EntryCountThreshold(n int) LoggerOption { return entryCountThreshold(n) }
|
||||
|
||||
type entryCountThreshold int
|
||||
|
||||
func (e entryCountThreshold) set(l *Logger) { l.bundler.BundleCountThreshold = int(e) }
|
||||
|
||||
// EntryByteThreshold is the maximum number of bytes of entries that will be
|
||||
// buffered in memory before a call to the logging service is triggered. See
|
||||
// EntryCountThreshold for a discussion of the tradeoffs involved in setting
|
||||
// this option.
|
||||
// The default is DefaultEntryByteThreshold.
|
||||
func EntryByteThreshold(n int) LoggerOption { return entryByteThreshold(n) }
|
||||
|
||||
type entryByteThreshold int
|
||||
|
||||
func (e entryByteThreshold) set(l *Logger) { l.bundler.BundleByteThreshold = int(e) }
|
||||
|
||||
// EntryByteLimit is the maximum number of bytes of entries that will be sent
|
||||
// in a single call to the logging service. ErrOversizedEntry is returned if an
|
||||
// entry exceeds EntryByteLimit. This option limits the size of a single RPC
|
||||
// payload, to account for network or service issues with large RPCs. If
|
||||
// EntryByteLimit is smaller than EntryByteThreshold, the latter has no effect.
|
||||
// The default is zero, meaning there is no limit.
|
||||
func EntryByteLimit(n int) LoggerOption { return entryByteLimit(n) }
|
||||
|
||||
type entryByteLimit int
|
||||
|
||||
func (e entryByteLimit) set(l *Logger) { l.bundler.BundleByteLimit = int(e) }
|
||||
|
||||
// BufferedByteLimit is the maximum number of bytes that the Logger will keep
|
||||
// in memory before returning ErrOverflow. This option limits the total memory
|
||||
// consumption of the Logger (but note that each Logger has its own, separate
|
||||
// limit). It is possible to reach BufferedByteLimit even if it is larger than
|
||||
// EntryByteThreshold or EntryByteLimit, because calls triggered by the latter
|
||||
// two options may be enqueued (and hence occupying memory) while new log
|
||||
// entries are being added.
|
||||
// The default is DefaultBufferedByteLimit.
|
||||
func BufferedByteLimit(n int) LoggerOption { return bufferedByteLimit(n) }
|
||||
|
||||
type bufferedByteLimit int
|
||||
|
||||
func (b bufferedByteLimit) set(l *Logger) { l.bundler.BufferedByteLimit = int(b) }
|
||||
|
||||
// ContextFunc is a function that will be called to obtain a context.Context for the
|
||||
// WriteLogEntries RPC executed in the background for calls to Logger.Log. The
|
||||
// default is a function that always returns context.Background. The second return
|
||||
// value of the function is a function to call after the RPC completes.
|
||||
//
|
||||
// The function is not used for calls to Logger.LogSync, since the caller can pass
|
||||
// in the context directly.
|
||||
//
|
||||
// This option is EXPERIMENTAL. It may be changed or removed.
|
||||
func ContextFunc(f func() (ctx context.Context, afterCall func())) LoggerOption {
|
||||
return contextFunc(f)
|
||||
}
|
||||
|
||||
type contextFunc func() (ctx context.Context, afterCall func())
|
||||
|
||||
func (c contextFunc) set(l *Logger) { l.ctxFunc = c }
|
||||
|
||||
// SourceLocationPopulation is the flag controlling population of the source location info
|
||||
// in the ingested entries. This options allows to configure automatic population of the
|
||||
// SourceLocation field for all ingested entries, entries with DEBUG severity or disable it.
|
||||
// Note that enabling this option can decrease execution time of Logger.Log and Logger.LogSync
|
||||
// by the factor of 2 or larger.
|
||||
// The default disables source location population.
|
||||
//
|
||||
// This option is not used when an entry is created using ToLogEntry.
|
||||
func SourceLocationPopulation(f int) LoggerOption {
|
||||
return sourceLocationOption(f)
|
||||
}
|
||||
|
||||
const (
|
||||
// DoNotPopulateSourceLocation is default for clients when WithSourceLocation is not provided
|
||||
DoNotPopulateSourceLocation = 0
|
||||
// PopulateSourceLocationForDebugEntries is set when WithSourceLocation(PopulateDebugEntries) is provided
|
||||
PopulateSourceLocationForDebugEntries = 1
|
||||
// AlwaysPopulateSourceLocation is set when WithSourceLocation(PopulateAllEntries) is provided
|
||||
AlwaysPopulateSourceLocation = 2
|
||||
)
|
||||
|
||||
type sourceLocationOption int
|
||||
|
||||
func (o sourceLocationOption) set(l *Logger) {
|
||||
if o == DoNotPopulateSourceLocation || o == PopulateSourceLocationForDebugEntries || o == AlwaysPopulateSourceLocation {
|
||||
l.populateSourceLocation = int(o)
|
||||
}
|
||||
}
|
||||
|
||||
// PartialSuccess sets the partialSuccess flag to true when ingesting a bundle of log entries.
|
||||
// See https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write#body.request_body.FIELDS.partial_success
|
||||
// If not provided the partialSuccess flag is set to false.
|
||||
func PartialSuccess() LoggerOption {
|
||||
return &partialSuccessOption{}
|
||||
}
|
||||
|
||||
type partialSuccessOption struct{}
|
||||
|
||||
func (o *partialSuccessOption) set(l *Logger) {
|
||||
l.partialSuccess = true
|
||||
}
|
||||
|
||||
// RedirectAsJSON instructs Logger to redirect output of calls to Log and LogSync to provided io.Writer instead of ingesting
|
||||
// to Cloud Logging. Logger formats log entries following logging agent's Json format.
|
||||
// See https://cloud.google.com/logging/docs/structured-logging#special-payload-fields for more info about the format.
|
||||
// Use this option to delegate log ingestion to an out-of-process logging agent.
|
||||
// If no writer is provided, the redirect is set to stdout.
|
||||
func RedirectAsJSON(w io.Writer) LoggerOption {
|
||||
if w == nil {
|
||||
w = os.Stdout
|
||||
}
|
||||
return &redirectOutputOption{
|
||||
writer: w,
|
||||
}
|
||||
}
|
||||
|
||||
type redirectOutputOption struct {
|
||||
writer io.Writer
|
||||
}
|
||||
|
||||
func (o *redirectOutputOption) set(l *Logger) {
|
||||
l.redirectOutputWriter = o.writer
|
||||
}
|
438
vendor/cloud.google.com/go/logging/logging.go
generated
vendored
438
vendor/cloud.google.com/go/logging/logging.go
generated
vendored
|
@ -30,17 +30,19 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"cloud.google.com/go/internal/version"
|
||||
vkit "cloud.google.com/go/logging/apiv2"
|
||||
logpb "cloud.google.com/go/logging/apiv2/loggingpb"
|
||||
"cloud.google.com/go/logging/internal"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
|
@ -49,7 +51,8 @@ import (
|
|||
"google.golang.org/api/support/bundler"
|
||||
mrpb "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
logtypepb "google.golang.org/genproto/googleapis/logging/type"
|
||||
logpb "google.golang.org/genproto/googleapis/logging/v2"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -75,7 +78,7 @@ const (
|
|||
DefaultEntryCountThreshold = 1000
|
||||
|
||||
// DefaultEntryByteThreshold is the default value for the EntryByteThreshold LoggerOption.
|
||||
DefaultEntryByteThreshold = 1 << 20 // 1MiB
|
||||
DefaultEntryByteThreshold = 1 << 23 // 8MiB
|
||||
|
||||
// DefaultBufferedByteLimit is the default value for the BufferedByteLimit LoggerOption.
|
||||
DefaultBufferedByteLimit = 1 << 30 // 1GiB
|
||||
|
@ -87,16 +90,23 @@ const (
|
|||
defaultWriteTimeout = 10 * time.Minute
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrRedirectProtoPayloadNotSupported is returned when Logger is configured to redirect output and
|
||||
// tries to redirect logs with protobuf payload.
|
||||
ErrRedirectProtoPayloadNotSupported = errors.New("printEntryToStdout: cannot find valid payload")
|
||||
|
||||
// For testing:
|
||||
var now = time.Now
|
||||
now = time.Now
|
||||
toLogEntryInternal = toLogEntryInternalImpl
|
||||
|
||||
// ErrOverflow signals that the number of buffered entries for a Logger
|
||||
// exceeds its BufferLimit.
|
||||
var ErrOverflow = bundler.ErrOverflow
|
||||
ErrOverflow = bundler.ErrOverflow
|
||||
|
||||
// ErrOversizedEntry signals that an entry's size exceeds the maximum number of
|
||||
// bytes that will be sent in a single call to the logging service.
|
||||
var ErrOversizedEntry = bundler.ErrOversizedItem
|
||||
ErrOversizedEntry = bundler.ErrOversizedItem
|
||||
)
|
||||
|
||||
// Client is a Logging client. A Client is associated with a single Cloud project.
|
||||
type Client struct {
|
||||
|
@ -125,17 +135,22 @@ type Client struct {
|
|||
|
||||
// NewClient returns a new logging client associated with the provided parent.
|
||||
// A parent can take any of the following forms:
|
||||
//
|
||||
// projects/PROJECT_ID
|
||||
// folders/FOLDER_ID
|
||||
// billingAccounts/ACCOUNT_ID
|
||||
// organizations/ORG_ID
|
||||
//
|
||||
// for backwards compatibility, a string with no '/' is also allowed and is interpreted
|
||||
// as a project ID.
|
||||
//
|
||||
// By default NewClient uses WriteScope. To use a different scope, call
|
||||
// NewClient using a WithScopes option (see https://godoc.org/google.golang.org/api/option#WithScopes).
|
||||
func NewClient(ctx context.Context, parent string, opts ...option.ClientOption) (*Client, error) {
|
||||
parent = makeParent(parent)
|
||||
parent, err := makeParent(parent)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
opts = append([]option.ClientOption{
|
||||
option.WithScopes(WriteScope),
|
||||
}, opts...)
|
||||
|
@ -143,7 +158,7 @@ func NewClient(ctx context.Context, parent string, opts ...option.ClientOption)
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.SetGoogleClientInfo("gccl", version.Repo)
|
||||
c.SetGoogleClientInfo("gccl", internal.Version)
|
||||
client := &Client{
|
||||
client: c,
|
||||
parent: parent,
|
||||
|
@ -168,11 +183,15 @@ func NewClient(ctx context.Context, parent string, opts ...option.ClientOption)
|
|||
return client, nil
|
||||
}
|
||||
|
||||
func makeParent(parent string) string {
|
||||
func makeParent(parent string) (string, error) {
|
||||
if !strings.ContainsRune(parent, '/') {
|
||||
return "projects/" + parent
|
||||
return "projects/" + parent, nil
|
||||
}
|
||||
return parent
|
||||
prefix := strings.Split(parent, "/")[0]
|
||||
if prefix != "projects" && prefix != "folders" && prefix != "billingAccounts" && prefix != "organizations" {
|
||||
return parent, fmt.Errorf("parent parameter must start with 'projects/' 'folders/' 'billingAccounts/' or 'organizations/'")
|
||||
}
|
||||
return parent, nil
|
||||
}
|
||||
|
||||
// Ping reports whether the client's connection to the logging service and the
|
||||
|
@ -213,7 +232,7 @@ func (c *Client) extractErrorInfo() error {
|
|||
var err error
|
||||
c.mu.Lock()
|
||||
if c.lastErr != nil {
|
||||
err = fmt.Errorf("saw %d errors; last: %v", c.nErrs, c.lastErr)
|
||||
err = fmt.Errorf("saw %d errors; last: %w", c.nErrs, c.lastErr)
|
||||
c.nErrs = 0
|
||||
c.lastErr = nil
|
||||
}
|
||||
|
@ -233,111 +252,11 @@ type Logger struct {
|
|||
commonResource *mrpb.MonitoredResource
|
||||
commonLabels map[string]string
|
||||
ctxFunc func() (context.Context, func())
|
||||
populateSourceLocation int
|
||||
partialSuccess bool
|
||||
redirectOutputWriter io.Writer
|
||||
}
|
||||
|
||||
// A LoggerOption is a configuration option for a Logger.
|
||||
type LoggerOption interface {
|
||||
set(*Logger)
|
||||
}
|
||||
|
||||
// CommonLabels are labels that apply to all log entries written from a Logger,
|
||||
// so that you don't have to repeat them in each log entry's Labels field. If
|
||||
// any of the log entries contains a (key, value) with the same key that is in
|
||||
// CommonLabels, then the entry's (key, value) overrides the one in
|
||||
// CommonLabels.
|
||||
func CommonLabels(m map[string]string) LoggerOption { return commonLabels(m) }
|
||||
|
||||
type commonLabels map[string]string
|
||||
|
||||
func (c commonLabels) set(l *Logger) { l.commonLabels = c }
|
||||
|
||||
// ConcurrentWriteLimit determines how many goroutines will send log entries to the
|
||||
// underlying service. The default is 1. Set ConcurrentWriteLimit to a higher value to
|
||||
// increase throughput.
|
||||
func ConcurrentWriteLimit(n int) LoggerOption { return concurrentWriteLimit(n) }
|
||||
|
||||
type concurrentWriteLimit int
|
||||
|
||||
func (c concurrentWriteLimit) set(l *Logger) { l.bundler.HandlerLimit = int(c) }
|
||||
|
||||
// DelayThreshold is the maximum amount of time that an entry should remain
|
||||
// buffered in memory before a call to the logging service is triggered. Larger
|
||||
// values of DelayThreshold will generally result in fewer calls to the logging
|
||||
// service, while increasing the risk that log entries will be lost if the
|
||||
// process crashes.
|
||||
// The default is DefaultDelayThreshold.
|
||||
func DelayThreshold(d time.Duration) LoggerOption { return delayThreshold(d) }
|
||||
|
||||
type delayThreshold time.Duration
|
||||
|
||||
func (d delayThreshold) set(l *Logger) { l.bundler.DelayThreshold = time.Duration(d) }
|
||||
|
||||
// EntryCountThreshold is the maximum number of entries that will be buffered
|
||||
// in memory before a call to the logging service is triggered. Larger values
|
||||
// will generally result in fewer calls to the logging service, while
|
||||
// increasing both memory consumption and the risk that log entries will be
|
||||
// lost if the process crashes.
|
||||
// The default is DefaultEntryCountThreshold.
|
||||
func EntryCountThreshold(n int) LoggerOption { return entryCountThreshold(n) }
|
||||
|
||||
type entryCountThreshold int
|
||||
|
||||
func (e entryCountThreshold) set(l *Logger) { l.bundler.BundleCountThreshold = int(e) }
|
||||
|
||||
// EntryByteThreshold is the maximum number of bytes of entries that will be
|
||||
// buffered in memory before a call to the logging service is triggered. See
|
||||
// EntryCountThreshold for a discussion of the tradeoffs involved in setting
|
||||
// this option.
|
||||
// The default is DefaultEntryByteThreshold.
|
||||
func EntryByteThreshold(n int) LoggerOption { return entryByteThreshold(n) }
|
||||
|
||||
type entryByteThreshold int
|
||||
|
||||
func (e entryByteThreshold) set(l *Logger) { l.bundler.BundleByteThreshold = int(e) }
|
||||
|
||||
// EntryByteLimit is the maximum number of bytes of entries that will be sent
|
||||
// in a single call to the logging service. ErrOversizedEntry is returned if an
|
||||
// entry exceeds EntryByteLimit. This option limits the size of a single RPC
|
||||
// payload, to account for network or service issues with large RPCs. If
|
||||
// EntryByteLimit is smaller than EntryByteThreshold, the latter has no effect.
|
||||
// The default is zero, meaning there is no limit.
|
||||
func EntryByteLimit(n int) LoggerOption { return entryByteLimit(n) }
|
||||
|
||||
type entryByteLimit int
|
||||
|
||||
func (e entryByteLimit) set(l *Logger) { l.bundler.BundleByteLimit = int(e) }
|
||||
|
||||
// BufferedByteLimit is the maximum number of bytes that the Logger will keep
|
||||
// in memory before returning ErrOverflow. This option limits the total memory
|
||||
// consumption of the Logger (but note that each Logger has its own, separate
|
||||
// limit). It is possible to reach BufferedByteLimit even if it is larger than
|
||||
// EntryByteThreshold or EntryByteLimit, because calls triggered by the latter
|
||||
// two options may be enqueued (and hence occupying memory) while new log
|
||||
// entries are being added.
|
||||
// The default is DefaultBufferedByteLimit.
|
||||
func BufferedByteLimit(n int) LoggerOption { return bufferedByteLimit(n) }
|
||||
|
||||
type bufferedByteLimit int
|
||||
|
||||
func (b bufferedByteLimit) set(l *Logger) { l.bundler.BufferedByteLimit = int(b) }
|
||||
|
||||
// ContextFunc is a function that will be called to obtain a context.Context for the
|
||||
// WriteLogEntries RPC executed in the background for calls to Logger.Log. The
|
||||
// default is a function that always returns context.Background. The second return
|
||||
// value of the function is a function to call after the RPC completes.
|
||||
//
|
||||
// The function is not used for calls to Logger.LogSync, since the caller can pass
|
||||
// in the context directly.
|
||||
//
|
||||
// This option is EXPERIMENTAL. It may be changed or removed.
|
||||
func ContextFunc(f func() (ctx context.Context, afterCall func())) LoggerOption {
|
||||
return contextFunc(f)
|
||||
}
|
||||
|
||||
type contextFunc func() (ctx context.Context, afterCall func())
|
||||
|
||||
func (c contextFunc) set(l *Logger) { l.ctxFunc = c }
|
||||
|
||||
// Logger returns a Logger that will write entries with the given log ID, such as
|
||||
// "syslog". A log ID must be less than 512 characters long and can only
|
||||
// include the following characters: upper and lower case alphanumeric
|
||||
|
@ -353,6 +272,9 @@ func (c *Client) Logger(logID string, opts ...LoggerOption) *Logger {
|
|||
logName: internal.LogPath(c.parent, logID),
|
||||
commonResource: r,
|
||||
ctxFunc: func() (context.Context, func()) { return context.Background(), nil },
|
||||
populateSourceLocation: DoNotPopulateSourceLocation,
|
||||
partialSuccess: false,
|
||||
redirectOutputWriter: nil,
|
||||
}
|
||||
l.bundler = bundler.NewBundler(&logpb.LogEntry{}, func(entries interface{}) {
|
||||
l.writeLogEntries(entries.([]*logpb.LogEntry))
|
||||
|
@ -366,7 +288,8 @@ func (c *Client) Logger(logID string, opts ...LoggerOption) *Logger {
|
|||
}
|
||||
l.stdLoggers = map[Severity]*log.Logger{}
|
||||
for s := range severityName {
|
||||
l.stdLoggers[s] = log.New(severityWriter{l, s}, "", 0)
|
||||
e := Entry{Severity: s}
|
||||
l.stdLoggers[s] = log.New(templateEntryWriter{l, &e}, "", 0)
|
||||
}
|
||||
|
||||
c.loggers.Add(1)
|
||||
|
@ -380,16 +303,20 @@ func (c *Client) Logger(logID string, opts ...LoggerOption) *Logger {
|
|||
return l
|
||||
}
|
||||
|
||||
type severityWriter struct {
|
||||
type templateEntryWriter struct {
|
||||
l *Logger
|
||||
s Severity
|
||||
template *Entry
|
||||
}
|
||||
|
||||
func (w severityWriter) Write(p []byte) (n int, err error) {
|
||||
w.l.Log(Entry{
|
||||
Severity: w.s,
|
||||
Payload: string(p),
|
||||
})
|
||||
func (w templateEntryWriter) Write(p []byte) (n int, err error) {
|
||||
e := *w.template
|
||||
e.Payload = string(p)
|
||||
// The second argument to logInternal() is how many frames to skip
|
||||
// from the call stack when determining the source location. In the
|
||||
// current implementation of log.Logger (i.e. Go's logging library)
|
||||
// the Write() method is called 2 calls deep so we need to skip 3
|
||||
// frames to account for the call to logInternal() itself.
|
||||
w.l.logInternal(e, 3)
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
|
@ -464,10 +391,14 @@ func (v Severity) String() string {
|
|||
// Severity.
|
||||
func (v *Severity) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(data, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
var i int
|
||||
if strErr := json.Unmarshal(data, &s); strErr == nil {
|
||||
*v = ParseSeverity(s)
|
||||
} else if intErr := json.Unmarshal(data, &i); intErr == nil {
|
||||
*v = Severity(i)
|
||||
} else {
|
||||
return fmt.Errorf("%v; %v", strErr, intErr)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -659,13 +590,13 @@ func toProtoStruct(v interface{}) (*structpb.Struct, error) {
|
|||
} else {
|
||||
jb, err = json.Marshal(v)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("logging: json.Marshal: %v", err)
|
||||
return nil, fmt.Errorf("logging: json.Marshal: %w", err)
|
||||
}
|
||||
}
|
||||
var m map[string]interface{}
|
||||
err = json.Unmarshal(jb, &m)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("logging: json.Unmarshal: %v", err)
|
||||
return nil, fmt.Errorf("logging: json.Unmarshal: %w", err)
|
||||
}
|
||||
return jsonMapToProtoStruct(m), nil
|
||||
}
|
||||
|
@ -705,30 +636,58 @@ func jsonValueToStructValue(v interface{}) *structpb.Value {
|
|||
// and will block, it is intended primarily for debugging or critical errors.
|
||||
// Prefer Log for most uses.
|
||||
func (l *Logger) LogSync(ctx context.Context, e Entry) error {
|
||||
ent, err := toLogEntryInternal(e, l.client, l.client.parent)
|
||||
ent, err := toLogEntryInternal(e, l, l.client.parent, 1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
entries, hasInstrumentation := l.instrumentLogs([]*logpb.LogEntry{ent})
|
||||
if l.redirectOutputWriter != nil {
|
||||
for _, ent = range entries {
|
||||
err = serializeEntryToWriter(ent, l.redirectOutputWriter)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
_, err = l.client.client.WriteLogEntries(ctx, &logpb.WriteLogEntriesRequest{
|
||||
LogName: l.logName,
|
||||
Resource: l.commonResource,
|
||||
Labels: l.commonLabels,
|
||||
Entries: []*logpb.LogEntry{ent},
|
||||
Entries: entries,
|
||||
PartialSuccess: l.partialSuccess || hasInstrumentation,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
// Log buffers the Entry for output to the logging service. It never blocks.
|
||||
func (l *Logger) Log(e Entry) {
|
||||
ent, err := toLogEntryInternal(e, l.client, l.client.parent)
|
||||
l.logInternal(e, 1)
|
||||
}
|
||||
|
||||
func (l *Logger) logInternal(e Entry, skipLevels int) {
|
||||
ent, err := toLogEntryInternal(e, l, l.client.parent, skipLevels+1)
|
||||
if err != nil {
|
||||
l.client.error(err)
|
||||
return
|
||||
}
|
||||
|
||||
entries, _ := l.instrumentLogs([]*logpb.LogEntry{ent})
|
||||
if l.redirectOutputWriter != nil {
|
||||
for _, ent = range entries {
|
||||
err = serializeEntryToWriter(ent, l.redirectOutputWriter)
|
||||
if err != nil {
|
||||
l.client.error(err)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
for _, ent = range entries {
|
||||
if err := l.bundler.Add(ent, proto.Size(ent)); err != nil {
|
||||
l.client.error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flush blocks until all currently buffered log entries are sent.
|
||||
//
|
||||
|
@ -742,11 +701,16 @@ func (l *Logger) Flush() error {
|
|||
}
|
||||
|
||||
func (l *Logger) writeLogEntries(entries []*logpb.LogEntry) {
|
||||
partialSuccess := l.partialSuccess
|
||||
if len(entries) > 1 {
|
||||
partialSuccess = partialSuccess || hasInstrumentation(entries)
|
||||
}
|
||||
req := &logpb.WriteLogEntriesRequest{
|
||||
LogName: l.logName,
|
||||
Resource: l.commonResource,
|
||||
Labels: l.commonLabels,
|
||||
Entries: entries,
|
||||
PartialSuccess: partialSuccess,
|
||||
}
|
||||
ctx, afterCall := l.ctxFunc()
|
||||
ctx, cancel := context.WithTimeout(ctx, defaultWriteTimeout)
|
||||
|
@ -767,7 +731,73 @@ func (l *Logger) writeLogEntries(entries []*logpb.LogEntry) {
|
|||
// (for example by calling SetFlags or SetPrefix).
|
||||
func (l *Logger) StandardLogger(s Severity) *log.Logger { return l.stdLoggers[s] }
|
||||
|
||||
var reCloudTraceContext = regexp.MustCompile(
|
||||
// StandardLoggerFromTemplate returns a Go Standard Logging API *log.Logger.
|
||||
//
|
||||
// The returned logger emits logs using logging.(*Logger).Log() with an entry
|
||||
// constructed from the provided template Entry struct.
|
||||
//
|
||||
// The caller is responsible for ensuring that the template Entry struct
|
||||
// does not change during the the lifetime of the returned *log.Logger.
|
||||
//
|
||||
// Prefer (*Logger).StandardLogger() which is more efficient if the template
|
||||
// only sets Severity.
|
||||
func (l *Logger) StandardLoggerFromTemplate(template *Entry) *log.Logger {
|
||||
return log.New(templateEntryWriter{l, template}, "", 0)
|
||||
}
|
||||
|
||||
func populateTraceInfo(e *Entry, req *http.Request) bool {
|
||||
if req == nil {
|
||||
if e.HTTPRequest != nil && e.HTTPRequest.Request != nil {
|
||||
req = e.HTTPRequest.Request
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
header := req.Header.Get("Traceparent")
|
||||
if header != "" {
|
||||
// do not use traceSampled flag defined by traceparent because
|
||||
// flag's definition differs from expected by Cloud Tracing
|
||||
traceID, spanID, _ := deconstructTraceParent(header)
|
||||
if traceID != "" {
|
||||
e.Trace = traceID
|
||||
e.SpanID = spanID
|
||||
return true
|
||||
}
|
||||
}
|
||||
header = req.Header.Get("X-Cloud-Trace-Context")
|
||||
if header != "" {
|
||||
traceID, spanID, traceSampled := deconstructXCloudTraceContext(header)
|
||||
if traceID != "" {
|
||||
e.Trace = traceID
|
||||
e.SpanID = spanID
|
||||
// enforce sampling if required
|
||||
e.TraceSampled = e.TraceSampled || traceSampled
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// As per format described at https://www.w3.org/TR/trace-context/#traceparent-header-field-values
|
||||
var validTraceParentExpression = regexp.MustCompile(`^(00)-([a-fA-F\d]{32})-([a-f\d]{16})-([a-fA-F\d]{2})$`)
|
||||
|
||||
func deconstructTraceParent(s string) (traceID, spanID string, traceSampled bool) {
|
||||
matches := validTraceParentExpression.FindStringSubmatch(s)
|
||||
if matches != nil {
|
||||
// regexp package does not support negative lookahead preventing all 0 validations
|
||||
if matches[2] == "00000000000000000000000000000000" || matches[3] == "0000000000000000" {
|
||||
return
|
||||
}
|
||||
flags, err := strconv.ParseInt(matches[4], 16, 16)
|
||||
if err == nil {
|
||||
traceSampled = (flags & 0x01) == 1
|
||||
}
|
||||
traceID, spanID = matches[2], matches[3]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var validXCloudTraceContext = regexp.MustCompile(
|
||||
// Matches on "TRACE_ID"
|
||||
`([a-f\d]+)?` +
|
||||
// Matches on "/SPAN_ID"
|
||||
|
@ -785,9 +815,11 @@ func deconstructXCloudTraceContext(s string) (traceID, spanID string, traceSampl
|
|||
// * traceID (optional): "105445aa7843bc8bf206b120001000"
|
||||
// * spanID (optional): "1"
|
||||
// * traceSampled (optional): true
|
||||
matches := reCloudTraceContext.FindStringSubmatch(s)
|
||||
matches := validXCloudTraceContext.FindStringSubmatch(s)
|
||||
|
||||
if matches != nil {
|
||||
traceID, spanID, traceSampled = matches[1], matches[2], matches[3] == "1"
|
||||
}
|
||||
|
||||
if spanID == "0" {
|
||||
spanID = ""
|
||||
|
@ -798,10 +830,12 @@ func deconstructXCloudTraceContext(s string) (traceID, spanID string, traceSampl
|
|||
|
||||
// ToLogEntry takes an Entry structure and converts it to the LogEntry proto.
|
||||
// A parent can take any of the following forms:
|
||||
//
|
||||
// projects/PROJECT_ID
|
||||
// folders/FOLDER_ID
|
||||
// billingAccounts/ACCOUNT_ID
|
||||
// organizations/ORG_ID
|
||||
//
|
||||
// for backwards compatibility, a string with no '/' is also allowed and is interpreted
|
||||
// as a project ID.
|
||||
//
|
||||
|
@ -811,11 +845,20 @@ func deconstructXCloudTraceContext(s string) (traceID, spanID string, traceSampl
|
|||
// Logger.LogSync are used, it is intended to be used together with direct call
|
||||
// to WriteLogEntries method.
|
||||
func ToLogEntry(e Entry, parent string) (*logpb.LogEntry, error) {
|
||||
// We have this method to support logging agents that need a bigger flexibility.
|
||||
return toLogEntryInternal(e, nil, makeParent(parent))
|
||||
var l Logger
|
||||
return l.ToLogEntry(e, parent)
|
||||
}
|
||||
|
||||
func toLogEntryInternal(e Entry, client *Client, parent string) (*logpb.LogEntry, error) {
|
||||
// ToLogEntry for Logger instance
|
||||
func (l *Logger) ToLogEntry(e Entry, parent string) (*logpb.LogEntry, error) {
|
||||
parent, err := makeParent(parent)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return toLogEntryInternal(e, l, parent, 1)
|
||||
}
|
||||
|
||||
func toLogEntryInternalImpl(e Entry, l *Logger, parent string, skipLevels int) (*logpb.LogEntry, error) {
|
||||
if e.LogName != "" {
|
||||
return nil, errors.New("logging: Entry.LogName should be not be set when writing")
|
||||
}
|
||||
|
@ -823,33 +866,34 @@ func toLogEntryInternal(e Entry, client *Client, parent string) (*logpb.LogEntry
|
|||
if t.IsZero() {
|
||||
t = now()
|
||||
}
|
||||
ts, err := ptypes.TimestampProto(t)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
ts := timestamppb.New(t)
|
||||
if l != nil && l.populateSourceLocation != DoNotPopulateSourceLocation && e.SourceLocation == nil {
|
||||
if l.populateSourceLocation == AlwaysPopulateSourceLocation ||
|
||||
l.populateSourceLocation == PopulateSourceLocationForDebugEntries && e.Severity == Severity(Debug) {
|
||||
// filename and line are captured for source code that calls
|
||||
// skipLevels up the goroutine calling stack + 1 for this func.
|
||||
pc, file, line, ok := runtime.Caller(skipLevels + 1)
|
||||
if ok {
|
||||
details := runtime.FuncForPC(pc)
|
||||
e.SourceLocation = &logpb.LogEntrySourceLocation{
|
||||
File: file,
|
||||
Function: details.Name(),
|
||||
Line: int64(line),
|
||||
}
|
||||
if e.Trace == "" && e.HTTPRequest != nil && e.HTTPRequest.Request != nil {
|
||||
traceHeader := e.HTTPRequest.Request.Header.Get("X-Cloud-Trace-Context")
|
||||
if traceHeader != "" {
|
||||
// Set to a relative resource name, as described at
|
||||
// https://cloud.google.com/appengine/docs/flexible/go/writing-application-logs.
|
||||
traceID, spanID, traceSampled := deconstructXCloudTraceContext(traceHeader)
|
||||
if traceID != "" {
|
||||
e.Trace = fmt.Sprintf("%s/traces/%s", parent, traceID)
|
||||
}
|
||||
if e.SpanID == "" {
|
||||
e.SpanID = spanID
|
||||
}
|
||||
|
||||
// If we previously hadn't set TraceSampled, let's retrieve it
|
||||
// from the HTTP request's header, as per:
|
||||
// https://cloud.google.com/trace/docs/troubleshooting#force-trace
|
||||
e.TraceSampled = e.TraceSampled || traceSampled
|
||||
}
|
||||
if e.Trace == "" {
|
||||
populateTraceInfo(&e, nil)
|
||||
// format trace
|
||||
if e.Trace != "" && !strings.Contains(e.Trace, "/traces/") {
|
||||
e.Trace = fmt.Sprintf("%s/traces/%s", parent, e.Trace)
|
||||
}
|
||||
}
|
||||
req, err := fromHTTPRequest(e.HTTPRequest)
|
||||
if err != nil {
|
||||
if client != nil {
|
||||
client.error(err)
|
||||
if l != nil && l.client != nil {
|
||||
l.client.error(err)
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -870,6 +914,8 @@ func toLogEntryInternal(e Entry, client *Client, parent string) (*logpb.LogEntry
|
|||
switch p := e.Payload.(type) {
|
||||
case string:
|
||||
ent.Payload = &logpb.LogEntry_TextPayload{TextPayload: p}
|
||||
case *anypb.Any:
|
||||
ent.Payload = &logpb.LogEntry_ProtoPayload{ProtoPayload: p}
|
||||
default:
|
||||
s, err := toProtoStruct(p)
|
||||
if err != nil {
|
||||
|
@ -879,3 +925,83 @@ func toLogEntryInternal(e Entry, client *Client, parent string) (*logpb.LogEntry
|
|||
}
|
||||
return ent, nil
|
||||
}
|
||||
|
||||
// entry represents the fields of a logging.Entry that can be parsed by Logging agent.
|
||||
// See the mappings at https://cloud.google.com/logging/docs/structured-logging#special-payload-fields
|
||||
type structuredLogEntry struct {
|
||||
// JsonMessage map[string]interface{} `json:"message,omitempty"`
|
||||
// TextMessage string `json:"message,omitempty"`
|
||||
Message json.RawMessage `json:"message"`
|
||||
Severity string `json:"severity,omitempty"`
|
||||
HTTPRequest *logtypepb.HttpRequest `json:"httpRequest,omitempty"`
|
||||
Timestamp string `json:"timestamp,omitempty"`
|
||||
Labels map[string]string `json:"logging.googleapis.com/labels,omitempty"`
|
||||
InsertID string `json:"logging.googleapis.com/insertId,omitempty"`
|
||||
Operation *logpb.LogEntryOperation `json:"logging.googleapis.com/operation,omitempty"`
|
||||
SourceLocation *logpb.LogEntrySourceLocation `json:"logging.googleapis.com/sourceLocation,omitempty"`
|
||||
SpanID string `json:"logging.googleapis.com/spanId,omitempty"`
|
||||
Trace string `json:"logging.googleapis.com/trace,omitempty"`
|
||||
TraceSampled bool `json:"logging.googleapis.com/trace_sampled,omitempty"`
|
||||
}
|
||||
|
||||
func convertSnakeToMixedCase(snakeStr string) string {
|
||||
words := strings.Split(snakeStr, "_")
|
||||
mixedStr := words[0]
|
||||
for _, word := range words[1:] {
|
||||
mixedStr += strings.Title(word)
|
||||
}
|
||||
return mixedStr
|
||||
}
|
||||
|
||||
func (s structuredLogEntry) MarshalJSON() ([]byte, error) {
|
||||
// extract structuredLogEntry into json map
|
||||
type Alias structuredLogEntry
|
||||
var mapData map[string]interface{}
|
||||
data, err := json.Marshal(Alias(s))
|
||||
if err == nil {
|
||||
err = json.Unmarshal(data, &mapData)
|
||||
}
|
||||
if err == nil {
|
||||
// ensure all inner dicts use mixed case instead of snake case
|
||||
innerDicts := [3]string{"httpRequest", "logging.googleapis.com/operation", "logging.googleapis.com/sourceLocation"}
|
||||
for _, field := range innerDicts {
|
||||
if fieldData, ok := mapData[field]; ok {
|
||||
formattedFieldData := make(map[string]interface{})
|
||||
for k, v := range fieldData.(map[string]interface{}) {
|
||||
formattedFieldData[convertSnakeToMixedCase(k)] = v
|
||||
}
|
||||
mapData[field] = formattedFieldData
|
||||
}
|
||||
}
|
||||
// serialize json map into raw bytes
|
||||
return json.Marshal(mapData)
|
||||
}
|
||||
return data, err
|
||||
}
|
||||
|
||||
func serializeEntryToWriter(entry *logpb.LogEntry, w io.Writer) error {
|
||||
jsonifiedEntry := structuredLogEntry{
|
||||
Severity: entry.Severity.String(),
|
||||
HTTPRequest: entry.HttpRequest,
|
||||
Timestamp: entry.Timestamp.String(),
|
||||
Labels: entry.Labels,
|
||||
InsertID: entry.InsertId,
|
||||
Operation: entry.Operation,
|
||||
SourceLocation: entry.SourceLocation,
|
||||
SpanID: entry.SpanId,
|
||||
Trace: entry.Trace,
|
||||
TraceSampled: entry.TraceSampled,
|
||||
}
|
||||
var err error
|
||||
if entry.GetTextPayload() != "" {
|
||||
jsonifiedEntry.Message, err = json.Marshal(entry.GetTextPayload())
|
||||
} else if entry.GetJsonPayload() != nil {
|
||||
jsonifiedEntry.Message, err = json.Marshal(entry.GetJsonPayload().AsMap())
|
||||
} else {
|
||||
return ErrRedirectProtoPayloadNotSupported
|
||||
}
|
||||
if err == nil {
|
||||
err = json.NewEncoder(w).Encode(jsonifiedEntry)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
241
vendor/cloud.google.com/go/logging/resource.go
generated
vendored
241
vendor/cloud.google.com/go/logging/resource.go
generated
vendored
|
@ -15,12 +15,11 @@
|
|||
package logging
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"cloud.google.com/go/compute/metadata"
|
||||
"cloud.google.com/go/logging/internal"
|
||||
mrpb "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
)
|
||||
|
||||
|
@ -34,175 +33,185 @@ type commonResource struct{ *mrpb.MonitoredResource }
|
|||
|
||||
func (r commonResource) set(l *Logger) { l.commonResource = r.MonitoredResource }
|
||||
|
||||
var detectedResource struct {
|
||||
type resource struct {
|
||||
pb *mrpb.MonitoredResource
|
||||
once sync.Once
|
||||
attrs internal.ResourceAttributesGetter
|
||||
once *sync.Once
|
||||
}
|
||||
|
||||
var detectedResource = &resource{
|
||||
attrs: internal.ResourceAttributes(),
|
||||
once: new(sync.Once),
|
||||
}
|
||||
|
||||
func (r *resource) metadataProjectID() string {
|
||||
return r.attrs.Metadata("project/project-id")
|
||||
}
|
||||
|
||||
func (r *resource) metadataZone() string {
|
||||
zone := r.attrs.Metadata("instance/zone")
|
||||
if zone != "" {
|
||||
return zone[strings.LastIndex(zone, "/")+1:]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (r *resource) metadataRegion() string {
|
||||
region := r.attrs.Metadata("instance/region")
|
||||
if region != "" {
|
||||
return region[strings.LastIndex(region, "/")+1:]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// isMetadataActive queries valid response on "/computeMetadata/v1/" URL
|
||||
func (r *resource) isMetadataActive() bool {
|
||||
data := r.attrs.Metadata("")
|
||||
return data != ""
|
||||
}
|
||||
|
||||
// isAppEngine returns true for both standard and flex
|
||||
func isAppEngine() bool {
|
||||
_, service := os.LookupEnv("GAE_SERVICE")
|
||||
_, version := os.LookupEnv("GAE_VERSION")
|
||||
_, instance := os.LookupEnv("GAE_INSTANCE")
|
||||
|
||||
return service && version && instance
|
||||
func (r *resource) isAppEngine() bool {
|
||||
service := r.attrs.EnvVar("GAE_SERVICE")
|
||||
version := r.attrs.EnvVar("GAE_VERSION")
|
||||
instance := r.attrs.EnvVar("GAE_INSTANCE")
|
||||
return service != "" && version != "" && instance != ""
|
||||
}
|
||||
|
||||
func detectAppEngineResource() *mrpb.MonitoredResource {
|
||||
projectID, err := metadata.ProjectID()
|
||||
if err != nil {
|
||||
return nil
|
||||
projectID := detectedResource.metadataProjectID()
|
||||
if projectID == "" {
|
||||
projectID = detectedResource.attrs.EnvVar("GOOGLE_CLOUD_PROJECT")
|
||||
}
|
||||
if projectID == "" {
|
||||
projectID = os.Getenv("GOOGLE_CLOUD_PROJECT")
|
||||
}
|
||||
zone, err := metadata.Zone()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
zone := detectedResource.metadataZone()
|
||||
service := detectedResource.attrs.EnvVar("GAE_SERVICE")
|
||||
version := detectedResource.attrs.EnvVar("GAE_VERSION")
|
||||
|
||||
return &mrpb.MonitoredResource{
|
||||
Type: "gae_app",
|
||||
Labels: map[string]string{
|
||||
"project_id": projectID,
|
||||
"module_id": os.Getenv("GAE_SERVICE"),
|
||||
"version_id": os.Getenv("GAE_VERSION"),
|
||||
"instance_id": os.Getenv("GAE_INSTANCE"),
|
||||
"runtime": os.Getenv("GAE_RUNTIME"),
|
||||
"module_id": service,
|
||||
"version_id": version,
|
||||
"zone": zone,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func isCloudFunction() bool {
|
||||
// Reserved envvars in older function runtimes, e.g. Node.js 8, Python 3.7 and Go 1.11.
|
||||
_, name := os.LookupEnv("FUNCTION_NAME")
|
||||
_, region := os.LookupEnv("FUNCTION_REGION")
|
||||
_, entry := os.LookupEnv("ENTRY_POINT")
|
||||
|
||||
// Reserved envvars in newer function runtimes.
|
||||
_, target := os.LookupEnv("FUNCTION_TARGET")
|
||||
_, signature := os.LookupEnv("FUNCTION_SIGNATURE_TYPE")
|
||||
_, service := os.LookupEnv("K_SERVICE")
|
||||
return (name && region && entry) || (target && signature && service)
|
||||
func (r *resource) isCloudFunction() bool {
|
||||
target := r.attrs.EnvVar("FUNCTION_TARGET")
|
||||
signature := r.attrs.EnvVar("FUNCTION_SIGNATURE_TYPE")
|
||||
// note that this envvar is also present in Cloud Run environments
|
||||
service := r.attrs.EnvVar("K_SERVICE")
|
||||
return target != "" && signature != "" && service != ""
|
||||
}
|
||||
|
||||
func detectCloudFunction() *mrpb.MonitoredResource {
|
||||
projectID, err := metadata.ProjectID()
|
||||
if err != nil {
|
||||
projectID := detectedResource.metadataProjectID()
|
||||
if projectID == "" {
|
||||
return nil
|
||||
}
|
||||
zone, err := metadata.Zone()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
// Newer functions runtimes store name in K_SERVICE.
|
||||
functionName, exists := os.LookupEnv("K_SERVICE")
|
||||
if !exists {
|
||||
functionName, _ = os.LookupEnv("FUNCTION_NAME")
|
||||
}
|
||||
region := detectedResource.metadataRegion()
|
||||
functionName := detectedResource.attrs.EnvVar("K_SERVICE")
|
||||
return &mrpb.MonitoredResource{
|
||||
Type: "cloud_function",
|
||||
Labels: map[string]string{
|
||||
"project_id": projectID,
|
||||
"region": regionFromZone(zone),
|
||||
"region": region,
|
||||
"function_name": functionName,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func isCloudRun() bool {
|
||||
_, config := os.LookupEnv("K_CONFIGURATION")
|
||||
_, service := os.LookupEnv("K_SERVICE")
|
||||
_, revision := os.LookupEnv("K_REVISION")
|
||||
return config && service && revision
|
||||
func (r *resource) isCloudRun() bool {
|
||||
config := r.attrs.EnvVar("K_CONFIGURATION")
|
||||
// note that this envvar is also present in Cloud Function environments
|
||||
service := r.attrs.EnvVar("K_SERVICE")
|
||||
revision := r.attrs.EnvVar("K_REVISION")
|
||||
return config != "" && service != "" && revision != ""
|
||||
}
|
||||
|
||||
func detectCloudRunResource() *mrpb.MonitoredResource {
|
||||
projectID, err := metadata.ProjectID()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
zone, err := metadata.Zone()
|
||||
if err != nil {
|
||||
projectID := detectedResource.metadataProjectID()
|
||||
if projectID == "" {
|
||||
return nil
|
||||
}
|
||||
region := detectedResource.metadataRegion()
|
||||
config := detectedResource.attrs.EnvVar("K_CONFIGURATION")
|
||||
service := detectedResource.attrs.EnvVar("K_SERVICE")
|
||||
revision := detectedResource.attrs.EnvVar("K_REVISION")
|
||||
return &mrpb.MonitoredResource{
|
||||
Type: "cloud_run_revision",
|
||||
Labels: map[string]string{
|
||||
"project_id": projectID,
|
||||
"location": regionFromZone(zone),
|
||||
"service_name": os.Getenv("K_SERVICE"),
|
||||
"revision_name": os.Getenv("K_REVISION"),
|
||||
"configuration_name": os.Getenv("K_CONFIGURATION"),
|
||||
"location": region,
|
||||
"service_name": service,
|
||||
"revision_name": revision,
|
||||
"configuration_name": config,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func isKubernetesEngine() bool {
|
||||
clusterName, err := metadata.InstanceAttributeValue("cluster-name")
|
||||
// Note: InstanceAttributeValue can return "", nil
|
||||
if err != nil || clusterName == "" {
|
||||
func (r *resource) isKubernetesEngine() bool {
|
||||
clusterName := r.attrs.Metadata("instance/attributes/cluster-name")
|
||||
if clusterName == "" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func detectKubernetesResource() *mrpb.MonitoredResource {
|
||||
projectID, err := metadata.ProjectID()
|
||||
if err != nil {
|
||||
projectID := detectedResource.metadataProjectID()
|
||||
if projectID == "" {
|
||||
return nil
|
||||
}
|
||||
zone, err := metadata.Zone()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
clusterName, err := metadata.InstanceAttributeValue("cluster-name")
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
namespaceBytes, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
|
||||
namespaceName := ""
|
||||
if err == nil {
|
||||
namespaceName = string(namespaceBytes)
|
||||
zone := detectedResource.metadataZone()
|
||||
clusterName := detectedResource.attrs.Metadata("instance/attributes/cluster-name")
|
||||
namespaceName := detectedResource.attrs.ReadAll("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
|
||||
if namespaceName == "" {
|
||||
// if automountServiceAccountToken is disabled allow to customize
|
||||
// the namespace via environment
|
||||
namespaceName = detectedResource.attrs.EnvVar("NAMESPACE_NAME")
|
||||
}
|
||||
// note: if deployment customizes hostname, HOSTNAME envvar will have invalid content
|
||||
podName := detectedResource.attrs.EnvVar("HOSTNAME")
|
||||
// there is no way to derive container name from within container; use custom envvar if available
|
||||
containerName := detectedResource.attrs.EnvVar("CONTAINER_NAME")
|
||||
return &mrpb.MonitoredResource{
|
||||
Type: "k8s_container",
|
||||
Labels: map[string]string{
|
||||
"cluster_name": clusterName,
|
||||
"location": zone,
|
||||
"project_id": projectID,
|
||||
"pod_name": os.Getenv("HOSTNAME"),
|
||||
"pod_name": podName,
|
||||
"namespace_name": namespaceName,
|
||||
// To get the `container_name` label, users need to explicitly provide it.
|
||||
"container_name": os.Getenv("CONTAINER_NAME"),
|
||||
"container_name": containerName,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func detectGCEResource() *mrpb.MonitoredResource {
|
||||
projectID, err := metadata.ProjectID()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
id, err := metadata.InstanceID()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
zone, err := metadata.Zone()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
name, err := metadata.InstanceName()
|
||||
if err != nil {
|
||||
func (r *resource) isComputeEngine() bool {
|
||||
preempted := r.attrs.Metadata("instance/preempted")
|
||||
platform := r.attrs.Metadata("instance/cpu-platform")
|
||||
appBucket := r.attrs.Metadata("instance/attributes/gae_app_bucket")
|
||||
return preempted != "" && platform != "" && appBucket == ""
|
||||
}
|
||||
|
||||
func detectComputeEngineResource() *mrpb.MonitoredResource {
|
||||
projectID := detectedResource.metadataProjectID()
|
||||
if projectID == "" {
|
||||
return nil
|
||||
}
|
||||
id := detectedResource.attrs.Metadata("instance/id")
|
||||
zone := detectedResource.metadataZone()
|
||||
return &mrpb.MonitoredResource{
|
||||
Type: "gce_instance",
|
||||
Labels: map[string]string{
|
||||
"project_id": projectID,
|
||||
"instance_id": id,
|
||||
"instance_name": name,
|
||||
"zone": zone,
|
||||
},
|
||||
}
|
||||
|
@ -210,24 +219,38 @@ func detectGCEResource() *mrpb.MonitoredResource {
|
|||
|
||||
func detectResource() *mrpb.MonitoredResource {
|
||||
detectedResource.once.Do(func() {
|
||||
if detectedResource.isMetadataActive() {
|
||||
name := systemProductName()
|
||||
switch {
|
||||
// AppEngine, Functions, CloudRun, Kubernetes are detected first,
|
||||
// as metadata.OnGCE() erroneously returns true on these runtimes.
|
||||
case isAppEngine():
|
||||
case name == "Google App Engine", detectedResource.isAppEngine():
|
||||
detectedResource.pb = detectAppEngineResource()
|
||||
case isCloudFunction():
|
||||
case name == "Google Cloud Functions", detectedResource.isCloudFunction():
|
||||
detectedResource.pb = detectCloudFunction()
|
||||
case isCloudRun():
|
||||
case name == "Google Cloud Run", detectedResource.isCloudRun():
|
||||
detectedResource.pb = detectCloudRunResource()
|
||||
case isKubernetesEngine():
|
||||
// cannot use name validation for GKE and GCE because
|
||||
// both of them set product name to "Google Compute Engine"
|
||||
case detectedResource.isKubernetesEngine():
|
||||
detectedResource.pb = detectKubernetesResource()
|
||||
case metadata.OnGCE():
|
||||
detectedResource.pb = detectGCEResource()
|
||||
case detectedResource.isComputeEngine():
|
||||
detectedResource.pb = detectComputeEngineResource()
|
||||
}
|
||||
}
|
||||
})
|
||||
return detectedResource.pb
|
||||
}
|
||||
|
||||
// systemProductName reads resource type on the Linux-based environments such as
|
||||
// Cloud Functions, Cloud Run, GKE, GCE, GAE, etc.
|
||||
func systemProductName() string {
|
||||
if runtime.GOOS != "linux" {
|
||||
// We don't have any non-Linux clues available, at least yet.
|
||||
return ""
|
||||
}
|
||||
slurp := detectedResource.attrs.ReadAll("/sys/class/dmi/id/product_name")
|
||||
return strings.TrimSpace(slurp)
|
||||
}
|
||||
|
||||
var resourceInfo = map[string]struct{ rtype, label string }{
|
||||
"organizations": {"organization", "organization_id"},
|
||||
"folders": {"folder", "folder_id"},
|
||||
|
@ -250,14 +273,6 @@ func monitoredResource(parent string) *mrpb.MonitoredResource {
|
|||
}
|
||||
}
|
||||
|
||||
func regionFromZone(zone string) string {
|
||||
cutoff := strings.LastIndex(zone, "-")
|
||||
if cutoff > 0 {
|
||||
return zone[:cutoff]
|
||||
}
|
||||
return zone
|
||||
}
|
||||
|
||||
func globalResource(projectID string) *mrpb.MonitoredResource {
|
||||
return &mrpb.MonitoredResource{
|
||||
Type: "global",
|
||||
|
|
12
vendor/cloud.google.com/go/longrunning/CHANGES.md
generated
vendored
Normal file
12
vendor/cloud.google.com/go/longrunning/CHANGES.md
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Changes
|
||||
|
||||
## [0.3.0](https://github.com/googleapis/google-cloud-go/compare/longrunning/v0.2.1...longrunning/v0.3.0) (2022-11-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **longrunning:** rewrite signatures in terms of new location ([3c4b2b3](https://github.com/googleapis/google-cloud-go/commit/3c4b2b34565795537aac1661e6af2442437e34ad))
|
||||
|
||||
## v0.1.0
|
||||
|
||||
Initial release.
|
202
vendor/cloud.google.com/go/longrunning/LICENSE
generated
vendored
Normal file
202
vendor/cloud.google.com/go/longrunning/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,202 @@
|
|||
|
||||
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.
|
26
vendor/cloud.google.com/go/longrunning/README.md
generated
vendored
Normal file
26
vendor/cloud.google.com/go/longrunning/README.md
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
# longrunning
|
||||
|
||||
[![Go Reference](https://pkg.go.dev/badge/cloud.google.com/go/longrunning.svg)](https://pkg.go.dev/cloud.google.com/go/longrunning)
|
||||
|
||||
A helper library for working with long running operations.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
go get cloud.google.com/go/longrunning
|
||||
```
|
||||
|
||||
## Go Version Support
|
||||
|
||||
See the [Go Versions Supported](https://github.com/googleapis/google-cloud-go#go-versions-supported)
|
||||
section in the root directory's README.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome. Please, see the [CONTRIBUTING](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/main/CONTRIBUTING.md)
|
||||
document for details.
|
||||
|
||||
Please note that this project is released with a Contributor Code of Conduct.
|
||||
By participating in this project you agree to abide by its terms. See
|
||||
[Contributor Code of Conduct](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/main/CONTRIBUTING.md#contributor-code-of-conduct)
|
||||
for more information.
|
197
vendor/cloud.google.com/go/longrunning/autogen/doc.go
generated
vendored
Normal file
197
vendor/cloud.google.com/go/longrunning/autogen/doc.go
generated
vendored
Normal file
|
@ -0,0 +1,197 @@
|
|||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// https://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.
|
||||
|
||||
// Code generated by protoc-gen-go_gapic. DO NOT EDIT.
|
||||
|
||||
// Package longrunning is an auto-generated package for the
|
||||
// Long Running Operations API.
|
||||
//
|
||||
// NOTE: This package is in alpha. It is not stable, and is likely to change.
|
||||
//
|
||||
// # Example usage
|
||||
//
|
||||
// To get started with this package, create a client.
|
||||
//
|
||||
// ctx := context.Background()
|
||||
// // This snippet has been automatically generated and should be regarded as a code template only.
|
||||
// // It will require modifications to work:
|
||||
// // - It may require correct/in-range values for request initialization.
|
||||
// // - It may require specifying regional endpoints when creating the service client as shown in:
|
||||
// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
|
||||
// c, err := longrunning.NewOperationsClient(ctx)
|
||||
// if err != nil {
|
||||
// // TODO: Handle error.
|
||||
// }
|
||||
// defer c.Close()
|
||||
//
|
||||
// The client will use your default application credentials. Clients should be reused instead of created as needed.
|
||||
// The methods of Client are safe for concurrent use by multiple goroutines.
|
||||
// The returned client must be Closed when it is done being used.
|
||||
//
|
||||
// # Using the Client
|
||||
//
|
||||
// The following is an example of making an API call with the newly created client.
|
||||
//
|
||||
// ctx := context.Background()
|
||||
// // This snippet has been automatically generated and should be regarded as a code template only.
|
||||
// // It will require modifications to work:
|
||||
// // - It may require correct/in-range values for request initialization.
|
||||
// // - It may require specifying regional endpoints when creating the service client as shown in:
|
||||
// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
|
||||
// c, err := longrunning.NewOperationsClient(ctx)
|
||||
// if err != nil {
|
||||
// // TODO: Handle error.
|
||||
// }
|
||||
// defer c.Close()
|
||||
//
|
||||
// req := &longrunningpb.ListOperationsRequest{
|
||||
// // TODO: Fill request struct fields.
|
||||
// // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
|
||||
// }
|
||||
// it := c.ListOperations(ctx, req)
|
||||
// for {
|
||||
// resp, err := it.Next()
|
||||
// if err == iterator.Done {
|
||||
// break
|
||||
// }
|
||||
// if err != nil {
|
||||
// // TODO: Handle error.
|
||||
// }
|
||||
// // TODO: Use resp.
|
||||
// _ = resp
|
||||
// }
|
||||
//
|
||||
// # Use of Context
|
||||
//
|
||||
// The ctx passed to NewOperationsClient is used for authentication requests and
|
||||
// for creating the underlying connection, but is not used for subsequent calls.
|
||||
// Individual methods on the client use the ctx given to them.
|
||||
//
|
||||
// To close the open connection, use the Close() method.
|
||||
//
|
||||
// For information about setting deadlines, reusing contexts, and more
|
||||
// please visit https://pkg.go.dev/cloud.google.com/go.
|
||||
package longrunning // import "cloud.google.com/go/longrunning/autogen"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
// For more information on implementing a client constructor hook, see
|
||||
// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors.
|
||||
type clientHookParams struct{}
|
||||
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
|
||||
|
||||
var versionClient string
|
||||
|
||||
func getVersionClient() string {
|
||||
if versionClient == "" {
|
||||
return "UNKNOWN"
|
||||
}
|
||||
return versionClient
|
||||
}
|
||||
|
||||
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
|
||||
out, _ := metadata.FromOutgoingContext(ctx)
|
||||
out = out.Copy()
|
||||
for _, md := range mds {
|
||||
for k, v := range md {
|
||||
out[k] = append(out[k], v...)
|
||||
}
|
||||
}
|
||||
return metadata.NewOutgoingContext(ctx, out)
|
||||
}
|
||||
|
||||
func checkDisableDeadlines() (bool, error) {
|
||||
raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE")
|
||||
if !ok {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
b, err := strconv.ParseBool(raw)
|
||||
return b, err
|
||||
}
|
||||
|
||||
// DefaultAuthScopes reports the default set of authentication scopes to use with this package.
|
||||
func DefaultAuthScopes() []string {
|
||||
return []string{
|
||||
"",
|
||||
}
|
||||
}
|
||||
|
||||
// versionGo returns the Go runtime version. The returned string
|
||||
// has no whitespace, suitable for reporting in header.
|
||||
func versionGo() string {
|
||||
const develPrefix = "devel +"
|
||||
|
||||
s := runtime.Version()
|
||||
if strings.HasPrefix(s, develPrefix) {
|
||||
s = s[len(develPrefix):]
|
||||
if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
|
||||
s = s[:p]
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
notSemverRune := func(r rune) bool {
|
||||
return !strings.ContainsRune("0123456789.", r)
|
||||
}
|
||||
|
||||
if strings.HasPrefix(s, "go1") {
|
||||
s = s[2:]
|
||||
var prerelease string
|
||||
if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
|
||||
s, prerelease = s[:p], s[p:]
|
||||
}
|
||||
if strings.HasSuffix(s, ".") {
|
||||
s += "0"
|
||||
} else if strings.Count(s, ".") < 2 {
|
||||
s += ".0"
|
||||
}
|
||||
if prerelease != "" {
|
||||
s += "-" + prerelease
|
||||
}
|
||||
return s
|
||||
}
|
||||
return "UNKNOWN"
|
||||
}
|
||||
|
||||
// maybeUnknownEnum wraps the given proto-JSON parsing error if it is the result
|
||||
// of receiving an unknown enum value.
|
||||
func maybeUnknownEnum(err error) error {
|
||||
if strings.Contains(err.Error(), "invalid value for enum type") {
|
||||
err = fmt.Errorf("received an unknown enum value; a later version of the library may support it: %w", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// buildHeaders extracts metadata from the outgoing context, joins it with any other
|
||||
// given metadata, and converts them into a http.Header.
|
||||
func buildHeaders(ctx context.Context, mds ...metadata.MD) http.Header {
|
||||
if cmd, ok := metadata.FromOutgoingContext(ctx); ok {
|
||||
mds = append(mds, cmd)
|
||||
}
|
||||
md := metadata.Join(mds...)
|
||||
return http.Header(md)
|
||||
}
|
30
vendor/cloud.google.com/go/longrunning/autogen/from_conn.go
generated
vendored
Normal file
30
vendor/cloud.google.com/go/longrunning/autogen/from_conn.go
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2020, Google LLC
|
||||
//
|
||||
// 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 longrunning
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// InternalFromConn is for use by the Google Cloud Libraries only.
|
||||
//
|
||||
// Deprecated. Use `NewOperationsClient(ctx, option.WithGRPCConn(conn))` instead.
|
||||
func InternalFromConn(conn *grpc.ClientConn) *OperationsClient {
|
||||
c, _ := NewOperationsClient(context.Background(), option.WithGRPCConn(conn))
|
||||
return c
|
||||
}
|
73
vendor/cloud.google.com/go/longrunning/autogen/gapic_metadata.json
generated
vendored
Normal file
73
vendor/cloud.google.com/go/longrunning/autogen/gapic_metadata.json
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
"schema": "1.0",
|
||||
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods.",
|
||||
"language": "go",
|
||||
"protoPackage": "google.longrunning",
|
||||
"libraryPackage": "cloud.google.com/go/longrunning/autogen",
|
||||
"services": {
|
||||
"Operations": {
|
||||
"clients": {
|
||||
"grpc": {
|
||||
"libraryClient": "OperationsClient",
|
||||
"rpcs": {
|
||||
"CancelOperation": {
|
||||
"methods": [
|
||||
"CancelOperation"
|
||||
]
|
||||
},
|
||||
"DeleteOperation": {
|
||||
"methods": [
|
||||
"DeleteOperation"
|
||||
]
|
||||
},
|
||||
"GetOperation": {
|
||||
"methods": [
|
||||
"GetOperation"
|
||||
]
|
||||
},
|
||||
"ListOperations": {
|
||||
"methods": [
|
||||
"ListOperations"
|
||||
]
|
||||
},
|
||||
"WaitOperation": {
|
||||
"methods": [
|
||||
"WaitOperation"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"rest": {
|
||||
"libraryClient": "OperationsClient",
|
||||
"rpcs": {
|
||||
"CancelOperation": {
|
||||
"methods": [
|
||||
"CancelOperation"
|
||||
]
|
||||
},
|
||||
"DeleteOperation": {
|
||||
"methods": [
|
||||
"DeleteOperation"
|
||||
]
|
||||
},
|
||||
"GetOperation": {
|
||||
"methods": [
|
||||
"GetOperation"
|
||||
]
|
||||
},
|
||||
"ListOperations": {
|
||||
"methods": [
|
||||
"ListOperations"
|
||||
]
|
||||
},
|
||||
"WaitOperation": {
|
||||
"methods": [
|
||||
"WaitOperation"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
24
vendor/cloud.google.com/go/longrunning/autogen/info.go
generated
vendored
Normal file
24
vendor/cloud.google.com/go/longrunning/autogen/info.go
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// 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 longrunning
|
||||
|
||||
// SetGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Also passes any
|
||||
// provided key-value pairs. Intended for use by Google-written clients.
|
||||
//
|
||||
// Internal use only.
|
||||
func (c *OperationsClient) SetGoogleClientInfo(keyval ...string) {
|
||||
c.setGoogleClientInfo(keyval...)
|
||||
}
|
|
@ -15,10 +15,10 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.12.2
|
||||
// protoc v3.21.5
|
||||
// source: google/longrunning/operations.proto
|
||||
|
||||
package longrunning
|
||||
package longrunningpb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
@ -70,6 +70,7 @@ type Operation struct {
|
|||
// If `done` == `true`, exactly one of `error` or `response` is set.
|
||||
//
|
||||
// Types that are assignable to Result:
|
||||
//
|
||||
// *Operation_Error
|
||||
// *Operation_Response
|
||||
Result isOperation_Result `protobuf_oneof:"result"`
|
917
vendor/cloud.google.com/go/longrunning/autogen/operations_client.go
generated
vendored
Normal file
917
vendor/cloud.google.com/go/longrunning/autogen/operations_client.go
generated
vendored
Normal file
|
@ -0,0 +1,917 @@
|
|||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// https://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.
|
||||
|
||||
// Code generated by protoc-gen-go_gapic. DO NOT EDIT.
|
||||
|
||||
package longrunning
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
|
||||
gax "github.com/googleapis/gax-go/v2"
|
||||
"google.golang.org/api/googleapi"
|
||||
"google.golang.org/api/iterator"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/option/internaloption"
|
||||
gtransport "google.golang.org/api/transport/grpc"
|
||||
httptransport "google.golang.org/api/transport/http"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var newOperationsClientHook clientHook
|
||||
|
||||
// OperationsCallOptions contains the retry settings for each method of OperationsClient.
|
||||
type OperationsCallOptions struct {
|
||||
ListOperations []gax.CallOption
|
||||
GetOperation []gax.CallOption
|
||||
DeleteOperation []gax.CallOption
|
||||
CancelOperation []gax.CallOption
|
||||
WaitOperation []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultOperationsGRPCClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
internaloption.WithDefaultEndpoint("longrunning.googleapis.com:443"),
|
||||
internaloption.WithDefaultMTLSEndpoint("longrunning.mtls.googleapis.com:443"),
|
||||
internaloption.WithDefaultAudience("https://longrunning.googleapis.com/"),
|
||||
internaloption.WithDefaultScopes(DefaultAuthScopes()...),
|
||||
internaloption.EnableJwtWithScope(),
|
||||
option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
|
||||
grpc.MaxCallRecvMsgSize(math.MaxInt32))),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultOperationsCallOptions() *OperationsCallOptions {
|
||||
return &OperationsCallOptions{
|
||||
ListOperations: []gax.CallOption{
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 500 * time.Millisecond,
|
||||
Max: 10000 * time.Millisecond,
|
||||
Multiplier: 2.00,
|
||||
})
|
||||
}),
|
||||
},
|
||||
GetOperation: []gax.CallOption{
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 500 * time.Millisecond,
|
||||
Max: 10000 * time.Millisecond,
|
||||
Multiplier: 2.00,
|
||||
})
|
||||
}),
|
||||
},
|
||||
DeleteOperation: []gax.CallOption{
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 500 * time.Millisecond,
|
||||
Max: 10000 * time.Millisecond,
|
||||
Multiplier: 2.00,
|
||||
})
|
||||
}),
|
||||
},
|
||||
CancelOperation: []gax.CallOption{
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 500 * time.Millisecond,
|
||||
Max: 10000 * time.Millisecond,
|
||||
Multiplier: 2.00,
|
||||
})
|
||||
}),
|
||||
},
|
||||
WaitOperation: []gax.CallOption{},
|
||||
}
|
||||
}
|
||||
|
||||
func defaultOperationsRESTCallOptions() *OperationsCallOptions {
|
||||
return &OperationsCallOptions{
|
||||
ListOperations: []gax.CallOption{
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnHTTPCodes(gax.Backoff{
|
||||
Initial: 500 * time.Millisecond,
|
||||
Max: 10000 * time.Millisecond,
|
||||
Multiplier: 2.00,
|
||||
},
|
||||
http.StatusServiceUnavailable)
|
||||
}),
|
||||
},
|
||||
GetOperation: []gax.CallOption{
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnHTTPCodes(gax.Backoff{
|
||||
Initial: 500 * time.Millisecond,
|
||||
Max: 10000 * time.Millisecond,
|
||||
Multiplier: 2.00,
|
||||
},
|
||||
http.StatusServiceUnavailable)
|
||||
}),
|
||||
},
|
||||
DeleteOperation: []gax.CallOption{
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnHTTPCodes(gax.Backoff{
|
||||
Initial: 500 * time.Millisecond,
|
||||
Max: 10000 * time.Millisecond,
|
||||
Multiplier: 2.00,
|
||||
},
|
||||
http.StatusServiceUnavailable)
|
||||
}),
|
||||
},
|
||||
CancelOperation: []gax.CallOption{
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnHTTPCodes(gax.Backoff{
|
||||
Initial: 500 * time.Millisecond,
|
||||
Max: 10000 * time.Millisecond,
|
||||
Multiplier: 2.00,
|
||||
},
|
||||
http.StatusServiceUnavailable)
|
||||
}),
|
||||
},
|
||||
WaitOperation: []gax.CallOption{},
|
||||
}
|
||||
}
|
||||
|
||||
// internalOperationsClient is an interface that defines the methods available from Long Running Operations API.
|
||||
type internalOperationsClient interface {
|
||||
Close() error
|
||||
setGoogleClientInfo(...string)
|
||||
Connection() *grpc.ClientConn
|
||||
ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
|
||||
GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
|
||||
DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
|
||||
CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
|
||||
WaitOperation(context.Context, *longrunningpb.WaitOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
|
||||
}
|
||||
|
||||
// OperationsClient is a client for interacting with Long Running Operations API.
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
//
|
||||
// Manages long-running operations with an API service.
|
||||
//
|
||||
// When an API method normally takes long time to complete, it can be designed
|
||||
// to return Operation to the client, and the client can use this
|
||||
// interface to receive the real response asynchronously by polling the
|
||||
// operation resource, or pass the operation resource to another API (such as
|
||||
// Google Cloud Pub/Sub API) to receive the response. Any API service that
|
||||
// returns long-running operations should implement the Operations interface
|
||||
// so developers can have a consistent client experience.
|
||||
type OperationsClient struct {
|
||||
// The internal transport-dependent client.
|
||||
internalClient internalOperationsClient
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *OperationsCallOptions
|
||||
}
|
||||
|
||||
// Wrapper methods routed to the internal client.
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *OperationsClient) Close() error {
|
||||
return c.internalClient.Close()
|
||||
}
|
||||
|
||||
// setGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *OperationsClient) setGoogleClientInfo(keyval ...string) {
|
||||
c.internalClient.setGoogleClientInfo(keyval...)
|
||||
}
|
||||
|
||||
// Connection returns a connection to the API service.
|
||||
//
|
||||
// Deprecated: Connections are now pooled so this method does not always
|
||||
// return the same resource.
|
||||
func (c *OperationsClient) Connection() *grpc.ClientConn {
|
||||
return c.internalClient.Connection()
|
||||
}
|
||||
|
||||
// ListOperations lists operations that match the specified filter in the request. If the
|
||||
// server doesn’t support this method, it returns UNIMPLEMENTED.
|
||||
//
|
||||
// NOTE: the name binding allows API services to override the binding
|
||||
// to use different resource name schemes, such as users/*/operations. To
|
||||
// override the binding, API services can add a binding such as
|
||||
// "/v1/{name=users/*}/operations" to their service configuration.
|
||||
// For backwards compatibility, the default name includes the operations
|
||||
// collection id, however overriding users must ensure the name binding
|
||||
// is the parent resource, without the operations collection id.
|
||||
func (c *OperationsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
|
||||
return c.internalClient.ListOperations(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// GetOperation gets the latest state of a long-running operation. Clients can use this
|
||||
// method to poll the operation result at intervals as recommended by the API
|
||||
// service.
|
||||
func (c *OperationsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
|
||||
return c.internalClient.GetOperation(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// DeleteOperation deletes a long-running operation. This method indicates that the client is
|
||||
// no longer interested in the operation result. It does not cancel the
|
||||
// operation. If the server doesn’t support this method, it returns
|
||||
// google.rpc.Code.UNIMPLEMENTED.
|
||||
func (c *OperationsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
|
||||
return c.internalClient.DeleteOperation(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// CancelOperation starts asynchronous cancellation on a long-running operation. The server
|
||||
// makes a best effort to cancel the operation, but success is not
|
||||
// guaranteed. If the server doesn’t support this method, it returns
|
||||
// google.rpc.Code.UNIMPLEMENTED. Clients can use
|
||||
// Operations.GetOperation or
|
||||
// other methods to check whether the cancellation succeeded or whether the
|
||||
// operation completed despite cancellation. On successful cancellation,
|
||||
// the operation is not deleted; instead, it becomes an operation with
|
||||
// an Operation.error value with a google.rpc.Status.code of 1,
|
||||
// corresponding to Code.CANCELLED.
|
||||
func (c *OperationsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
|
||||
return c.internalClient.CancelOperation(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// WaitOperation waits until the specified long-running operation is done or reaches at most
|
||||
// a specified timeout, returning the latest state. If the operation is
|
||||
// already done, the latest state is immediately returned. If the timeout
|
||||
// specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
||||
// timeout is used. If the server does not support this method, it returns
|
||||
// google.rpc.Code.UNIMPLEMENTED.
|
||||
// Note that this method is on a best-effort basis. It may return the latest
|
||||
// state before the specified timeout (including immediately), meaning even an
|
||||
// immediate response is no guarantee that the operation is done.
|
||||
func (c *OperationsClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
|
||||
return c.internalClient.WaitOperation(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// operationsGRPCClient is a client for interacting with Long Running Operations API over gRPC transport.
|
||||
//
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
type operationsGRPCClient struct {
|
||||
// Connection pool of gRPC connections to the service.
|
||||
connPool gtransport.ConnPool
|
||||
|
||||
// flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE
|
||||
disableDeadlines bool
|
||||
|
||||
// Points back to the CallOptions field of the containing OperationsClient
|
||||
CallOptions **OperationsCallOptions
|
||||
|
||||
// The gRPC API client.
|
||||
operationsClient longrunningpb.OperationsClient
|
||||
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewOperationsClient creates a new operations client based on gRPC.
|
||||
// The returned client must be Closed when it is done being used to clean up its underlying connections.
|
||||
//
|
||||
// Manages long-running operations with an API service.
|
||||
//
|
||||
// When an API method normally takes long time to complete, it can be designed
|
||||
// to return Operation to the client, and the client can use this
|
||||
// interface to receive the real response asynchronously by polling the
|
||||
// operation resource, or pass the operation resource to another API (such as
|
||||
// Google Cloud Pub/Sub API) to receive the response. Any API service that
|
||||
// returns long-running operations should implement the Operations interface
|
||||
// so developers can have a consistent client experience.
|
||||
func NewOperationsClient(ctx context.Context, opts ...option.ClientOption) (*OperationsClient, error) {
|
||||
clientOpts := defaultOperationsGRPCClientOptions()
|
||||
if newOperationsClientHook != nil {
|
||||
hookOpts, err := newOperationsClientHook(ctx, clientHookParams{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
clientOpts = append(clientOpts, hookOpts...)
|
||||
}
|
||||
|
||||
disableDeadlines, err := checkDisableDeadlines()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := OperationsClient{CallOptions: defaultOperationsCallOptions()}
|
||||
|
||||
c := &operationsGRPCClient{
|
||||
connPool: connPool,
|
||||
disableDeadlines: disableDeadlines,
|
||||
operationsClient: longrunningpb.NewOperationsClient(connPool),
|
||||
CallOptions: &client.CallOptions,
|
||||
}
|
||||
c.setGoogleClientInfo()
|
||||
|
||||
client.internalClient = c
|
||||
|
||||
return &client, nil
|
||||
}
|
||||
|
||||
// Connection returns a connection to the API service.
|
||||
//
|
||||
// Deprecated: Connections are now pooled so this method does not always
|
||||
// return the same resource.
|
||||
func (c *operationsGRPCClient) Connection() *grpc.ClientConn {
|
||||
return c.connPool.Conn()
|
||||
}
|
||||
|
||||
// setGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *operationsGRPCClient) setGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", versionGo()}, keyval...)
|
||||
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version)
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *operationsGRPCClient) Close() error {
|
||||
return c.connPool.Close()
|
||||
}
|
||||
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
type operationsRESTClient struct {
|
||||
// The http endpoint to connect to.
|
||||
endpoint string
|
||||
|
||||
// The http client.
|
||||
httpClient *http.Client
|
||||
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
|
||||
// Points back to the CallOptions field of the containing OperationsClient
|
||||
CallOptions **OperationsCallOptions
|
||||
}
|
||||
|
||||
// NewOperationsRESTClient creates a new operations rest client.
|
||||
//
|
||||
// Manages long-running operations with an API service.
|
||||
//
|
||||
// When an API method normally takes long time to complete, it can be designed
|
||||
// to return Operation to the client, and the client can use this
|
||||
// interface to receive the real response asynchronously by polling the
|
||||
// operation resource, or pass the operation resource to another API (such as
|
||||
// Google Cloud Pub/Sub API) to receive the response. Any API service that
|
||||
// returns long-running operations should implement the Operations interface
|
||||
// so developers can have a consistent client experience.
|
||||
func NewOperationsRESTClient(ctx context.Context, opts ...option.ClientOption) (*OperationsClient, error) {
|
||||
clientOpts := append(defaultOperationsRESTClientOptions(), opts...)
|
||||
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
callOpts := defaultOperationsRESTCallOptions()
|
||||
c := &operationsRESTClient{
|
||||
endpoint: endpoint,
|
||||
httpClient: httpClient,
|
||||
CallOptions: &callOpts,
|
||||
}
|
||||
c.setGoogleClientInfo()
|
||||
|
||||
return &OperationsClient{internalClient: c, CallOptions: callOpts}, nil
|
||||
}
|
||||
|
||||
func defaultOperationsRESTClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
internaloption.WithDefaultEndpoint("https://longrunning.googleapis.com"),
|
||||
internaloption.WithDefaultMTLSEndpoint("https://longrunning.mtls.googleapis.com"),
|
||||
internaloption.WithDefaultAudience("https://longrunning.googleapis.com/"),
|
||||
internaloption.WithDefaultScopes(DefaultAuthScopes()...),
|
||||
}
|
||||
}
|
||||
|
||||
// setGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *operationsRESTClient) setGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", versionGo()}, keyval...)
|
||||
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN")
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *operationsRESTClient) Close() error {
|
||||
// Replace httpClient with nil to force cleanup.
|
||||
c.httpClient = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Connection returns a connection to the API service.
|
||||
//
|
||||
// Deprecated: This method always returns nil.
|
||||
func (c *operationsRESTClient) Connection() *grpc.ClientConn {
|
||||
return nil
|
||||
}
|
||||
func (c *operationsGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
|
||||
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
|
||||
opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
|
||||
it := &OperationIterator{}
|
||||
req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
|
||||
resp := &longrunningpb.ListOperationsResponse{}
|
||||
if pageToken != "" {
|
||||
req.PageToken = pageToken
|
||||
}
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else if pageSize != 0 {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.operationsClient.ListOperations(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
it.Response = resp
|
||||
return resp.GetOperations(), resp.GetNextPageToken(), nil
|
||||
}
|
||||
fetch := func(pageSize int, pageToken string) (string, error) {
|
||||
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
it.items = append(it.items, items...)
|
||||
return nextPageToken, nil
|
||||
}
|
||||
|
||||
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
|
||||
it.pageInfo.MaxSize = int(req.GetPageSize())
|
||||
it.pageInfo.Token = req.GetPageToken()
|
||||
|
||||
return it
|
||||
}
|
||||
|
||||
func (c *operationsGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
|
||||
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
|
||||
cctx, cancel := context.WithTimeout(ctx, 10000*time.Millisecond)
|
||||
defer cancel()
|
||||
ctx = cctx
|
||||
}
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
|
||||
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
|
||||
opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
|
||||
var resp *longrunningpb.Operation
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.operationsClient.GetOperation(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *operationsGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
|
||||
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
|
||||
cctx, cancel := context.WithTimeout(ctx, 10000*time.Millisecond)
|
||||
defer cancel()
|
||||
ctx = cctx
|
||||
}
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
|
||||
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
|
||||
opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
_, err = c.operationsClient.DeleteOperation(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *operationsGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
|
||||
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
|
||||
cctx, cancel := context.WithTimeout(ctx, 10000*time.Millisecond)
|
||||
defer cancel()
|
||||
ctx = cctx
|
||||
}
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
|
||||
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
|
||||
opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
_, err = c.operationsClient.CancelOperation(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *operationsGRPCClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)
|
||||
var resp *longrunningpb.Operation
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.operationsClient.WaitOperation(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ListOperations lists operations that match the specified filter in the request. If the
|
||||
// server doesn’t support this method, it returns UNIMPLEMENTED.
|
||||
//
|
||||
// NOTE: the name binding allows API services to override the binding
|
||||
// to use different resource name schemes, such as users/*/operations. To
|
||||
// override the binding, API services can add a binding such as
|
||||
// "/v1/{name=users/*}/operations" to their service configuration.
|
||||
// For backwards compatibility, the default name includes the operations
|
||||
// collection id, however overriding users must ensure the name binding
|
||||
// is the parent resource, without the operations collection id.
|
||||
func (c *operationsRESTClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
|
||||
it := &OperationIterator{}
|
||||
req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
|
||||
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
|
||||
resp := &longrunningpb.ListOperationsResponse{}
|
||||
if pageToken != "" {
|
||||
req.PageToken = pageToken
|
||||
}
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else if pageSize != 0 {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
baseUrl, err := url.Parse(c.endpoint)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
|
||||
|
||||
params := url.Values{}
|
||||
if req.GetFilter() != "" {
|
||||
params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
|
||||
}
|
||||
if req.GetPageSize() != 0 {
|
||||
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
|
||||
}
|
||||
if req.GetPageToken() != "" {
|
||||
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
|
||||
}
|
||||
|
||||
baseUrl.RawQuery = params.Encode()
|
||||
|
||||
// Build HTTP headers from client and context metadata.
|
||||
headers := buildHeaders(ctx, c.xGoogMetadata, metadata.Pairs("Content-Type", "application/json"))
|
||||
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
if settings.Path != "" {
|
||||
baseUrl.Path = settings.Path
|
||||
}
|
||||
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq.Header = headers
|
||||
|
||||
httpRsp, err := c.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer httpRsp.Body.Close()
|
||||
|
||||
if err = googleapi.CheckResponse(httpRsp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}, opts...)
|
||||
if e != nil {
|
||||
return nil, "", e
|
||||
}
|
||||
it.Response = resp
|
||||
return resp.GetOperations(), resp.GetNextPageToken(), nil
|
||||
}
|
||||
|
||||
fetch := func(pageSize int, pageToken string) (string, error) {
|
||||
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
it.items = append(it.items, items...)
|
||||
return nextPageToken, nil
|
||||
}
|
||||
|
||||
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
|
||||
it.pageInfo.MaxSize = int(req.GetPageSize())
|
||||
it.pageInfo.Token = req.GetPageToken()
|
||||
|
||||
return it
|
||||
}
|
||||
|
||||
// GetOperation gets the latest state of a long-running operation. Clients can use this
|
||||
// method to poll the operation result at intervals as recommended by the API
|
||||
// service.
|
||||
func (c *operationsRESTClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
|
||||
baseUrl, err := url.Parse(c.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
|
||||
|
||||
// Build HTTP headers from client and context metadata.
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
|
||||
|
||||
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
|
||||
opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
|
||||
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
|
||||
resp := &longrunningpb.Operation{}
|
||||
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
if settings.Path != "" {
|
||||
baseUrl.Path = settings.Path
|
||||
}
|
||||
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq = httpReq.WithContext(ctx)
|
||||
httpReq.Header = headers
|
||||
|
||||
httpRsp, err := c.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer httpRsp.Body.Close()
|
||||
|
||||
if err = googleapi.CheckResponse(httpRsp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}, opts...)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteOperation deletes a long-running operation. This method indicates that the client is
|
||||
// no longer interested in the operation result. It does not cancel the
|
||||
// operation. If the server doesn’t support this method, it returns
|
||||
// google.rpc.Code.UNIMPLEMENTED.
|
||||
func (c *operationsRESTClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
|
||||
baseUrl, err := url.Parse(c.endpoint)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
|
||||
|
||||
// Build HTTP headers from client and context metadata.
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
|
||||
|
||||
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
|
||||
return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
if settings.Path != "" {
|
||||
baseUrl.Path = settings.Path
|
||||
}
|
||||
httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq = httpReq.WithContext(ctx)
|
||||
httpReq.Header = headers
|
||||
|
||||
httpRsp, err := c.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer httpRsp.Body.Close()
|
||||
|
||||
// Returns nil if there is no error, otherwise wraps
|
||||
// the response code and body into a non-nil error
|
||||
return googleapi.CheckResponse(httpRsp)
|
||||
}, opts...)
|
||||
}
|
||||
|
||||
// CancelOperation starts asynchronous cancellation on a long-running operation. The server
|
||||
// makes a best effort to cancel the operation, but success is not
|
||||
// guaranteed. If the server doesn’t support this method, it returns
|
||||
// google.rpc.Code.UNIMPLEMENTED. Clients can use
|
||||
// Operations.GetOperation or
|
||||
// other methods to check whether the cancellation succeeded or whether the
|
||||
// operation completed despite cancellation. On successful cancellation,
|
||||
// the operation is not deleted; instead, it becomes an operation with
|
||||
// an Operation.error value with a google.rpc.Status.code of 1,
|
||||
// corresponding to Code.CANCELLED.
|
||||
func (c *operationsRESTClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
|
||||
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
|
||||
jsonReq, err := m.Marshal(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
baseUrl, err := url.Parse(c.endpoint)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
baseUrl.Path += fmt.Sprintf("/v1/%v:cancel", req.GetName())
|
||||
|
||||
// Build HTTP headers from client and context metadata.
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
|
||||
|
||||
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
|
||||
return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
if settings.Path != "" {
|
||||
baseUrl.Path = settings.Path
|
||||
}
|
||||
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq = httpReq.WithContext(ctx)
|
||||
httpReq.Header = headers
|
||||
|
||||
httpRsp, err := c.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer httpRsp.Body.Close()
|
||||
|
||||
// Returns nil if there is no error, otherwise wraps
|
||||
// the response code and body into a non-nil error
|
||||
return googleapi.CheckResponse(httpRsp)
|
||||
}, opts...)
|
||||
}
|
||||
|
||||
// WaitOperation waits until the specified long-running operation is done or reaches at most
|
||||
// a specified timeout, returning the latest state. If the operation is
|
||||
// already done, the latest state is immediately returned. If the timeout
|
||||
// specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
||||
// timeout is used. If the server does not support this method, it returns
|
||||
// google.rpc.Code.UNIMPLEMENTED.
|
||||
// Note that this method is on a best-effort basis. It may return the latest
|
||||
// state before the specified timeout (including immediately), meaning even an
|
||||
// immediate response is no guarantee that the operation is done.
|
||||
func (c *operationsRESTClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
|
||||
baseUrl, err := url.Parse(c.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
baseUrl.Path += fmt.Sprintf("")
|
||||
|
||||
params := url.Values{}
|
||||
if req.GetName() != "" {
|
||||
params.Add("name", fmt.Sprintf("%v", req.GetName()))
|
||||
}
|
||||
if req.GetTimeout() != nil {
|
||||
timeout, err := protojson.Marshal(req.GetTimeout())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
params.Add("timeout", string(timeout))
|
||||
}
|
||||
|
||||
baseUrl.RawQuery = params.Encode()
|
||||
|
||||
// Build HTTP headers from client and context metadata.
|
||||
headers := buildHeaders(ctx, c.xGoogMetadata, metadata.Pairs("Content-Type", "application/json"))
|
||||
opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)
|
||||
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
|
||||
resp := &longrunningpb.Operation{}
|
||||
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
if settings.Path != "" {
|
||||
baseUrl.Path = settings.Path
|
||||
}
|
||||
httpReq, err := http.NewRequest("", baseUrl.String(), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq = httpReq.WithContext(ctx)
|
||||
httpReq.Header = headers
|
||||
|
||||
httpRsp, err := c.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer httpRsp.Body.Close()
|
||||
|
||||
if err = googleapi.CheckResponse(httpRsp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}, opts...)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// OperationIterator manages a stream of *longrunningpb.Operation.
|
||||
type OperationIterator struct {
|
||||
items []*longrunningpb.Operation
|
||||
pageInfo *iterator.PageInfo
|
||||
nextFunc func() error
|
||||
|
||||
// Response is the raw response for the current page.
|
||||
// It must be cast to the RPC response type.
|
||||
// Calling Next() or InternalFetch() updates this value.
|
||||
Response interface{}
|
||||
|
||||
// InternalFetch is for use by the Google Cloud Libraries only.
|
||||
// It is not part of the stable interface of this package.
|
||||
//
|
||||
// InternalFetch returns results from a single call to the underlying RPC.
|
||||
// The number of results is no greater than pageSize.
|
||||
// If there are no more results, nextPageToken is empty and err is nil.
|
||||
InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *OperationIterator) PageInfo() *iterator.PageInfo {
|
||||
return it.pageInfo
|
||||
}
|
||||
|
||||
// Next returns the next result. Its second return value is iterator.Done if there are no more
|
||||
// results. Once Next returns Done, all subsequent calls will return Done.
|
||||
func (it *OperationIterator) Next() (*longrunningpb.Operation, error) {
|
||||
var item *longrunningpb.Operation
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *OperationIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *OperationIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
179
vendor/cloud.google.com/go/longrunning/longrunning.go
generated
vendored
Normal file
179
vendor/cloud.google.com/go/longrunning/longrunning.go
generated
vendored
Normal file
|
@ -0,0 +1,179 @@
|
|||
// Copyright 2016 Google LLC
|
||||
//
|
||||
// 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 longrunning supports Long Running Operations for the Google Cloud Libraries.
|
||||
// See google.golang.org/genproto/googleapis/longrunning for its service definition.
|
||||
//
|
||||
// Users of the Google Cloud Libraries will typically not use this package directly.
|
||||
// Instead they will call functions returning Operations and call their methods.
|
||||
//
|
||||
// This package is still experimental and subject to change.
|
||||
package longrunning // import "cloud.google.com/go/longrunning"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
autogen "cloud.google.com/go/longrunning/autogen"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
gax "github.com/googleapis/gax-go/v2"
|
||||
pb "google.golang.org/genproto/googleapis/longrunning"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// ErrNoMetadata is the error returned by Metadata if the operation contains no metadata.
|
||||
var ErrNoMetadata = errors.New("operation contains no metadata")
|
||||
|
||||
// Operation represents the result of an API call that may not be ready yet.
|
||||
type Operation struct {
|
||||
c operationsClient
|
||||
proto *pb.Operation
|
||||
}
|
||||
|
||||
type operationsClient interface {
|
||||
GetOperation(context.Context, *pb.GetOperationRequest, ...gax.CallOption) (*pb.Operation, error)
|
||||
CancelOperation(context.Context, *pb.CancelOperationRequest, ...gax.CallOption) error
|
||||
DeleteOperation(context.Context, *pb.DeleteOperationRequest, ...gax.CallOption) error
|
||||
}
|
||||
|
||||
// InternalNewOperation is for use by the google Cloud Libraries only.
|
||||
//
|
||||
// InternalNewOperation returns an long-running operation, abstracting the raw pb.Operation.
|
||||
// The conn parameter refers to a server that proto was received from.
|
||||
func InternalNewOperation(inner *autogen.OperationsClient, proto *pb.Operation) *Operation {
|
||||
return &Operation{
|
||||
c: inner,
|
||||
proto: proto,
|
||||
}
|
||||
}
|
||||
|
||||
// Name returns the name of the long-running operation.
|
||||
// The name is assigned by the server and is unique within the service
|
||||
// from which the operation is created.
|
||||
func (op *Operation) Name() string {
|
||||
return op.proto.Name
|
||||
}
|
||||
|
||||
// Done reports whether the long-running operation has completed.
|
||||
func (op *Operation) Done() bool {
|
||||
return op.proto.Done
|
||||
}
|
||||
|
||||
// Metadata unmarshals op's metadata into meta.
|
||||
// If op does not contain any metadata, Metadata returns ErrNoMetadata and meta is unmodified.
|
||||
func (op *Operation) Metadata(meta proto.Message) error {
|
||||
if m := op.proto.Metadata; m != nil {
|
||||
return ptypes.UnmarshalAny(m, meta)
|
||||
}
|
||||
return ErrNoMetadata
|
||||
}
|
||||
|
||||
// Poll fetches the latest state of a long-running operation.
|
||||
//
|
||||
// If Poll fails, the error is returned and op is unmodified.
|
||||
// If Poll succeeds and the operation has completed with failure,
|
||||
// the error is returned and op.Done will return true.
|
||||
// If Poll succeeds and the operation has completed successfully,
|
||||
// op.Done will return true; if resp != nil, the response of the operation
|
||||
// is stored in resp.
|
||||
func (op *Operation) Poll(ctx context.Context, resp proto.Message, opts ...gax.CallOption) error {
|
||||
if !op.Done() {
|
||||
p, err := op.c.GetOperation(ctx, &pb.GetOperationRequest{Name: op.Name()}, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
op.proto = p
|
||||
}
|
||||
if !op.Done() {
|
||||
return nil
|
||||
}
|
||||
|
||||
switch r := op.proto.Result.(type) {
|
||||
case *pb.Operation_Error:
|
||||
// TODO(pongad): r.Details may contain further information
|
||||
return status.Errorf(codes.Code(r.Error.Code), "%s", r.Error.Message)
|
||||
case *pb.Operation_Response:
|
||||
if resp == nil {
|
||||
return nil
|
||||
}
|
||||
return ptypes.UnmarshalAny(r.Response, resp)
|
||||
default:
|
||||
return fmt.Errorf("unsupported result type %[1]T: %[1]v", r)
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultWaitInterval is the polling interval used by Operation.Wait.
|
||||
const DefaultWaitInterval = 60 * time.Second
|
||||
|
||||
// Wait is equivalent to WaitWithInterval using DefaultWaitInterval.
|
||||
func (op *Operation) Wait(ctx context.Context, resp proto.Message, opts ...gax.CallOption) error {
|
||||
return op.WaitWithInterval(ctx, resp, DefaultWaitInterval, opts...)
|
||||
}
|
||||
|
||||
// WaitWithInterval blocks until the operation is completed.
|
||||
// If resp != nil, Wait stores the response in resp.
|
||||
// WaitWithInterval polls every interval, except initially
|
||||
// when it polls using exponential backoff.
|
||||
//
|
||||
// See documentation of Poll for error-handling information.
|
||||
func (op *Operation) WaitWithInterval(ctx context.Context, resp proto.Message, interval time.Duration, opts ...gax.CallOption) error {
|
||||
bo := gax.Backoff{
|
||||
Initial: 1 * time.Second,
|
||||
Max: interval,
|
||||
}
|
||||
if bo.Max < bo.Initial {
|
||||
bo.Max = bo.Initial
|
||||
}
|
||||
return op.wait(ctx, resp, &bo, gax.Sleep, opts...)
|
||||
}
|
||||
|
||||
type sleeper func(context.Context, time.Duration) error
|
||||
|
||||
// wait implements Wait, taking exponentialBackoff and sleeper arguments for testing.
|
||||
func (op *Operation) wait(ctx context.Context, resp proto.Message, bo *gax.Backoff, sl sleeper, opts ...gax.CallOption) error {
|
||||
for {
|
||||
if err := op.Poll(ctx, resp, opts...); err != nil {
|
||||
return err
|
||||
}
|
||||
if op.Done() {
|
||||
return nil
|
||||
}
|
||||
if err := sl(ctx, bo.Pause()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cancel starts asynchronous cancellation on a long-running operation. The server
|
||||
// makes a best effort to cancel the operation, but success is not
|
||||
// guaranteed. If the server doesn't support this method, it returns
|
||||
// status.Code(err) == codes.Unimplemented. Clients can use
|
||||
// Poll or other methods to check whether the cancellation succeeded or whether the
|
||||
// operation completed despite cancellation. On successful cancellation,
|
||||
// the operation is not deleted; instead, op.Poll returns an error
|
||||
// with code Canceled.
|
||||
func (op *Operation) Cancel(ctx context.Context, opts ...gax.CallOption) error {
|
||||
return op.c.CancelOperation(ctx, &pb.CancelOperationRequest{Name: op.Name()}, opts...)
|
||||
}
|
||||
|
||||
// Delete deletes a long-running operation. This method indicates that the client is
|
||||
// no longer interested in the operation result. It does not cancel the
|
||||
// operation. If the server doesn't support this method, status.Code(err) == codes.Unimplemented.
|
||||
func (op *Operation) Delete(ctx context.Context, opts ...gax.CallOption) error {
|
||||
return op.c.DeleteOperation(ctx, &pb.DeleteOperationRequest{Name: op.Name()}, opts...)
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2019 Google LLC
|
||||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -12,11 +12,12 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This file, and the cloud.google.com/go import, won't actually become part of
|
||||
// This file, and the {{.RootMod}} import, won't actually become part of
|
||||
// the resultant binary.
|
||||
//go:build modhack
|
||||
// +build modhack
|
||||
|
||||
package logging
|
||||
package longrunning
|
||||
|
||||
// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
|
||||
import _ "cloud.google.com/go"
|
50
vendor/cloud.google.com/go/migration.md
generated
vendored
Normal file
50
vendor/cloud.google.com/go/migration.md
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
# go-genproto to google-cloud-go message type migration
|
||||
|
||||
The message types for all of our client libraries are being migrated from the
|
||||
`google.golang.org/genproto` [module](https://pkg.go.dev/google.golang.org/genproto)
|
||||
to their respective product specific module in this repository. For example
|
||||
this asset request type that was once found in [genproto](https://pkg.go.dev/google.golang.org/genproto@v0.0.0-20220908141613-51c1cc9bc6d0/googleapis/cloud/asset/v1p5beta1#ListAssetsRequest)
|
||||
can now be found in directly in the [asset module](https://pkg.go.dev/cloud.google.com/go/asset/apiv1p5beta1/assetpb#ListAssetsRequest).
|
||||
|
||||
Although the type definitions have moved, aliases have been left in the old
|
||||
genproto packages to ensure a smooth non-breaking transition.
|
||||
|
||||
## How do I migrate to the new packages?
|
||||
|
||||
The easiest option is to run a migration tool at the root of our project. It is
|
||||
like `go fix`, but specifically for this migration. Before running the tool it
|
||||
is best to make sure any modules that have the prefix of `cloud.google.com/go`
|
||||
are up to date. To run the tool, do the following:
|
||||
|
||||
```bash
|
||||
go run cloud.google.com/go/internal/aliasfix/cmd/aliasfix@latest .
|
||||
go mod tidy
|
||||
```
|
||||
|
||||
The tool should only change up to one line in the import statement per file.
|
||||
This can also be done by hand if you prefer.
|
||||
|
||||
## Do I have to migrate?
|
||||
|
||||
Yes if you wish to keep using the newest versions of our client libraries with
|
||||
the newest features -- You should migrate by the start of 2023. Until then we
|
||||
will keep updating the aliases in go-genproto weekly. If you have an existing
|
||||
workload that uses these client libraries and does not need to update its
|
||||
dependencies there is no action to take. All existing written code will continue
|
||||
to work.
|
||||
|
||||
## Why are these types being moved
|
||||
|
||||
1. This change will help simplify dependency trees over time.
|
||||
2. The types will now be in product specific modules that are versioned
|
||||
independently with semver. This is especially a benefit for users that rely
|
||||
on multiple clients in a single application. Because message types are no
|
||||
longer mono-packaged users are less likely to run into intermediate
|
||||
dependency conflicts when updating dependencies.
|
||||
3. Having all these types in one repository will help us ensure that unintended
|
||||
changes are caught before they would be released.
|
||||
|
||||
## Have questions?
|
||||
|
||||
Please reach out to us on our [issue tracker](https://github.com/googleapis/google-cloud-go/issues/new?assignees=&labels=genproto-migration&template=migration-issue.md&title=package%3A+migration+help)
|
||||
if you have any questions or concerns.
|
45
vendor/cloud.google.com/go/release-please-config-individual.json
generated
vendored
Normal file
45
vendor/cloud.google.com/go/release-please-config-individual.json
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
||||
"release-type": "go-yoshi",
|
||||
"include-component-in-tag": true,
|
||||
"separate-pull-requests": true,
|
||||
"tag-separator": "/",
|
||||
"packages": {
|
||||
"bigquery": {
|
||||
"component": "bigquery"
|
||||
},
|
||||
"bigtable": {
|
||||
"component": "bigtable"
|
||||
},
|
||||
"datastore": {
|
||||
"component": "datastore"
|
||||
},
|
||||
"errorreporting": {
|
||||
"component": "errorreporting"
|
||||
},
|
||||
"firestore": {
|
||||
"component": "firestore"
|
||||
},
|
||||
"logging": {
|
||||
"component": "logging"
|
||||
},
|
||||
"profiler": {
|
||||
"component": "profiler"
|
||||
},
|
||||
"pubsub": {
|
||||
"component": "pubsub"
|
||||
},
|
||||
"pubsublite": {
|
||||
"component": "pubsublite"
|
||||
},
|
||||
"spanner": {
|
||||
"component": "spanner"
|
||||
},
|
||||
"storage": {
|
||||
"component": "storage"
|
||||
}
|
||||
},
|
||||
"plugins": [
|
||||
"sentence-case"
|
||||
]
|
||||
}
|
15
vendor/cloud.google.com/go/release-please-config-yoshi-submodules.json
generated
vendored
15
vendor/cloud.google.com/go/release-please-config-yoshi-submodules.json
generated
vendored
|
@ -78,6 +78,9 @@
|
|||
"compute": {
|
||||
"component": "compute"
|
||||
},
|
||||
"compute/metadata": {
|
||||
"component": "compute/metadata"
|
||||
},
|
||||
"contactcenterinsights": {
|
||||
"component": "contactcenterinsights"
|
||||
},
|
||||
|
@ -129,6 +132,9 @@
|
|||
"domains": {
|
||||
"component": "domains"
|
||||
},
|
||||
"edgecontainer": {
|
||||
"component": "edgecontainer"
|
||||
},
|
||||
"essentialcontacts": {
|
||||
"component": "essentialcontacts"
|
||||
},
|
||||
|
@ -183,9 +189,15 @@
|
|||
"lifesciences": {
|
||||
"component": "lifesciences"
|
||||
},
|
||||
"longrunning": {
|
||||
"component": "longrunning"
|
||||
},
|
||||
"managedidentities": {
|
||||
"component": "managedidentities"
|
||||
},
|
||||
"maps": {
|
||||
"component": "maps"
|
||||
},
|
||||
"mediatranslation": {
|
||||
"component": "mediatranslation"
|
||||
},
|
||||
|
@ -330,5 +342,6 @@
|
|||
"workflows": {
|
||||
"component": "workflows"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugins": ["sentence-case"]
|
||||
}
|
||||
|
|
3
vendor/cloud.google.com/go/release-please-config.json
generated
vendored
3
vendor/cloud.google.com/go/release-please-config.json
generated
vendored
|
@ -6,5 +6,6 @@
|
|||
".": {
|
||||
"component": "main"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugins": ["sentence-case"]
|
||||
}
|
||||
|
|
117
vendor/go.opencensus.io/plugin/ochttp/client.go
generated
vendored
Normal file
117
vendor/go.opencensus.io/plugin/ochttp/client.go
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
|||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 ochttp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptrace"
|
||||
|
||||
"go.opencensus.io/trace"
|
||||
"go.opencensus.io/trace/propagation"
|
||||
)
|
||||
|
||||
// Transport is an http.RoundTripper that instruments all outgoing requests with
|
||||
// OpenCensus stats and tracing.
|
||||
//
|
||||
// The zero value is intended to be a useful default, but for
|
||||
// now it's recommended that you explicitly set Propagation, since the default
|
||||
// for this may change.
|
||||
type Transport struct {
|
||||
// Base may be set to wrap another http.RoundTripper that does the actual
|
||||
// requests. By default http.DefaultTransport is used.
|
||||
//
|
||||
// If base HTTP roundtripper implements CancelRequest,
|
||||
// the returned round tripper will be cancelable.
|
||||
Base http.RoundTripper
|
||||
|
||||
// Propagation defines how traces are propagated. If unspecified, a default
|
||||
// (currently B3 format) will be used.
|
||||
Propagation propagation.HTTPFormat
|
||||
|
||||
// StartOptions are applied to the span started by this Transport around each
|
||||
// request.
|
||||
//
|
||||
// StartOptions.SpanKind will always be set to trace.SpanKindClient
|
||||
// for spans started by this transport.
|
||||
StartOptions trace.StartOptions
|
||||
|
||||
// GetStartOptions allows to set start options per request. If set,
|
||||
// StartOptions is going to be ignored.
|
||||
GetStartOptions func(*http.Request) trace.StartOptions
|
||||
|
||||
// NameFromRequest holds the function to use for generating the span name
|
||||
// from the information found in the outgoing HTTP Request. By default the
|
||||
// name equals the URL Path.
|
||||
FormatSpanName func(*http.Request) string
|
||||
|
||||
// NewClientTrace may be set to a function allowing the current *trace.Span
|
||||
// to be annotated with HTTP request event information emitted by the
|
||||
// httptrace package.
|
||||
NewClientTrace func(*http.Request, *trace.Span) *httptrace.ClientTrace
|
||||
|
||||
// TODO: Implement tag propagation for HTTP.
|
||||
}
|
||||
|
||||
// RoundTrip implements http.RoundTripper, delegating to Base and recording stats and traces for the request.
|
||||
func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
rt := t.base()
|
||||
if isHealthEndpoint(req.URL.Path) {
|
||||
return rt.RoundTrip(req)
|
||||
}
|
||||
// TODO: remove excessive nesting of http.RoundTrippers here.
|
||||
format := t.Propagation
|
||||
if format == nil {
|
||||
format = defaultFormat
|
||||
}
|
||||
spanNameFormatter := t.FormatSpanName
|
||||
if spanNameFormatter == nil {
|
||||
spanNameFormatter = spanNameFromURL
|
||||
}
|
||||
|
||||
startOpts := t.StartOptions
|
||||
if t.GetStartOptions != nil {
|
||||
startOpts = t.GetStartOptions(req)
|
||||
}
|
||||
|
||||
rt = &traceTransport{
|
||||
base: rt,
|
||||
format: format,
|
||||
startOptions: trace.StartOptions{
|
||||
Sampler: startOpts.Sampler,
|
||||
SpanKind: trace.SpanKindClient,
|
||||
},
|
||||
formatSpanName: spanNameFormatter,
|
||||
newClientTrace: t.NewClientTrace,
|
||||
}
|
||||
rt = statsTransport{base: rt}
|
||||
return rt.RoundTrip(req)
|
||||
}
|
||||
|
||||
func (t *Transport) base() http.RoundTripper {
|
||||
if t.Base != nil {
|
||||
return t.Base
|
||||
}
|
||||
return http.DefaultTransport
|
||||
}
|
||||
|
||||
// CancelRequest cancels an in-flight request by closing its connection.
|
||||
func (t *Transport) CancelRequest(req *http.Request) {
|
||||
type canceler interface {
|
||||
CancelRequest(*http.Request)
|
||||
}
|
||||
if cr, ok := t.base().(canceler); ok {
|
||||
cr.CancelRequest(req)
|
||||
}
|
||||
}
|
143
vendor/go.opencensus.io/plugin/ochttp/client_stats.go
generated
vendored
Normal file
143
vendor/go.opencensus.io/plugin/ochttp/client_stats.go
generated
vendored
Normal file
|
@ -0,0 +1,143 @@
|
|||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 ochttp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"go.opencensus.io/stats"
|
||||
"go.opencensus.io/tag"
|
||||
)
|
||||
|
||||
// statsTransport is an http.RoundTripper that collects stats for the outgoing requests.
|
||||
type statsTransport struct {
|
||||
base http.RoundTripper
|
||||
}
|
||||
|
||||
// RoundTrip implements http.RoundTripper, delegating to Base and recording stats for the request.
|
||||
func (t statsTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
ctx, _ := tag.New(req.Context(),
|
||||
tag.Upsert(KeyClientHost, req.Host),
|
||||
tag.Upsert(Host, req.Host),
|
||||
tag.Upsert(KeyClientPath, req.URL.Path),
|
||||
tag.Upsert(Path, req.URL.Path),
|
||||
tag.Upsert(KeyClientMethod, req.Method),
|
||||
tag.Upsert(Method, req.Method))
|
||||
req = req.WithContext(ctx)
|
||||
track := &tracker{
|
||||
start: time.Now(),
|
||||
ctx: ctx,
|
||||
}
|
||||
if req.Body == nil {
|
||||
// TODO: Handle cases where ContentLength is not set.
|
||||
track.reqSize = -1
|
||||
} else if req.ContentLength > 0 {
|
||||
track.reqSize = req.ContentLength
|
||||
}
|
||||
stats.Record(ctx, ClientRequestCount.M(1))
|
||||
|
||||
// Perform request.
|
||||
resp, err := t.base.RoundTrip(req)
|
||||
|
||||
if err != nil {
|
||||
track.statusCode = http.StatusInternalServerError
|
||||
track.end()
|
||||
} else {
|
||||
track.statusCode = resp.StatusCode
|
||||
if req.Method != "HEAD" {
|
||||
track.respContentLength = resp.ContentLength
|
||||
}
|
||||
if resp.Body == nil {
|
||||
track.end()
|
||||
} else {
|
||||
track.body = resp.Body
|
||||
resp.Body = wrappedBody(track, resp.Body)
|
||||
}
|
||||
}
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// CancelRequest cancels an in-flight request by closing its connection.
|
||||
func (t statsTransport) CancelRequest(req *http.Request) {
|
||||
type canceler interface {
|
||||
CancelRequest(*http.Request)
|
||||
}
|
||||
if cr, ok := t.base.(canceler); ok {
|
||||
cr.CancelRequest(req)
|
||||
}
|
||||
}
|
||||
|
||||
type tracker struct {
|
||||
ctx context.Context
|
||||
respSize int64
|
||||
respContentLength int64
|
||||
reqSize int64
|
||||
start time.Time
|
||||
body io.ReadCloser
|
||||
statusCode int
|
||||
endOnce sync.Once
|
||||
}
|
||||
|
||||
var _ io.ReadCloser = (*tracker)(nil)
|
||||
|
||||
func (t *tracker) end() {
|
||||
t.endOnce.Do(func() {
|
||||
latencyMs := float64(time.Since(t.start)) / float64(time.Millisecond)
|
||||
respSize := t.respSize
|
||||
if t.respSize == 0 && t.respContentLength > 0 {
|
||||
respSize = t.respContentLength
|
||||
}
|
||||
m := []stats.Measurement{
|
||||
ClientSentBytes.M(t.reqSize),
|
||||
ClientReceivedBytes.M(respSize),
|
||||
ClientRoundtripLatency.M(latencyMs),
|
||||
ClientLatency.M(latencyMs),
|
||||
ClientResponseBytes.M(t.respSize),
|
||||
}
|
||||
if t.reqSize >= 0 {
|
||||
m = append(m, ClientRequestBytes.M(t.reqSize))
|
||||
}
|
||||
|
||||
stats.RecordWithTags(t.ctx, []tag.Mutator{
|
||||
tag.Upsert(StatusCode, strconv.Itoa(t.statusCode)),
|
||||
tag.Upsert(KeyClientStatus, strconv.Itoa(t.statusCode)),
|
||||
}, m...)
|
||||
})
|
||||
}
|
||||
|
||||
func (t *tracker) Read(b []byte) (int, error) {
|
||||
n, err := t.body.Read(b)
|
||||
t.respSize += int64(n)
|
||||
switch err {
|
||||
case nil:
|
||||
return n, nil
|
||||
case io.EOF:
|
||||
t.end()
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (t *tracker) Close() error {
|
||||
// Invoking endSpan on Close will help catch the cases
|
||||
// in which a read returned a non-nil error, we set the
|
||||
// span status but didn't end the span.
|
||||
t.end()
|
||||
return t.body.Close()
|
||||
}
|
19
vendor/go.opencensus.io/plugin/ochttp/doc.go
generated
vendored
Normal file
19
vendor/go.opencensus.io/plugin/ochttp/doc.go
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 ochttp provides OpenCensus instrumentation for net/http package.
|
||||
//
|
||||
// For server instrumentation, see Handler. For client-side instrumentation,
|
||||
// see Transport.
|
||||
package ochttp // import "go.opencensus.io/plugin/ochttp"
|
123
vendor/go.opencensus.io/plugin/ochttp/propagation/b3/b3.go
generated
vendored
Normal file
123
vendor/go.opencensus.io/plugin/ochttp/propagation/b3/b3.go
generated
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 b3 contains a propagation.HTTPFormat implementation
|
||||
// for B3 propagation. See https://github.com/openzipkin/b3-propagation
|
||||
// for more details.
|
||||
package b3 // import "go.opencensus.io/plugin/ochttp/propagation/b3"
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"net/http"
|
||||
|
||||
"go.opencensus.io/trace"
|
||||
"go.opencensus.io/trace/propagation"
|
||||
)
|
||||
|
||||
// B3 headers that OpenCensus understands.
|
||||
const (
|
||||
TraceIDHeader = "X-B3-TraceId"
|
||||
SpanIDHeader = "X-B3-SpanId"
|
||||
SampledHeader = "X-B3-Sampled"
|
||||
)
|
||||
|
||||
// HTTPFormat implements propagation.HTTPFormat to propagate
|
||||
// traces in HTTP headers in B3 propagation format.
|
||||
// HTTPFormat skips the X-B3-ParentId and X-B3-Flags headers
|
||||
// because there are additional fields not represented in the
|
||||
// OpenCensus span context. Spans created from the incoming
|
||||
// header will be the direct children of the client-side span.
|
||||
// Similarly, receiver of the outgoing spans should use client-side
|
||||
// span created by OpenCensus as the parent.
|
||||
type HTTPFormat struct{}
|
||||
|
||||
var _ propagation.HTTPFormat = (*HTTPFormat)(nil)
|
||||
|
||||
// SpanContextFromRequest extracts a B3 span context from incoming requests.
|
||||
func (f *HTTPFormat) SpanContextFromRequest(req *http.Request) (sc trace.SpanContext, ok bool) {
|
||||
tid, ok := ParseTraceID(req.Header.Get(TraceIDHeader))
|
||||
if !ok {
|
||||
return trace.SpanContext{}, false
|
||||
}
|
||||
sid, ok := ParseSpanID(req.Header.Get(SpanIDHeader))
|
||||
if !ok {
|
||||
return trace.SpanContext{}, false
|
||||
}
|
||||
sampled, _ := ParseSampled(req.Header.Get(SampledHeader))
|
||||
return trace.SpanContext{
|
||||
TraceID: tid,
|
||||
SpanID: sid,
|
||||
TraceOptions: sampled,
|
||||
}, true
|
||||
}
|
||||
|
||||
// ParseTraceID parses the value of the X-B3-TraceId header.
|
||||
func ParseTraceID(tid string) (trace.TraceID, bool) {
|
||||
if tid == "" {
|
||||
return trace.TraceID{}, false
|
||||
}
|
||||
b, err := hex.DecodeString(tid)
|
||||
if err != nil || len(b) > 16 {
|
||||
return trace.TraceID{}, false
|
||||
}
|
||||
var traceID trace.TraceID
|
||||
if len(b) <= 8 {
|
||||
// The lower 64-bits.
|
||||
start := 8 + (8 - len(b))
|
||||
copy(traceID[start:], b)
|
||||
} else {
|
||||
start := 16 - len(b)
|
||||
copy(traceID[start:], b)
|
||||
}
|
||||
|
||||
return traceID, true
|
||||
}
|
||||
|
||||
// ParseSpanID parses the value of the X-B3-SpanId or X-B3-ParentSpanId headers.
|
||||
func ParseSpanID(sid string) (spanID trace.SpanID, ok bool) {
|
||||
if sid == "" {
|
||||
return trace.SpanID{}, false
|
||||
}
|
||||
b, err := hex.DecodeString(sid)
|
||||
if err != nil || len(b) > 8 {
|
||||
return trace.SpanID{}, false
|
||||
}
|
||||
start := 8 - len(b)
|
||||
copy(spanID[start:], b)
|
||||
return spanID, true
|
||||
}
|
||||
|
||||
// ParseSampled parses the value of the X-B3-Sampled header.
|
||||
func ParseSampled(sampled string) (trace.TraceOptions, bool) {
|
||||
switch sampled {
|
||||
case "true", "1":
|
||||
return trace.TraceOptions(1), true
|
||||
default:
|
||||
return trace.TraceOptions(0), false
|
||||
}
|
||||
}
|
||||
|
||||
// SpanContextToRequest modifies the given request to include B3 headers.
|
||||
func (f *HTTPFormat) SpanContextToRequest(sc trace.SpanContext, req *http.Request) {
|
||||
req.Header.Set(TraceIDHeader, hex.EncodeToString(sc.TraceID[:]))
|
||||
req.Header.Set(SpanIDHeader, hex.EncodeToString(sc.SpanID[:]))
|
||||
|
||||
var sampled string
|
||||
if sc.IsSampled() {
|
||||
sampled = "1"
|
||||
} else {
|
||||
sampled = "0"
|
||||
}
|
||||
req.Header.Set(SampledHeader, sampled)
|
||||
}
|
61
vendor/go.opencensus.io/plugin/ochttp/route.go
generated
vendored
Normal file
61
vendor/go.opencensus.io/plugin/ochttp/route.go
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 ochttp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"go.opencensus.io/tag"
|
||||
)
|
||||
|
||||
// SetRoute sets the http_server_route tag to the given value.
|
||||
// It's useful when an HTTP framework does not support the http.Handler interface
|
||||
// and using WithRouteTag is not an option, but provides a way to hook into the request flow.
|
||||
func SetRoute(ctx context.Context, route string) {
|
||||
if a, ok := ctx.Value(addedTagsKey{}).(*addedTags); ok {
|
||||
a.t = append(a.t, tag.Upsert(KeyServerRoute, route))
|
||||
}
|
||||
}
|
||||
|
||||
// WithRouteTag returns an http.Handler that records stats with the
|
||||
// http_server_route tag set to the given value.
|
||||
func WithRouteTag(handler http.Handler, route string) http.Handler {
|
||||
return taggedHandlerFunc(func(w http.ResponseWriter, r *http.Request) []tag.Mutator {
|
||||
addRoute := []tag.Mutator{tag.Upsert(KeyServerRoute, route)}
|
||||
ctx, _ := tag.New(r.Context(), addRoute...)
|
||||
r = r.WithContext(ctx)
|
||||
handler.ServeHTTP(w, r)
|
||||
return addRoute
|
||||
})
|
||||
}
|
||||
|
||||
// taggedHandlerFunc is a http.Handler that returns tags describing the
|
||||
// processing of the request. These tags will be recorded along with the
|
||||
// measures in this package at the end of the request.
|
||||
type taggedHandlerFunc func(w http.ResponseWriter, r *http.Request) []tag.Mutator
|
||||
|
||||
func (h taggedHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
tags := h(w, r)
|
||||
if a, ok := r.Context().Value(addedTagsKey{}).(*addedTags); ok {
|
||||
a.t = append(a.t, tags...)
|
||||
}
|
||||
}
|
||||
|
||||
type addedTagsKey struct{}
|
||||
|
||||
type addedTags struct {
|
||||
t []tag.Mutator
|
||||
}
|
455
vendor/go.opencensus.io/plugin/ochttp/server.go
generated
vendored
Normal file
455
vendor/go.opencensus.io/plugin/ochttp/server.go
generated
vendored
Normal file
|
@ -0,0 +1,455 @@
|
|||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 ochttp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"go.opencensus.io/stats"
|
||||
"go.opencensus.io/tag"
|
||||
"go.opencensus.io/trace"
|
||||
"go.opencensus.io/trace/propagation"
|
||||
)
|
||||
|
||||
// Handler is an http.Handler wrapper to instrument your HTTP server with
|
||||
// OpenCensus. It supports both stats and tracing.
|
||||
//
|
||||
// # Tracing
|
||||
//
|
||||
// This handler is aware of the incoming request's span, reading it from request
|
||||
// headers as configured using the Propagation field.
|
||||
// The extracted span can be accessed from the incoming request's
|
||||
// context.
|
||||
//
|
||||
// span := trace.FromContext(r.Context())
|
||||
//
|
||||
// The server span will be automatically ended at the end of ServeHTTP.
|
||||
type Handler struct {
|
||||
// Propagation defines how traces are propagated. If unspecified,
|
||||
// B3 propagation will be used.
|
||||
Propagation propagation.HTTPFormat
|
||||
|
||||
// Handler is the handler used to handle the incoming request.
|
||||
Handler http.Handler
|
||||
|
||||
// StartOptions are applied to the span started by this Handler around each
|
||||
// request.
|
||||
//
|
||||
// StartOptions.SpanKind will always be set to trace.SpanKindServer
|
||||
// for spans started by this transport.
|
||||
StartOptions trace.StartOptions
|
||||
|
||||
// GetStartOptions allows to set start options per request. If set,
|
||||
// StartOptions is going to be ignored.
|
||||
GetStartOptions func(*http.Request) trace.StartOptions
|
||||
|
||||
// IsPublicEndpoint should be set to true for publicly accessible HTTP(S)
|
||||
// servers. If true, any trace metadata set on the incoming request will
|
||||
// be added as a linked trace instead of being added as a parent of the
|
||||
// current trace.
|
||||
IsPublicEndpoint bool
|
||||
|
||||
// FormatSpanName holds the function to use for generating the span name
|
||||
// from the information found in the incoming HTTP Request. By default the
|
||||
// name equals the URL Path.
|
||||
FormatSpanName func(*http.Request) string
|
||||
|
||||
// IsHealthEndpoint holds the function to use for determining if the
|
||||
// incoming HTTP request should be considered a health check. This is in
|
||||
// addition to the private isHealthEndpoint func which may also indicate
|
||||
// tracing should be skipped.
|
||||
IsHealthEndpoint func(*http.Request) bool
|
||||
}
|
||||
|
||||
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
var tags addedTags
|
||||
r, traceEnd := h.startTrace(w, r)
|
||||
defer traceEnd()
|
||||
w, statsEnd := h.startStats(w, r)
|
||||
defer statsEnd(&tags)
|
||||
handler := h.Handler
|
||||
if handler == nil {
|
||||
handler = http.DefaultServeMux
|
||||
}
|
||||
r = r.WithContext(context.WithValue(r.Context(), addedTagsKey{}, &tags))
|
||||
handler.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
func (h *Handler) startTrace(w http.ResponseWriter, r *http.Request) (*http.Request, func()) {
|
||||
if h.IsHealthEndpoint != nil && h.IsHealthEndpoint(r) || isHealthEndpoint(r.URL.Path) {
|
||||
return r, func() {}
|
||||
}
|
||||
var name string
|
||||
if h.FormatSpanName == nil {
|
||||
name = spanNameFromURL(r)
|
||||
} else {
|
||||
name = h.FormatSpanName(r)
|
||||
}
|
||||
ctx := r.Context()
|
||||
|
||||
startOpts := h.StartOptions
|
||||
if h.GetStartOptions != nil {
|
||||
startOpts = h.GetStartOptions(r)
|
||||
}
|
||||
|
||||
var span *trace.Span
|
||||
sc, ok := h.extractSpanContext(r)
|
||||
if ok && !h.IsPublicEndpoint {
|
||||
ctx, span = trace.StartSpanWithRemoteParent(ctx, name, sc,
|
||||
trace.WithSampler(startOpts.Sampler),
|
||||
trace.WithSpanKind(trace.SpanKindServer))
|
||||
} else {
|
||||
ctx, span = trace.StartSpan(ctx, name,
|
||||
trace.WithSampler(startOpts.Sampler),
|
||||
trace.WithSpanKind(trace.SpanKindServer),
|
||||
)
|
||||
if ok {
|
||||
span.AddLink(trace.Link{
|
||||
TraceID: sc.TraceID,
|
||||
SpanID: sc.SpanID,
|
||||
Type: trace.LinkTypeParent,
|
||||
Attributes: nil,
|
||||
})
|
||||
}
|
||||
}
|
||||
span.AddAttributes(requestAttrs(r)...)
|
||||
if r.Body == nil {
|
||||
// TODO: Handle cases where ContentLength is not set.
|
||||
} else if r.ContentLength > 0 {
|
||||
span.AddMessageReceiveEvent(0, /* TODO: messageID */
|
||||
r.ContentLength, -1)
|
||||
}
|
||||
return r.WithContext(ctx), span.End
|
||||
}
|
||||
|
||||
func (h *Handler) extractSpanContext(r *http.Request) (trace.SpanContext, bool) {
|
||||
if h.Propagation == nil {
|
||||
return defaultFormat.SpanContextFromRequest(r)
|
||||
}
|
||||
return h.Propagation.SpanContextFromRequest(r)
|
||||
}
|
||||
|
||||
func (h *Handler) startStats(w http.ResponseWriter, r *http.Request) (http.ResponseWriter, func(tags *addedTags)) {
|
||||
ctx, _ := tag.New(r.Context(),
|
||||
tag.Upsert(Host, r.Host),
|
||||
tag.Upsert(Path, r.URL.Path),
|
||||
tag.Upsert(Method, r.Method))
|
||||
track := &trackingResponseWriter{
|
||||
start: time.Now(),
|
||||
ctx: ctx,
|
||||
writer: w,
|
||||
}
|
||||
if r.Body == nil {
|
||||
// TODO: Handle cases where ContentLength is not set.
|
||||
track.reqSize = -1
|
||||
} else if r.ContentLength > 0 {
|
||||
track.reqSize = r.ContentLength
|
||||
}
|
||||
stats.Record(ctx, ServerRequestCount.M(1))
|
||||
return track.wrappedResponseWriter(), track.end
|
||||
}
|
||||
|
||||
type trackingResponseWriter struct {
|
||||
ctx context.Context
|
||||
reqSize int64
|
||||
respSize int64
|
||||
start time.Time
|
||||
statusCode int
|
||||
statusLine string
|
||||
endOnce sync.Once
|
||||
writer http.ResponseWriter
|
||||
}
|
||||
|
||||
// Compile time assertion for ResponseWriter interface
|
||||
var _ http.ResponseWriter = (*trackingResponseWriter)(nil)
|
||||
|
||||
func (t *trackingResponseWriter) end(tags *addedTags) {
|
||||
t.endOnce.Do(func() {
|
||||
if t.statusCode == 0 {
|
||||
t.statusCode = 200
|
||||
}
|
||||
|
||||
span := trace.FromContext(t.ctx)
|
||||
span.SetStatus(TraceStatus(t.statusCode, t.statusLine))
|
||||
span.AddAttributes(trace.Int64Attribute(StatusCodeAttribute, int64(t.statusCode)))
|
||||
|
||||
m := []stats.Measurement{
|
||||
ServerLatency.M(float64(time.Since(t.start)) / float64(time.Millisecond)),
|
||||
ServerResponseBytes.M(t.respSize),
|
||||
}
|
||||
if t.reqSize >= 0 {
|
||||
m = append(m, ServerRequestBytes.M(t.reqSize))
|
||||
}
|
||||
allTags := make([]tag.Mutator, len(tags.t)+1)
|
||||
allTags[0] = tag.Upsert(StatusCode, strconv.Itoa(t.statusCode))
|
||||
copy(allTags[1:], tags.t)
|
||||
stats.RecordWithTags(t.ctx, allTags, m...)
|
||||
})
|
||||
}
|
||||
|
||||
func (t *trackingResponseWriter) Header() http.Header {
|
||||
return t.writer.Header()
|
||||
}
|
||||
|
||||
func (t *trackingResponseWriter) Write(data []byte) (int, error) {
|
||||
n, err := t.writer.Write(data)
|
||||
t.respSize += int64(n)
|
||||
// Add message event for request bytes sent.
|
||||
span := trace.FromContext(t.ctx)
|
||||
span.AddMessageSendEvent(0 /* TODO: messageID */, int64(n), -1)
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (t *trackingResponseWriter) WriteHeader(statusCode int) {
|
||||
t.writer.WriteHeader(statusCode)
|
||||
t.statusCode = statusCode
|
||||
t.statusLine = http.StatusText(t.statusCode)
|
||||
}
|
||||
|
||||
// wrappedResponseWriter returns a wrapped version of the original
|
||||
//
|
||||
// ResponseWriter and only implements the same combination of additional
|
||||
//
|
||||
// interfaces as the original.
|
||||
// This implementation is based on https://github.com/felixge/httpsnoop.
|
||||
func (t *trackingResponseWriter) wrappedResponseWriter() http.ResponseWriter {
|
||||
var (
|
||||
hj, i0 = t.writer.(http.Hijacker)
|
||||
cn, i1 = t.writer.(http.CloseNotifier)
|
||||
pu, i2 = t.writer.(http.Pusher)
|
||||
fl, i3 = t.writer.(http.Flusher)
|
||||
rf, i4 = t.writer.(io.ReaderFrom)
|
||||
)
|
||||
|
||||
switch {
|
||||
case !i0 && !i1 && !i2 && !i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
}{t}
|
||||
case !i0 && !i1 && !i2 && !i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
io.ReaderFrom
|
||||
}{t, rf}
|
||||
case !i0 && !i1 && !i2 && i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Flusher
|
||||
}{t, fl}
|
||||
case !i0 && !i1 && !i2 && i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Flusher
|
||||
io.ReaderFrom
|
||||
}{t, fl, rf}
|
||||
case !i0 && !i1 && i2 && !i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Pusher
|
||||
}{t, pu}
|
||||
case !i0 && !i1 && i2 && !i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{t, pu, rf}
|
||||
case !i0 && !i1 && i2 && i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Pusher
|
||||
http.Flusher
|
||||
}{t, pu, fl}
|
||||
case !i0 && !i1 && i2 && i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Pusher
|
||||
http.Flusher
|
||||
io.ReaderFrom
|
||||
}{t, pu, fl, rf}
|
||||
case !i0 && i1 && !i2 && !i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
}{t, cn}
|
||||
case !i0 && i1 && !i2 && !i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
io.ReaderFrom
|
||||
}{t, cn, rf}
|
||||
case !i0 && i1 && !i2 && i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
}{t, cn, fl}
|
||||
case !i0 && i1 && !i2 && i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
io.ReaderFrom
|
||||
}{t, cn, fl, rf}
|
||||
case !i0 && i1 && i2 && !i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Pusher
|
||||
}{t, cn, pu}
|
||||
case !i0 && i1 && i2 && !i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{t, cn, pu, rf}
|
||||
case !i0 && i1 && i2 && i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Pusher
|
||||
http.Flusher
|
||||
}{t, cn, pu, fl}
|
||||
case !i0 && i1 && i2 && i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Pusher
|
||||
http.Flusher
|
||||
io.ReaderFrom
|
||||
}{t, cn, pu, fl, rf}
|
||||
case i0 && !i1 && !i2 && !i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
}{t, hj}
|
||||
case i0 && !i1 && !i2 && !i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
io.ReaderFrom
|
||||
}{t, hj, rf}
|
||||
case i0 && !i1 && !i2 && i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.Flusher
|
||||
}{t, hj, fl}
|
||||
case i0 && !i1 && !i2 && i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.Flusher
|
||||
io.ReaderFrom
|
||||
}{t, hj, fl, rf}
|
||||
case i0 && !i1 && i2 && !i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
}{t, hj, pu}
|
||||
case i0 && !i1 && i2 && !i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{t, hj, pu, rf}
|
||||
case i0 && !i1 && i2 && i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
http.Flusher
|
||||
}{t, hj, pu, fl}
|
||||
case i0 && !i1 && i2 && i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
http.Flusher
|
||||
io.ReaderFrom
|
||||
}{t, hj, pu, fl, rf}
|
||||
case i0 && i1 && !i2 && !i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.CloseNotifier
|
||||
}{t, hj, cn}
|
||||
case i0 && i1 && !i2 && !i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.CloseNotifier
|
||||
io.ReaderFrom
|
||||
}{t, hj, cn, rf}
|
||||
case i0 && i1 && !i2 && i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
}{t, hj, cn, fl}
|
||||
case i0 && i1 && !i2 && i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
io.ReaderFrom
|
||||
}{t, hj, cn, fl, rf}
|
||||
case i0 && i1 && i2 && !i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.CloseNotifier
|
||||
http.Pusher
|
||||
}{t, hj, cn, pu}
|
||||
case i0 && i1 && i2 && !i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.CloseNotifier
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{t, hj, cn, pu, rf}
|
||||
case i0 && i1 && i2 && i3 && !i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.CloseNotifier
|
||||
http.Pusher
|
||||
http.Flusher
|
||||
}{t, hj, cn, pu, fl}
|
||||
case i0 && i1 && i2 && i3 && i4:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.CloseNotifier
|
||||
http.Pusher
|
||||
http.Flusher
|
||||
io.ReaderFrom
|
||||
}{t, hj, cn, pu, fl, rf}
|
||||
default:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
}{t}
|
||||
}
|
||||
}
|
169
vendor/go.opencensus.io/plugin/ochttp/span_annotating_client_trace.go
generated
vendored
Normal file
169
vendor/go.opencensus.io/plugin/ochttp/span_annotating_client_trace.go
generated
vendored
Normal file
|
@ -0,0 +1,169 @@
|
|||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 ochttp
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net/http"
|
||||
"net/http/httptrace"
|
||||
"strings"
|
||||
|
||||
"go.opencensus.io/trace"
|
||||
)
|
||||
|
||||
type spanAnnotator struct {
|
||||
sp *trace.Span
|
||||
}
|
||||
|
||||
// TODO: Remove NewSpanAnnotator at the next release.
|
||||
|
||||
// NewSpanAnnotator returns a httptrace.ClientTrace which annotates
|
||||
// all emitted httptrace events on the provided Span.
|
||||
// Deprecated: Use NewSpanAnnotatingClientTrace instead
|
||||
func NewSpanAnnotator(r *http.Request, s *trace.Span) *httptrace.ClientTrace {
|
||||
return NewSpanAnnotatingClientTrace(r, s)
|
||||
}
|
||||
|
||||
// NewSpanAnnotatingClientTrace returns a httptrace.ClientTrace which annotates
|
||||
// all emitted httptrace events on the provided Span.
|
||||
func NewSpanAnnotatingClientTrace(_ *http.Request, s *trace.Span) *httptrace.ClientTrace {
|
||||
sa := spanAnnotator{sp: s}
|
||||
|
||||
return &httptrace.ClientTrace{
|
||||
GetConn: sa.getConn,
|
||||
GotConn: sa.gotConn,
|
||||
PutIdleConn: sa.putIdleConn,
|
||||
GotFirstResponseByte: sa.gotFirstResponseByte,
|
||||
Got100Continue: sa.got100Continue,
|
||||
DNSStart: sa.dnsStart,
|
||||
DNSDone: sa.dnsDone,
|
||||
ConnectStart: sa.connectStart,
|
||||
ConnectDone: sa.connectDone,
|
||||
TLSHandshakeStart: sa.tlsHandshakeStart,
|
||||
TLSHandshakeDone: sa.tlsHandshakeDone,
|
||||
WroteHeaders: sa.wroteHeaders,
|
||||
Wait100Continue: sa.wait100Continue,
|
||||
WroteRequest: sa.wroteRequest,
|
||||
}
|
||||
}
|
||||
|
||||
func (s spanAnnotator) getConn(hostPort string) {
|
||||
attrs := []trace.Attribute{
|
||||
trace.StringAttribute("httptrace.get_connection.host_port", hostPort),
|
||||
}
|
||||
s.sp.Annotate(attrs, "GetConn")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) gotConn(info httptrace.GotConnInfo) {
|
||||
attrs := []trace.Attribute{
|
||||
trace.BoolAttribute("httptrace.got_connection.reused", info.Reused),
|
||||
trace.BoolAttribute("httptrace.got_connection.was_idle", info.WasIdle),
|
||||
}
|
||||
if info.WasIdle {
|
||||
attrs = append(attrs,
|
||||
trace.StringAttribute("httptrace.got_connection.idle_time", info.IdleTime.String()))
|
||||
}
|
||||
s.sp.Annotate(attrs, "GotConn")
|
||||
}
|
||||
|
||||
// PutIdleConn implements a httptrace.ClientTrace hook
|
||||
func (s spanAnnotator) putIdleConn(err error) {
|
||||
var attrs []trace.Attribute
|
||||
if err != nil {
|
||||
attrs = append(attrs,
|
||||
trace.StringAttribute("httptrace.put_idle_connection.error", err.Error()))
|
||||
}
|
||||
s.sp.Annotate(attrs, "PutIdleConn")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) gotFirstResponseByte() {
|
||||
s.sp.Annotate(nil, "GotFirstResponseByte")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) got100Continue() {
|
||||
s.sp.Annotate(nil, "Got100Continue")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) dnsStart(info httptrace.DNSStartInfo) {
|
||||
attrs := []trace.Attribute{
|
||||
trace.StringAttribute("httptrace.dns_start.host", info.Host),
|
||||
}
|
||||
s.sp.Annotate(attrs, "DNSStart")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) dnsDone(info httptrace.DNSDoneInfo) {
|
||||
var addrs []string
|
||||
for _, addr := range info.Addrs {
|
||||
addrs = append(addrs, addr.String())
|
||||
}
|
||||
attrs := []trace.Attribute{
|
||||
trace.StringAttribute("httptrace.dns_done.addrs", strings.Join(addrs, " , ")),
|
||||
}
|
||||
if info.Err != nil {
|
||||
attrs = append(attrs,
|
||||
trace.StringAttribute("httptrace.dns_done.error", info.Err.Error()))
|
||||
}
|
||||
s.sp.Annotate(attrs, "DNSDone")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) connectStart(network, addr string) {
|
||||
attrs := []trace.Attribute{
|
||||
trace.StringAttribute("httptrace.connect_start.network", network),
|
||||
trace.StringAttribute("httptrace.connect_start.addr", addr),
|
||||
}
|
||||
s.sp.Annotate(attrs, "ConnectStart")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) connectDone(network, addr string, err error) {
|
||||
attrs := []trace.Attribute{
|
||||
trace.StringAttribute("httptrace.connect_done.network", network),
|
||||
trace.StringAttribute("httptrace.connect_done.addr", addr),
|
||||
}
|
||||
if err != nil {
|
||||
attrs = append(attrs,
|
||||
trace.StringAttribute("httptrace.connect_done.error", err.Error()))
|
||||
}
|
||||
s.sp.Annotate(attrs, "ConnectDone")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) tlsHandshakeStart() {
|
||||
s.sp.Annotate(nil, "TLSHandshakeStart")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) tlsHandshakeDone(_ tls.ConnectionState, err error) {
|
||||
var attrs []trace.Attribute
|
||||
if err != nil {
|
||||
attrs = append(attrs,
|
||||
trace.StringAttribute("httptrace.tls_handshake_done.error", err.Error()))
|
||||
}
|
||||
s.sp.Annotate(attrs, "TLSHandshakeDone")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) wroteHeaders() {
|
||||
s.sp.Annotate(nil, "WroteHeaders")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) wait100Continue() {
|
||||
s.sp.Annotate(nil, "Wait100Continue")
|
||||
}
|
||||
|
||||
func (s spanAnnotator) wroteRequest(info httptrace.WroteRequestInfo) {
|
||||
var attrs []trace.Attribute
|
||||
if info.Err != nil {
|
||||
attrs = append(attrs,
|
||||
trace.StringAttribute("httptrace.wrote_request.error", info.Err.Error()))
|
||||
}
|
||||
s.sp.Annotate(attrs, "WroteRequest")
|
||||
}
|
292
vendor/go.opencensus.io/plugin/ochttp/stats.go
generated
vendored
Normal file
292
vendor/go.opencensus.io/plugin/ochttp/stats.go
generated
vendored
Normal file
|
@ -0,0 +1,292 @@
|
|||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 ochttp
|
||||
|
||||
import (
|
||||
"go.opencensus.io/stats"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/tag"
|
||||
)
|
||||
|
||||
// Deprecated: client HTTP measures.
|
||||
var (
|
||||
// Deprecated: Use a Count aggregation over one of the other client measures to achieve the same effect.
|
||||
ClientRequestCount = stats.Int64(
|
||||
"opencensus.io/http/client/request_count",
|
||||
"Number of HTTP requests started",
|
||||
stats.UnitDimensionless)
|
||||
// Deprecated: Use ClientSentBytes.
|
||||
ClientRequestBytes = stats.Int64(
|
||||
"opencensus.io/http/client/request_bytes",
|
||||
"HTTP request body size if set as ContentLength (uncompressed)",
|
||||
stats.UnitBytes)
|
||||
// Deprecated: Use ClientReceivedBytes.
|
||||
ClientResponseBytes = stats.Int64(
|
||||
"opencensus.io/http/client/response_bytes",
|
||||
"HTTP response body size (uncompressed)",
|
||||
stats.UnitBytes)
|
||||
// Deprecated: Use ClientRoundtripLatency.
|
||||
ClientLatency = stats.Float64(
|
||||
"opencensus.io/http/client/latency",
|
||||
"End-to-end latency",
|
||||
stats.UnitMilliseconds)
|
||||
)
|
||||
|
||||
// The following client HTTP measures are supported for use in custom views.
|
||||
var (
|
||||
ClientSentBytes = stats.Int64(
|
||||
"opencensus.io/http/client/sent_bytes",
|
||||
"Total bytes sent in request body (not including headers)",
|
||||
stats.UnitBytes,
|
||||
)
|
||||
ClientReceivedBytes = stats.Int64(
|
||||
"opencensus.io/http/client/received_bytes",
|
||||
"Total bytes received in response bodies (not including headers but including error responses with bodies)",
|
||||
stats.UnitBytes,
|
||||
)
|
||||
ClientRoundtripLatency = stats.Float64(
|
||||
"opencensus.io/http/client/roundtrip_latency",
|
||||
"Time between first byte of request headers sent to last byte of response received, or terminal error",
|
||||
stats.UnitMilliseconds,
|
||||
)
|
||||
)
|
||||
|
||||
// The following server HTTP measures are supported for use in custom views:
|
||||
var (
|
||||
ServerRequestCount = stats.Int64(
|
||||
"opencensus.io/http/server/request_count",
|
||||
"Number of HTTP requests started",
|
||||
stats.UnitDimensionless)
|
||||
ServerRequestBytes = stats.Int64(
|
||||
"opencensus.io/http/server/request_bytes",
|
||||
"HTTP request body size if set as ContentLength (uncompressed)",
|
||||
stats.UnitBytes)
|
||||
ServerResponseBytes = stats.Int64(
|
||||
"opencensus.io/http/server/response_bytes",
|
||||
"HTTP response body size (uncompressed)",
|
||||
stats.UnitBytes)
|
||||
ServerLatency = stats.Float64(
|
||||
"opencensus.io/http/server/latency",
|
||||
"End-to-end latency",
|
||||
stats.UnitMilliseconds)
|
||||
)
|
||||
|
||||
// The following tags are applied to stats recorded by this package. Host, Path
|
||||
// and Method are applied to all measures. StatusCode is not applied to
|
||||
// ClientRequestCount or ServerRequestCount, since it is recorded before the status is known.
|
||||
var (
|
||||
// Host is the value of the HTTP Host header.
|
||||
//
|
||||
// The value of this tag can be controlled by the HTTP client, so you need
|
||||
// to watch out for potentially generating high-cardinality labels in your
|
||||
// metrics backend if you use this tag in views.
|
||||
Host = tag.MustNewKey("http.host")
|
||||
|
||||
// StatusCode is the numeric HTTP response status code,
|
||||
// or "error" if a transport error occurred and no status code was read.
|
||||
StatusCode = tag.MustNewKey("http.status")
|
||||
|
||||
// Path is the URL path (not including query string) in the request.
|
||||
//
|
||||
// The value of this tag can be controlled by the HTTP client, so you need
|
||||
// to watch out for potentially generating high-cardinality labels in your
|
||||
// metrics backend if you use this tag in views.
|
||||
Path = tag.MustNewKey("http.path")
|
||||
|
||||
// Method is the HTTP method of the request, capitalized (GET, POST, etc.).
|
||||
Method = tag.MustNewKey("http.method")
|
||||
|
||||
// KeyServerRoute is a low cardinality string representing the logical
|
||||
// handler of the request. This is usually the pattern registered on the a
|
||||
// ServeMux (or similar string).
|
||||
KeyServerRoute = tag.MustNewKey("http_server_route")
|
||||
)
|
||||
|
||||
// Client tag keys.
|
||||
var (
|
||||
// KeyClientMethod is the HTTP method, capitalized (i.e. GET, POST, PUT, DELETE, etc.).
|
||||
KeyClientMethod = tag.MustNewKey("http_client_method")
|
||||
// KeyClientPath is the URL path (not including query string).
|
||||
KeyClientPath = tag.MustNewKey("http_client_path")
|
||||
// KeyClientStatus is the HTTP status code as an integer (e.g. 200, 404, 500.), or "error" if no response status line was received.
|
||||
KeyClientStatus = tag.MustNewKey("http_client_status")
|
||||
// KeyClientHost is the value of the request Host header.
|
||||
KeyClientHost = tag.MustNewKey("http_client_host")
|
||||
)
|
||||
|
||||
// Default distributions used by views in this package.
|
||||
var (
|
||||
DefaultSizeDistribution = view.Distribution(1024, 2048, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456, 1073741824, 4294967296)
|
||||
DefaultLatencyDistribution = view.Distribution(1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 30, 40, 50, 65, 80, 100, 130, 160, 200, 250, 300, 400, 500, 650, 800, 1000, 2000, 5000, 10000, 20000, 50000, 100000)
|
||||
)
|
||||
|
||||
// Package ochttp provides some convenience views for client measures.
|
||||
// You still need to register these views for data to actually be collected.
|
||||
var (
|
||||
ClientSentBytesDistribution = &view.View{
|
||||
Name: "opencensus.io/http/client/sent_bytes",
|
||||
Measure: ClientSentBytes,
|
||||
Aggregation: DefaultSizeDistribution,
|
||||
Description: "Total bytes sent in request body (not including headers), by HTTP method and response status",
|
||||
TagKeys: []tag.Key{KeyClientMethod, KeyClientStatus},
|
||||
}
|
||||
|
||||
ClientReceivedBytesDistribution = &view.View{
|
||||
Name: "opencensus.io/http/client/received_bytes",
|
||||
Measure: ClientReceivedBytes,
|
||||
Aggregation: DefaultSizeDistribution,
|
||||
Description: "Total bytes received in response bodies (not including headers but including error responses with bodies), by HTTP method and response status",
|
||||
TagKeys: []tag.Key{KeyClientMethod, KeyClientStatus},
|
||||
}
|
||||
|
||||
ClientRoundtripLatencyDistribution = &view.View{
|
||||
Name: "opencensus.io/http/client/roundtrip_latency",
|
||||
Measure: ClientRoundtripLatency,
|
||||
Aggregation: DefaultLatencyDistribution,
|
||||
Description: "End-to-end latency, by HTTP method and response status",
|
||||
TagKeys: []tag.Key{KeyClientMethod, KeyClientStatus},
|
||||
}
|
||||
|
||||
ClientCompletedCount = &view.View{
|
||||
Name: "opencensus.io/http/client/completed_count",
|
||||
Measure: ClientRoundtripLatency,
|
||||
Aggregation: view.Count(),
|
||||
Description: "Count of completed requests, by HTTP method and response status",
|
||||
TagKeys: []tag.Key{KeyClientMethod, KeyClientStatus},
|
||||
}
|
||||
)
|
||||
|
||||
// Deprecated: Old client Views.
|
||||
var (
|
||||
// Deprecated: No direct replacement, but see ClientCompletedCount.
|
||||
ClientRequestCountView = &view.View{
|
||||
Name: "opencensus.io/http/client/request_count",
|
||||
Description: "Count of HTTP requests started",
|
||||
Measure: ClientRequestCount,
|
||||
Aggregation: view.Count(),
|
||||
}
|
||||
|
||||
// Deprecated: Use ClientSentBytesDistribution.
|
||||
ClientRequestBytesView = &view.View{
|
||||
Name: "opencensus.io/http/client/request_bytes",
|
||||
Description: "Size distribution of HTTP request body",
|
||||
Measure: ClientSentBytes,
|
||||
Aggregation: DefaultSizeDistribution,
|
||||
}
|
||||
|
||||
// Deprecated: Use ClientReceivedBytesDistribution instead.
|
||||
ClientResponseBytesView = &view.View{
|
||||
Name: "opencensus.io/http/client/response_bytes",
|
||||
Description: "Size distribution of HTTP response body",
|
||||
Measure: ClientReceivedBytes,
|
||||
Aggregation: DefaultSizeDistribution,
|
||||
}
|
||||
|
||||
// Deprecated: Use ClientRoundtripLatencyDistribution instead.
|
||||
ClientLatencyView = &view.View{
|
||||
Name: "opencensus.io/http/client/latency",
|
||||
Description: "Latency distribution of HTTP requests",
|
||||
Measure: ClientRoundtripLatency,
|
||||
Aggregation: DefaultLatencyDistribution,
|
||||
}
|
||||
|
||||
// Deprecated: Use ClientCompletedCount instead.
|
||||
ClientRequestCountByMethod = &view.View{
|
||||
Name: "opencensus.io/http/client/request_count_by_method",
|
||||
Description: "Client request count by HTTP method",
|
||||
TagKeys: []tag.Key{Method},
|
||||
Measure: ClientSentBytes,
|
||||
Aggregation: view.Count(),
|
||||
}
|
||||
|
||||
// Deprecated: Use ClientCompletedCount instead.
|
||||
ClientResponseCountByStatusCode = &view.View{
|
||||
Name: "opencensus.io/http/client/response_count_by_status_code",
|
||||
Description: "Client response count by status code",
|
||||
TagKeys: []tag.Key{StatusCode},
|
||||
Measure: ClientRoundtripLatency,
|
||||
Aggregation: view.Count(),
|
||||
}
|
||||
)
|
||||
|
||||
// Package ochttp provides some convenience views for server measures.
|
||||
// You still need to register these views for data to actually be collected.
|
||||
var (
|
||||
ServerRequestCountView = &view.View{
|
||||
Name: "opencensus.io/http/server/request_count",
|
||||
Description: "Count of HTTP requests started",
|
||||
Measure: ServerRequestCount,
|
||||
Aggregation: view.Count(),
|
||||
}
|
||||
|
||||
ServerRequestBytesView = &view.View{
|
||||
Name: "opencensus.io/http/server/request_bytes",
|
||||
Description: "Size distribution of HTTP request body",
|
||||
Measure: ServerRequestBytes,
|
||||
Aggregation: DefaultSizeDistribution,
|
||||
}
|
||||
|
||||
ServerResponseBytesView = &view.View{
|
||||
Name: "opencensus.io/http/server/response_bytes",
|
||||
Description: "Size distribution of HTTP response body",
|
||||
Measure: ServerResponseBytes,
|
||||
Aggregation: DefaultSizeDistribution,
|
||||
}
|
||||
|
||||
ServerLatencyView = &view.View{
|
||||
Name: "opencensus.io/http/server/latency",
|
||||
Description: "Latency distribution of HTTP requests",
|
||||
Measure: ServerLatency,
|
||||
Aggregation: DefaultLatencyDistribution,
|
||||
}
|
||||
|
||||
ServerRequestCountByMethod = &view.View{
|
||||
Name: "opencensus.io/http/server/request_count_by_method",
|
||||
Description: "Server request count by HTTP method",
|
||||
TagKeys: []tag.Key{Method},
|
||||
Measure: ServerRequestCount,
|
||||
Aggregation: view.Count(),
|
||||
}
|
||||
|
||||
ServerResponseCountByStatusCode = &view.View{
|
||||
Name: "opencensus.io/http/server/response_count_by_status_code",
|
||||
Description: "Server response count by status code",
|
||||
TagKeys: []tag.Key{StatusCode},
|
||||
Measure: ServerLatency,
|
||||
Aggregation: view.Count(),
|
||||
}
|
||||
)
|
||||
|
||||
// DefaultClientViews are the default client views provided by this package.
|
||||
// Deprecated: No replacement. Register the views you would like individually.
|
||||
var DefaultClientViews = []*view.View{
|
||||
ClientRequestCountView,
|
||||
ClientRequestBytesView,
|
||||
ClientResponseBytesView,
|
||||
ClientLatencyView,
|
||||
ClientRequestCountByMethod,
|
||||
ClientResponseCountByStatusCode,
|
||||
}
|
||||
|
||||
// DefaultServerViews are the default server views provided by this package.
|
||||
// Deprecated: No replacement. Register the views you would like individually.
|
||||
var DefaultServerViews = []*view.View{
|
||||
ServerRequestCountView,
|
||||
ServerRequestBytesView,
|
||||
ServerResponseBytesView,
|
||||
ServerLatencyView,
|
||||
ServerRequestCountByMethod,
|
||||
ServerResponseCountByStatusCode,
|
||||
}
|
244
vendor/go.opencensus.io/plugin/ochttp/trace.go
generated
vendored
Normal file
244
vendor/go.opencensus.io/plugin/ochttp/trace.go
generated
vendored
Normal file
|
@ -0,0 +1,244 @@
|
|||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 ochttp
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptrace"
|
||||
|
||||
"go.opencensus.io/plugin/ochttp/propagation/b3"
|
||||
"go.opencensus.io/trace"
|
||||
"go.opencensus.io/trace/propagation"
|
||||
)
|
||||
|
||||
// TODO(jbd): Add godoc examples.
|
||||
|
||||
var defaultFormat propagation.HTTPFormat = &b3.HTTPFormat{}
|
||||
|
||||
// Attributes recorded on the span for the requests.
|
||||
// Only trace exporters will need them.
|
||||
const (
|
||||
HostAttribute = "http.host"
|
||||
MethodAttribute = "http.method"
|
||||
PathAttribute = "http.path"
|
||||
URLAttribute = "http.url"
|
||||
UserAgentAttribute = "http.user_agent"
|
||||
StatusCodeAttribute = "http.status_code"
|
||||
)
|
||||
|
||||
type traceTransport struct {
|
||||
base http.RoundTripper
|
||||
startOptions trace.StartOptions
|
||||
format propagation.HTTPFormat
|
||||
formatSpanName func(*http.Request) string
|
||||
newClientTrace func(*http.Request, *trace.Span) *httptrace.ClientTrace
|
||||
}
|
||||
|
||||
// TODO(jbd): Add message events for request and response size.
|
||||
|
||||
// RoundTrip creates a trace.Span and inserts it into the outgoing request's headers.
|
||||
// The created span can follow a parent span, if a parent is presented in
|
||||
// the request's context.
|
||||
func (t *traceTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
name := t.formatSpanName(req)
|
||||
// TODO(jbd): Discuss whether we want to prefix
|
||||
// outgoing requests with Sent.
|
||||
ctx, span := trace.StartSpan(req.Context(), name,
|
||||
trace.WithSampler(t.startOptions.Sampler),
|
||||
trace.WithSpanKind(trace.SpanKindClient))
|
||||
|
||||
if t.newClientTrace != nil {
|
||||
req = req.WithContext(httptrace.WithClientTrace(ctx, t.newClientTrace(req, span)))
|
||||
} else {
|
||||
req = req.WithContext(ctx)
|
||||
}
|
||||
|
||||
if t.format != nil {
|
||||
// SpanContextToRequest will modify its Request argument, which is
|
||||
// contrary to the contract for http.RoundTripper, so we need to
|
||||
// pass it a copy of the Request.
|
||||
// However, the Request struct itself was already copied by
|
||||
// the WithContext calls above and so we just need to copy the header.
|
||||
header := make(http.Header)
|
||||
for k, v := range req.Header {
|
||||
header[k] = v
|
||||
}
|
||||
req.Header = header
|
||||
t.format.SpanContextToRequest(span.SpanContext(), req)
|
||||
}
|
||||
|
||||
span.AddAttributes(requestAttrs(req)...)
|
||||
resp, err := t.base.RoundTrip(req)
|
||||
if err != nil {
|
||||
span.SetStatus(trace.Status{Code: trace.StatusCodeUnknown, Message: err.Error()})
|
||||
span.End()
|
||||
return resp, err
|
||||
}
|
||||
|
||||
span.AddAttributes(responseAttrs(resp)...)
|
||||
span.SetStatus(TraceStatus(resp.StatusCode, resp.Status))
|
||||
|
||||
// span.End() will be invoked after
|
||||
// a read from resp.Body returns io.EOF or when
|
||||
// resp.Body.Close() is invoked.
|
||||
bt := &bodyTracker{rc: resp.Body, span: span}
|
||||
resp.Body = wrappedBody(bt, resp.Body)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// bodyTracker wraps a response.Body and invokes
|
||||
// trace.EndSpan on encountering io.EOF on reading
|
||||
// the body of the original response.
|
||||
type bodyTracker struct {
|
||||
rc io.ReadCloser
|
||||
span *trace.Span
|
||||
}
|
||||
|
||||
var _ io.ReadCloser = (*bodyTracker)(nil)
|
||||
|
||||
func (bt *bodyTracker) Read(b []byte) (int, error) {
|
||||
n, err := bt.rc.Read(b)
|
||||
|
||||
switch err {
|
||||
case nil:
|
||||
return n, nil
|
||||
case io.EOF:
|
||||
bt.span.End()
|
||||
default:
|
||||
// For all other errors, set the span status
|
||||
bt.span.SetStatus(trace.Status{
|
||||
// Code 2 is the error code for Internal server error.
|
||||
Code: 2,
|
||||
Message: err.Error(),
|
||||
})
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (bt *bodyTracker) Close() error {
|
||||
// Invoking endSpan on Close will help catch the cases
|
||||
// in which a read returned a non-nil error, we set the
|
||||
// span status but didn't end the span.
|
||||
bt.span.End()
|
||||
return bt.rc.Close()
|
||||
}
|
||||
|
||||
// CancelRequest cancels an in-flight request by closing its connection.
|
||||
func (t *traceTransport) CancelRequest(req *http.Request) {
|
||||
type canceler interface {
|
||||
CancelRequest(*http.Request)
|
||||
}
|
||||
if cr, ok := t.base.(canceler); ok {
|
||||
cr.CancelRequest(req)
|
||||
}
|
||||
}
|
||||
|
||||
func spanNameFromURL(req *http.Request) string {
|
||||
return req.URL.Path
|
||||
}
|
||||
|
||||
func requestAttrs(r *http.Request) []trace.Attribute {
|
||||
userAgent := r.UserAgent()
|
||||
|
||||
attrs := make([]trace.Attribute, 0, 5)
|
||||
attrs = append(attrs,
|
||||
trace.StringAttribute(PathAttribute, r.URL.Path),
|
||||
trace.StringAttribute(URLAttribute, r.URL.String()),
|
||||
trace.StringAttribute(HostAttribute, r.Host),
|
||||
trace.StringAttribute(MethodAttribute, r.Method),
|
||||
)
|
||||
|
||||
if userAgent != "" {
|
||||
attrs = append(attrs, trace.StringAttribute(UserAgentAttribute, userAgent))
|
||||
}
|
||||
|
||||
return attrs
|
||||
}
|
||||
|
||||
func responseAttrs(resp *http.Response) []trace.Attribute {
|
||||
return []trace.Attribute{
|
||||
trace.Int64Attribute(StatusCodeAttribute, int64(resp.StatusCode)),
|
||||
}
|
||||
}
|
||||
|
||||
// TraceStatus is a utility to convert the HTTP status code to a trace.Status that
|
||||
// represents the outcome as closely as possible.
|
||||
func TraceStatus(httpStatusCode int, statusLine string) trace.Status {
|
||||
var code int32
|
||||
if httpStatusCode < 200 || httpStatusCode >= 400 {
|
||||
code = trace.StatusCodeUnknown
|
||||
}
|
||||
switch httpStatusCode {
|
||||
case 499:
|
||||
code = trace.StatusCodeCancelled
|
||||
case http.StatusBadRequest:
|
||||
code = trace.StatusCodeInvalidArgument
|
||||
case http.StatusUnprocessableEntity:
|
||||
code = trace.StatusCodeInvalidArgument
|
||||
case http.StatusGatewayTimeout:
|
||||
code = trace.StatusCodeDeadlineExceeded
|
||||
case http.StatusNotFound:
|
||||
code = trace.StatusCodeNotFound
|
||||
case http.StatusForbidden:
|
||||
code = trace.StatusCodePermissionDenied
|
||||
case http.StatusUnauthorized: // 401 is actually unauthenticated.
|
||||
code = trace.StatusCodeUnauthenticated
|
||||
case http.StatusTooManyRequests:
|
||||
code = trace.StatusCodeResourceExhausted
|
||||
case http.StatusNotImplemented:
|
||||
code = trace.StatusCodeUnimplemented
|
||||
case http.StatusServiceUnavailable:
|
||||
code = trace.StatusCodeUnavailable
|
||||
case http.StatusOK:
|
||||
code = trace.StatusCodeOK
|
||||
case http.StatusConflict:
|
||||
code = trace.StatusCodeAlreadyExists
|
||||
}
|
||||
|
||||
return trace.Status{Code: code, Message: codeToStr[code]}
|
||||
}
|
||||
|
||||
var codeToStr = map[int32]string{
|
||||
trace.StatusCodeOK: `OK`,
|
||||
trace.StatusCodeCancelled: `CANCELLED`,
|
||||
trace.StatusCodeUnknown: `UNKNOWN`,
|
||||
trace.StatusCodeInvalidArgument: `INVALID_ARGUMENT`,
|
||||
trace.StatusCodeDeadlineExceeded: `DEADLINE_EXCEEDED`,
|
||||
trace.StatusCodeNotFound: `NOT_FOUND`,
|
||||
trace.StatusCodeAlreadyExists: `ALREADY_EXISTS`,
|
||||
trace.StatusCodePermissionDenied: `PERMISSION_DENIED`,
|
||||
trace.StatusCodeResourceExhausted: `RESOURCE_EXHAUSTED`,
|
||||
trace.StatusCodeFailedPrecondition: `FAILED_PRECONDITION`,
|
||||
trace.StatusCodeAborted: `ABORTED`,
|
||||
trace.StatusCodeOutOfRange: `OUT_OF_RANGE`,
|
||||
trace.StatusCodeUnimplemented: `UNIMPLEMENTED`,
|
||||
trace.StatusCodeInternal: `INTERNAL`,
|
||||
trace.StatusCodeUnavailable: `UNAVAILABLE`,
|
||||
trace.StatusCodeDataLoss: `DATA_LOSS`,
|
||||
trace.StatusCodeUnauthenticated: `UNAUTHENTICATED`,
|
||||
}
|
||||
|
||||
func isHealthEndpoint(path string) bool {
|
||||
// Health checking is pretty frequent and
|
||||
// traces collected for health endpoints
|
||||
// can be extremely noisy and expensive.
|
||||
// Disable canonical health checking endpoints
|
||||
// like /healthz and /_ah/health for now.
|
||||
if path == "/healthz" || path == "/_ah/health" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
44
vendor/go.opencensus.io/plugin/ochttp/wrapped_body.go
generated
vendored
Normal file
44
vendor/go.opencensus.io/plugin/ochttp/wrapped_body.go
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Copyright 2019, OpenCensus Authors
|
||||
//
|
||||
// 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 ochttp
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// wrappedBody returns a wrapped version of the original
|
||||
// Body and only implements the same combination of additional
|
||||
// interfaces as the original.
|
||||
func wrappedBody(wrapper io.ReadCloser, body io.ReadCloser) io.ReadCloser {
|
||||
var (
|
||||
wr, i0 = body.(io.Writer)
|
||||
)
|
||||
switch {
|
||||
case !i0:
|
||||
return struct {
|
||||
io.ReadCloser
|
||||
}{wrapper}
|
||||
|
||||
case i0:
|
||||
return struct {
|
||||
io.ReadCloser
|
||||
io.Writer
|
||||
}{wrapper, wr}
|
||||
default:
|
||||
return struct {
|
||||
io.ReadCloser
|
||||
}{wrapper}
|
||||
}
|
||||
}
|
13
vendor/google.golang.org/api/googleapi/googleapi.go
generated
vendored
13
vendor/google.golang.org/api/googleapi/googleapi.go
generated
vendored
|
@ -79,6 +79,9 @@ type Error struct {
|
|||
Header http.Header
|
||||
|
||||
Errors []ErrorItem
|
||||
// err is typically a wrapped apierror.APIError, see
|
||||
// google-api-go-client/internal/gensupport/error.go.
|
||||
err error
|
||||
}
|
||||
|
||||
// ErrorItem is a detailed error code & message from the Google API frontend.
|
||||
|
@ -122,6 +125,15 @@ func (e *Error) Error() string {
|
|||
return buf.String()
|
||||
}
|
||||
|
||||
// Wrap allows an existing Error to wrap another error. See also [Error.Unwrap].
|
||||
func (e *Error) Wrap(err error) {
|
||||
e.err = err
|
||||
}
|
||||
|
||||
func (e *Error) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
||||
type errorReply struct {
|
||||
Error *Error `json:"error"`
|
||||
}
|
||||
|
@ -176,6 +188,7 @@ func CheckMediaResponse(res *http.Response) error {
|
|||
return &Error{
|
||||
Code: res.StatusCode,
|
||||
Body: string(slurp),
|
||||
Header: res.Header,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
44
vendor/google.golang.org/api/googleapi/transport/apikey.go
generated
vendored
Normal file
44
vendor/google.golang.org/api/googleapi/transport/apikey.go
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Copyright 2012 Google LLC. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package transport contains HTTP transports used to make
|
||||
// authenticated API requests.
|
||||
//
|
||||
// This package is DEPRECATED. Users should instead use,
|
||||
//
|
||||
// service, err := NewService(..., option.WithAPIKey(...))
|
||||
package transport
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// APIKey is an HTTP Transport which wraps an underlying transport and
|
||||
// appends an API Key "key" parameter to the URL of outgoing requests.
|
||||
//
|
||||
// Deprecated: please use NewService(..., option.WithAPIKey(...)) instead.
|
||||
type APIKey struct {
|
||||
// Key is the API Key to set on requests.
|
||||
Key string
|
||||
|
||||
// Transport is the underlying HTTP transport.
|
||||
// If nil, http.DefaultTransport is used.
|
||||
Transport http.RoundTripper
|
||||
}
|
||||
|
||||
func (t *APIKey) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
rt := t.Transport
|
||||
if rt == nil {
|
||||
rt = http.DefaultTransport
|
||||
if rt == nil {
|
||||
return nil, errors.New("googleapi/transport: no Transport specified or available")
|
||||
}
|
||||
}
|
||||
newReq := *req
|
||||
args := newReq.URL.Query()
|
||||
args.Set("key", t.Key)
|
||||
newReq.URL.RawQuery = args.Encode()
|
||||
return rt.RoundTrip(&newReq)
|
||||
}
|
2
vendor/google.golang.org/api/internal/version.go
generated
vendored
2
vendor/google.golang.org/api/internal/version.go
generated
vendored
|
@ -5,4 +5,4 @@
|
|||
package internal
|
||||
|
||||
// Version is the current tagged release of the library.
|
||||
const Version = "0.102.0"
|
||||
const Version = "0.110.0"
|
||||
|
|
7
vendor/google.golang.org/api/option/internaloption/internaloption.go
generated
vendored
7
vendor/google.golang.org/api/option/internaloption/internaloption.go
generated
vendored
|
@ -134,3 +134,10 @@ type withCreds google.Credentials
|
|||
func (w *withCreds) Apply(o *internal.DialSettings) {
|
||||
o.InternalCredentials = (*google.Credentials)(w)
|
||||
}
|
||||
|
||||
// EmbeddableAdapter is a no-op option.ClientOption that allow libraries to
|
||||
// create their own client options by embedding this type into their own
|
||||
// client-specific option wrapper. See example for usage.
|
||||
type EmbeddableAdapter struct{}
|
||||
|
||||
func (*EmbeddableAdapter) Apply(_ *internal.DialSettings) {}
|
||||
|
|
4
vendor/google.golang.org/api/option/option.go
generated
vendored
4
vendor/google.golang.org/api/option/option.go
generated
vendored
|
@ -96,7 +96,9 @@ func (w withScopes) Apply(o *internal.DialSettings) {
|
|||
copy(o.Scopes, w)
|
||||
}
|
||||
|
||||
// WithUserAgent returns a ClientOption that sets the User-Agent.
|
||||
// WithUserAgent returns a ClientOption that sets the User-Agent. This option
|
||||
// is incompatible with the [WithHTTPClient] option. If you wish to provide a
|
||||
// custom client you will need to add this header via RoundTripper middleware.
|
||||
func WithUserAgent(ua string) ClientOption {
|
||||
return withUA(ua)
|
||||
}
|
||||
|
|
4
vendor/google.golang.org/api/transport/cert/enterprise_cert.go
generated
vendored
4
vendor/google.golang.org/api/transport/cert/enterprise_cert.go
generated
vendored
|
@ -15,7 +15,6 @@ package cert
|
|||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"os"
|
||||
|
||||
"github.com/googleapis/enterprise-certificate-proxy/client"
|
||||
)
|
||||
|
@ -36,8 +35,7 @@ type ecpSource struct {
|
|||
func NewEnterpriseCertificateProxySource(configFilePath string) (Source, error) {
|
||||
key, err := client.Cred(configFilePath)
|
||||
if err != nil {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
// Config file missing means Enterprise Certificate Proxy is not supported.
|
||||
if errors.Is(err, client.ErrCredUnavailable) {
|
||||
return nil, errSourceUnavailable
|
||||
}
|
||||
return nil, err
|
||||
|
|
48
vendor/google.golang.org/api/transport/grpc/dial.go
generated
vendored
48
vendor/google.golang.org/api/transport/grpc/dial.go
generated
vendored
|
@ -25,6 +25,7 @@ import (
|
|||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
grpcgoogle "google.golang.org/grpc/credentials/google"
|
||||
grpcinsecure "google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/grpc/credentials/oauth"
|
||||
|
||||
// Install grpclb, which is required for direct path.
|
||||
|
@ -126,10 +127,26 @@ func dial(ctx context.Context, insecure bool, o *internal.DialSettings) (*grpc.C
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var grpcOpts []grpc.DialOption
|
||||
|
||||
var transportCreds credentials.TransportCredentials
|
||||
if insecure {
|
||||
grpcOpts = []grpc.DialOption{grpc.WithInsecure()}
|
||||
} else if !o.NoAuth {
|
||||
transportCreds = grpcinsecure.NewCredentials()
|
||||
} else {
|
||||
transportCreds = credentials.NewTLS(&tls.Config{
|
||||
GetClientCertificate: clientCertSource,
|
||||
})
|
||||
}
|
||||
|
||||
// Initialize gRPC dial options with transport-level security options.
|
||||
grpcOpts := []grpc.DialOption{
|
||||
grpc.WithTransportCredentials(transportCreds),
|
||||
}
|
||||
|
||||
// Authentication can only be sent when communicating over a secure connection.
|
||||
//
|
||||
// TODO: Should we be more lenient in the future and allow sending credentials
|
||||
// when dialing an insecure connection?
|
||||
if !o.NoAuth && !insecure {
|
||||
if o.APIKey != "" {
|
||||
log.Print("API keys are not supported for gRPC APIs. Remove the WithAPIKey option from your client-creating call.")
|
||||
}
|
||||
|
@ -142,8 +159,17 @@ func dial(ctx context.Context, insecure bool, o *internal.DialSettings) (*grpc.C
|
|||
o.QuotaProject = internal.QuotaProjectFromCreds(creds)
|
||||
}
|
||||
|
||||
grpcOpts = append(grpcOpts,
|
||||
grpc.WithPerRPCCredentials(grpcTokenSource{
|
||||
TokenSource: oauth.TokenSource{creds.TokenSource},
|
||||
quotaProject: o.QuotaProject,
|
||||
requestReason: o.RequestReason,
|
||||
}),
|
||||
)
|
||||
|
||||
// Attempt Direct Path:
|
||||
if isDirectPathEnabled(endpoint, o) && isTokenSourceDirectPathCompatible(creds.TokenSource, o) && metadata.OnGCE() {
|
||||
// Overwrite all of the previously specific DialOptions, DirectPath uses its own set of credentials and certificates.
|
||||
grpcOpts = []grpc.DialOption{
|
||||
grpc.WithCredentialsBundle(grpcgoogle.NewDefaultCredentialsWithOptions(grpcgoogle.DefaultCredentialsOptions{oauth.TokenSource{creds.TokenSource}}))}
|
||||
if timeoutDialerOption != nil {
|
||||
|
@ -153,9 +179,9 @@ func dial(ctx context.Context, insecure bool, o *internal.DialSettings) (*grpc.C
|
|||
if strings.EqualFold(os.Getenv(enableDirectPathXds), "true") {
|
||||
// google-c2p resolver target must not have a port number
|
||||
if addr, _, err := net.SplitHostPort(endpoint); err == nil {
|
||||
endpoint = "google-c2p-experimental:///" + addr
|
||||
endpoint = "google-c2p:///" + addr
|
||||
} else {
|
||||
endpoint = "google-c2p-experimental:///" + endpoint
|
||||
endpoint = "google-c2p:///" + endpoint
|
||||
}
|
||||
} else {
|
||||
if !strings.HasPrefix(endpoint, "dns:///") {
|
||||
|
@ -169,18 +195,6 @@ func dial(ctx context.Context, insecure bool, o *internal.DialSettings) (*grpc.C
|
|||
grpc.WithDefaultServiceConfig(`{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"pick_first":{}}]}}]}`))
|
||||
}
|
||||
// TODO(cbro): add support for system parameters (quota project, request reason) via chained interceptor.
|
||||
} else {
|
||||
tlsConfig := &tls.Config{
|
||||
GetClientCertificate: clientCertSource,
|
||||
}
|
||||
grpcOpts = []grpc.DialOption{
|
||||
grpc.WithPerRPCCredentials(grpcTokenSource{
|
||||
TokenSource: oauth.TokenSource{creds.TokenSource},
|
||||
quotaProject: o.QuotaProject,
|
||||
requestReason: o.RequestReason,
|
||||
}),
|
||||
grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
6
vendor/google.golang.org/api/transport/grpc/dial_socketopt.go
generated
vendored
6
vendor/google.golang.org/api/transport/grpc/dial_socketopt.go
generated
vendored
|
@ -12,7 +12,6 @@ import (
|
|||
"net"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
|
@ -20,6 +19,9 @@ const (
|
|||
// defaultTCPUserTimeout is the default TCP_USER_TIMEOUT socket option. By
|
||||
// default is 20 seconds.
|
||||
tcpUserTimeoutMilliseconds = 20000
|
||||
|
||||
// Copied from golang.org/x/sys/unix.TCP_USER_TIMEOUT.
|
||||
tcpUserTimeoutOp = 0x12
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -33,7 +35,7 @@ func dialTCPUserTimeout(ctx context.Context, addr string) (net.Conn, error) {
|
|||
var syscallErr error
|
||||
controlErr := c.Control(func(fd uintptr) {
|
||||
syscallErr = syscall.SetsockoptInt(
|
||||
int(fd), syscall.IPPROTO_TCP, unix.TCP_USER_TIMEOUT, tcpUserTimeoutMilliseconds)
|
||||
int(fd), syscall.IPPROTO_TCP, tcpUserTimeoutOp, tcpUserTimeoutMilliseconds)
|
||||
})
|
||||
if syscallErr != nil {
|
||||
return syscallErr
|
||||
|
|
233
vendor/google.golang.org/api/transport/http/dial.go
generated
vendored
Normal file
233
vendor/google.golang.org/api/transport/http/dial.go
generated
vendored
Normal file
|
@ -0,0 +1,233 @@
|
|||
// Copyright 2015 Google LLC.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package http supports network connections to HTTP servers.
|
||||
// This package is not intended for use by end developers. Use the
|
||||
// google.golang.org/api/option package to configure API clients.
|
||||
package http
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"go.opencensus.io/plugin/ochttp"
|
||||
"golang.org/x/net/http2"
|
||||
"golang.org/x/oauth2"
|
||||
"google.golang.org/api/googleapi/transport"
|
||||
"google.golang.org/api/internal"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/transport/cert"
|
||||
"google.golang.org/api/transport/http/internal/propagation"
|
||||
"google.golang.org/api/transport/internal/dca"
|
||||
)
|
||||
|
||||
// NewClient returns an HTTP client for use communicating with a Google cloud
|
||||
// service, configured with the given ClientOptions. It also returns the endpoint
|
||||
// for the service as specified in the options.
|
||||
func NewClient(ctx context.Context, opts ...option.ClientOption) (*http.Client, string, error) {
|
||||
settings, err := newSettings(opts)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
clientCertSource, endpoint, err := dca.GetClientCertificateSourceAndEndpoint(settings)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
// TODO(cbro): consider injecting the User-Agent even if an explicit HTTP client is provided?
|
||||
if settings.HTTPClient != nil {
|
||||
return settings.HTTPClient, endpoint, nil
|
||||
}
|
||||
trans, err := newTransport(ctx, defaultBaseTransport(ctx, clientCertSource), settings)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return &http.Client{Transport: trans}, endpoint, nil
|
||||
}
|
||||
|
||||
// NewTransport creates an http.RoundTripper for use communicating with a Google
|
||||
// cloud service, configured with the given ClientOptions. Its RoundTrip method delegates to base.
|
||||
func NewTransport(ctx context.Context, base http.RoundTripper, opts ...option.ClientOption) (http.RoundTripper, error) {
|
||||
settings, err := newSettings(opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if settings.HTTPClient != nil {
|
||||
return nil, errors.New("transport/http: WithHTTPClient passed to NewTransport")
|
||||
}
|
||||
return newTransport(ctx, base, settings)
|
||||
}
|
||||
|
||||
func newTransport(ctx context.Context, base http.RoundTripper, settings *internal.DialSettings) (http.RoundTripper, error) {
|
||||
paramTransport := ¶meterTransport{
|
||||
base: base,
|
||||
userAgent: settings.UserAgent,
|
||||
quotaProject: settings.QuotaProject,
|
||||
requestReason: settings.RequestReason,
|
||||
}
|
||||
var trans http.RoundTripper = paramTransport
|
||||
trans = addOCTransport(trans, settings)
|
||||
switch {
|
||||
case settings.NoAuth:
|
||||
// Do nothing.
|
||||
case settings.APIKey != "":
|
||||
trans = &transport.APIKey{
|
||||
Transport: trans,
|
||||
Key: settings.APIKey,
|
||||
}
|
||||
default:
|
||||
creds, err := internal.Creds(ctx, settings)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if paramTransport.quotaProject == "" {
|
||||
paramTransport.quotaProject = internal.QuotaProjectFromCreds(creds)
|
||||
}
|
||||
|
||||
ts := creds.TokenSource
|
||||
if settings.ImpersonationConfig == nil && settings.TokenSource != nil {
|
||||
ts = settings.TokenSource
|
||||
}
|
||||
trans = &oauth2.Transport{
|
||||
Base: trans,
|
||||
Source: ts,
|
||||
}
|
||||
}
|
||||
return trans, nil
|
||||
}
|
||||
|
||||
func newSettings(opts []option.ClientOption) (*internal.DialSettings, error) {
|
||||
var o internal.DialSettings
|
||||
for _, opt := range opts {
|
||||
opt.Apply(&o)
|
||||
}
|
||||
if err := o.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if o.GRPCConn != nil {
|
||||
return nil, errors.New("unsupported gRPC connection specified")
|
||||
}
|
||||
return &o, nil
|
||||
}
|
||||
|
||||
type parameterTransport struct {
|
||||
userAgent string
|
||||
quotaProject string
|
||||
requestReason string
|
||||
|
||||
base http.RoundTripper
|
||||
}
|
||||
|
||||
func (t *parameterTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
rt := t.base
|
||||
if rt == nil {
|
||||
return nil, errors.New("transport: no Transport specified")
|
||||
}
|
||||
newReq := *req
|
||||
newReq.Header = make(http.Header)
|
||||
for k, vv := range req.Header {
|
||||
newReq.Header[k] = vv
|
||||
}
|
||||
if t.userAgent != "" {
|
||||
// TODO(cbro): append to existing User-Agent header?
|
||||
newReq.Header.Set("User-Agent", t.userAgent)
|
||||
}
|
||||
|
||||
// Attach system parameters into the header
|
||||
if t.quotaProject != "" {
|
||||
newReq.Header.Set("X-Goog-User-Project", t.quotaProject)
|
||||
}
|
||||
if t.requestReason != "" {
|
||||
newReq.Header.Set("X-Goog-Request-Reason", t.requestReason)
|
||||
}
|
||||
|
||||
return rt.RoundTrip(&newReq)
|
||||
}
|
||||
|
||||
// Set at init time by dial_appengine.go. If nil, we're not on App Engine.
|
||||
var appengineUrlfetchHook func(context.Context) http.RoundTripper
|
||||
|
||||
// defaultBaseTransport returns the base HTTP transport.
|
||||
// On App Engine, this is urlfetch.Transport.
|
||||
// Otherwise, use a default transport, taking most defaults from
|
||||
// http.DefaultTransport.
|
||||
// If TLSCertificate is available, set TLSClientConfig as well.
|
||||
func defaultBaseTransport(ctx context.Context, clientCertSource cert.Source) http.RoundTripper {
|
||||
if appengineUrlfetchHook != nil {
|
||||
return appengineUrlfetchHook(ctx)
|
||||
}
|
||||
|
||||
// Copy http.DefaultTransport except for MaxIdleConnsPerHost setting,
|
||||
// which is increased due to reported performance issues under load in the GCS
|
||||
// client. Transport.Clone is only available in Go 1.13 and up.
|
||||
trans := clonedTransport(http.DefaultTransport)
|
||||
if trans == nil {
|
||||
trans = fallbackBaseTransport()
|
||||
}
|
||||
trans.MaxIdleConnsPerHost = 100
|
||||
|
||||
if clientCertSource != nil {
|
||||
trans.TLSClientConfig = &tls.Config{
|
||||
GetClientCertificate: clientCertSource,
|
||||
}
|
||||
}
|
||||
|
||||
configureHTTP2(trans)
|
||||
|
||||
return trans
|
||||
}
|
||||
|
||||
// configureHTTP2 configures the ReadIdleTimeout HTTP/2 option for the
|
||||
// transport. This allows broken idle connections to be pruned more quickly,
|
||||
// preventing the client from attempting to re-use connections that will no
|
||||
// longer work.
|
||||
func configureHTTP2(trans *http.Transport) {
|
||||
http2Trans, err := http2.ConfigureTransports(trans)
|
||||
if err == nil {
|
||||
http2Trans.ReadIdleTimeout = time.Second * 31
|
||||
}
|
||||
}
|
||||
|
||||
// fallbackBaseTransport is used in <go1.13 as well as in the rare case if
|
||||
// http.DefaultTransport has been reassigned something that's not a
|
||||
// *http.Transport.
|
||||
func fallbackBaseTransport() *http.Transport {
|
||||
return &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
DualStack: true,
|
||||
}).DialContext,
|
||||
MaxIdleConns: 100,
|
||||
MaxIdleConnsPerHost: 100,
|
||||
IdleConnTimeout: 90 * time.Second,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
}
|
||||
}
|
||||
|
||||
func addOCTransport(trans http.RoundTripper, settings *internal.DialSettings) http.RoundTripper {
|
||||
if settings.TelemetryDisabled {
|
||||
return trans
|
||||
}
|
||||
return &ochttp.Transport{
|
||||
Base: trans,
|
||||
Propagation: &propagation.HTTPFormat{},
|
||||
}
|
||||
}
|
||||
|
||||
// clonedTransport returns the given RoundTripper as a cloned *http.Transport.
|
||||
// It returns nil if the RoundTripper can't be cloned or coerced to
|
||||
// *http.Transport.
|
||||
func clonedTransport(rt http.RoundTripper) *http.Transport {
|
||||
t, ok := rt.(*http.Transport)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return t.Clone()
|
||||
}
|
21
vendor/google.golang.org/api/transport/http/dial_appengine.go
generated
vendored
Normal file
21
vendor/google.golang.org/api/transport/http/dial_appengine.go
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2016 Google LLC.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build appengine
|
||||
// +build appengine
|
||||
|
||||
package http
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"google.golang.org/appengine/urlfetch"
|
||||
)
|
||||
|
||||
func init() {
|
||||
appengineUrlfetchHook = func(ctx context.Context) http.RoundTripper {
|
||||
return &urlfetch.Transport{Context: ctx}
|
||||
}
|
||||
}
|
87
vendor/google.golang.org/api/transport/http/internal/propagation/http.go
generated
vendored
Normal file
87
vendor/google.golang.org/api/transport/http/internal/propagation/http.go
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
// Copyright 2018 Google LLC.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.8
|
||||
// +build go1.8
|
||||
|
||||
// Package propagation implements X-Cloud-Trace-Context header propagation used
|
||||
// by Google Cloud products.
|
||||
package propagation
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"go.opencensus.io/trace"
|
||||
"go.opencensus.io/trace/propagation"
|
||||
)
|
||||
|
||||
const (
|
||||
httpHeaderMaxSize = 200
|
||||
httpHeader = `X-Cloud-Trace-Context`
|
||||
)
|
||||
|
||||
var _ propagation.HTTPFormat = (*HTTPFormat)(nil)
|
||||
|
||||
// HTTPFormat implements propagation.HTTPFormat to propagate
|
||||
// traces in HTTP headers for Google Cloud Platform and Stackdriver Trace.
|
||||
type HTTPFormat struct{}
|
||||
|
||||
// SpanContextFromRequest extracts a Stackdriver Trace span context from incoming requests.
|
||||
func (f *HTTPFormat) SpanContextFromRequest(req *http.Request) (sc trace.SpanContext, ok bool) {
|
||||
h := req.Header.Get(httpHeader)
|
||||
// See https://cloud.google.com/trace/docs/faq for the header HTTPFormat.
|
||||
// Return if the header is empty or missing, or if the header is unreasonably
|
||||
// large, to avoid making unnecessary copies of a large string.
|
||||
if h == "" || len(h) > httpHeaderMaxSize {
|
||||
return trace.SpanContext{}, false
|
||||
}
|
||||
|
||||
// Parse the trace id field.
|
||||
slash := strings.Index(h, `/`)
|
||||
if slash == -1 {
|
||||
return trace.SpanContext{}, false
|
||||
}
|
||||
tid, h := h[:slash], h[slash+1:]
|
||||
|
||||
buf, err := hex.DecodeString(tid)
|
||||
if err != nil {
|
||||
return trace.SpanContext{}, false
|
||||
}
|
||||
copy(sc.TraceID[:], buf)
|
||||
|
||||
// Parse the span id field.
|
||||
spanstr := h
|
||||
semicolon := strings.Index(h, `;`)
|
||||
if semicolon != -1 {
|
||||
spanstr, h = h[:semicolon], h[semicolon+1:]
|
||||
}
|
||||
sid, err := strconv.ParseUint(spanstr, 10, 64)
|
||||
if err != nil {
|
||||
return trace.SpanContext{}, false
|
||||
}
|
||||
binary.BigEndian.PutUint64(sc.SpanID[:], sid)
|
||||
|
||||
// Parse the options field, options field is optional.
|
||||
if !strings.HasPrefix(h, "o=") {
|
||||
return sc, true
|
||||
}
|
||||
o, err := strconv.ParseUint(h[2:], 10, 64)
|
||||
if err != nil {
|
||||
return trace.SpanContext{}, false
|
||||
}
|
||||
sc.TraceOptions = trace.TraceOptions(o)
|
||||
return sc, true
|
||||
}
|
||||
|
||||
// SpanContextToRequest modifies the given request to include a Stackdriver Trace header.
|
||||
func (f *HTTPFormat) SpanContextToRequest(sc trace.SpanContext, req *http.Request) {
|
||||
sid := binary.BigEndian.Uint64(sc.SpanID[:])
|
||||
header := fmt.Sprintf("%s/%d;o=%d", hex.EncodeToString(sc.TraceID[:]), sid, int64(sc.TraceOptions))
|
||||
req.Header.Set(httpHeader, header)
|
||||
}
|
1519
vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go
generated
vendored
1519
vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go
generated
vendored
File diff suppressed because it is too large
Load diff
8
vendor/google.golang.org/genproto/googleapis/api/launch_stage.pb.go
generated
vendored
8
vendor/google.golang.org/genproto/googleapis/api/launch_stage.pb.go
generated
vendored
|
@ -15,7 +15,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.12.2
|
||||
// protoc v3.18.1
|
||||
// source: google/api/launch_stage.proto
|
||||
|
||||
package api
|
||||
|
@ -36,7 +36,7 @@ const (
|
|||
)
|
||||
|
||||
// The launch stage as defined by [Google Cloud Platform
|
||||
// Launch Stages](http://cloud.google.com/terms/launch-stages).
|
||||
// Launch Stages](https://cloud.google.com/terms/launch-stages).
|
||||
type LaunchStage int32
|
||||
|
||||
const (
|
||||
|
@ -56,7 +56,7 @@ const (
|
|||
// for widespread use. By Alpha, all significant design issues are resolved
|
||||
// and we are in the process of verifying functionality. Alpha customers
|
||||
// need to apply for access, agree to applicable terms, and have their
|
||||
// projects allowlisted. Alpha releases don’t have to be feature complete,
|
||||
// projects allowlisted. Alpha releases don't have to be feature complete,
|
||||
// no SLAs are provided, and there are no technical support obligations, but
|
||||
// they will be far enough along that customers can actually use them in
|
||||
// test environments or for limited-use tests -- just like they would in
|
||||
|
@ -72,7 +72,7 @@ const (
|
|||
// fully qualified for production use.
|
||||
LaunchStage_GA LaunchStage = 4
|
||||
// Deprecated features are scheduled to be shut down and removed. For more
|
||||
// information, see the “Deprecation Policy” section of our [Terms of
|
||||
// information, see the "Deprecation Policy" section of our [Terms of
|
||||
// Service](https://cloud.google.com/terms/)
|
||||
// and the [Google Cloud Platform Subject to the Deprecation
|
||||
// Policy](https://cloud.google.com/terms/deprecation) documentation.
|
||||
|
|
16
vendor/google.golang.org/genproto/googleapis/api/metric/metric.pb.go
generated
vendored
16
vendor/google.golang.org/genproto/googleapis/api/metric/metric.pb.go
generated
vendored
|
@ -15,7 +15,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.12.2
|
||||
// protoc v3.18.1
|
||||
// source: google/api/metric.proto
|
||||
|
||||
package metric
|
||||
|
@ -267,11 +267,11 @@ type MetricDescriptor struct {
|
|||
//
|
||||
// The grammar also includes these connectors:
|
||||
//
|
||||
// * `/` division or ratio (as an infix operator). For examples,
|
||||
// - `/` division or ratio (as an infix operator). For examples,
|
||||
// `kBy/{email}` or `MiBy/10ms` (although you should almost never
|
||||
// have `/s` in a metric `unit`; rates should always be computed at
|
||||
// query time from the underlying cumulative or delta value).
|
||||
// * `.` multiplication or composition (as an infix operator). For
|
||||
// - `.` multiplication or composition (as an infix operator). For
|
||||
// examples, `GBy.d` or `k{watt}.h`.
|
||||
//
|
||||
// The grammar for a unit is as follows:
|
||||
|
@ -287,12 +287,12 @@ type MetricDescriptor struct {
|
|||
//
|
||||
// Notes:
|
||||
//
|
||||
// * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
|
||||
// - `Annotation` is just a comment if it follows a `UNIT`. If the annotation
|
||||
// is used alone, then the unit is equivalent to `1`. For examples,
|
||||
// `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
|
||||
// * `NAME` is a sequence of non-blank printable ASCII characters not
|
||||
// - `NAME` is a sequence of non-blank printable ASCII characters not
|
||||
// containing `{` or `}`.
|
||||
// * `1` represents a unitary [dimensionless
|
||||
// - `1` represents a unitary [dimensionless
|
||||
// unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
|
||||
// as in `1/s`. It is typically used when none of the basic units are
|
||||
// appropriate. For example, "new users per day" can be represented as
|
||||
|
@ -300,10 +300,10 @@ type MetricDescriptor struct {
|
|||
// users). Alternatively, "thousands of page views per day" would be
|
||||
// represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
|
||||
// value of `5.3` would mean "5300 page views per day").
|
||||
// * `%` represents dimensionless value of 1/100, and annotates values giving
|
||||
// - `%` represents dimensionless value of 1/100, and annotates values giving
|
||||
// a percentage (so the metric values are typically in the range of 0..100,
|
||||
// and a metric value `3` means "3 percent").
|
||||
// * `10^2.%` indicates a metric contains a ratio, typically in the range
|
||||
// - `10^2.%` indicates a metric contains a ratio, typically in the range
|
||||
// 0..1, that will be multiplied by 100 and displayed as a percentage
|
||||
// (so a metric value `0.03` means "3 percent").
|
||||
Unit string `protobuf:"bytes,5,opt,name=unit,proto3" json:"unit,omitempty"`
|
||||
|
|
15
vendor/google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.pb.go
generated
vendored
15
vendor/google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.pb.go
generated
vendored
|
@ -15,7 +15,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.12.2
|
||||
// protoc v3.18.1
|
||||
// source: google/api/monitored_resource.proto
|
||||
|
||||
package monitoredres
|
||||
|
@ -61,6 +61,12 @@ type MonitoredResourceDescriptor struct {
|
|||
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// Required. The monitored resource type. For example, the type
|
||||
// `"cloudsql_database"` represents databases in Google Cloud SQL.
|
||||
//
|
||||
// For a list of types, see [Monitoring resource
|
||||
// types](https://cloud.google.com/monitoring/api/resources)
|
||||
//
|
||||
// and [Logging resource
|
||||
// types](https://cloud.google.com/logging/docs/api/v2/resource-list).
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
// Optional. A concise name for the monitored resource type that might be
|
||||
// displayed in user interfaces. It should be a Title Cased Noun Phrase,
|
||||
|
@ -160,10 +166,11 @@ func (x *MonitoredResourceDescriptor) GetLaunchStage() api.LaunchStage {
|
|||
// its attributes according to the schema. For example, a particular Compute
|
||||
// Engine VM instance could be represented by the following object, because the
|
||||
// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for `"gce_instance"` has labels
|
||||
// `"instance_id"` and `"zone"`:
|
||||
// `"project_id"`, `"instance_id"` and `"zone"`:
|
||||
//
|
||||
// { "type": "gce_instance",
|
||||
// "labels": { "instance_id": "12345678901234",
|
||||
// "labels": { "project_id": "my-project",
|
||||
// "instance_id": "12345678901234",
|
||||
// "zone": "us-central1-a" }}
|
||||
type MonitoredResource struct {
|
||||
state protoimpl.MessageState
|
||||
|
@ -173,6 +180,8 @@ type MonitoredResource struct {
|
|||
// Required. The monitored resource type. This field must match
|
||||
// the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For
|
||||
// example, the type of a Compute Engine VM instance is `gce_instance`.
|
||||
// Some descriptors include the service name in the type; for example,
|
||||
// the type of a Datastream stream is `datastream.googleapis.com/Stream`.
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
// Required. Values for all of the labels listed in the associated monitored
|
||||
// resource descriptor. For example, Compute Engine VM instances use the
|
||||
|
|
115
vendor/google.golang.org/genproto/googleapis/longrunning/alias.go
generated
vendored
Normal file
115
vendor/google.golang.org/genproto/googleapis/longrunning/alias.go
generated
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// 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.
|
||||
|
||||
// Code generated by aliasgen. DO NOT EDIT.
|
||||
|
||||
// Package longrunning aliases all exported identifiers in package
|
||||
// "cloud.google.com/go/longrunning/autogen/longrunningpb".
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb.
|
||||
// Please read https://github.com/googleapis/google-cloud-go/blob/main/migration.md
|
||||
// for more details.
|
||||
package longrunning
|
||||
|
||||
import (
|
||||
src "cloud.google.com/go/longrunning/autogen/longrunningpb"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Deprecated: Please use vars in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
var (
|
||||
E_OperationInfo = src.E_OperationInfo
|
||||
File_google_longrunning_operations_proto = src.File_google_longrunning_operations_proto
|
||||
)
|
||||
|
||||
// The request message for
|
||||
// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation].
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
type CancelOperationRequest = src.CancelOperationRequest
|
||||
|
||||
// The request message for
|
||||
// [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation].
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
type DeleteOperationRequest = src.DeleteOperationRequest
|
||||
|
||||
// The request message for
|
||||
// [Operations.GetOperation][google.longrunning.Operations.GetOperation].
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
type GetOperationRequest = src.GetOperationRequest
|
||||
|
||||
// The request message for
|
||||
// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
type ListOperationsRequest = src.ListOperationsRequest
|
||||
|
||||
// The response message for
|
||||
// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
type ListOperationsResponse = src.ListOperationsResponse
|
||||
|
||||
// This resource represents a long-running operation that is the result of a
|
||||
// network API call.
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
type Operation = src.Operation
|
||||
|
||||
// A message representing the message types used by a long-running operation.
|
||||
// Example: rpc LongRunningRecognize(LongRunningRecognizeRequest) returns
|
||||
// (google.longrunning.Operation) { option (google.longrunning.operation_info)
|
||||
// = { response_type: "LongRunningRecognizeResponse" metadata_type:
|
||||
// "LongRunningRecognizeMetadata" }; }
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
type OperationInfo = src.OperationInfo
|
||||
type Operation_Error = src.Operation_Error
|
||||
type Operation_Response = src.Operation_Response
|
||||
|
||||
// OperationsClient is the client API for Operations service. For semantics
|
||||
// around ctx use and closing/ending streaming RPCs, please refer to
|
||||
// https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
type OperationsClient = src.OperationsClient
|
||||
|
||||
// OperationsServer is the server API for Operations service.
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
type OperationsServer = src.OperationsServer
|
||||
|
||||
// UnimplementedOperationsServer can be embedded to have forward compatible
|
||||
// implementations.
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
type UnimplementedOperationsServer = src.UnimplementedOperationsServer
|
||||
|
||||
// The request message for
|
||||
// [Operations.WaitOperation][google.longrunning.Operations.WaitOperation].
|
||||
//
|
||||
// Deprecated: Please use types in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
type WaitOperationRequest = src.WaitOperationRequest
|
||||
|
||||
// Deprecated: Please use funcs in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
func NewOperationsClient(cc grpc.ClientConnInterface) OperationsClient {
|
||||
return src.NewOperationsClient(cc)
|
||||
}
|
||||
|
||||
// Deprecated: Please use funcs in: cloud.google.com/go/longrunning/autogen/longrunningpb
|
||||
func RegisterOperationsServer(s *grpc.Server, srv OperationsServer) {
|
||||
src.RegisterOperationsServer(s, srv)
|
||||
}
|
17
vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go
generated
vendored
17
vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2020 Google LLC
|
||||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -15,7 +15,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.12.2
|
||||
// protoc v3.21.9
|
||||
// source: google/rpc/code.proto
|
||||
|
||||
package code
|
||||
|
@ -44,7 +44,7 @@ const (
|
|||
type Code int32
|
||||
|
||||
const (
|
||||
// Not an error; returned on success
|
||||
// Not an error; returned on success.
|
||||
//
|
||||
// HTTP Mapping: 200 OK
|
||||
Code_OK Code = 0
|
||||
|
@ -78,7 +78,7 @@ const (
|
|||
// Some requested entity (e.g., file or directory) was not found.
|
||||
//
|
||||
// Note to server developers: if a request is denied for an entire class
|
||||
// of users, such as gradual feature rollout or undocumented whitelist,
|
||||
// of users, such as gradual feature rollout or undocumented allowlist,
|
||||
// `NOT_FOUND` may be used. If a request is denied for some users within
|
||||
// a class of users, such as user-based access control, `PERMISSION_DENIED`
|
||||
// must be used.
|
||||
|
@ -118,12 +118,13 @@ const (
|
|||
//
|
||||
// Service implementors can use the following guidelines to decide
|
||||
// between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`:
|
||||
//
|
||||
// (a) Use `UNAVAILABLE` if the client can retry just the failing call.
|
||||
// (b) Use `ABORTED` if the client should retry at a higher level
|
||||
// (e.g., when a client-specified test-and-set fails, indicating the
|
||||
// client should restart a read-modify-write sequence).
|
||||
// (b) Use `ABORTED` if the client should retry at a higher level. For
|
||||
// example, when a client-specified test-and-set fails, indicating the
|
||||
// client should restart a read-modify-write sequence.
|
||||
// (c) Use `FAILED_PRECONDITION` if the client should not retry until
|
||||
// the system state has been explicitly fixed. E.g., if an "rmdir"
|
||||
// the system state has been explicitly fixed. For example, if an "rmdir"
|
||||
// fails because the directory is non-empty, `FAILED_PRECONDITION`
|
||||
// should be returned since the client should not retry unless
|
||||
// the files are deleted from the directory.
|
||||
|
|
374
vendor/google.golang.org/genproto/googleapis/rpc/errdetails/error_details.pb.go
generated
vendored
374
vendor/google.golang.org/genproto/googleapis/rpc/errdetails/error_details.pb.go
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2020 Google LLC
|
||||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -15,7 +15,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.12.2
|
||||
// protoc v3.21.9
|
||||
// source: google/rpc/error_details.proto
|
||||
|
||||
package errdetails
|
||||
|
@ -36,6 +36,112 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// Describes the cause of the error with structured details.
|
||||
//
|
||||
// Example of an error when contacting the "pubsub.googleapis.com" API when it
|
||||
// is not enabled:
|
||||
//
|
||||
// { "reason": "API_DISABLED"
|
||||
// "domain": "googleapis.com"
|
||||
// "metadata": {
|
||||
// "resource": "projects/123",
|
||||
// "service": "pubsub.googleapis.com"
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// This response indicates that the pubsub.googleapis.com API is not enabled.
|
||||
//
|
||||
// Example of an error that is returned when attempting to create a Spanner
|
||||
// instance in a region that is out of stock:
|
||||
//
|
||||
// { "reason": "STOCKOUT"
|
||||
// "domain": "spanner.googleapis.com",
|
||||
// "metadata": {
|
||||
// "availableRegions": "us-central1,us-east2"
|
||||
// }
|
||||
// }
|
||||
type ErrorInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// The reason of the error. This is a constant value that identifies the
|
||||
// proximate cause of the error. Error reasons are unique within a particular
|
||||
// domain of errors. This should be at most 63 characters and match a
|
||||
// regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents
|
||||
// UPPER_SNAKE_CASE.
|
||||
Reason string `protobuf:"bytes,1,opt,name=reason,proto3" json:"reason,omitempty"`
|
||||
// The logical grouping to which the "reason" belongs. The error domain
|
||||
// is typically the registered service name of the tool or product that
|
||||
// generates the error. Example: "pubsub.googleapis.com". If the error is
|
||||
// generated by some common infrastructure, the error domain must be a
|
||||
// globally unique value that identifies the infrastructure. For Google API
|
||||
// infrastructure, the error domain is "googleapis.com".
|
||||
Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
|
||||
// Additional structured details about this error.
|
||||
//
|
||||
// Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in
|
||||
// length. When identifying the current value of an exceeded limit, the units
|
||||
// should be contained in the key, not the value. For example, rather than
|
||||
// {"instanceLimit": "100/request"}, should be returned as,
|
||||
// {"instanceLimitPerRequest": "100"}, if the client exceeds the number of
|
||||
// instances that can be created in a single (batch) request.
|
||||
Metadata map[string]string `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
}
|
||||
|
||||
func (x *ErrorInfo) Reset() {
|
||||
*x = ErrorInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ErrorInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ErrorInfo) ProtoMessage() {}
|
||||
|
||||
func (x *ErrorInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ErrorInfo.ProtoReflect.Descriptor instead.
|
||||
func (*ErrorInfo) Descriptor() ([]byte, []int) {
|
||||
return file_google_rpc_error_details_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ErrorInfo) GetReason() string {
|
||||
if x != nil {
|
||||
return x.Reason
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ErrorInfo) GetDomain() string {
|
||||
if x != nil {
|
||||
return x.Domain
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ErrorInfo) GetMetadata() map[string]string {
|
||||
if x != nil {
|
||||
return x.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Describes when the clients can retry a failed request. Clients could ignore
|
||||
// the recommendation here or retry when this information is missing from error
|
||||
// responses.
|
||||
|
@ -61,7 +167,7 @@ type RetryInfo struct {
|
|||
func (x *RetryInfo) Reset() {
|
||||
*x = RetryInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[0]
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -74,7 +180,7 @@ func (x *RetryInfo) String() string {
|
|||
func (*RetryInfo) ProtoMessage() {}
|
||||
|
||||
func (x *RetryInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[0]
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -87,7 +193,7 @@ func (x *RetryInfo) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use RetryInfo.ProtoReflect.Descriptor instead.
|
||||
func (*RetryInfo) Descriptor() ([]byte, []int) {
|
||||
return file_google_rpc_error_details_proto_rawDescGZIP(), []int{0}
|
||||
return file_google_rpc_error_details_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *RetryInfo) GetRetryDelay() *durationpb.Duration {
|
||||
|
@ -112,7 +218,7 @@ type DebugInfo struct {
|
|||
func (x *DebugInfo) Reset() {
|
||||
*x = DebugInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[1]
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -125,7 +231,7 @@ func (x *DebugInfo) String() string {
|
|||
func (*DebugInfo) ProtoMessage() {}
|
||||
|
||||
func (x *DebugInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[1]
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -138,7 +244,7 @@ func (x *DebugInfo) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use DebugInfo.ProtoReflect.Descriptor instead.
|
||||
func (*DebugInfo) Descriptor() ([]byte, []int) {
|
||||
return file_google_rpc_error_details_proto_rawDescGZIP(), []int{1}
|
||||
return file_google_rpc_error_details_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *DebugInfo) GetStackEntries() []string {
|
||||
|
@ -178,7 +284,7 @@ type QuotaFailure struct {
|
|||
func (x *QuotaFailure) Reset() {
|
||||
*x = QuotaFailure{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[2]
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -191,7 +297,7 @@ func (x *QuotaFailure) String() string {
|
|||
func (*QuotaFailure) ProtoMessage() {}
|
||||
|
||||
func (x *QuotaFailure) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[2]
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -204,7 +310,7 @@ func (x *QuotaFailure) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use QuotaFailure.ProtoReflect.Descriptor instead.
|
||||
func (*QuotaFailure) Descriptor() ([]byte, []int) {
|
||||
return file_google_rpc_error_details_proto_rawDescGZIP(), []int{2}
|
||||
return file_google_rpc_error_details_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *QuotaFailure) GetViolations() []*QuotaFailure_Violation {
|
||||
|
@ -214,111 +320,6 @@ func (x *QuotaFailure) GetViolations() []*QuotaFailure_Violation {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Describes the cause of the error with structured details.
|
||||
//
|
||||
// Example of an error when contacting the "pubsub.googleapis.com" API when it
|
||||
// is not enabled:
|
||||
//
|
||||
// { "reason": "API_DISABLED"
|
||||
// "domain": "googleapis.com"
|
||||
// "metadata": {
|
||||
// "resource": "projects/123",
|
||||
// "service": "pubsub.googleapis.com"
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// This response indicates that the pubsub.googleapis.com API is not enabled.
|
||||
//
|
||||
// Example of an error that is returned when attempting to create a Spanner
|
||||
// instance in a region that is out of stock:
|
||||
//
|
||||
// { "reason": "STOCKOUT"
|
||||
// "domain": "spanner.googleapis.com",
|
||||
// "metadata": {
|
||||
// "availableRegions": "us-central1,us-east2"
|
||||
// }
|
||||
// }
|
||||
type ErrorInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// The reason of the error. This is a constant value that identifies the
|
||||
// proximate cause of the error. Error reasons are unique within a particular
|
||||
// domain of errors. This should be at most 63 characters and match
|
||||
// /[A-Z0-9_]+/.
|
||||
Reason string `protobuf:"bytes,1,opt,name=reason,proto3" json:"reason,omitempty"`
|
||||
// The logical grouping to which the "reason" belongs. The error domain
|
||||
// is typically the registered service name of the tool or product that
|
||||
// generates the error. Example: "pubsub.googleapis.com". If the error is
|
||||
// generated by some common infrastructure, the error domain must be a
|
||||
// globally unique value that identifies the infrastructure. For Google API
|
||||
// infrastructure, the error domain is "googleapis.com".
|
||||
Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
|
||||
// Additional structured details about this error.
|
||||
//
|
||||
// Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in
|
||||
// length. When identifying the current value of an exceeded limit, the units
|
||||
// should be contained in the key, not the value. For example, rather than
|
||||
// {"instanceLimit": "100/request"}, should be returned as,
|
||||
// {"instanceLimitPerRequest": "100"}, if the client exceeds the number of
|
||||
// instances that can be created in a single (batch) request.
|
||||
Metadata map[string]string `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
}
|
||||
|
||||
func (x *ErrorInfo) Reset() {
|
||||
*x = ErrorInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ErrorInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ErrorInfo) ProtoMessage() {}
|
||||
|
||||
func (x *ErrorInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ErrorInfo.ProtoReflect.Descriptor instead.
|
||||
func (*ErrorInfo) Descriptor() ([]byte, []int) {
|
||||
return file_google_rpc_error_details_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *ErrorInfo) GetReason() string {
|
||||
if x != nil {
|
||||
return x.Reason
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ErrorInfo) GetDomain() string {
|
||||
if x != nil {
|
||||
return x.Domain
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ErrorInfo) GetMetadata() map[string]string {
|
||||
if x != nil {
|
||||
return x.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Describes what preconditions have failed.
|
||||
//
|
||||
// For example, if an RPC failed because it required the Terms of Service to be
|
||||
|
@ -495,7 +496,8 @@ type ResourceInfo struct {
|
|||
ResourceType string `protobuf:"bytes,1,opt,name=resource_type,json=resourceType,proto3" json:"resource_type,omitempty"`
|
||||
// The name of the resource being accessed. For example, a shared calendar
|
||||
// name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current
|
||||
// error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
|
||||
// error is
|
||||
// [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
|
||||
ResourceName string `protobuf:"bytes,2,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"`
|
||||
// The owner of the resource (optional).
|
||||
// For example, "user:<owner email>" or "project:<Google developer project
|
||||
|
@ -628,7 +630,7 @@ type LocalizedMessage struct {
|
|||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// The locale used following the specification defined at
|
||||
// http://www.rfc-editor.org/rfc/bcp/bcp47.txt.
|
||||
// https://www.rfc-editor.org/rfc/bcp/bcp47.txt.
|
||||
// Examples are: "en-US", "fr-CH", "es-MX"
|
||||
Locale string `protobuf:"bytes,1,opt,name=locale,proto3" json:"locale,omitempty"`
|
||||
// The localized error message in the above locale.
|
||||
|
@ -705,7 +707,7 @@ type QuotaFailure_Violation struct {
|
|||
func (x *QuotaFailure_Violation) Reset() {
|
||||
*x = QuotaFailure_Violation{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[10]
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -718,7 +720,7 @@ func (x *QuotaFailure_Violation) String() string {
|
|||
func (*QuotaFailure_Violation) ProtoMessage() {}
|
||||
|
||||
func (x *QuotaFailure_Violation) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[10]
|
||||
mi := &file_google_rpc_error_details_proto_msgTypes[11]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -731,7 +733,7 @@ func (x *QuotaFailure_Violation) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use QuotaFailure_Violation.ProtoReflect.Descriptor instead.
|
||||
func (*QuotaFailure_Violation) Descriptor() ([]byte, []int) {
|
||||
return file_google_rpc_error_details_proto_rawDescGZIP(), []int{2, 0}
|
||||
return file_google_rpc_error_details_proto_rawDescGZIP(), []int{3, 0}
|
||||
}
|
||||
|
||||
func (x *QuotaFailure_Violation) GetSubject() string {
|
||||
|
@ -828,9 +830,43 @@ type BadRequest_FieldViolation struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// A path leading to a field in the request body. The value will be a
|
||||
// A path that leads to a field in the request body. The value will be a
|
||||
// sequence of dot-separated identifiers that identify a protocol buffer
|
||||
// field. E.g., "field_violations.field" would identify this field.
|
||||
// field.
|
||||
//
|
||||
// Consider the following:
|
||||
//
|
||||
// message CreateContactRequest {
|
||||
// message EmailAddress {
|
||||
// enum Type {
|
||||
// TYPE_UNSPECIFIED = 0;
|
||||
// HOME = 1;
|
||||
// WORK = 2;
|
||||
// }
|
||||
//
|
||||
// optional string email = 1;
|
||||
// repeated EmailType type = 2;
|
||||
// }
|
||||
//
|
||||
// string full_name = 1;
|
||||
// repeated EmailAddress email_addresses = 2;
|
||||
// }
|
||||
//
|
||||
// In this example, in proto `field` could take one of the following values:
|
||||
//
|
||||
// - `full_name` for a violation in the `full_name` value
|
||||
// - `email_addresses[1].email` for a violation in the `email` field of the
|
||||
// first `email_addresses` message
|
||||
// - `email_addresses[3].type[2]` for a violation in the second `type`
|
||||
// value in the third `email_addresses` message.
|
||||
//
|
||||
// In JSON, the same values are represented as:
|
||||
//
|
||||
// - `fullName` for a violation in the `fullName` value
|
||||
// - `emailAddresses[1].email` for a violation in the `email` field of the
|
||||
// first `emailAddresses` message
|
||||
// - `emailAddresses[3].type[2]` for a violation in the second `type`
|
||||
// value in the third `emailAddresses` message.
|
||||
Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"`
|
||||
// A description of why the request element is bad.
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
|
@ -947,38 +983,38 @@ var file_google_rpc_error_details_proto_rawDesc = []byte{
|
|||
0x6f, 0x72, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x12, 0x0a, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x1a, 0x1e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x47, 0x0a, 0x09,
|
||||
0x52, 0x65, 0x74, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3a, 0x0a, 0x0b, 0x72, 0x65, 0x74,
|
||||
0x72, 0x79, 0x5f, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
|
||||
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x72, 0x79,
|
||||
0x44, 0x65, 0x6c, 0x61, 0x79, 0x22, 0x48, 0x0a, 0x09, 0x44, 0x65, 0x62, 0x75, 0x67, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x5f, 0x65, 0x6e, 0x74, 0x72,
|
||||
0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x63, 0x6b,
|
||||
0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69,
|
||||
0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22,
|
||||
0x9b, 0x01, 0x0a, 0x0c, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65,
|
||||
0x12, 0x42, 0x0a, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01,
|
||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70,
|
||||
0x63, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x2e, 0x56,
|
||||
0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x47, 0x0a, 0x09, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64,
|
||||
0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xb9, 0x01,
|
||||
0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x72,
|
||||
0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x61,
|
||||
0x73, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x3f, 0x0a, 0x08, 0x6d,
|
||||
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e,
|
||||
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74,
|
||||
0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d,
|
||||
0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xbd, 0x01, 0x0a, 0x13, 0x50, 0x72,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb9, 0x01, 0x0a,
|
||||
0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65,
|
||||
0x61, 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73,
|
||||
0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x3f, 0x0a, 0x08, 0x6d, 0x65,
|
||||
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72,
|
||||
0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d,
|
||||
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
|
||||
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76,
|
||||
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x47, 0x0a, 0x09, 0x52, 0x65, 0x74, 0x72,
|
||||
0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3a, 0x0a, 0x0b, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x64,
|
||||
0x65, 0x6c, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x61,
|
||||
0x79, 0x22, 0x48, 0x0a, 0x09, 0x44, 0x65, 0x62, 0x75, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23,
|
||||
0x0a, 0x0d, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18,
|
||||
0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x72,
|
||||
0x69, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x9b, 0x01, 0x0a, 0x0c,
|
||||
0x51, 0x75, 0x6f, 0x74, 0x61, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x12, 0x42, 0x0a, 0x0a,
|
||||
0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75,
|
||||
0x6f, 0x74, 0x61, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x2e, 0x56, 0x69, 0x6f, 0x6c, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x1a, 0x47, 0x0a, 0x09, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
|
||||
0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
|
||||
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65,
|
||||
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xbd, 0x01, 0x0a, 0x13, 0x50, 0x72,
|
||||
0x65, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72,
|
||||
0x65, 0x12, 0x49, 0x0a, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18,
|
||||
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72,
|
||||
|
@ -1051,27 +1087,27 @@ func file_google_rpc_error_details_proto_rawDescGZIP() []byte {
|
|||
|
||||
var file_google_rpc_error_details_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
|
||||
var file_google_rpc_error_details_proto_goTypes = []interface{}{
|
||||
(*RetryInfo)(nil), // 0: google.rpc.RetryInfo
|
||||
(*DebugInfo)(nil), // 1: google.rpc.DebugInfo
|
||||
(*QuotaFailure)(nil), // 2: google.rpc.QuotaFailure
|
||||
(*ErrorInfo)(nil), // 3: google.rpc.ErrorInfo
|
||||
(*ErrorInfo)(nil), // 0: google.rpc.ErrorInfo
|
||||
(*RetryInfo)(nil), // 1: google.rpc.RetryInfo
|
||||
(*DebugInfo)(nil), // 2: google.rpc.DebugInfo
|
||||
(*QuotaFailure)(nil), // 3: google.rpc.QuotaFailure
|
||||
(*PreconditionFailure)(nil), // 4: google.rpc.PreconditionFailure
|
||||
(*BadRequest)(nil), // 5: google.rpc.BadRequest
|
||||
(*RequestInfo)(nil), // 6: google.rpc.RequestInfo
|
||||
(*ResourceInfo)(nil), // 7: google.rpc.ResourceInfo
|
||||
(*Help)(nil), // 8: google.rpc.Help
|
||||
(*LocalizedMessage)(nil), // 9: google.rpc.LocalizedMessage
|
||||
(*QuotaFailure_Violation)(nil), // 10: google.rpc.QuotaFailure.Violation
|
||||
nil, // 11: google.rpc.ErrorInfo.MetadataEntry
|
||||
nil, // 10: google.rpc.ErrorInfo.MetadataEntry
|
||||
(*QuotaFailure_Violation)(nil), // 11: google.rpc.QuotaFailure.Violation
|
||||
(*PreconditionFailure_Violation)(nil), // 12: google.rpc.PreconditionFailure.Violation
|
||||
(*BadRequest_FieldViolation)(nil), // 13: google.rpc.BadRequest.FieldViolation
|
||||
(*Help_Link)(nil), // 14: google.rpc.Help.Link
|
||||
(*durationpb.Duration)(nil), // 15: google.protobuf.Duration
|
||||
}
|
||||
var file_google_rpc_error_details_proto_depIdxs = []int32{
|
||||
15, // 0: google.rpc.RetryInfo.retry_delay:type_name -> google.protobuf.Duration
|
||||
10, // 1: google.rpc.QuotaFailure.violations:type_name -> google.rpc.QuotaFailure.Violation
|
||||
11, // 2: google.rpc.ErrorInfo.metadata:type_name -> google.rpc.ErrorInfo.MetadataEntry
|
||||
10, // 0: google.rpc.ErrorInfo.metadata:type_name -> google.rpc.ErrorInfo.MetadataEntry
|
||||
15, // 1: google.rpc.RetryInfo.retry_delay:type_name -> google.protobuf.Duration
|
||||
11, // 2: google.rpc.QuotaFailure.violations:type_name -> google.rpc.QuotaFailure.Violation
|
||||
12, // 3: google.rpc.PreconditionFailure.violations:type_name -> google.rpc.PreconditionFailure.Violation
|
||||
13, // 4: google.rpc.BadRequest.field_violations:type_name -> google.rpc.BadRequest.FieldViolation
|
||||
14, // 5: google.rpc.Help.links:type_name -> google.rpc.Help.Link
|
||||
|
@ -1089,7 +1125,7 @@ func file_google_rpc_error_details_proto_init() {
|
|||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_google_rpc_error_details_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RetryInfo); i {
|
||||
switch v := v.(*ErrorInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -1101,7 +1137,7 @@ func file_google_rpc_error_details_proto_init() {
|
|||
}
|
||||
}
|
||||
file_google_rpc_error_details_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DebugInfo); i {
|
||||
switch v := v.(*RetryInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -1113,7 +1149,7 @@ func file_google_rpc_error_details_proto_init() {
|
|||
}
|
||||
}
|
||||
file_google_rpc_error_details_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*QuotaFailure); i {
|
||||
switch v := v.(*DebugInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -1125,7 +1161,7 @@ func file_google_rpc_error_details_proto_init() {
|
|||
}
|
||||
}
|
||||
file_google_rpc_error_details_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ErrorInfo); i {
|
||||
switch v := v.(*QuotaFailure); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -1208,7 +1244,7 @@ func file_google_rpc_error_details_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_google_rpc_error_details_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_google_rpc_error_details_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*QuotaFailure_Violation); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
|
10
vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go
generated
vendored
10
vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2020 Google LLC
|
||||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -15,7 +15,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.12.2
|
||||
// protoc v3.21.9
|
||||
// source: google/rpc/status.proto
|
||||
|
||||
package status
|
||||
|
@ -48,11 +48,13 @@ type Status struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
|
||||
// The status code, which should be an enum value of
|
||||
// [google.rpc.Code][google.rpc.Code].
|
||||
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
|
||||
// A developer-facing error message, which should be in English. Any
|
||||
// user-facing error message should be localized and sent in the
|
||||
// [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
|
||||
// [google.rpc.Status.details][google.rpc.Status.details] field, or localized
|
||||
// by the client.
|
||||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||
// A list of messages that carry the error details. There is a common set of
|
||||
// message types for APIs to use.
|
||||
|
|
2
vendor/google.golang.org/grpc/attributes/attributes.go
generated
vendored
2
vendor/google.golang.org/grpc/attributes/attributes.go
generated
vendored
|
@ -19,7 +19,7 @@
|
|||
// Package attributes defines a generic key/value store used in various gRPC
|
||||
// components.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This package is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
|
|
2
vendor/google.golang.org/grpc/backoff.go
generated
vendored
2
vendor/google.golang.org/grpc/backoff.go
generated
vendored
|
@ -48,7 +48,7 @@ type BackoffConfig struct {
|
|||
// here for more details:
|
||||
// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
|
|
31
vendor/google.golang.org/grpc/balancer/balancer.go
generated
vendored
31
vendor/google.golang.org/grpc/balancer/balancer.go
generated
vendored
|
@ -110,6 +110,11 @@ type SubConn interface {
|
|||
UpdateAddresses([]resolver.Address)
|
||||
// Connect starts the connecting for this SubConn.
|
||||
Connect()
|
||||
// GetOrBuildProducer returns a reference to the existing Producer for this
|
||||
// ProducerBuilder in this SubConn, or, if one does not currently exist,
|
||||
// creates a new one and returns it. Returns a close function which must
|
||||
// be called when the Producer is no longer needed.
|
||||
GetOrBuildProducer(ProducerBuilder) (p Producer, close func())
|
||||
}
|
||||
|
||||
// NewSubConnOptions contains options to create new SubConn.
|
||||
|
@ -274,6 +279,14 @@ type PickResult struct {
|
|||
// type, Done may not be called. May be nil if the balancer does not wish
|
||||
// to be notified when the RPC completes.
|
||||
Done func(DoneInfo)
|
||||
|
||||
// Metadata provides a way for LB policies to inject arbitrary per-call
|
||||
// metadata. Any metadata returned here will be merged with existing
|
||||
// metadata added by the client application.
|
||||
//
|
||||
// LB policies with child policies are responsible for propagating metadata
|
||||
// injected by their children to the ClientConn, as part of Pick().
|
||||
Metatada metadata.MD
|
||||
}
|
||||
|
||||
// TransientFailureError returns e. It exists for backward compatibility and
|
||||
|
@ -371,3 +384,21 @@ type ClientConnState struct {
|
|||
// ErrBadResolverState may be returned by UpdateClientConnState to indicate a
|
||||
// problem with the provided name resolver data.
|
||||
var ErrBadResolverState = errors.New("bad resolver state")
|
||||
|
||||
// A ProducerBuilder is a simple constructor for a Producer. It is used by the
|
||||
// SubConn to create producers when needed.
|
||||
type ProducerBuilder interface {
|
||||
// Build creates a Producer. The first parameter is always a
|
||||
// grpc.ClientConnInterface (a type to allow creating RPCs/streams on the
|
||||
// associated SubConn), but is declared as interface{} to avoid a
|
||||
// dependency cycle. Should also return a close function that will be
|
||||
// called when all references to the Producer have been given up.
|
||||
Build(grpcClientConnInterface interface{}) (p Producer, close func())
|
||||
}
|
||||
|
||||
// A Producer is a type shared among potentially many consumers. It is
|
||||
// associated with a SubConn, and an implementation will typically contain
|
||||
// other methods to provide additional functionality, e.g. configuration or
|
||||
// subscription registration.
|
||||
type Producer interface {
|
||||
}
|
||||
|
|
4
vendor/google.golang.org/grpc/balancer/conn_state_evaluator.go
generated
vendored
4
vendor/google.golang.org/grpc/balancer/conn_state_evaluator.go
generated
vendored
|
@ -55,7 +55,11 @@ func (cse *ConnectivityStateEvaluator) RecordTransition(oldState, newState conne
|
|||
cse.numIdle += updateVal
|
||||
}
|
||||
}
|
||||
return cse.CurrentState()
|
||||
}
|
||||
|
||||
// CurrentState returns the current aggregate conn state by evaluating the counters
|
||||
func (cse *ConnectivityStateEvaluator) CurrentState() connectivity.State {
|
||||
// Evaluate.
|
||||
if cse.numReady > 0 {
|
||||
return connectivity.Ready
|
||||
|
|
9
vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go
generated
vendored
9
vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go
generated
vendored
|
@ -19,14 +19,13 @@
|
|||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v3.14.0
|
||||
// source: grpc/lb/v1/load_balancer.proto
|
||||
|
||||
package grpc_lb_v1
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
durationpb "google.golang.org/protobuf/types/known/durationpb"
|
||||
|
@ -42,16 +41,13 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type LoadBalanceRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Types that are assignable to LoadBalanceRequestType:
|
||||
//
|
||||
// *LoadBalanceRequest_InitialRequest
|
||||
// *LoadBalanceRequest_ClientStats
|
||||
LoadBalanceRequestType isLoadBalanceRequest_LoadBalanceRequestType `protobuf_oneof:"load_balance_request_type"`
|
||||
|
@ -340,6 +336,7 @@ type LoadBalanceResponse struct {
|
|||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Types that are assignable to LoadBalanceResponseType:
|
||||
//
|
||||
// *LoadBalanceResponse_InitialResponse
|
||||
// *LoadBalanceResponse_ServerList
|
||||
// *LoadBalanceResponse_FallbackResponse
|
||||
|
|
6
vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go
generated
vendored
6
vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go
generated
vendored
|
@ -19,6 +19,7 @@
|
|||
// Package grpclb defines a grpclb balancer.
|
||||
//
|
||||
// To install grpclb balancer, import this package as:
|
||||
//
|
||||
// import _ "google.golang.org/grpc/balancer/grpclb"
|
||||
package grpclb
|
||||
|
||||
|
@ -135,8 +136,8 @@ func (b *lbBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) bal
|
|||
|
||||
lb := &lbBalancer{
|
||||
cc: newLBCacheClientConn(cc),
|
||||
dialTarget: opt.Target.Endpoint,
|
||||
target: opt.Target.Endpoint,
|
||||
dialTarget: opt.Target.Endpoint(),
|
||||
target: opt.Target.Endpoint(),
|
||||
opt: opt,
|
||||
fallbackTimeout: b.fallbackTimeout,
|
||||
doneCh: make(chan struct{}),
|
||||
|
@ -231,6 +232,7 @@ type lbBalancer struct {
|
|||
// it. The picker
|
||||
// - always returns ErrTransientFailure if the balancer is in TransientFailure,
|
||||
// - does two layer roundrobin pick otherwise.
|
||||
//
|
||||
// Caller must hold lb.mu.
|
||||
func (lb *lbBalancer) regeneratePicker(resetDrop bool) {
|
||||
if lb.state == connectivity.TransientFailure {
|
||||
|
|
2
vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go
generated
vendored
2
vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go
generated
vendored
|
@ -332,7 +332,7 @@ func (ccw *remoteBalancerCCWrapper) callRemoteBalancer(ctx context.Context) (bac
|
|||
lbClient := &loadBalancerClient{cc: ccw.cc}
|
||||
stream, err := lbClient.BalanceLoad(ctx, grpc.WaitForReady(true))
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("grpclb: failed to perform RPC to the remote balancer %v", err)
|
||||
return true, fmt.Errorf("grpclb: failed to perform RPC to the remote balancer: %v", err)
|
||||
}
|
||||
ccw.lb.mu.Lock()
|
||||
ccw.lb.remoteBalancerConnected = true
|
||||
|
|
67
vendor/google.golang.org/grpc/balancer_conn_wrappers.go
generated
vendored
67
vendor/google.golang.org/grpc/balancer_conn_wrappers.go
generated
vendored
|
@ -19,17 +19,20 @@
|
|||
package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"google.golang.org/grpc/balancer"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/connectivity"
|
||||
"google.golang.org/grpc/internal/balancer/gracefulswitch"
|
||||
"google.golang.org/grpc/internal/buffer"
|
||||
"google.golang.org/grpc/internal/channelz"
|
||||
"google.golang.org/grpc/internal/grpcsync"
|
||||
"google.golang.org/grpc/resolver"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// ccBalancerWrapper sits between the ClientConn and the Balancer.
|
||||
|
@ -305,7 +308,7 @@ func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer
|
|||
channelz.Warningf(logger, ccb.cc.channelzID, "acBalancerWrapper: NewSubConn: failed to newAddrConn: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
acbw := &acBalancerWrapper{ac: ac}
|
||||
acbw := &acBalancerWrapper{ac: ac, producers: make(map[balancer.ProducerBuilder]*refCountedProducer)}
|
||||
acbw.ac.mu.Lock()
|
||||
ac.acbw = acbw
|
||||
acbw.ac.mu.Unlock()
|
||||
|
@ -361,6 +364,7 @@ func (ccb *ccBalancerWrapper) Target() string {
|
|||
type acBalancerWrapper struct {
|
||||
mu sync.Mutex
|
||||
ac *addrConn
|
||||
producers map[balancer.ProducerBuilder]*refCountedProducer
|
||||
}
|
||||
|
||||
func (acbw *acBalancerWrapper) UpdateAddresses(addrs []resolver.Address) {
|
||||
|
@ -414,3 +418,64 @@ func (acbw *acBalancerWrapper) getAddrConn() *addrConn {
|
|||
defer acbw.mu.Unlock()
|
||||
return acbw.ac
|
||||
}
|
||||
|
||||
var errSubConnNotReady = status.Error(codes.Unavailable, "SubConn not currently connected")
|
||||
|
||||
// NewStream begins a streaming RPC on the addrConn. If the addrConn is not
|
||||
// ready, returns errSubConnNotReady.
|
||||
func (acbw *acBalancerWrapper) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) {
|
||||
transport := acbw.ac.getReadyTransport()
|
||||
if transport == nil {
|
||||
return nil, errSubConnNotReady
|
||||
}
|
||||
return newNonRetryClientStream(ctx, desc, method, transport, acbw.ac, opts...)
|
||||
}
|
||||
|
||||
// Invoke performs a unary RPC. If the addrConn is not ready, returns
|
||||
// errSubConnNotReady.
|
||||
func (acbw *acBalancerWrapper) Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...CallOption) error {
|
||||
cs, err := acbw.NewStream(ctx, unaryStreamDesc, method, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := cs.SendMsg(args); err != nil {
|
||||
return err
|
||||
}
|
||||
return cs.RecvMsg(reply)
|
||||
}
|
||||
|
||||
type refCountedProducer struct {
|
||||
producer balancer.Producer
|
||||
refs int // number of current refs to the producer
|
||||
close func() // underlying producer's close function
|
||||
}
|
||||
|
||||
func (acbw *acBalancerWrapper) GetOrBuildProducer(pb balancer.ProducerBuilder) (balancer.Producer, func()) {
|
||||
acbw.mu.Lock()
|
||||
defer acbw.mu.Unlock()
|
||||
|
||||
// Look up existing producer from this builder.
|
||||
pData := acbw.producers[pb]
|
||||
if pData == nil {
|
||||
// Not found; create a new one and add it to the producers map.
|
||||
p, close := pb.Build(acbw)
|
||||
pData = &refCountedProducer{producer: p, close: close}
|
||||
acbw.producers[pb] = pData
|
||||
}
|
||||
// Account for this new reference.
|
||||
pData.refs++
|
||||
|
||||
// Return a cleanup function wrapped in a OnceFunc to remove this reference
|
||||
// and delete the refCountedProducer from the map if the total reference
|
||||
// count goes to zero.
|
||||
unref := func() {
|
||||
acbw.mu.Lock()
|
||||
pData.refs--
|
||||
if pData.refs == 0 {
|
||||
defer pData.close() // Run outside the acbw mutex
|
||||
delete(acbw.producers, pb)
|
||||
}
|
||||
acbw.mu.Unlock()
|
||||
}
|
||||
return pData.producer, grpcsync.OnceFunc(unref)
|
||||
}
|
||||
|
|
8
vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go
generated
vendored
8
vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go
generated
vendored
|
@ -18,14 +18,13 @@
|
|||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v3.14.0
|
||||
// source: grpc/binlog/v1/binarylog.proto
|
||||
|
||||
package grpc_binarylog_v1
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
durationpb "google.golang.org/protobuf/types/known/durationpb"
|
||||
|
@ -41,10 +40,6 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
// Enumerates the type of event
|
||||
// Note the terminology is different from the RPC semantics
|
||||
// definition, but the same meaning is expressed here.
|
||||
|
@ -261,6 +256,7 @@ type GrpcLogEntry struct {
|
|||
// according to the type of the log entry.
|
||||
//
|
||||
// Types that are assignable to Payload:
|
||||
//
|
||||
// *GrpcLogEntry_ClientHeader
|
||||
// *GrpcLogEntry_ServerHeader
|
||||
// *GrpcLogEntry_Message
|
||||
|
|
2
vendor/google.golang.org/grpc/channelz/channelz.go
generated
vendored
2
vendor/google.golang.org/grpc/channelz/channelz.go
generated
vendored
|
@ -23,7 +23,7 @@
|
|||
// https://github.com/grpc/proposal/blob/master/A14-channelz.md, is provided by
|
||||
// the `internal/channelz` package.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: All APIs in this package are experimental and may be removed in a
|
||||
// later release.
|
||||
|
|
137
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
137
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
|
@ -256,7 +256,7 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cc.authority, err = determineAuthority(cc.parsedTarget.Endpoint, cc.target, cc.dopts)
|
||||
cc.authority, err = determineAuthority(cc.parsedTarget.Endpoint(), cc.target, cc.dopts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -503,7 +503,7 @@ type ClientConn struct {
|
|||
// WaitForStateChange waits until the connectivity.State of ClientConn changes from sourceState or
|
||||
// ctx expires. A true value is returned in former case and false in latter.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
|
@ -522,7 +522,7 @@ func (cc *ClientConn) WaitForStateChange(ctx context.Context, sourceState connec
|
|||
|
||||
// GetState returns the connectivity.State of ClientConn.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later
|
||||
// release.
|
||||
|
@ -534,7 +534,7 @@ func (cc *ClientConn) GetState() connectivity.State {
|
|||
// the channel is idle. Does not wait for the connection attempts to begin
|
||||
// before returning.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later
|
||||
// release.
|
||||
|
@ -761,7 +761,7 @@ func (cc *ClientConn) channelzMetric() *channelz.ChannelInternalMetric {
|
|||
|
||||
// Target returns the target string of the ClientConn.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
|
@ -788,10 +788,16 @@ func (cc *ClientConn) incrCallsFailed() {
|
|||
func (ac *addrConn) connect() error {
|
||||
ac.mu.Lock()
|
||||
if ac.state == connectivity.Shutdown {
|
||||
if logger.V(2) {
|
||||
logger.Infof("connect called on shutdown addrConn; ignoring.")
|
||||
}
|
||||
ac.mu.Unlock()
|
||||
return errConnClosing
|
||||
}
|
||||
if ac.state != connectivity.Idle {
|
||||
if logger.V(2) {
|
||||
logger.Infof("connect called on addrConn in non-idle state (%v); ignoring.", ac.state)
|
||||
}
|
||||
ac.mu.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
@ -928,7 +934,7 @@ func (cc *ClientConn) healthCheckConfig() *healthCheckConfig {
|
|||
return cc.sc.healthCheckConfig
|
||||
}
|
||||
|
||||
func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method string) (transport.ClientTransport, func(balancer.DoneInfo), error) {
|
||||
func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method string) (transport.ClientTransport, balancer.PickResult, error) {
|
||||
return cc.blockingpicker.pick(ctx, failfast, balancer.PickInfo{
|
||||
Ctx: ctx,
|
||||
FullMethodName: method,
|
||||
|
@ -998,7 +1004,7 @@ func (cc *ClientConn) resolveNow(o resolver.ResolveNowOptions) {
|
|||
// However, if a previously unavailable network becomes available, this may be
|
||||
// used to trigger an immediate reconnect.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
|
@ -1228,86 +1234,58 @@ func (ac *addrConn) tryAllAddrs(addrs []resolver.Address, connectDeadline time.T
|
|||
// address was not successfully connected, or updates ac appropriately with the
|
||||
// new transport.
|
||||
func (ac *addrConn) createTransport(addr resolver.Address, copts transport.ConnectOptions, connectDeadline time.Time) error {
|
||||
// TODO: Delete prefaceReceived and move the logic to wait for it into the
|
||||
// transport.
|
||||
prefaceReceived := grpcsync.NewEvent()
|
||||
connClosed := grpcsync.NewEvent()
|
||||
|
||||
addr.ServerName = ac.cc.getServerName(addr)
|
||||
hctx, hcancel := context.WithCancel(ac.ctx)
|
||||
hcStarted := false // protected by ac.mu
|
||||
|
||||
onClose := func() {
|
||||
onClose := func(r transport.GoAwayReason) {
|
||||
ac.mu.Lock()
|
||||
defer ac.mu.Unlock()
|
||||
defer connClosed.Fire()
|
||||
defer hcancel()
|
||||
if !hcStarted || hctx.Err() != nil {
|
||||
// We didn't start the health check or set the state to READY, so
|
||||
// no need to do anything else here.
|
||||
//
|
||||
// OR, we have already cancelled the health check context, meaning
|
||||
// we have already called onClose once for this transport. In this
|
||||
// case it would be dangerous to clear the transport and update the
|
||||
// state, since there may be a new transport in this addrConn.
|
||||
// adjust params based on GoAwayReason
|
||||
ac.adjustParams(r)
|
||||
if ac.state == connectivity.Shutdown {
|
||||
// Already shut down. tearDown() already cleared the transport and
|
||||
// canceled hctx via ac.ctx, and we expected this connection to be
|
||||
// closed, so do nothing here.
|
||||
return
|
||||
}
|
||||
hcancel()
|
||||
if ac.transport == nil {
|
||||
// We're still connecting to this address, which could error. Do
|
||||
// not update the connectivity state or resolve; these will happen
|
||||
// at the end of the tryAllAddrs connection loop in the event of an
|
||||
// error.
|
||||
return
|
||||
}
|
||||
ac.transport = nil
|
||||
// Refresh the name resolver
|
||||
// Refresh the name resolver on any connection loss.
|
||||
ac.cc.resolveNow(resolver.ResolveNowOptions{})
|
||||
if ac.state != connectivity.Shutdown {
|
||||
// Always go idle and wait for the LB policy to initiate a new
|
||||
// connection attempt.
|
||||
ac.updateConnectivityState(connectivity.Idle, nil)
|
||||
}
|
||||
}
|
||||
|
||||
onGoAway := func(r transport.GoAwayReason) {
|
||||
ac.mu.Lock()
|
||||
ac.adjustParams(r)
|
||||
ac.mu.Unlock()
|
||||
onClose()
|
||||
}
|
||||
|
||||
connectCtx, cancel := context.WithDeadline(ac.ctx, connectDeadline)
|
||||
defer cancel()
|
||||
copts.ChannelzParentID = ac.channelzID
|
||||
|
||||
newTr, err := transport.NewClientTransport(connectCtx, ac.cc.ctx, addr, copts, func() { prefaceReceived.Fire() }, onGoAway, onClose)
|
||||
newTr, err := transport.NewClientTransport(connectCtx, ac.cc.ctx, addr, copts, onClose)
|
||||
if err != nil {
|
||||
if logger.V(2) {
|
||||
logger.Infof("Creating new client transport to %q: %v", addr, err)
|
||||
}
|
||||
// newTr is either nil, or closed.
|
||||
hcancel()
|
||||
channelz.Warningf(logger, ac.channelzID, "grpc: addrConn.createTransport failed to connect to %s. Err: %v", addr, err)
|
||||
return err
|
||||
}
|
||||
|
||||
select {
|
||||
case <-connectCtx.Done():
|
||||
// We didn't get the preface in time.
|
||||
// The error we pass to Close() is immaterial since there are no open
|
||||
// streams at this point, so no trailers with error details will be sent
|
||||
// out. We just need to pass a non-nil error.
|
||||
newTr.Close(transport.ErrConnClosing)
|
||||
if connectCtx.Err() == context.DeadlineExceeded {
|
||||
err := errors.New("failed to receive server preface within timeout")
|
||||
channelz.Warningf(logger, ac.channelzID, "grpc: addrConn.createTransport failed to connect to %s: %v", addr, err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
case <-prefaceReceived.Done():
|
||||
// We got the preface - huzzah! things are good.
|
||||
ac.mu.Lock()
|
||||
defer ac.mu.Unlock()
|
||||
if connClosed.HasFired() {
|
||||
// onClose called first; go idle but do nothing else.
|
||||
if ac.state != connectivity.Shutdown {
|
||||
ac.updateConnectivityState(connectivity.Idle, nil)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if ac.state == connectivity.Shutdown {
|
||||
// This can happen if the subConn was removed while in `Connecting`
|
||||
// state. tearDown() would have set the state to `Shutdown`, but
|
||||
// would not have closed the transport since ac.transport would not
|
||||
// been set at that point.
|
||||
// have been set at that point.
|
||||
//
|
||||
// We run this in a goroutine because newTr.Close() calls onClose()
|
||||
// inline, which requires locking ac.mu.
|
||||
|
@ -1318,21 +1296,17 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne
|
|||
go newTr.Close(transport.ErrConnClosing)
|
||||
return nil
|
||||
}
|
||||
if hctx.Err() != nil {
|
||||
// onClose was already called for this connection, but the connection
|
||||
// was successfully established first. Consider it a success and set
|
||||
// the new state to Idle.
|
||||
ac.updateConnectivityState(connectivity.Idle, nil)
|
||||
return nil
|
||||
}
|
||||
ac.curAddr = addr
|
||||
ac.transport = newTr
|
||||
hcStarted = true
|
||||
ac.startHealthCheck(hctx) // Will set state to READY if appropriate.
|
||||
return nil
|
||||
case <-connClosed.Done():
|
||||
// The transport has already closed. If we received the preface, too,
|
||||
// this is not an error.
|
||||
select {
|
||||
case <-prefaceReceived.Done():
|
||||
return nil
|
||||
default:
|
||||
return errors.New("connection closed before server preface received")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// startHealthCheck starts the health checking stream (RPC) to watch the health
|
||||
|
@ -1402,7 +1376,7 @@ func (ac *addrConn) startHealthCheck(ctx context.Context) {
|
|||
if status.Code(err) == codes.Unimplemented {
|
||||
channelz.Error(logger, ac.channelzID, "Subchannel health check is unimplemented at server side, thus health check is disabled")
|
||||
} else {
|
||||
channelz.Errorf(logger, ac.channelzID, "HealthCheckFunc exits with unexpected error %v", err)
|
||||
channelz.Errorf(logger, ac.channelzID, "Health checking failed: %v", err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
@ -1583,7 +1557,7 @@ func (cc *ClientConn) parseTargetAndFindResolver() (resolver.Builder, error) {
|
|||
channelz.Infof(logger, cc.channelzID, "dial target %q parse failed: %v", cc.target, err)
|
||||
} else {
|
||||
channelz.Infof(logger, cc.channelzID, "parsed dial target is: %+v", parsedTarget)
|
||||
rb = cc.getResolver(parsedTarget.Scheme)
|
||||
rb = cc.getResolver(parsedTarget.URL.Scheme)
|
||||
if rb != nil {
|
||||
cc.parsedTarget = parsedTarget
|
||||
return rb, nil
|
||||
|
@ -1604,39 +1578,26 @@ func (cc *ClientConn) parseTargetAndFindResolver() (resolver.Builder, error) {
|
|||
return nil, err
|
||||
}
|
||||
channelz.Infof(logger, cc.channelzID, "parsed dial target is: %+v", parsedTarget)
|
||||
rb = cc.getResolver(parsedTarget.Scheme)
|
||||
rb = cc.getResolver(parsedTarget.URL.Scheme)
|
||||
if rb == nil {
|
||||
return nil, fmt.Errorf("could not get resolver for default scheme: %q", parsedTarget.Scheme)
|
||||
return nil, fmt.Errorf("could not get resolver for default scheme: %q", parsedTarget.URL.Scheme)
|
||||
}
|
||||
cc.parsedTarget = parsedTarget
|
||||
return rb, nil
|
||||
}
|
||||
|
||||
// parseTarget uses RFC 3986 semantics to parse the given target into a
|
||||
// resolver.Target struct containing scheme, authority and endpoint. Query
|
||||
// resolver.Target struct containing scheme, authority and url. Query
|
||||
// params are stripped from the endpoint.
|
||||
func parseTarget(target string) (resolver.Target, error) {
|
||||
u, err := url.Parse(target)
|
||||
if err != nil {
|
||||
return resolver.Target{}, err
|
||||
}
|
||||
// For targets of the form "[scheme]://[authority]/endpoint, the endpoint
|
||||
// value returned from url.Parse() contains a leading "/". Although this is
|
||||
// in accordance with RFC 3986, we do not want to break existing resolver
|
||||
// implementations which expect the endpoint without the leading "/". So, we
|
||||
// end up stripping the leading "/" here. But this will result in an
|
||||
// incorrect parsing for something like "unix:///path/to/socket". Since we
|
||||
// own the "unix" resolver, we can workaround in the unix resolver by using
|
||||
// the `URL` field instead of the `Endpoint` field.
|
||||
endpoint := u.Path
|
||||
if endpoint == "" {
|
||||
endpoint = u.Opaque
|
||||
}
|
||||
endpoint = strings.TrimPrefix(endpoint, "/")
|
||||
|
||||
return resolver.Target{
|
||||
Scheme: u.Scheme,
|
||||
Authority: u.Host,
|
||||
Endpoint: endpoint,
|
||||
URL: *u,
|
||||
}, nil
|
||||
}
|
||||
|
|
|
@ -17,14 +17,13 @@
|
|||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v3.14.0
|
||||
// source: grpc/gcp/altscontext.proto
|
||||
|
||||
package grpc_gcp
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
|
@ -38,10 +37,6 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type AltsContext struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
|
|
@ -17,14 +17,13 @@
|
|||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v3.14.0
|
||||
// source: grpc/gcp/handshaker.proto
|
||||
|
||||
package grpc_gcp
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
|
@ -38,10 +37,6 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type HandshakeProtocol int32
|
||||
|
||||
const (
|
||||
|
@ -216,6 +211,7 @@ type Identity struct {
|
|||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Types that are assignable to IdentityOneof:
|
||||
//
|
||||
// *Identity_ServiceAccount
|
||||
// *Identity_Hostname
|
||||
IdentityOneof isIdentity_IdentityOneof `protobuf_oneof:"identity_oneof"`
|
||||
|
@ -664,6 +660,7 @@ type HandshakerReq struct {
|
|||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Types that are assignable to ReqOneof:
|
||||
//
|
||||
// *HandshakerReq_ClientStart
|
||||
// *HandshakerReq_ServerStart
|
||||
// *HandshakerReq_Next
|
||||
|
|
|
@ -17,14 +17,13 @@
|
|||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v3.14.0
|
||||
// source: grpc/gcp/transport_security_common.proto
|
||||
|
||||
package grpc_gcp
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
|
@ -38,10 +37,6 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
// The security level of the created channel. The list is sorted in increasing
|
||||
// level of security. This order must always be maintained.
|
||||
type SecurityLevel int32
|
||||
|
|
20
vendor/google.golang.org/grpc/credentials/credentials.go
generated
vendored
20
vendor/google.golang.org/grpc/credentials/credentials.go
generated
vendored
|
@ -36,16 +36,16 @@ import (
|
|||
// PerRPCCredentials defines the common interface for the credentials which need to
|
||||
// attach security information to every RPC (e.g., oauth2).
|
||||
type PerRPCCredentials interface {
|
||||
// GetRequestMetadata gets the current request metadata, refreshing
|
||||
// tokens if required. This should be called by the transport layer on
|
||||
// each request, and the data should be populated in headers or other
|
||||
// context. If a status code is returned, it will be used as the status
|
||||
// for the RPC. uri is the URI of the entry point for the request.
|
||||
// When supported by the underlying implementation, ctx can be used for
|
||||
// timeout and cancellation. Additionally, RequestInfo data will be
|
||||
// available via ctx to this call.
|
||||
// TODO(zhaoq): Define the set of the qualified keys instead of leaving
|
||||
// it as an arbitrary string.
|
||||
// GetRequestMetadata gets the current request metadata, refreshing tokens
|
||||
// if required. This should be called by the transport layer on each
|
||||
// request, and the data should be populated in headers or other
|
||||
// context. If a status code is returned, it will be used as the status for
|
||||
// the RPC (restricted to an allowable set of codes as defined by gRFC
|
||||
// A54). uri is the URI of the entry point for the request. When supported
|
||||
// by the underlying implementation, ctx can be used for timeout and
|
||||
// cancellation. Additionally, RequestInfo data will be available via ctx
|
||||
// to this call. TODO(zhaoq): Define the set of the qualified keys instead
|
||||
// of leaving it as an arbitrary string.
|
||||
GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)
|
||||
// RequireTransportSecurity indicates whether the credentials requires
|
||||
// transport security.
|
||||
|
|
1
vendor/google.golang.org/grpc/credentials/google/xds.go
generated
vendored
1
vendor/google.golang.org/grpc/credentials/google/xds.go
generated
vendored
|
@ -40,6 +40,7 @@ const cfeClusterAuthorityName = "traffic-director-c2p.xds.googleapis.com"
|
|||
// "xdstp://traffic-director-c2p.xds.googleapis.com/envoy.config.cluster.v3.Cluster/google_cfe_",
|
||||
// use TLS
|
||||
// - otherwise, use ALTS
|
||||
//
|
||||
// - else, do TLS
|
||||
//
|
||||
// On the server, ServerHandshake always does TLS.
|
||||
|
|
8
vendor/google.golang.org/grpc/credentials/oauth/oauth.go
generated
vendored
8
vendor/google.golang.org/grpc/credentials/oauth/oauth.go
generated
vendored
|
@ -22,8 +22,8 @@ package oauth
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
|
@ -73,7 +73,7 @@ type jwtAccess struct {
|
|||
|
||||
// NewJWTAccessFromFile creates PerRPCCredentials from the given keyFile.
|
||||
func NewJWTAccessFromFile(keyFile string) (credentials.PerRPCCredentials, error) {
|
||||
jsonKey, err := ioutil.ReadFile(keyFile)
|
||||
jsonKey, err := os.ReadFile(keyFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("credentials: failed to read the service account key file: %v", err)
|
||||
}
|
||||
|
@ -121,6 +121,8 @@ type oauthAccess struct {
|
|||
}
|
||||
|
||||
// NewOauthAccess constructs the PerRPCCredentials using a given token.
|
||||
//
|
||||
// Deprecated: use oauth.TokenSource instead.
|
||||
func NewOauthAccess(token *oauth2.Token) credentials.PerRPCCredentials {
|
||||
return oauthAccess{token: *token}
|
||||
}
|
||||
|
@ -190,7 +192,7 @@ func NewServiceAccountFromKey(jsonKey []byte, scope ...string) (credentials.PerR
|
|||
// NewServiceAccountFromFile constructs the PerRPCCredentials using the JSON key file
|
||||
// of a Google Developers service account.
|
||||
func NewServiceAccountFromFile(keyFile string, scope ...string) (credentials.PerRPCCredentials, error) {
|
||||
jsonKey, err := ioutil.ReadFile(keyFile)
|
||||
jsonKey, err := os.ReadFile(keyFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("credentials: failed to read the service account key file: %v", err)
|
||||
}
|
||||
|
|
6
vendor/google.golang.org/grpc/credentials/tls.go
generated
vendored
6
vendor/google.golang.org/grpc/credentials/tls.go
generated
vendored
|
@ -23,9 +23,9 @@ import (
|
|||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
credinternal "google.golang.org/grpc/internal/credentials"
|
||||
)
|
||||
|
@ -166,7 +166,7 @@ func NewClientTLSFromCert(cp *x509.CertPool, serverNameOverride string) Transpor
|
|||
// it will override the virtual host name of authority (e.g. :authority header
|
||||
// field) in requests.
|
||||
func NewClientTLSFromFile(certFile, serverNameOverride string) (TransportCredentials, error) {
|
||||
b, err := ioutil.ReadFile(certFile)
|
||||
b, err := os.ReadFile(certFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ func NewServerTLSFromFile(certFile, keyFile string) (TransportCredentials, error
|
|||
// TLSChannelzSecurityValue defines the struct that TLS protocol should return
|
||||
// from GetSecurityValue(), containing security info like cipher and certificate used.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
|
|
25
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
25
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
|
@ -44,6 +44,7 @@ func init() {
|
|||
extraDialOptions = nil
|
||||
}
|
||||
internal.WithBinaryLogger = withBinaryLogger
|
||||
internal.JoinDialOptions = newJoinDialOption
|
||||
}
|
||||
|
||||
// dialOptions configure a Dial call. dialOptions are set by the DialOption
|
||||
|
@ -111,13 +112,28 @@ func newFuncDialOption(f func(*dialOptions)) *funcDialOption {
|
|||
}
|
||||
}
|
||||
|
||||
type joinDialOption struct {
|
||||
opts []DialOption
|
||||
}
|
||||
|
||||
func (jdo *joinDialOption) apply(do *dialOptions) {
|
||||
for _, opt := range jdo.opts {
|
||||
opt.apply(do)
|
||||
}
|
||||
}
|
||||
|
||||
func newJoinDialOption(opts ...DialOption) DialOption {
|
||||
return &joinDialOption{opts: opts}
|
||||
}
|
||||
|
||||
// WithWriteBufferSize determines how much data can be batched before doing a
|
||||
// write on the wire. The corresponding memory allocation for this buffer will
|
||||
// be twice the size to keep syscalls low. The default value for this buffer is
|
||||
// 32KB.
|
||||
//
|
||||
// Zero will disable the write buffer such that each write will be on underlying
|
||||
// connection. Note: A Send call may not directly translate to a write.
|
||||
// Zero or negative values will disable the write buffer such that each write
|
||||
// will be on underlying connection. Note: A Send call may not directly
|
||||
// translate to a write.
|
||||
func WithWriteBufferSize(s int) DialOption {
|
||||
return newFuncDialOption(func(o *dialOptions) {
|
||||
o.copts.WriteBufferSize = s
|
||||
|
@ -127,8 +143,9 @@ func WithWriteBufferSize(s int) DialOption {
|
|||
// WithReadBufferSize lets you set the size of read buffer, this determines how
|
||||
// much data can be read at most for each read syscall.
|
||||
//
|
||||
// The default value for this buffer is 32KB. Zero will disable read buffer for
|
||||
// a connection so data framer can access the underlying conn directly.
|
||||
// The default value for this buffer is 32KB. Zero or negative values will
|
||||
// disable read buffer for a connection so data framer can access the
|
||||
// underlying conn directly.
|
||||
func WithReadBufferSize(s int) DialOption {
|
||||
return newFuncDialOption(func(o *dialOptions) {
|
||||
o.copts.ReadBufferSize = s
|
||||
|
|
7
vendor/google.golang.org/grpc/encoding/encoding.go
generated
vendored
7
vendor/google.golang.org/grpc/encoding/encoding.go
generated
vendored
|
@ -19,7 +19,7 @@
|
|||
// Package encoding defines the interface for the compressor and codec, and
|
||||
// functions to register and retrieve compressors and codecs.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This package is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
|
@ -28,6 +28,8 @@ package encoding
|
|||
import (
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/grpc/internal/grpcutil"
|
||||
)
|
||||
|
||||
// Identity specifies the optional encoding for uncompressed streams.
|
||||
|
@ -73,6 +75,9 @@ var registeredCompressor = make(map[string]Compressor)
|
|||
// registered with the same name, the one registered last will take effect.
|
||||
func RegisterCompressor(c Compressor) {
|
||||
registeredCompressor[c.Name()] = c
|
||||
if !grpcutil.IsCompressorNameRegistered(c.Name()) {
|
||||
grpcutil.RegisteredCompressorNames = append(grpcutil.RegisteredCompressorNames, c.Name())
|
||||
}
|
||||
}
|
||||
|
||||
// GetCompressor returns Compressor for the given compressor name.
|
||||
|
|
7
vendor/google.golang.org/grpc/encoding/gzip/gzip.go
generated
vendored
7
vendor/google.golang.org/grpc/encoding/gzip/gzip.go
generated
vendored
|
@ -19,7 +19,7 @@
|
|||
// Package gzip implements and registers the gzip compressor
|
||||
// during the initialization.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This package is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
|
@ -30,7 +30,6 @@ import (
|
|||
"encoding/binary"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"sync"
|
||||
|
||||
"google.golang.org/grpc/encoding"
|
||||
|
@ -42,7 +41,7 @@ const Name = "gzip"
|
|||
func init() {
|
||||
c := &compressor{}
|
||||
c.poolCompressor.New = func() interface{} {
|
||||
return &writer{Writer: gzip.NewWriter(ioutil.Discard), pool: &c.poolCompressor}
|
||||
return &writer{Writer: gzip.NewWriter(io.Discard), pool: &c.poolCompressor}
|
||||
}
|
||||
encoding.RegisterCompressor(c)
|
||||
}
|
||||
|
@ -63,7 +62,7 @@ func SetLevel(level int) error {
|
|||
}
|
||||
c := encoding.GetCompressor(Name).(*compressor)
|
||||
c.poolCompressor.New = func() interface{} {
|
||||
w, err := gzip.NewWriterLevel(ioutil.Discard, level)
|
||||
w, err := gzip.NewWriterLevel(io.Discard, level)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
9
vendor/google.golang.org/grpc/grpclog/loggerv2.go
generated
vendored
9
vendor/google.golang.org/grpc/grpclog/loggerv2.go
generated
vendored
|
@ -22,7 +22,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
|
@ -140,9 +139,9 @@ func newLoggerV2WithConfig(infoW, warningW, errorW io.Writer, c loggerV2Config)
|
|||
// newLoggerV2 creates a loggerV2 to be used as default logger.
|
||||
// All logs are written to stderr.
|
||||
func newLoggerV2() LoggerV2 {
|
||||
errorW := ioutil.Discard
|
||||
warningW := ioutil.Discard
|
||||
infoW := ioutil.Discard
|
||||
errorW := io.Discard
|
||||
warningW := io.Discard
|
||||
infoW := io.Discard
|
||||
|
||||
logLevel := os.Getenv("GRPC_GO_LOG_SEVERITY_LEVEL")
|
||||
switch logLevel {
|
||||
|
@ -242,7 +241,7 @@ func (g *loggerT) V(l int) bool {
|
|||
// DepthLoggerV2, the below functions will be called with the appropriate stack
|
||||
// depth set for trivial functions the logger may ignore.
|
||||
//
|
||||
// Experimental
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue