doc.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // Copyright 2023 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 protoc-gen-go_gapic. DO NOT EDIT.
  15. // Package logging is an auto-generated package for the
  16. // Cloud Logging API.
  17. //
  18. // Writes log entries and manages your Cloud Logging configuration.
  19. //
  20. // # General documentation
  21. //
  22. // For information that is relevant for all client libraries please reference
  23. // https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this
  24. // page includes:
  25. //
  26. // - [Authentication and Authorization]
  27. // - [Timeouts and Cancellation]
  28. // - [Testing against Client Libraries]
  29. // - [Debugging Client Libraries]
  30. // - [Inspecting errors]
  31. //
  32. // # Example usage
  33. //
  34. // To get started with this package, create a client.
  35. //
  36. // ctx := context.Background()
  37. // // This snippet has been automatically generated and should be regarded as a code template only.
  38. // // It will require modifications to work:
  39. // // - It may require correct/in-range values for request initialization.
  40. // // - It may require specifying regional endpoints when creating the service client as shown in:
  41. // // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  42. // c, err := logging.NewClient(ctx)
  43. // if err != nil {
  44. // // TODO: Handle error.
  45. // }
  46. // defer c.Close()
  47. //
  48. // The client will use your default application credentials. Clients should be reused instead of created as needed.
  49. // The methods of Client are safe for concurrent use by multiple goroutines.
  50. // The returned client must be Closed when it is done being used.
  51. //
  52. // # Using the Client
  53. //
  54. // The following is an example of making an API call with the newly created client.
  55. //
  56. // ctx := context.Background()
  57. // // This snippet has been automatically generated and should be regarded as a code template only.
  58. // // It will require modifications to work:
  59. // // - It may require correct/in-range values for request initialization.
  60. // // - It may require specifying regional endpoints when creating the service client as shown in:
  61. // // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  62. // c, err := logging.NewClient(ctx)
  63. // if err != nil {
  64. // // TODO: Handle error.
  65. // }
  66. // defer c.Close()
  67. //
  68. // req := &loggingpb.DeleteLogRequest{
  69. // // TODO: Fill request struct fields.
  70. // // See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#DeleteLogRequest.
  71. // }
  72. // err = c.DeleteLog(ctx, req)
  73. // if err != nil {
  74. // // TODO: Handle error.
  75. // }
  76. //
  77. // # Use of Context
  78. //
  79. // The ctx passed to NewClient is used for authentication requests and
  80. // for creating the underlying connection, but is not used for subsequent calls.
  81. // Individual methods on the client use the ctx given to them.
  82. //
  83. // To close the open connection, use the Close() method.
  84. //
  85. // [Authentication and Authorization]: https://pkg.go.dev/cloud.google.com/go#hdr-Authentication_and_Authorization
  86. // [Timeouts and Cancellation]: https://pkg.go.dev/cloud.google.com/go#hdr-Timeouts_and_Cancellation
  87. // [Testing against Client Libraries]: https://pkg.go.dev/cloud.google.com/go#hdr-Testing
  88. // [Debugging Client Libraries]: https://pkg.go.dev/cloud.google.com/go#hdr-Debugging
  89. // [Inspecting errors]: https://pkg.go.dev/cloud.google.com/go#hdr-Inspecting_errors
  90. package logging // import "cloud.google.com/go/logging/apiv2"
  91. import (
  92. "context"
  93. "google.golang.org/api/option"
  94. )
  95. // For more information on implementing a client constructor hook, see
  96. // https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors.
  97. type clientHookParams struct{}
  98. type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
  99. var versionClient string
  100. func getVersionClient() string {
  101. if versionClient == "" {
  102. return "UNKNOWN"
  103. }
  104. return versionClient
  105. }
  106. // DefaultAuthScopes reports the default set of authentication scopes to use with this package.
  107. func DefaultAuthScopes() []string {
  108. return []string{
  109. "https://www.googleapis.com/auth/cloud-platform",
  110. "https://www.googleapis.com/auth/cloud-platform.read-only",
  111. "https://www.googleapis.com/auth/logging.admin",
  112. "https://www.googleapis.com/auth/logging.read",
  113. "https://www.googleapis.com/auth/logging.write",
  114. }
  115. }