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.
 
 
 

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