doc.go 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. // Copyright 2024 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 storage is an auto-generated package for the
  16. // Cloud Storage API.
  17. //
  18. // Stop. This folder is likely not what you are looking for. This folder
  19. // contains protocol buffer definitions for an API only accessible to select
  20. // customers. Customers not participating should not depend on this file.
  21. // Please contact Google Cloud sales if you are interested. Unless told
  22. // otherwise by a Google Cloud representative, do not use or otherwise rely
  23. // on any of the contents of this folder. If you would like to use Cloud
  24. // Storage, please consult our official documentation (at
  25. // https://cloud.google.com/storage/docs/apis) for details on our XML and
  26. // JSON APIs, or else consider one of our client libraries (at
  27. // https://cloud.google.com/storage/docs/reference/libraries). This API
  28. // defined in this folder is unreleased and may shut off, break, or fail at
  29. // any time for any users who are not registered as a part of a private
  30. // preview program.
  31. //
  32. // # General documentation
  33. //
  34. // For information that is relevant for all client libraries please reference
  35. // https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this
  36. // page includes:
  37. //
  38. // - [Authentication and Authorization]
  39. // - [Timeouts and Cancellation]
  40. // - [Testing against Client Libraries]
  41. // - [Debugging Client Libraries]
  42. // - [Inspecting errors]
  43. //
  44. // # Example usage
  45. //
  46. // To get started with this package, create a client.
  47. //
  48. // ctx := context.Background()
  49. // // This snippet has been automatically generated and should be regarded as a code template only.
  50. // // It will require modifications to work:
  51. // // - It may require correct/in-range values for request initialization.
  52. // // - It may require specifying regional endpoints when creating the service client as shown in:
  53. // // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  54. // c, err := storage.NewClient(ctx)
  55. // if err != nil {
  56. // // TODO: Handle error.
  57. // }
  58. // defer c.Close()
  59. //
  60. // The client will use your default application credentials. Clients should be reused instead of created as needed.
  61. // The methods of Client are safe for concurrent use by multiple goroutines.
  62. // The returned client must be Closed when it is done being used.
  63. //
  64. // # Using the Client
  65. //
  66. // The following is an example of making an API call with the newly created client.
  67. //
  68. // ctx := context.Background()
  69. // // This snippet has been automatically generated and should be regarded as a code template only.
  70. // // It will require modifications to work:
  71. // // - It may require correct/in-range values for request initialization.
  72. // // - It may require specifying regional endpoints when creating the service client as shown in:
  73. // // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
  74. // c, err := storage.NewClient(ctx)
  75. // if err != nil {
  76. // // TODO: Handle error.
  77. // }
  78. // defer c.Close()
  79. // stream, err := c.BidiWriteObject(ctx)
  80. // if err != nil {
  81. // // TODO: Handle error.
  82. // }
  83. // go func() {
  84. // reqs := []*storagepb.BidiWriteObjectRequest{
  85. // // TODO: Create requests.
  86. // }
  87. // for _, req := range reqs {
  88. // if err := stream.Send(req); err != nil {
  89. // // TODO: Handle error.
  90. // }
  91. // }
  92. // stream.CloseSend()
  93. // }()
  94. // for {
  95. // resp, err := stream.Recv()
  96. // if err == io.EOF {
  97. // break
  98. // }
  99. // if err != nil {
  100. // // TODO: handle error.
  101. // }
  102. // // TODO: Use resp.
  103. // _ = resp
  104. // }
  105. //
  106. // # Use of Context
  107. //
  108. // The ctx passed to NewClient is used for authentication requests and
  109. // for creating the underlying connection, but is not used for subsequent calls.
  110. // Individual methods on the client use the ctx given to them.
  111. //
  112. // To close the open connection, use the Close() method.
  113. //
  114. // [Authentication and Authorization]: https://pkg.go.dev/cloud.google.com/go#hdr-Authentication_and_Authorization
  115. // [Timeouts and Cancellation]: https://pkg.go.dev/cloud.google.com/go#hdr-Timeouts_and_Cancellation
  116. // [Testing against Client Libraries]: https://pkg.go.dev/cloud.google.com/go#hdr-Testing
  117. // [Debugging Client Libraries]: https://pkg.go.dev/cloud.google.com/go#hdr-Debugging
  118. // [Inspecting errors]: https://pkg.go.dev/cloud.google.com/go#hdr-Inspecting_errors
  119. package storage // import "cloud.google.com/go/storage/internal/apiv2"
  120. import (
  121. "context"
  122. "google.golang.org/api/option"
  123. )
  124. // For more information on implementing a client constructor hook, see
  125. // https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors.
  126. type clientHookParams struct{}
  127. type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
  128. var versionClient string
  129. func getVersionClient() string {
  130. if versionClient == "" {
  131. return "UNKNOWN"
  132. }
  133. return versionClient
  134. }
  135. // DefaultAuthScopes reports the default set of authentication scopes to use with this package.
  136. func DefaultAuthScopes() []string {
  137. return []string{
  138. "https://www.googleapis.com/auth/cloud-platform",
  139. "https://www.googleapis.com/auth/cloud-platform.read-only",
  140. "https://www.googleapis.com/auth/devstorage.full_control",
  141. "https://www.googleapis.com/auth/devstorage.read_only",
  142. "https://www.googleapis.com/auth/devstorage.read_write",
  143. }
  144. }