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.
 
 
 

93 lines
2.5 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 admin is an auto-generated package for the
  16. // Google Identity and Access Management (IAM) API.
  17. //
  18. // NOTE: This package is in alpha. It is not stable, and is likely to change.
  19. //
  20. // Manages identity and access control for Google Cloud Platform resources,
  21. // including the creation of service accounts, which you can use to
  22. // authenticate to Google and make API calls.
  23. package admin // import "cloud.google.com/go/iam/admin/apiv1"
  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/iam",
  46. }
  47. }
  48. // versionGo returns the Go runtime version. The returned string
  49. // has no whitespace, suitable for reporting in header.
  50. func versionGo() string {
  51. const develPrefix = "devel +"
  52. s := runtime.Version()
  53. if strings.HasPrefix(s, develPrefix) {
  54. s = s[len(develPrefix):]
  55. if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
  56. s = s[:p]
  57. }
  58. return s
  59. }
  60. notSemverRune := func(r rune) bool {
  61. return strings.IndexRune("0123456789.", r) < 0
  62. }
  63. if strings.HasPrefix(s, "go1") {
  64. s = s[2:]
  65. var prerelease string
  66. if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
  67. s, prerelease = s[:p], s[p:]
  68. }
  69. if strings.HasSuffix(s, ".") {
  70. s += "0"
  71. } else if strings.Count(s, ".") < 2 {
  72. s += ".0"
  73. }
  74. if prerelease != "" {
  75. s += "-" + prerelease
  76. }
  77. return s
  78. }
  79. return "UNKNOWN"
  80. }
  81. const versionClient = "20190306"