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.
 
 
 

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