gcloud 0.12.2 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +5 -13
  2. data/lib/gcloud.rb +27 -456
  3. data/lib/gcloud/bigquery.rb +2 -382
  4. data/lib/gcloud/datastore.rb +2 -576
  5. data/lib/gcloud/dns.rb +2 -321
  6. data/lib/gcloud/logging.rb +1 -322
  7. data/lib/gcloud/pubsub.rb +2 -476
  8. data/lib/gcloud/resource_manager.rb +2 -273
  9. data/lib/gcloud/storage.rb +2 -440
  10. data/lib/gcloud/translate.rb +1 -250
  11. data/lib/gcloud/version.rb +2 -2
  12. data/lib/gcloud/vision.rb +1 -501
  13. metadata +36 -332
  14. data/AUTHENTICATION.md +0 -75
  15. data/CHANGELOG.md +0 -382
  16. data/OVERVIEW.md +0 -259
  17. data/lib/gcloud/backoff.rb +0 -150
  18. data/lib/gcloud/bigquery/copy_job.rb +0 -97
  19. data/lib/gcloud/bigquery/credentials.rb +0 -29
  20. data/lib/gcloud/bigquery/data.rb +0 -239
  21. data/lib/gcloud/bigquery/dataset.rb +0 -753
  22. data/lib/gcloud/bigquery/dataset/access.rb +0 -507
  23. data/lib/gcloud/bigquery/dataset/list.rb +0 -169
  24. data/lib/gcloud/bigquery/extract_job.rb +0 -117
  25. data/lib/gcloud/bigquery/insert_response.rb +0 -81
  26. data/lib/gcloud/bigquery/job.rb +0 -299
  27. data/lib/gcloud/bigquery/job/list.rb +0 -172
  28. data/lib/gcloud/bigquery/load_job.rb +0 -202
  29. data/lib/gcloud/bigquery/project.rb +0 -475
  30. data/lib/gcloud/bigquery/query_data.rb +0 -234
  31. data/lib/gcloud/bigquery/query_job.rb +0 -137
  32. data/lib/gcloud/bigquery/schema.rb +0 -359
  33. data/lib/gcloud/bigquery/service.rb +0 -506
  34. data/lib/gcloud/bigquery/table.rb +0 -1141
  35. data/lib/gcloud/bigquery/table/list.rb +0 -180
  36. data/lib/gcloud/bigquery/view.rb +0 -475
  37. data/lib/gcloud/credentials.rb +0 -129
  38. data/lib/gcloud/datastore/commit.rb +0 -148
  39. data/lib/gcloud/datastore/credentials.rb +0 -35
  40. data/lib/gcloud/datastore/cursor.rb +0 -76
  41. data/lib/gcloud/datastore/dataset.rb +0 -660
  42. data/lib/gcloud/datastore/dataset/lookup_results.rb +0 -219
  43. data/lib/gcloud/datastore/dataset/query_results.rb +0 -386
  44. data/lib/gcloud/datastore/entity.rb +0 -449
  45. data/lib/gcloud/datastore/errors.rb +0 -41
  46. data/lib/gcloud/datastore/gql_query.rb +0 -211
  47. data/lib/gcloud/datastore/grpc_utils.rb +0 -132
  48. data/lib/gcloud/datastore/key.rb +0 -281
  49. data/lib/gcloud/datastore/properties.rb +0 -128
  50. data/lib/gcloud/datastore/query.rb +0 -348
  51. data/lib/gcloud/datastore/service.rb +0 -167
  52. data/lib/gcloud/datastore/transaction.rb +0 -362
  53. data/lib/gcloud/dns/change.rb +0 -158
  54. data/lib/gcloud/dns/change/list.rb +0 -173
  55. data/lib/gcloud/dns/credentials.rb +0 -29
  56. data/lib/gcloud/dns/importer.rb +0 -183
  57. data/lib/gcloud/dns/project.rb +0 -247
  58. data/lib/gcloud/dns/record.rb +0 -170
  59. data/lib/gcloud/dns/record/list.rb +0 -174
  60. data/lib/gcloud/dns/service.rb +0 -167
  61. data/lib/gcloud/dns/zone.rb +0 -759
  62. data/lib/gcloud/dns/zone/list.rb +0 -168
  63. data/lib/gcloud/dns/zone/transaction.rb +0 -176
  64. data/lib/gcloud/errors.rb +0 -206
  65. data/lib/gcloud/gce.rb +0 -56
  66. data/lib/gcloud/grpc_utils.rb +0 -87
  67. data/lib/gcloud/logging/credentials.rb +0 -29
  68. data/lib/gcloud/logging/entry.rb +0 -465
  69. data/lib/gcloud/logging/entry/http_request.rb +0 -141
  70. data/lib/gcloud/logging/entry/list.rb +0 -177
  71. data/lib/gcloud/logging/entry/operation.rb +0 -90
  72. data/lib/gcloud/logging/logger.rb +0 -307
  73. data/lib/gcloud/logging/metric.rb +0 -169
  74. data/lib/gcloud/logging/metric/list.rb +0 -172
  75. data/lib/gcloud/logging/project.rb +0 -642
  76. data/lib/gcloud/logging/resource.rb +0 -84
  77. data/lib/gcloud/logging/resource_descriptor.rb +0 -137
  78. data/lib/gcloud/logging/resource_descriptor/list.rb +0 -174
  79. data/lib/gcloud/logging/service.rb +0 -267
  80. data/lib/gcloud/logging/sink.rb +0 -227
  81. data/lib/gcloud/logging/sink/list.rb +0 -171
  82. data/lib/gcloud/pubsub/credentials.rb +0 -29
  83. data/lib/gcloud/pubsub/message.rb +0 -94
  84. data/lib/gcloud/pubsub/policy.rb +0 -204
  85. data/lib/gcloud/pubsub/project.rb +0 -482
  86. data/lib/gcloud/pubsub/received_message.rb +0 -160
  87. data/lib/gcloud/pubsub/service.rb +0 -334
  88. data/lib/gcloud/pubsub/subscription.rb +0 -565
  89. data/lib/gcloud/pubsub/subscription/list.rb +0 -208
  90. data/lib/gcloud/pubsub/topic.rb +0 -511
  91. data/lib/gcloud/pubsub/topic/list.rb +0 -174
  92. data/lib/gcloud/pubsub/topic/publisher.rb +0 -85
  93. data/lib/gcloud/resource_manager/credentials.rb +0 -30
  94. data/lib/gcloud/resource_manager/manager.rb +0 -266
  95. data/lib/gcloud/resource_manager/policy.rb +0 -211
  96. data/lib/gcloud/resource_manager/project.rb +0 -484
  97. data/lib/gcloud/resource_manager/project/list.rb +0 -167
  98. data/lib/gcloud/resource_manager/project/updater.rb +0 -130
  99. data/lib/gcloud/resource_manager/service.rb +0 -127
  100. data/lib/gcloud/storage/bucket.rb +0 -775
  101. data/lib/gcloud/storage/bucket/acl.rb +0 -810
  102. data/lib/gcloud/storage/bucket/cors.rb +0 -153
  103. data/lib/gcloud/storage/bucket/list.rb +0 -172
  104. data/lib/gcloud/storage/credentials.rb +0 -29
  105. data/lib/gcloud/storage/errors.rb +0 -65
  106. data/lib/gcloud/storage/file.rb +0 -842
  107. data/lib/gcloud/storage/file/acl.rb +0 -425
  108. data/lib/gcloud/storage/file/list.rb +0 -191
  109. data/lib/gcloud/storage/file/verifier.rb +0 -67
  110. data/lib/gcloud/storage/project.rb +0 -316
  111. data/lib/gcloud/storage/service.rb +0 -347
  112. data/lib/gcloud/translate/api.rb +0 -241
  113. data/lib/gcloud/translate/detection.rb +0 -137
  114. data/lib/gcloud/translate/language.rb +0 -69
  115. data/lib/gcloud/translate/service.rb +0 -80
  116. data/lib/gcloud/translate/translation.rb +0 -112
  117. data/lib/gcloud/vision/annotate.rb +0 -224
  118. data/lib/gcloud/vision/annotation.rb +0 -455
  119. data/lib/gcloud/vision/annotation/entity.rb +0 -234
  120. data/lib/gcloud/vision/annotation/face.rb +0 -1750
  121. data/lib/gcloud/vision/annotation/properties.rb +0 -245
  122. data/lib/gcloud/vision/annotation/safe_search.rb +0 -161
  123. data/lib/gcloud/vision/annotation/text.rb +0 -236
  124. data/lib/gcloud/vision/annotation/vertex.rb +0 -108
  125. data/lib/gcloud/vision/credentials.rb +0 -29
  126. data/lib/gcloud/vision/image.rb +0 -590
  127. data/lib/gcloud/vision/location.rb +0 -115
  128. data/lib/gcloud/vision/project.rb +0 -278
  129. data/lib/gcloud/vision/service.rb +0 -66
  130. data/lib/google/api/annotations.rb +0 -14
  131. data/lib/google/api/http.rb +0 -30
  132. data/lib/google/api/label.rb +0 -24
  133. data/lib/google/api/monitored_resource.rb +0 -25
  134. data/lib/google/datastore/v1beta3/datastore.rb +0 -115
  135. data/lib/google/datastore/v1beta3/datastore_services.rb +0 -33
  136. data/lib/google/datastore/v1beta3/entity.rb +0 -63
  137. data/lib/google/datastore/v1beta3/query.rb +0 -128
  138. data/lib/google/devtools/cloudtrace/v1/trace.rb +0 -78
  139. data/lib/google/devtools/cloudtrace/v1/trace_services.rb +0 -32
  140. data/lib/google/example/library/v1/library.rb +0 -91
  141. data/lib/google/example/library/v1/library_services.rb +0 -40
  142. data/lib/google/iam/v1/iam_policy.rb +0 -33
  143. data/lib/google/iam/v1/iam_policy_services.rb +0 -30
  144. data/lib/google/iam/v1/policy.rb +0 -25
  145. data/lib/google/logging/type/http_request.rb +0 -28
  146. data/lib/google/logging/type/log_severity.rb +0 -27
  147. data/lib/google/logging/v2/log_entry.rb +0 -44
  148. data/lib/google/logging/v2/logging.rb +0 -56
  149. data/lib/google/logging/v2/logging_config.rb +0 -59
  150. data/lib/google/logging/v2/logging_config_services.rb +0 -32
  151. data/lib/google/logging/v2/logging_metrics.rb +0 -51
  152. data/lib/google/logging/v2/logging_metrics_services.rb +0 -32
  153. data/lib/google/logging/v2/logging_services.rb +0 -31
  154. data/lib/google/longrunning/operations.rb +0 -50
  155. data/lib/google/longrunning/operations_services.rb +0 -29
  156. data/lib/google/protobuf/descriptor.rb +0 -0
  157. data/lib/google/pubsub/v1/pubsub.rb +0 -129
  158. data/lib/google/pubsub/v1/pubsub_services.rb +0 -56
  159. data/lib/google/pubsub/v1beta2/pubsub.rb +0 -126
  160. data/lib/google/pubsub/v1beta2/pubsub_services.rb +0 -56
  161. data/lib/google/rpc/code.rb +0 -32
  162. data/lib/google/rpc/error_details.rb +0 -61
  163. data/lib/google/rpc/status.rb +0 -19
  164. data/lib/google/type/color.rb +0 -20
  165. data/lib/google/type/date.rb +0 -18
  166. data/lib/google/type/dayofweek.rb +0 -23
  167. data/lib/google/type/latlng.rb +0 -17
  168. data/lib/google/type/money.rb +0 -18
  169. data/lib/google/type/timeofday.rb +0 -19
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OThmNGI2N2Q2MjdmYTUwZWJkMWFjZWFlZjliMDA0NGRmNmFlZmYwNQ==
5
- data.tar.gz: !binary |-
6
- MDVjY2QyZjVlZjQ0MjlhOWVmMjY3MDQxNDUxOGRkZTdkNDgxMDQ3Mw==
2
+ SHA1:
3
+ metadata.gz: d055c4d6f17c0bccc949a494263d04a8ed6f7f1c
4
+ data.tar.gz: 47f6b245bcc789a016303a718ff20037d1da5553
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MTU5YjQ2ZWMxZjk5MDE2ZWYzMGE1NTNiNTg0NzkyNWM0ODJjZWFlYjc0NDA4
10
- Y2M3NzNhM2NjOTc1MmIwNzhjNDg5NzRkNGJlYTU2YWU4YmFhOGQwMmU4Y2Nk
11
- NjEwNTlmMjQzYjg1MzM2ODJlMzc2MzE4N2RiZmYwNjQ5MzQ3OTg=
12
- data.tar.gz: !binary |-
13
- ZTQzYjkxZmZjMmFiMTM2MTU3MjkzZWQwNTFiOTE0ODI2YWM4YjMwZmY2ZjJl
14
- ZmVmNmExYzZlZDMzMWMxOGVhMzcwOTFkYjE4ZjM3NTdlMzU3MGQyMjY3MWI5
15
- MTBhYjBmMGFhODcyMzg1OTVmMGI1YjljY2M5M2I5NGM3MjY1YzM=
6
+ metadata.gz: d0d7d8f8c67305623c06b9ad452a86b3a6e2b73cfda042f335c40f38f2d1707bf29212a4d9d23435cd24f55639c0e8d33aa0d78f65075ac85101241f0e2391e6
7
+ data.tar.gz: cfb499d0a05232f1c6d2a1a1cd8e9a13c67cedf2c5585c6574dac0a81532d9b6cb99097d24d62aeb7a724f07d765b696cd735bb0258b865a1eed5e1ca676cea4
data/lib/gcloud.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2016 Google Inc. All rights reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -13,466 +13,37 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require "gcloud/version"
16
+ require "google/cloud"
17
+
18
+ Gcloud = Google::Cloud
17
19
 
18
20
  ##
19
- # # Google Cloud
21
+ # # Gcloud
22
+ #
23
+ # #### The `gcloud` gem and `Gcloud` namespace are now deprecated.
24
+ #
25
+ # The current `gcloud` gem exists only to facilitate the timely transition of
26
+ # legacy code from the deprecated `Gcloud` namespace to the new `Google::Cloud`
27
+ # namespace. Please see the top-level project [README](../README.md) for current
28
+ # information about using the `google-cloud` umbrella gem and the individual
29
+ # service gems.
30
+ #
31
+ # This module exists to facilitate the transition of legacy code using the
32
+ # `Gcloud` namespace to the current `Google::Cloud` namespace.
20
33
  #
21
- # The gcloud-ruby library is the official library for interacting with Google
22
- # Cloud Platform. Google Cloud Platform is a set of modular cloud-based services
23
- # that allow you to create anything from simple websites to complex
24
- # applications.
34
+ # ## BigQuery Example
25
35
  #
26
- # The goal of gcloud-ruby is to provide a API that is familiar and comfortable
27
- # to Rubyists. Authentication is handled by providing project and credential
28
- # information, or if you are running on Google Compute Engine this configuration
29
- # is taken care of for you.
36
+ # ```ruby
37
+ # require "gcloud"
30
38
  #
31
- # You can learn more about various options for connection on the [Authentication
32
- # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
39
+ # gcloud = Gcloud.new
40
+ # bigquery = gcloud.bigquery
41
+ # dataset = bigquery.dataset "my-dataset"
42
+ # table = dataset.table "my-table"
43
+ # table.data.each do |row|
44
+ # puts row
45
+ # end
46
+ # ```
33
47
  #
34
48
  module Gcloud
35
- ##
36
- # Creates a new object for connecting to Google Cloud.
37
- #
38
- # For more information on connecting to Google Cloud see the [Authentication
39
- # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
40
- #
41
- # @param [String] project Project identifier for the Pub/Sub service you are
42
- # connecting to.
43
- # @param [String, Hash] keyfile Keyfile downloaded from Google Cloud. If file
44
- # path the file must be readable.
45
- # @param [Integer] retries Number of times to retry requests on server error.
46
- # The default value is `3`. Optional.
47
- # @param [Integer] timeout Default timeout to use in requests. Optional.
48
- #
49
- # @return [Gcloud]
50
- #
51
- # @example
52
- # require "gcloud"
53
- #
54
- # gcloud = Gcloud.new
55
- # datastore = gcloud.datastore
56
- # pubsub = gcloud.pubsub
57
- # storage = gcloud.storage
58
- #
59
- def self.new project = nil, keyfile = nil, retries: nil, timeout: nil
60
- gcloud = Object.new
61
- gcloud.instance_variable_set "@project", project
62
- gcloud.instance_variable_set "@keyfile", keyfile
63
- gcloud.instance_variable_set "@retries", retries
64
- gcloud.instance_variable_set "@timeout", timeout
65
- gcloud.extend Gcloud
66
- gcloud
67
- end
68
-
69
- ##
70
- # Creates a new object for connecting to the Datastore service.
71
- # Each call creates a new connection.
72
- #
73
- # For more information on connecting to Google Cloud see the [Authentication
74
- # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
75
- #
76
- # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
77
- # set of resources and operations that the connection can access. See [Using
78
- # OAuth 2.0 to Access Google
79
- # APIs](https://developers.google.com/identity/protocols/OAuth2).
80
- #
81
- # The default scope is:
82
- #
83
- # * `https://www.googleapis.com/auth/datastore`
84
- # @param [Integer] retries Number of times to retry requests on server error.
85
- # The default value is `3`. Optional.
86
- # @param [Integer] timeout Default timeout to use in requests. Optional.
87
- #
88
- # @return [Gcloud::Datastore::Dataset]
89
- #
90
- # @example
91
- # require "gcloud"
92
- #
93
- # gcloud = Gcloud.new
94
- # datastore = gcloud.datastore
95
- #
96
- # task = datastore.entity "Task" do |t|
97
- # t["type"] = "Personal"
98
- # t["done"] = false
99
- # t["priority"] = 4
100
- # t["description"] = "Learn Cloud Datastore"
101
- # end
102
- #
103
- # datastore.save task
104
- #
105
- # @example You shouldn't need to override the default scope, but you can:
106
- # require "gcloud"
107
- #
108
- # gcloud = Gcloud.new
109
- # platform_scope = "https://www.googleapis.com/auth/cloud-platform"
110
- # datastore = gcloud.datastore scope: platform_scope
111
- #
112
- def datastore scope: nil, retries: nil, timeout: nil
113
- require "gcloud/datastore"
114
- Gcloud.datastore @project, @keyfile, scope: scope,
115
- retries: (retries || @retries),
116
- timeout: (timeout || @timeout)
117
- end
118
-
119
- ##
120
- # Creates a new object for connecting to the Storage service.
121
- # Each call creates a new connection.
122
- #
123
- # For more information on connecting to Google Cloud see the [Authentication
124
- # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
125
- #
126
- # @see https://cloud.google.com/storage/docs/authentication#oauth Storage
127
- # OAuth 2.0 Authentication
128
- #
129
- # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
130
- # set of resources and operations that the connection can access. See [Using
131
- # OAuth 2.0 to Access Google
132
- # APIs](https://developers.google.com/identity/protocols/OAuth2).
133
- #
134
- # The default scope is:
135
- #
136
- # * `https://www.googleapis.com/auth/devstorage.full_control`
137
- # @param [Integer] retries Number of times to retry requests on server error.
138
- # The default value is `3`. Optional.
139
- # @param [Integer] timeout Default timeout to use in requests. Optional.
140
- #
141
- # @return [Gcloud::Storage::Project]
142
- #
143
- # @example
144
- # require "gcloud"
145
- #
146
- # gcloud = Gcloud.new
147
- # storage = gcloud.storage
148
- # bucket = storage.bucket "my-bucket"
149
- # file = bucket.file "path/to/my-file.ext"
150
- #
151
- # @example The default scope can be overridden with the `scope` option:
152
- # require "gcloud"
153
- #
154
- # gcloud = Gcloud.new
155
- # readonly_scope = "https://www.googleapis.com/auth/devstorage.read_only"
156
- # readonly_storage = gcloud.storage scope: readonly_scope
157
- #
158
- def storage scope: nil, retries: nil, timeout: nil
159
- require "gcloud/storage"
160
- Gcloud.storage @project, @keyfile, scope: scope,
161
- retries: (retries || @retries),
162
- timeout: (timeout || @timeout)
163
- end
164
-
165
- ##
166
- # Creates a new object for connecting to the Pub/Sub service.
167
- # Each call creates a new connection.
168
- #
169
- # For more information on connecting to Google Cloud see the [Authentication
170
- # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
171
- #
172
- # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
173
- # set of resources and operations that the connection can access. See [Using
174
- # OAuth 2.0 to Access Google
175
- # APIs](https://developers.google.com/identity/protocols/OAuth2).
176
- #
177
- # The default scope is:
178
- #
179
- # * `https://www.googleapis.com/auth/pubsub`
180
- # @param [Integer] retries Number of times to retry requests on server error.
181
- # The default value is `3`. Optional.
182
- # @param [Integer] timeout Default timeout to use in requests. Optional.
183
- #
184
- # @return [Gcloud::Pubsub::Project]
185
- #
186
- # @example
187
- # require "gcloud"
188
- #
189
- # gcloud = Gcloud.new
190
- # pubsub = gcloud.pubsub
191
- # topic = pubsub.topic "my-topic"
192
- # topic.publish "task completed"
193
- #
194
- # @example The default scope can be overridden with the `scope` option:
195
- # require "gcloud"
196
- #
197
- # gcloud = Gcloud.new
198
- # platform_scope = "https://www.googleapis.com/auth/cloud-platform"
199
- # pubsub = gcloud.pubsub scope: platform_scope
200
- #
201
- def pubsub scope: nil, retries: nil, timeout: nil
202
- require "gcloud/pubsub"
203
- Gcloud.pubsub @project, @keyfile, scope: scope,
204
- retries: (retries || @retries),
205
- timeout: (timeout || @timeout)
206
- end
207
-
208
- ##
209
- # Creates a new object for connecting to the BigQuery service.
210
- # Each call creates a new connection.
211
- #
212
- # For more information on connecting to Google Cloud see the [Authentication
213
- # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
214
- #
215
- # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
216
- # set of resources and operations that the connection can access. See [Using
217
- # OAuth 2.0 to Access Google
218
- # APIs](https://developers.google.com/identity/protocols/OAuth2).
219
- #
220
- # The default scope is:
221
- #
222
- # * `https://www.googleapis.com/auth/bigquery`
223
- # @param [Integer] retries Number of times to retry requests on server error.
224
- # The default value is `3`. Optional.
225
- # @param [Integer] timeout Default request timeout in seconds. Optional.
226
- #
227
- # @return [Gcloud::Bigquery::Project]
228
- #
229
- # @example
230
- # require "gcloud"
231
- #
232
- # gcloud = Gcloud.new
233
- # bigquery = gcloud.bigquery
234
- # dataset = bigquery.dataset "my-dataset"
235
- # table = dataset.table "my-table"
236
- # table.data.each do |row|
237
- # puts row
238
- # end
239
- #
240
- # @example The default scope can be overridden with the `scope` option:
241
- # require "gcloud"
242
- #
243
- # gcloud = Gcloud.new
244
- # platform_scope = "https://www.googleapis.com/auth/cloud-platform"
245
- # bigquery = gcloud.bigquery scope: platform_scope
246
- #
247
- def bigquery scope: nil, retries: nil, timeout: nil
248
- require "gcloud/bigquery"
249
- Gcloud.bigquery @project, @keyfile, scope: scope,
250
- retries: (retries || @retries),
251
- timeout: (timeout || @timeout)
252
- end
253
-
254
- ##
255
- # Creates a new object for connecting to the DNS service.
256
- # Each call creates a new connection.
257
- #
258
- # For more information on connecting to Google Cloud see the [Authentication
259
- # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
260
- #
261
- # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
262
- # set of resources and operations that the connection can access. See [Using
263
- # OAuth 2.0 to Access Google
264
- # APIs](https://developers.google.com/identity/protocols/OAuth2).
265
- #
266
- # The default scope is:
267
- #
268
- # * `https://www.googleapis.com/auth/ndev.clouddns.readwrite`
269
- # @param [Integer] retries Number of times to retry requests on server error.
270
- # The default value is `3`. Optional.
271
- # @param [Integer] timeout Default timeout to use in requests. Optional.
272
- #
273
- # @return [Gcloud::Dns::Project]
274
- #
275
- # @example
276
- # require "gcloud"
277
- #
278
- # gcloud = Gcloud.new
279
- # dns = gcloud.dns
280
- # zone = dns.zone "example-zone"
281
- # zone.records.each do |record|
282
- # puts record.name
283
- # end
284
- #
285
- # @example The default scope can be overridden with the `scope` option:
286
- # require "gcloud"
287
- #
288
- # gcloud = Gcloud.new
289
- # readonly_scope = "https://www.googleapis.com/auth/ndev.clouddns.readonly"
290
- # dns = gcloud.dns scope: readonly_scope
291
- #
292
- def dns scope: nil, retries: nil, timeout: nil
293
- require "gcloud/dns"
294
- Gcloud.dns @project, @keyfile, scope: scope,
295
- retries: (retries || @retries),
296
- timeout: (timeout || @timeout)
297
- end
298
-
299
- # rubocop:disable Metrics/LineLength
300
- # Disabled because the readonly scope in the example code is long and we can't
301
- # shorten it.
302
-
303
- ##
304
- # Creates a new object for connecting to the Resource Manager service.
305
- # Each call creates a new connection.
306
- #
307
- # For more information on connecting to Google Cloud see the [Authentication
308
- # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
309
- #
310
- # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
311
- # set of resources and operations that the connection can access. See [Using
312
- # OAuth 2.0 to Access Google
313
- # APIs](https://developers.google.com/identity/protocols/OAuth2).
314
- #
315
- # The default scope is:
316
- #
317
- # * `https://www.googleapis.com/auth/cloud-platform`
318
- # @param [Integer] retries Number of times to retry requests on server error.
319
- # The default value is `3`. Optional.
320
- # @param [Integer] timeout Default timeout to use in requests. Optional.
321
- #
322
- # @return [Gcloud::ResourceManager::Manager]
323
- #
324
- # @example
325
- # require "gcloud"
326
- #
327
- # gcloud = Gcloud.new
328
- # resource_manager = gcloud.resource_manager
329
- # resource_manager.projects.each do |project|
330
- # puts projects.project_id
331
- # end
332
- #
333
- # @example The default scope can be overridden with the `scope` option:
334
- # require "gcloud"
335
- #
336
- # gcloud = Gcloud.new
337
- # readonly_scope = "https://www.googleapis.com/auth/cloudresourcemanager.readonly"
338
- # resource_manager = gcloud.resource_manager scope: readonly_scope
339
- #
340
- def resource_manager scope: nil, retries: nil, timeout: nil
341
- require "gcloud/resource_manager"
342
- Gcloud.resource_manager @keyfile, scope: scope,
343
- retries: (retries || @retries),
344
- timeout: (timeout || @timeout)
345
- end
346
-
347
- # rubocop:enable Metrics/LineLength
348
-
349
- ##
350
- # Creates a new object for connecting to the Stackdriver Logging service.
351
- # Each call creates a new connection.
352
- #
353
- # For more information on connecting to Google Cloud see the [Authentication
354
- # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
355
- #
356
- # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
357
- # set of resources and operations that the connection can access. See [Using
358
- # OAuth 2.0 to Access Google
359
- # APIs](https://developers.google.com/identity/protocols/OAuth2).
360
- #
361
- # The default scope is:
362
- #
363
- # * `https://www.googleapis.com/auth/logging.admin`
364
- # @param [Integer] retries Number of times to retry requests on server error.
365
- # The default value is `3`. Optional.
366
- # @param [Integer] timeout Default timeout to use in requests. Optional.
367
- #
368
- # @return [Gcloud::Logging::Project]
369
- #
370
- # @example
371
- # require "gcloud"
372
- #
373
- # gcloud = Gcloud.new
374
- # logging = gcloud.logging
375
- # # ...
376
- #
377
- # @example The default scope can be overridden with the `scope` option:
378
- # require "gcloud"
379
- #
380
- # gcloud = Gcloud.new
381
- # platform_scope = "https://www.googleapis.com/auth/cloud-platform"
382
- # logging = gcloud.logging scope: platform_scope
383
- #
384
- def logging scope: nil, retries: nil, timeout: nil
385
- require "gcloud/logging"
386
- Gcloud.logging @project, @keyfile, scope: scope,
387
- retries: (retries || @retries),
388
- timeout: (timeout || @timeout)
389
- end
390
-
391
- ##
392
- # Creates a new object for connecting to the Translate service.
393
- # Each call creates a new connection.
394
- #
395
- # Unlike other Cloud Platform services, which authenticate using a project ID
396
- # and OAuth 2.0 credentials, Google Translate API requires a public API access
397
- # key. (This may change in future releases of Google Translate API.) Follow
398
- # the general instructions at [Identifying your application to
399
- # Google](https://cloud.google.com/translate/v2/using_rest#auth), and the
400
- # specific instructions for [Server
401
- # keys](https://cloud.google.com/translate/v2/using_rest#creating-server-api-keys).
402
- #
403
- # @param [String] key a public API access key (not an OAuth 2.0 token)
404
- # @param [Integer] retries Number of times to retry requests on server error.
405
- # The default value is `3`. Optional.
406
- # @param [Integer] timeout Default timeout to use in requests. Optional.
407
- #
408
- # @return [Gcloud::Translate::Api]
409
- #
410
- # @example
411
- # require "gcloud"
412
- #
413
- # gcloud = Gcloud.new
414
- # translate = gcloud.translate "api-key-abc123XYZ789"
415
- #
416
- # translation = translate.translate "Hello world!", to: "la"
417
- # translation.text #=> "Salve mundi!"
418
- #
419
- # @example Using API Key from the environment variable.
420
- # require "gcloud"
421
- #
422
- # ENV["TRANSLATE_KEY"] = "api-key-abc123XYZ789"
423
- #
424
- # gcloud = Gcloud.new
425
- # translate = gcloud.translate
426
- #
427
- # translation = translate.translate "Hello world!", to: "la"
428
- # translation.text #=> "Salve mundi!"
429
- #
430
- def translate key = nil, retries: nil, timeout: nil
431
- require "gcloud/translate"
432
- Gcloud.translate key, retries: (retries || @retries),
433
- timeout: (timeout || @timeout)
434
- end
435
-
436
- ##
437
- # Creates a new object for connecting to the Vision service.
438
- # Each call creates a new connection.
439
- #
440
- # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
441
- # set of resources and operations that the connection can access. See [Using
442
- # OAuth 2.0 to Access Google
443
- # APIs](https://developers.google.com/identity/protocols/OAuth2).
444
- #
445
- # The default scope is:
446
- #
447
- # * `https://www.googleapis.com/auth/cloud-platform`
448
- # @param [Integer] retries Number of times to retry requests on server error.
449
- # The default value is `3`. Optional.
450
- # @param [Integer] timeout Default timeout to use in requests. Optional.
451
- #
452
- # @return [Gcloud::Vision::Project]
453
- #
454
- # @example
455
- # require "gcloud"
456
- #
457
- # gcloud = Gcloud.new
458
- # vision = gcloud.vision
459
- #
460
- # image = vision.image "path/to/landmark.jpg"
461
- #
462
- # landmark = image.landmark
463
- # landmark.description #=> "Mount Rushmore"
464
- #
465
- # @example The default scope can be overridden with the `scope` option:
466
- # require "gcloud"
467
- #
468
- # gcloud = Gcloud.new
469
- # platform_scope = "https://www.googleapis.com/auth/cloud-platform"
470
- # vision = gcloud.vision scope: platform_scope
471
- #
472
- def vision scope: nil, retries: nil, timeout: nil
473
- require "gcloud/vision"
474
- Gcloud.vision @project, @keyfile, scope: scope,
475
- retries: (retries || @retries),
476
- timeout: (timeout || @timeout)
477
- end
478
49
  end