You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

90 lines
2.3 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 asset is an auto-generated package for the
  16. // Cloud Asset API.
  17. //
  18. // NOTE: This package is in beta. It is not stable, and may be subject to changes.
  19. //
  20. // The cloud asset API manages the history and inventory of cloud resources.
  21. package asset // import "cloud.google.com/go/asset/apiv1beta1"
  22. import (
  23. "context"
  24. "runtime"
  25. "strings"
  26. "unicode"
  27. "google.golang.org/grpc/metadata"
  28. )
  29. func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
  30. out, _ := metadata.FromOutgoingContext(ctx)
  31. out = out.Copy()
  32. for _, md := range mds {
  33. for k, v := range md {
  34. out[k] = append(out[k], v...)
  35. }
  36. }
  37. return metadata.NewOutgoingContext(ctx, out)
  38. }
  39. // DefaultAuthScopes reports the default set of authentication scopes to use with this package.
  40. func DefaultAuthScopes() []string {
  41. return []string{
  42. "https://www.googleapis.com/auth/cloud-platform",
  43. }
  44. }
  45. // versionGo returns the Go runtime version. The returned string
  46. // has no whitespace, suitable for reporting in header.
  47. func versionGo() string {
  48. const develPrefix = "devel +"
  49. s := runtime.Version()
  50. if strings.HasPrefix(s, develPrefix) {
  51. s = s[len(develPrefix):]
  52. if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
  53. s = s[:p]
  54. }
  55. return s
  56. }
  57. notSemverRune := func(r rune) bool {
  58. return strings.IndexRune("0123456789.", r) < 0
  59. }
  60. if strings.HasPrefix(s, "go1") {
  61. s = s[2:]
  62. var prerelease string
  63. if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
  64. s, prerelease = s[:p], s[p:]
  65. }
  66. if strings.HasSuffix(s, ".") {
  67. s += "0"
  68. } else if strings.Count(s, ".") < 2 {
  69. s += ".0"
  70. }
  71. if prerelease != "" {
  72. s += "-" + prerelease
  73. }
  74. return s
  75. }
  76. return "UNKNOWN"
  77. }
  78. const versionClient = "20190306"