Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

96 righe
2.6 KiB

  1. // Copyright 2019 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Code generated by gapic-generator. DO NOT EDIT.
  15. // Package logging is an auto-generated package for the
  16. // Stackdriver Logging API.
  17. //
  18. // NOTE: This package is in alpha. It is not stable, and is likely to change.
  19. //
  20. // Writes log entries and manages your Logging configuration.
  21. //
  22. // Use the client at cloud.google.com/go/logging in preference to this.
  23. package logging // import "cloud.google.com/go/logging/apiv2"
  24. import (
  25. "context"
  26. "runtime"
  27. "strings"
  28. "unicode"
  29. "google.golang.org/grpc/metadata"
  30. )
  31. func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
  32. out, _ := metadata.FromOutgoingContext(ctx)
  33. out = out.Copy()
  34. for _, md := range mds {
  35. for k, v := range md {
  36. out[k] = append(out[k], v...)
  37. }
  38. }
  39. return metadata.NewOutgoingContext(ctx, out)
  40. }
  41. // DefaultAuthScopes reports the default set of authentication scopes to use with this package.
  42. func DefaultAuthScopes() []string {
  43. return []string{
  44. "https://www.googleapis.com/auth/cloud-platform",
  45. "https://www.googleapis.com/auth/cloud-platform.read-only",
  46. "https://www.googleapis.com/auth/logging.admin",
  47. "https://www.googleapis.com/auth/logging.read",
  48. "https://www.googleapis.com/auth/logging.write",
  49. }
  50. }
  51. // versionGo returns the Go runtime version. The returned string
  52. // has no whitespace, suitable for reporting in header.
  53. func versionGo() string {
  54. const develPrefix = "devel +"
  55. s := runtime.Version()
  56. if strings.HasPrefix(s, develPrefix) {
  57. s = s[len(develPrefix):]
  58. if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
  59. s = s[:p]
  60. }
  61. return s
  62. }
  63. notSemverRune := func(r rune) bool {
  64. return strings.IndexRune("0123456789.", r) < 0
  65. }
  66. if strings.HasPrefix(s, "go1") {
  67. s = s[2:]
  68. var prerelease string
  69. if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
  70. s, prerelease = s[:p], s[p:]
  71. }
  72. if strings.HasSuffix(s, ".") {
  73. s += "0"
  74. } else if strings.Count(s, ".") < 2 {
  75. s += ".0"
  76. }
  77. if prerelease != "" {
  78. s += "-" + prerelease
  79. }
  80. return s
  81. }
  82. return "UNKNOWN"
  83. }
  84. const versionClient = "20190306"