gcloud 0.6.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +8 -8
  2. data/AUTHENTICATION.md +13 -9
  3. data/CHANGELOG.md +8 -3
  4. data/OVERVIEW.md +46 -8
  5. data/lib/gcloud.rb +123 -117
  6. data/lib/gcloud/backoff.rb +43 -15
  7. data/lib/gcloud/bigquery.rb +211 -195
  8. data/lib/gcloud/bigquery/connection.rb +9 -9
  9. data/lib/gcloud/bigquery/copy_job.rb +15 -16
  10. data/lib/gcloud/bigquery/credentials.rb +3 -3
  11. data/lib/gcloud/bigquery/data.rb +12 -11
  12. data/lib/gcloud/bigquery/dataset.rb +162 -216
  13. data/lib/gcloud/bigquery/dataset/access.rb +59 -43
  14. data/lib/gcloud/bigquery/dataset/list.rb +3 -3
  15. data/lib/gcloud/bigquery/errors.rb +9 -5
  16. data/lib/gcloud/bigquery/extract_job.rb +18 -18
  17. data/lib/gcloud/bigquery/insert_response.rb +7 -4
  18. data/lib/gcloud/bigquery/job.rb +48 -44
  19. data/lib/gcloud/bigquery/job/list.rb +3 -3
  20. data/lib/gcloud/bigquery/load_job.rb +24 -25
  21. data/lib/gcloud/bigquery/project.rb +145 -204
  22. data/lib/gcloud/bigquery/query_data.rb +10 -9
  23. data/lib/gcloud/bigquery/query_job.rb +23 -32
  24. data/lib/gcloud/bigquery/table.rb +238 -280
  25. data/lib/gcloud/bigquery/table/list.rb +3 -3
  26. data/lib/gcloud/bigquery/table/schema.rb +79 -87
  27. data/lib/gcloud/bigquery/view.rb +69 -82
  28. data/lib/gcloud/credentials.rb +3 -9
  29. data/lib/gcloud/datastore.rb +194 -170
  30. data/lib/gcloud/datastore/connection.rb +12 -8
  31. data/lib/gcloud/datastore/credentials.rb +6 -4
  32. data/lib/gcloud/datastore/dataset.rb +74 -141
  33. data/lib/gcloud/datastore/dataset/lookup_results.rb +6 -4
  34. data/lib/gcloud/datastore/dataset/query_results.rb +6 -4
  35. data/lib/gcloud/datastore/entity.rb +81 -76
  36. data/lib/gcloud/datastore/errors.rb +10 -8
  37. data/lib/gcloud/datastore/key.rb +41 -77
  38. data/lib/gcloud/datastore/properties.rb +3 -3
  39. data/lib/gcloud/datastore/proto.rb +7 -4
  40. data/lib/gcloud/datastore/query.rb +26 -3
  41. data/lib/gcloud/datastore/transaction.rb +12 -8
  42. data/lib/gcloud/dns.rb +180 -152
  43. data/lib/gcloud/dns/change.rb +16 -16
  44. data/lib/gcloud/dns/change/list.rb +3 -3
  45. data/lib/gcloud/dns/connection.rb +9 -10
  46. data/lib/gcloud/dns/credentials.rb +3 -3
  47. data/lib/gcloud/dns/errors.rb +9 -5
  48. data/lib/gcloud/dns/importer.rb +17 -23
  49. data/lib/gcloud/dns/project.rb +42 -64
  50. data/lib/gcloud/dns/record.rb +58 -46
  51. data/lib/gcloud/dns/record/list.rb +6 -7
  52. data/lib/gcloud/dns/zone.rb +198 -289
  53. data/lib/gcloud/dns/zone/list.rb +3 -3
  54. data/lib/gcloud/dns/zone/transaction.rb +56 -72
  55. data/lib/gcloud/errors.rb +174 -3
  56. data/lib/gcloud/gce.rb +3 -4
  57. data/lib/gcloud/grpc_utils.rb +76 -0
  58. data/lib/gcloud/logging.rb +308 -0
  59. data/lib/gcloud/logging/credentials.rb +29 -0
  60. data/lib/gcloud/logging/entry.rb +303 -0
  61. data/lib/gcloud/logging/entry/http_request.rb +141 -0
  62. data/lib/gcloud/logging/entry/list.rb +111 -0
  63. data/lib/gcloud/logging/entry/operation.rb +90 -0
  64. data/lib/gcloud/logging/logger.rb +307 -0
  65. data/lib/gcloud/logging/metric.rb +175 -0
  66. data/lib/gcloud/logging/metric/list.rb +98 -0
  67. data/lib/gcloud/logging/project.rb +650 -0
  68. data/lib/gcloud/logging/resource.rb +95 -0
  69. data/lib/gcloud/logging/resource_descriptor.rb +140 -0
  70. data/lib/gcloud/logging/resource_descriptor/list.rb +78 -0
  71. data/lib/gcloud/logging/service.rb +258 -0
  72. data/lib/gcloud/logging/sink.rb +233 -0
  73. data/lib/gcloud/logging/sink/list.rb +97 -0
  74. data/lib/gcloud/pubsub.rb +241 -199
  75. data/lib/gcloud/pubsub/credentials.rb +3 -3
  76. data/lib/gcloud/pubsub/message.rb +26 -20
  77. data/lib/gcloud/pubsub/project.rb +166 -233
  78. data/lib/gcloud/pubsub/received_message.rb +28 -38
  79. data/lib/gcloud/pubsub/service.rb +323 -0
  80. data/lib/gcloud/pubsub/subscription.rb +172 -242
  81. data/lib/gcloud/pubsub/subscription/list.rb +11 -9
  82. data/lib/gcloud/pubsub/topic.rb +152 -271
  83. data/lib/gcloud/pubsub/topic/batch.rb +66 -0
  84. data/lib/gcloud/pubsub/topic/list.rb +9 -7
  85. data/lib/gcloud/resource_manager.rb +158 -138
  86. data/lib/gcloud/resource_manager/connection.rb +6 -5
  87. data/lib/gcloud/resource_manager/credentials.rb +3 -3
  88. data/lib/gcloud/resource_manager/errors.rb +9 -5
  89. data/lib/gcloud/resource_manager/manager.rb +54 -86
  90. data/lib/gcloud/resource_manager/project.rb +69 -88
  91. data/lib/gcloud/resource_manager/project/list.rb +4 -5
  92. data/lib/gcloud/resource_manager/project/updater.rb +12 -14
  93. data/lib/gcloud/search.rb +158 -135
  94. data/lib/gcloud/search/api_client.rb +7 -7
  95. data/lib/gcloud/search/connection.rb +8 -8
  96. data/lib/gcloud/search/credentials.rb +3 -3
  97. data/lib/gcloud/search/document.rb +64 -87
  98. data/lib/gcloud/search/document/list.rb +5 -5
  99. data/lib/gcloud/search/errors.rb +9 -5
  100. data/lib/gcloud/search/field_value.rb +32 -38
  101. data/lib/gcloud/search/field_values.rb +50 -80
  102. data/lib/gcloud/search/fields.rb +44 -65
  103. data/lib/gcloud/search/index.rb +163 -204
  104. data/lib/gcloud/search/index/list.rb +5 -5
  105. data/lib/gcloud/search/project.rb +31 -47
  106. data/lib/gcloud/search/result.rb +27 -31
  107. data/lib/gcloud/search/result/list.rb +6 -6
  108. data/lib/gcloud/storage.rb +224 -190
  109. data/lib/gcloud/storage/bucket.rb +202 -227
  110. data/lib/gcloud/storage/bucket/acl.rb +83 -170
  111. data/lib/gcloud/storage/bucket/cors.rb +31 -34
  112. data/lib/gcloud/storage/bucket/list.rb +3 -3
  113. data/lib/gcloud/storage/connection.rb +11 -7
  114. data/lib/gcloud/storage/credentials.rb +3 -3
  115. data/lib/gcloud/storage/errors.rb +11 -8
  116. data/lib/gcloud/storage/file.rb +129 -171
  117. data/lib/gcloud/storage/file/acl.rb +51 -99
  118. data/lib/gcloud/storage/file/list.rb +3 -3
  119. data/lib/gcloud/storage/file/verifier.rb +3 -2
  120. data/lib/gcloud/storage/project.rb +111 -132
  121. data/lib/gcloud/upload.rb +4 -7
  122. data/lib/gcloud/version.rb +2 -4
  123. data/lib/google/api/annotations.rb +14 -0
  124. data/lib/google/api/http.rb +30 -0
  125. data/lib/google/api/label.rb +24 -0
  126. data/lib/google/api/monitored_resource.rb +25 -0
  127. data/lib/google/datastore/v1beta3/datastore.rb +115 -0
  128. data/lib/google/datastore/v1beta3/datastore_services.rb +33 -0
  129. data/lib/google/datastore/v1beta3/entity.rb +63 -0
  130. data/lib/google/datastore/v1beta3/query.rb +128 -0
  131. data/lib/google/devtools/cloudtrace/v1/trace.rb +78 -0
  132. data/lib/google/devtools/cloudtrace/v1/trace_services.rb +32 -0
  133. data/lib/google/example/library/v1/library.rb +91 -0
  134. data/lib/google/example/library/v1/library_services.rb +40 -0
  135. data/lib/google/iam/v1/iam_policy.rb +33 -0
  136. data/lib/google/iam/v1/iam_policy_services.rb +30 -0
  137. data/lib/google/iam/v1/policy.rb +25 -0
  138. data/lib/google/logging/type/http_request.rb +28 -0
  139. data/lib/google/logging/type/log_severity.rb +27 -0
  140. data/lib/google/logging/v2/log_entry.rb +44 -0
  141. data/lib/google/logging/v2/logging.rb +56 -0
  142. data/lib/google/logging/v2/logging_config.rb +59 -0
  143. data/lib/google/logging/v2/logging_config_services.rb +32 -0
  144. data/lib/google/logging/v2/logging_metrics.rb +51 -0
  145. data/lib/google/logging/v2/logging_metrics_services.rb +32 -0
  146. data/lib/google/logging/v2/logging_services.rb +31 -0
  147. data/lib/google/longrunning/operations.rb +50 -0
  148. data/lib/google/longrunning/operations_services.rb +29 -0
  149. data/lib/google/protobuf/any.rb +17 -0
  150. data/lib/google/protobuf/api.rb +31 -0
  151. data/lib/google/protobuf/descriptor.rb +0 -0
  152. data/lib/google/protobuf/duration.rb +17 -0
  153. data/lib/google/protobuf/empty.rb +15 -0
  154. data/lib/google/protobuf/field_mask.rb +16 -0
  155. data/lib/google/protobuf/source_context.rb +16 -0
  156. data/lib/google/protobuf/struct.rb +35 -0
  157. data/lib/google/protobuf/timestamp.rb +17 -0
  158. data/lib/google/protobuf/type.rb +79 -0
  159. data/lib/google/protobuf/wrappers.rb +48 -0
  160. data/lib/google/pubsub/v1/pubsub.rb +129 -0
  161. data/lib/google/pubsub/v1/pubsub_services.rb +56 -0
  162. data/lib/google/pubsub/v1beta2/pubsub.rb +126 -0
  163. data/lib/google/pubsub/v1beta2/pubsub_services.rb +56 -0
  164. data/lib/google/rpc/code.rb +32 -0
  165. data/lib/google/rpc/error_details.rb +61 -0
  166. data/lib/google/rpc/status.rb +19 -0
  167. data/lib/google/type/color.rb +20 -0
  168. data/lib/google/type/date.rb +18 -0
  169. data/lib/google/type/dayofweek.rb +23 -0
  170. data/lib/google/type/latlng.rb +17 -0
  171. data/lib/google/type/money.rb +18 -0
  172. data/lib/google/type/timeofday.rb +19 -0
  173. metadata +101 -4
  174. data/lib/gcloud/pubsub/connection.rb +0 -295
  175. data/lib/gcloud/pubsub/errors.rb +0 -93
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWQ1NzQxZjYwNGUwZjA0NzIzNmU5ZGRlZGFiODk2NWFlNzc4ZTFhZA==
4
+ NTQ3OWYzM2ZkNDc1ZTFlZGU1YzU2OWY1YTVhNDRjNDE2M2ZkZDQyZg==
5
5
  data.tar.gz: !binary |-
6
- OGExNzlhZmU3OWMyNmJkZjg3NzRiOGRkZTg1MTdiNDUwMjc4ZGVjMw==
6
+ MTg1YjE2ODY0ZjEwMjc1MGQ3NzBkOTc4MTZiNTU5ZDllN2U0MWM0Mw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjE3MzQwMDNhMmM0M2FjZDQxMWY2MTZlMWY2MzdlZDU0Y2Q4NzUwZDM3YzI4
10
- YTdjOTdjOTZjZTM2NGU2MGViYTQwMjUzZTVkYTQ2YzA5MDMzMTE4Y2ZhMDEx
11
- ZmRhYTdlZWRhZGQ3YTI4MDBiNzIwOWMwNjRlNzg0MjA1MGU2YzE=
9
+ MDhkMTc0NmMxYjJiMTUwN2I2NjMwMTEyNTE4ODkxODViNDNiN2I1YWJhZWRk
10
+ YzdlMWIxN2E5YzU1OWMzYmRmYjQ1MDNjNzhkN2Y2MTM2ODRkMGNmY2ZlYmE0
11
+ NWRhY2JhZjM0YzQ2YmNkMzAwMDFiODI1N2JhNGNjYzBmZjQ2YTk=
12
12
  data.tar.gz: !binary |-
13
- N2I5MGUzOThiN2Y3OGM3MGIwM2JjY2I3ZGIxMGYzMGUxNzA0NzlhYWUxZDY3
14
- OGM0OGZmNmFjNWYwMDA4MDg0NGMyMTE5MTI4NTI4YjQ4ZDVmYzQzMTc3MmM3
15
- NGRiYWU1ODI1Yjc5OTJkMjRkZmUxNGE3MDY5YmExOTA0YzIzZDM=
13
+ MmJjMzRiMWRkN2E3ZTk3NzIwMTkyY2YwYjc3YTdlNTQzZWRkMGE3NjAwZTVm
14
+ YmY4N2E5MmIxNmZmNGQ3YjM0ZTlhYTYyZmY5OGMyZGFjNDNhM2U3MDRkYmEx
15
+ ZTE0MzlkYWQ2NTU1ZGM0N2VlODM1NTFhMDMwNGY3M2VjMjY0M2E=
data/AUTHENTICATION.md CHANGED
@@ -4,15 +4,19 @@
4
4
 
5
5
  Gcloud aims to make authentication as simple as possible. Google Cloud requires a **Project ID** and **Service Account Credentials** to connect to the APIs. To create a service account:
6
6
 
7
- 1. Visit the [Google Developers Console](https://console.developers.google.com/project).
8
- 2. Create a new project or click on an existing project.
9
- 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services):
10
- * Google Cloud Datastore API
11
- * Google Cloud Storage
12
- * Google Cloud Storage JSON API
13
- 4. Navigate to **APIs & auth** > **Credentials** and then:
14
- * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authorize your requests.
15
- * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file.
7
+ 1. Visit the [Google Developers Console Projects page](https://console.developers.google.com/project).
8
+ 1. Create a new project or click on an existing project that you wish to use.
9
+ 1. In the project's **Dashboard**, under **Explore other services**, click **Enable APIs and get credentials like keys**.
10
+ 1. Turn on one or more of the following APIs by clicking on each API name and then clicking **Enable API** (click **More** if you do not see an API; also, you may need to enable billing in order to use some services):
11
+ * BigQuery API
12
+ * Cloud Datastore API
13
+ * Cloud DNS API
14
+ * Cloud Pub/Sub API
15
+ * Cloud Storage Service
16
+ * Cloud Storage JSON API
17
+ 1. In the left nav, click **Credentials**.
18
+ 1. Under **New credentials**, select **Service account key**.
19
+ 1. If you want to create a new service account, under **Service account**, select **New service account**. Otherwise, select an existing service account. Submit the form to download a JSON type key. Save the downloaded JSON key file to authorize your requests.
16
20
 
17
21
  You will use the **Project ID** and **JSON file** to connect to services with gcloud.
18
22
 
data/CHANGELOG.md CHANGED
@@ -1,11 +1,16 @@
1
1
  # Release History
2
2
 
3
- ### 0.6.3 / 2016-05-25
3
+ ### 0.7.0 / 2016-03-31
4
4
 
5
5
  #### Changes
6
6
 
7
- * Pub/Sub
8
- * Fix issue with base64 encoding and the REST API (arparker)
7
+ * Add support for Logging service
8
+ * gRPC
9
+ * Add dependency on gRPC gem
10
+ * Pub/Sub transport layer now uses gRPC
11
+ * New Logging transport layer uses gRPC
12
+ * Future releases will migrate more services to gRPC
13
+
9
14
 
10
15
  ### 0.6.2 / 2016-03-02
11
16
 
data/OVERVIEW.md CHANGED
@@ -6,13 +6,13 @@ The `gcloud` library is installable through rubygems:
6
6
  $ gem install gcloud
7
7
  ```
8
8
 
9
- Gcloud aims to make authentication as simple as possible. Google Cloud requires a **Project ID** and **Service Account Credentials** to connect to the APIs. You can learn more about various options for connection on the [Authentication Guide](AUTHENTICATION.md).
9
+ Gcloud aims to make authentication as simple as possible. Google Cloud requires a **Project ID** and **Service Account Credentials** to connect to the APIs. You can learn more about various options for connection on the [Authentication Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
10
10
 
11
11
  # BigQuery
12
12
 
13
13
  [Google Cloud BigQuery](https://cloud.google.com/bigquery/) ([docs](https://cloud.google.com/bigquery/docs)) enables super-fast, SQL-like queries against append-only tables, using the processing power of Google's infrastructure. Simply move your data into BigQuery and let it handle the hard work. You can control access to both the project and your data based on your business needs, such as giving others the ability to view or query your data.
14
14
 
15
- See the [gcloud-ruby BigQuery API documentation](rdoc-ref:Gcloud::Bigquery) to learn how to connect to Cloud BigQuery using this library.
15
+ See the {Gcloud::Bigquery gcloud-ruby BigQuery API documentation} to learn how to connect to Cloud BigQuery using this library.
16
16
 
17
17
  ```ruby
18
18
  require "gcloud"
@@ -44,7 +44,7 @@ end
44
44
 
45
45
  Follow the [activation instructions](https://cloud.google.com/datastore/docs/activate) to use the Google Cloud Datastore API with your project.
46
46
 
47
- See the [gcloud-ruby Datastore API documentation](rdoc-ref:Gcloud::Datastore) to learn how to interact with the Cloud Datastore using this library.
47
+ See the {Gcloud::Bigquery gcloud-ruby Datastore API documentation} to learn how to interact with the Cloud Datastore using this library.
48
48
 
49
49
  ```ruby
50
50
  require "gcloud"
@@ -71,7 +71,7 @@ completed_tasks = dataset.run query
71
71
 
72
72
  [Google Cloud DNS](https://cloud.google.com/dns/) ([docs](https://cloud.google.com/dns/docs)) is a high-performance, resilient, global DNS service that provides a cost-effective way to make your applications and services available to your users. This programmable, authoritative DNS service can be used to easily publish and manage DNS records using the same infrastructure relied upon by Google. To learn more, read [What is Google Cloud DNS?](https://cloud.google.com/dns/what-is-cloud-dns).
73
73
 
74
- See the [gcloud-ruby DNS API documentation](rdoc-ref:Gcloud::Dns) to learn how to connect to Cloud DNS using this library.
74
+ See the {Gcloud::Dns gcloud-ruby DNS API documentation} to learn how to connect to Cloud DNS using this library.
75
75
 
76
76
  ```ruby
77
77
  require "gcloud"
@@ -95,11 +95,49 @@ end
95
95
 
96
96
  ```
97
97
 
98
+ # Logging
99
+
100
+ [Google Cloud Logging](https://cloud.google.com/logging/) collects and stores logs from applications and services on the Google Cloud Platform, giving you fine-grained, programmatic control over your projects' logs. With this API you can do the following:
101
+
102
+ * Read and filter log entries
103
+ * Export your log entries to Cloud Storage,
104
+ BigQuery, or Cloud Pub/Sub
105
+ * Create logs-based metrics for use in Cloud
106
+ Monitoring
107
+ * Write log entries
108
+
109
+ See the {Gcloud::Logging gcloud-ruby Logging API documentation} to learn how to connect to Cloud Loging using this library.
110
+
111
+ ```ruby
112
+ require "gcloud"
113
+
114
+ gcloud = Gcloud.new
115
+ logging = gcloud.logging
116
+
117
+ # List all log entries
118
+ logging.entries.each do |e|
119
+ puts "[#{e.timestamp}] #{e.log_name} #{e.payload.inspect}"
120
+ end
121
+
122
+ # List only entries from a single log
123
+ entries = logging.entries filter: "log:syslog"
124
+
125
+ # Write a log entry
126
+ entry = logging.entry
127
+ entry.payload = "Job started."
128
+ entry.log_name = "my_app_log"
129
+ entry.resource.type = "gae_app"
130
+ entry.resource.labels[:module_id] = "1"
131
+ entry.resource.labels[:version_id] = "20150925t173233"
132
+
133
+ logging.write_entries entry
134
+ ```
135
+
98
136
  # Pub/Sub
99
137
 
100
138
  [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/) ([docs](https://cloud.google.com/pubsub/reference/rest/)) is designed to provide reliable, many-to-many, asynchronous messaging between applications. Publisher applications can send messages to a “topic” and other applications can subscribe to that topic to receive the messages. By decoupling senders and receivers, Google Cloud Pub/Sub allows developers to communicate between independently written applications.
101
139
 
102
- See the [gcloud-ruby Pub/Sub API documentation](rdoc-ref:Gcloud::Pubsub) to learn how to connect to Cloud Pub/Sub using this library.
140
+ See the {Gcloud::Pubsub gcloud-ruby Pub/Sub API documentation} to learn how to connect to Cloud Pub/Sub using this library.
103
141
 
104
142
  ```ruby
105
143
  require "gcloud"
@@ -130,7 +168,7 @@ msgs = sub.pull
130
168
  * Delete projects
131
169
  * Undelete, or recover, projects that you don't want to delete
132
170
 
133
- See the [gcloud-ruby Resource Manager API documentation](rdoc-ref:Gcloud::ResourceManager) to learn how to connect to Cloud Resource Manager using this library.
171
+ See the {Gcloud::ResourceManager gcloud-ruby Resource Manager API documentation} to learn how to connect to Cloud Resource Manager using this library.
134
172
 
135
173
  ```ruby
136
174
  require "gcloud"
@@ -157,7 +195,7 @@ projects = resource_manager.projects filter: "labels.env:production"
157
195
 
158
196
  [Google Cloud Search](https://cloud.google.com/search/) ([docs](https://cloud.google.com/search/reference/rest/index)) allows an application to quickly perform full-text and geo-spatial searches without having to spin up instances and without the hassle of managing and maintaining a search service.
159
197
 
160
- See the [gcloud-ruby Search API documentation](rdoc-ref:Gcloud::Search) to learn how to connect to Cloud Search using this library.
198
+ See the {Gcloud::Search gcloud-ruby Search API documentation} to learn how to connect to Cloud Search using this library.
161
199
 
162
200
  ```ruby
163
201
  require "gcloud"
@@ -175,7 +213,7 @@ results = index.search "cotton T-shirt",
175
213
 
176
214
  [Google Cloud Storage](https://cloud.google.com/storage/) ([docs](https://cloud.google.com/storage/docs/json_api/)) allows you to store data on Google infrastructure with very high reliability, performance and availability, and can be used to distribute large data objects to users via direct download.
177
215
 
178
- See the [gcloud-ruby Storage API documentation](rdoc-ref:Gcloud::Storage) to learn how to connect to Cloud Storage using this library.
216
+ See the {Gcloud::Storage gcloud-ruby Storage API documentation} to learn how to connect to Cloud Storage using this library.
179
217
 
180
218
  ```ruby
181
219
  require "gcloud"
data/lib/gcloud.rb CHANGED
@@ -1,4 +1,3 @@
1
- #--
2
1
  # Copyright 2015 Google Inc. All rights reserved.
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,10 +12,11 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
15
+
16
16
  require "gcloud/version"
17
17
 
18
18
  ##
19
- # = Google Cloud
19
+ # # Google Cloud
20
20
  #
21
21
  # Gcloud is the official library for interacting with the Google Cloud Platform.
22
22
  # Google Cloud Platform is a set of modular cloud-based services that allow
@@ -27,28 +27,24 @@ require "gcloud/version"
27
27
  # information, or if you are running on Google Compute Engine this configuration
28
28
  # is taken care of for you.
29
29
  #
30
- # You can learn more about various options for connection on the
31
- # {Authentication Guide}[AUTHENTICATION.md].
30
+ # You can learn more about various options for connection on the [Authentication
31
+ # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
32
32
  #
33
33
  module Gcloud
34
34
  ##
35
35
  # Creates a new object for connecting to Google Cloud.
36
36
  #
37
- # === Parameters
38
- #
39
- # +project+::
40
- # Project identifier for the Pub/Sub service you are connecting to.
41
- # (+String+)
42
- # +keyfile+::
43
- # Keyfile downloaded from Google Cloud. If file path the file must be
44
- # readable. (+String+ or +Hash+)
45
- #
46
- # === Returns
37
+ # For more information on connecting to Google Cloud see the [Authentication
38
+ # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
47
39
  #
48
- # Gcloud
40
+ # @param [String] project Project identifier for the Pub/Sub service you are
41
+ # connecting to.
42
+ # @param [String, Hash] keyfile Keyfile downloaded from Google Cloud. If file
43
+ # path the file must be readable.
49
44
  #
50
- # === Example
45
+ # @return [Gcloud]
51
46
  #
47
+ # @example
52
48
  # require "gcloud"
53
49
  #
54
50
  # gcloud = Gcloud.new
@@ -70,25 +66,22 @@ module Gcloud
70
66
  # Creates a new object for connecting to the Datastore service.
71
67
  # Each call creates a new connection.
72
68
  #
73
- # === Parameters
69
+ # For more information on connecting to Google Cloud see the [Authentication
70
+ # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
74
71
  #
75
- # +scope+::
76
- # The OAuth 2.0 scopes controlling the set of resources and operations that
77
- # the connection can access. See {Using OAuth 2.0 to Access Google
78
- # APIs}[https://developers.google.com/identity/protocols/OAuth2]. (+String+
79
- # or +Array+)
72
+ # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
73
+ # set of resources and operations that the connection can access. See [Using
74
+ # OAuth 2.0 to Access Google
75
+ # APIs](https://developers.google.com/identity/protocols/OAuth2).
80
76
  #
81
77
  # The default scopes are:
82
78
  #
83
- # * +https://www.googleapis.com/auth/datastore+
84
- # * +https://www.googleapis.com/auth/userinfo.email+
79
+ # * `https://www.googleapis.com/auth/datastore`
80
+ # * `https://www.googleapis.com/auth/userinfo.email`
85
81
  #
86
- # === Returns
87
- #
88
- # Gcloud::Datastore::Dataset
89
- #
90
- # === Examples
82
+ # @return [Gcloud::Datastore::Dataset]
91
83
  #
84
+ # @example
92
85
  # require "gcloud"
93
86
  #
94
87
  # gcloud = Gcloud.new
@@ -101,9 +94,7 @@ module Gcloud
101
94
  #
102
95
  # dataset.save entity
103
96
  #
104
- # You shouldn't need to override the default scope, but it is possible to do
105
- # so with the +scope+ option:
106
- #
97
+ # @example You shouldn't need to override the default scope, but you can:
107
98
  # require "gcloud"
108
99
  #
109
100
  # gcloud = Gcloud.new
@@ -119,24 +110,24 @@ module Gcloud
119
110
  # Creates a new object for connecting to the Storage service.
120
111
  # Each call creates a new connection.
121
112
  #
122
- # === Parameters
113
+ # For more information on connecting to Google Cloud see the [Authentication
114
+ # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
123
115
  #
124
- # +scope+::
125
- # The OAuth 2.0 scopes controlling the set of resources and operations that
126
- # the connection can access. See {Using OAuth 2.0 to Access Google
127
- # APIs}[https://developers.google.com/identity/protocols/OAuth2]. (+String+
128
- # or +Array+)
116
+ # @see https://cloud.google.com/storage/docs/authentication#oauth Storage
117
+ # OAuth 2.0 Authentication
129
118
  #
130
- # The default scope is:
131
- #
132
- # * +https://www.googleapis.com/auth/devstorage.full_control+
119
+ # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
120
+ # set of resources and operations that the connection can access. See [Using
121
+ # OAuth 2.0 to Access Google
122
+ # APIs](https://developers.google.com/identity/protocols/OAuth2).
133
123
  #
134
- # === Returns
124
+ # The default scope is:
135
125
  #
136
- # Gcloud::Storage::Project
126
+ # * `https://www.googleapis.com/auth/devstorage.full_control`
137
127
  #
138
- # === Examples
128
+ # @return [Gcloud::Storage::Project]
139
129
  #
130
+ # @example
140
131
  # require "gcloud"
141
132
  #
142
133
  # gcloud = Gcloud.new
@@ -144,10 +135,7 @@ module Gcloud
144
135
  # bucket = storage.bucket "my-bucket"
145
136
  # file = bucket.file "path/to/my-file.ext"
146
137
  #
147
- # The default scope can be overridden with the +scope+ option. For more
148
- # information see {Storage OAuth 2.0
149
- # Authentication}[https://cloud.google.com/storage/docs/authentication#oauth].
150
- #
138
+ # @example The default scope can be overridden with the `scope` option:
151
139
  # require "gcloud"
152
140
  #
153
141
  # gcloud = Gcloud.new
@@ -163,24 +151,21 @@ module Gcloud
163
151
  # Creates a new object for connecting to the Pub/Sub service.
164
152
  # Each call creates a new connection.
165
153
  #
166
- # === Parameters
154
+ # For more information on connecting to Google Cloud see the [Authentication
155
+ # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
167
156
  #
168
- # +scope+::
169
- # The OAuth 2.0 scopes controlling the set of resources and operations that
170
- # the connection can access. See {Using OAuth 2.0 to Access Google
171
- # APIs}[https://developers.google.com/identity/protocols/OAuth2]. (+String+
172
- # or +Array+)
157
+ # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
158
+ # set of resources and operations that the connection can access. See [Using
159
+ # OAuth 2.0 to Access Google
160
+ # APIs](https://developers.google.com/identity/protocols/OAuth2).
173
161
  #
174
162
  # The default scope is:
175
163
  #
176
- # * +https://www.googleapis.com/auth/pubsub+
177
- #
178
- # === Returns
164
+ # * `https://www.googleapis.com/auth/pubsub`
179
165
  #
180
- # Gcloud::Pubsub::Project
181
- #
182
- # === Examples
166
+ # @return [Gcloud::Pubsub::Project]
183
167
  #
168
+ # @example
184
169
  # require "gcloud"
185
170
  #
186
171
  # gcloud = Gcloud.new
@@ -188,8 +173,7 @@ module Gcloud
188
173
  # topic = pubsub.topic "my-topic"
189
174
  # topic.publish "task completed"
190
175
  #
191
- # The default scope can be overridden with the +scope+ option:
192
- #
176
+ # @example The default scope can be overridden with the `scope` option:
193
177
  # require "gcloud"
194
178
  #
195
179
  # gcloud = Gcloud.new
@@ -205,24 +189,21 @@ module Gcloud
205
189
  # Creates a new object for connecting to the BigQuery service.
206
190
  # Each call creates a new connection.
207
191
  #
208
- # === Parameters
192
+ # For more information on connecting to Google Cloud see the [Authentication
193
+ # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
209
194
  #
210
- # +scope+::
211
- # The OAuth 2.0 scopes controlling the set of resources and operations that
212
- # the connection can access. See {Using OAuth 2.0 to Access Google
213
- # APIs}[https://developers.google.com/identity/protocols/OAuth2]. (+String+
214
- # or +Array+)
195
+ # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
196
+ # set of resources and operations that the connection can access. See [Using
197
+ # OAuth 2.0 to Access Google
198
+ # APIs](https://developers.google.com/identity/protocols/OAuth2).
215
199
  #
216
200
  # The default scope is:
217
201
  #
218
- # * +https://www.googleapis.com/auth/bigquery+
219
- #
220
- # === Returns
202
+ # * `https://www.googleapis.com/auth/bigquery`
221
203
  #
222
- # Gcloud::Bigquery::Project
223
- #
224
- # === Examples
204
+ # @return [Gcloud::Bigquery::Project]
225
205
  #
206
+ # @example
226
207
  # require "gcloud"
227
208
  #
228
209
  # gcloud = Gcloud.new
@@ -233,8 +214,7 @@ module Gcloud
233
214
  # puts row
234
215
  # end
235
216
  #
236
- # The default scope can be overridden with the +scope+ option:
237
- #
217
+ # @example The default scope can be overridden with the `scope` option:
238
218
  # require "gcloud"
239
219
  #
240
220
  # gcloud = Gcloud.new
@@ -250,24 +230,21 @@ module Gcloud
250
230
  # Creates a new object for connecting to the DNS service.
251
231
  # Each call creates a new connection.
252
232
  #
253
- # === Parameters
233
+ # For more information on connecting to Google Cloud see the [Authentication
234
+ # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
254
235
  #
255
- # +scope+::
256
- # The OAuth 2.0 scopes controlling the set of resources and operations that
257
- # the connection can access. See {Using OAuth 2.0 to Access Google
258
- # APIs}[https://developers.google.com/identity/protocols/OAuth2]. (+String+
259
- # or +Array+)
236
+ # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
237
+ # set of resources and operations that the connection can access. See [Using
238
+ # OAuth 2.0 to Access Google
239
+ # APIs](https://developers.google.com/identity/protocols/OAuth2).
260
240
  #
261
241
  # The default scope is:
262
242
  #
263
- # * +https://www.googleapis.com/auth/ndev.clouddns.readwrite+
264
- #
265
- # === Returns
243
+ # * `https://www.googleapis.com/auth/ndev.clouddns.readwrite`
266
244
  #
267
- # Gcloud::Dns::Project
268
- #
269
- # === Examples
245
+ # @return [Gcloud::Dns::Project]
270
246
  #
247
+ # @example
271
248
  # require "gcloud"
272
249
  #
273
250
  # gcloud = Gcloud.new
@@ -277,8 +254,7 @@ module Gcloud
277
254
  # puts record.name
278
255
  # end
279
256
  #
280
- # The default scope can be overridden with the +scope+ option:
281
- #
257
+ # @example The default scope can be overridden with the `scope` option:
282
258
  # require "gcloud"
283
259
  #
284
260
  # gcloud = Gcloud.new
@@ -298,24 +274,21 @@ module Gcloud
298
274
  # Creates a new object for connecting to the Resource Manager service.
299
275
  # Each call creates a new connection.
300
276
  #
301
- # === Parameters
277
+ # For more information on connecting to Google Cloud see the [Authentication
278
+ # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
302
279
  #
303
- # +scope+::
304
- # The OAuth 2.0 scopes controlling the set of resources and operations that
305
- # the connection can access. See {Using OAuth 2.0 to Access Google
306
- # APIs}[https://developers.google.com/identity/protocols/OAuth2]. (+String+
307
- # or +Array+)
280
+ # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
281
+ # set of resources and operations that the connection can access. See [Using
282
+ # OAuth 2.0 to Access Google
283
+ # APIs](https://developers.google.com/identity/protocols/OAuth2).
308
284
  #
309
285
  # The default scope is:
310
286
  #
311
- # * +https://www.googleapis.com/auth/cloud-platform+
312
- #
313
- # === Returns
287
+ # * `https://www.googleapis.com/auth/cloud-platform`
314
288
  #
315
- # Gcloud::ResourceManager::Manager
316
- #
317
- # === Examples
289
+ # @return [Gcloud::ResourceManager::Manager]
318
290
  #
291
+ # @example
319
292
  # require "gcloud"
320
293
  #
321
294
  # gcloud = Gcloud.new
@@ -324,8 +297,7 @@ module Gcloud
324
297
  # puts projects.project_id
325
298
  # end
326
299
  #
327
- # The default scope can be overridden with the +scope+ option:
328
- #
300
+ # @example The default scope can be overridden with the `scope` option:
329
301
  # require "gcloud"
330
302
  #
331
303
  # gcloud = Gcloud.new
@@ -343,29 +315,63 @@ module Gcloud
343
315
  # Creates a new object for connecting to the Search service.
344
316
  # Each call creates a new connection.
345
317
  #
346
- # === Parameters
318
+ # For more information on connecting to Google Cloud see the [Authentication
319
+ # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
347
320
  #
348
- # +scope+::
349
- # The OAuth 2.0 scopes controlling the set of resources and operations that
350
- # the connection can access. See {Using OAuth 2.0 to Access Google
351
- # APIs}[https://developers.google.com/identity/protocols/OAuth2]. (+String+
352
- # or +Array+)
321
+ # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
322
+ # set of resources and operations that the connection can access. See [Using
323
+ # OAuth 2.0 to Access Google
324
+ # APIs](https://developers.google.com/identity/protocols/OAuth2).
353
325
  #
354
326
  # The default scopes are:
355
327
  #
356
- # * +https://www.googleapis.com/auth/cloudsearch+
357
- # * +https://www.googleapis.com/auth/userinfo.email+
328
+ # * `https://www.googleapis.com/auth/cloudsearch`
329
+ # * `https://www.googleapis.com/auth/userinfo.email`
358
330
  #
359
- # === Returns
360
- #
361
- # Gcloud::Search::Project
362
- #
363
- # === Examples
331
+ # @return [Gcloud::Search::Project]
364
332
  #
333
+ # @example
365
334
  # require "gcloud"
366
335
  #
367
336
  def search scope: nil
368
337
  require "gcloud/search"
369
338
  Gcloud.search @project, @keyfile, scope: scope
370
339
  end
340
+
341
+ ##
342
+ # Creates a new object for connecting to the Logging service.
343
+ # Each call creates a new connection.
344
+ #
345
+ # For more information on connecting to Google Cloud see the [Authentication
346
+ # Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
347
+ #
348
+ # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
349
+ # set of resources and operations that the connection can access. See [Using
350
+ # OAuth 2.0 to Access Google
351
+ # APIs](https://developers.google.com/identity/protocols/OAuth2).
352
+ #
353
+ # The default scope is:
354
+ #
355
+ # * `https://www.googleapis.com/auth/logging.admin`
356
+ #
357
+ # @return [Gcloud::Logging::Project]
358
+ #
359
+ # @example
360
+ # require "gcloud"
361
+ #
362
+ # gcloud = Gcloud.new
363
+ # logging = gcloud.logging
364
+ # # ...
365
+ #
366
+ # @example The default scope can be overridden with the `scope` option:
367
+ # require "gcloud"
368
+ #
369
+ # gcloud = Gcloud.new
370
+ # platform_scope = "https://www.googleapis.com/auth/cloud-platform"
371
+ # logging = gcloud.logging scope: platform_scope
372
+ #
373
+ def logging scope: nil
374
+ require "gcloud/logging"
375
+ Gcloud.logging @project, @keyfile, scope: scope
376
+ end
371
377
  end