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
@@ -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,22 +12,24 @@
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
  require "google/api_client"
18
18
 
19
19
  module Gcloud
20
20
  module ResourceManager
21
21
  ##
22
+ # @private
22
23
  # Represents the connection to Resource Manager, as well as expose the API
23
24
  # calls.
24
- class Connection #:nodoc:
25
+ class Connection
25
26
  API_VERSION = "v1beta1"
26
27
 
27
- attr_accessor :credentials #:nodoc:
28
+ attr_accessor :credentials
28
29
 
29
30
  ##
30
31
  # Creates a new Connection instance.
31
- def initialize credentials #:nodoc:
32
+ def initialize credentials
32
33
  @credentials = credentials
33
34
  @client = Google::APIClient.new application_name: "gcloud-ruby",
34
35
  application_version: Gcloud::VERSION
@@ -116,7 +117,7 @@ module Gcloud
116
117
  )
117
118
  end
118
119
 
119
- def inspect #:nodoc:
120
+ def inspect
120
121
  "#{self.class}(#{@project})"
121
122
  end
122
123
  end
@@ -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,13 +12,14 @@
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/credentials"
17
17
 
18
18
  module Gcloud
19
19
  module ResourceManager
20
20
  ##
21
- # Represents the Oauth2 signing logic for Resource Manager.
22
- class Credentials < Gcloud::Credentials #:nodoc:
21
+ # @private Represents the Oauth2 signing logic for Resource Manager.
22
+ class Credentials < Gcloud::Credentials
23
23
  SCOPE = ["https://www.googleapis.com/auth/cloud-platform"]
24
24
  PATH_ENV_VARS = %w(RESOURCE_MANAGER_KEYFILE
25
25
  GCLOUD_KEYFILE GOOGLE_CLOUD_KEYFILE)
@@ -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,6 +12,7 @@
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/errors"
17
17
 
18
18
  module Gcloud
@@ -33,13 +33,15 @@ module Gcloud
33
33
  # The errors encountered.
34
34
  attr_reader :errors
35
35
 
36
- def initialize message, code, errors = [] #:nodoc:
36
+ # @private
37
+ def initialize message, code, errors = []
37
38
  super message
38
39
  @code = code
39
40
  @errors = errors
40
41
  end
41
42
 
42
- def self.from_response resp #:nodoc:
43
+ # @private
44
+ def self.from_response resp
43
45
  if resp.data? && resp.data["error"]
44
46
  from_response_data resp.data["error"]
45
47
  else
@@ -47,11 +49,13 @@ module Gcloud
47
49
  end
48
50
  end
49
51
 
50
- def self.from_response_data error #:nodoc:
52
+ # @private
53
+ def self.from_response_data error
51
54
  new error["message"], error["code"], error["errors"]
52
55
  end
53
56
 
54
- def self.from_response_status resp #:nodoc:
57
+ # @private
58
+ def self.from_response_status resp
55
59
  if resp.status == 404
56
60
  new "#{resp.error_message}: #{resp.request.uri.request_uri}",
57
61
  resp.status
@@ -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,6 +12,7 @@
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/resource_manager/credentials"
17
17
  require "gcloud/resource_manager/connection"
18
18
  require "gcloud/resource_manager/errors"
@@ -21,10 +21,11 @@ require "gcloud/resource_manager/project"
21
21
  module Gcloud
22
22
  module ResourceManager
23
23
  ##
24
- # = Manager
24
+ # # Manager
25
25
  #
26
26
  # Provides methods for creating, retrieving, and updating projects.
27
27
  #
28
+ # @example
28
29
  # require "gcloud"
29
30
  #
30
31
  # gcloud = Gcloud.new
@@ -33,17 +34,17 @@ module Gcloud
33
34
  # puts projects.project_id
34
35
  # end
35
36
  #
36
- # See Gcloud#resource_manager
37
+ # See {Gcloud#resource_manager}
37
38
  class Manager
38
39
  ##
39
- # The Connection object.
40
- attr_accessor :connection #:nodoc:
40
+ # @private The Connection object.
41
+ attr_accessor :connection
41
42
 
42
43
  ##
43
- # Creates a new Connection instance.
44
+ # @private Creates a new Connection instance.
44
45
  #
45
- # See Gcloud.resource_manager
46
- def initialize credentials #:nodoc:
46
+ # See {Gcloud.resource_manager}
47
+ def initialize credentials
47
48
  @connection = Connection.new credentials
48
49
  end
49
50
 
@@ -52,39 +53,33 @@ module Gcloud
52
53
  # specified filter. This method returns projects in an unspecified order.
53
54
  # New projects do not necessarily appear at the end of the list.
54
55
  #
55
- # === Parameters
56
- #
57
- # +filter+::
58
- # An expression for filtering the results of the request. Filter rules
59
- # are case insensitive. (+String+)
56
+ # @param [String] filter An expression for filtering the results of the
57
+ # request. Filter rules are case insensitive.
60
58
  #
61
59
  # The fields eligible for filtering are:
62
- # * +name+
63
- # * +id+
64
- # * +labels.key+ - where +key+ is the name of a label
60
+ #
61
+ # * `name`
62
+ # * `id`
63
+ # * `labels.key` - where `key` is the name of a label
65
64
  #
66
65
  # Some examples of using labels as filters:
67
- # * +name:*+ - The project has a name.
68
- # * +name:Howl+ - The project's name is Howl or howl.
69
- # * +name:HOWL+ - Equivalent to above.
70
- # * +NAME:howl+ - Equivalent to above.
71
- # * +labels.color:*+ - The project has the label color.
72
- # * +labels.color:red+ - The project's label color has the value red.
66
+ #
67
+ # * `name:*` - The project has a name.
68
+ # * `name:Howl` - The project's name is Howl or howl.
69
+ # * `name:HOWL` - Equivalent to above.
70
+ # * `NAME:howl` - Equivalent to above.
71
+ # * `labels.color:*` - The project has the label color.
72
+ # * `labels.color:red` - The project's label color has the value red.
73
73
  # * <code>labels.color:red labels.size:big</code> - The project's label
74
74
  # color has the value red and its label size has the value big.
75
- # +token+::
76
- # A previously-returned page token representing part of the larger set
77
- # of results to view. (+String+)
78
- # +max+::
79
- # Maximum number of projects to return. (+Integer+)
80
- #
81
- # === Returns
75
+ # @param [String] token A previously-returned page token representing part
76
+ # of the larger set of results to view.
77
+ # @param [Integer] max Maximum number of projects to return.
82
78
  #
83
- # Array of Gcloud::ResourceManager::Project
84
- # (See Gcloud::ResourceManager::Project::List)
85
- #
86
- # === Examples
79
+ # @return [Array<Gcloud::ResourceManager::Project>] (See
80
+ # {Gcloud::ResourceManager::Project::List})
87
81
  #
82
+ # @example
88
83
  # require "gcloud"
89
84
  #
90
85
  # gcloud = Gcloud.new
@@ -94,8 +89,7 @@ module Gcloud
94
89
  # puts project.project_id
95
90
  # end
96
91
  #
97
- # Projects can be filtered using the +filter+ option:
98
- #
92
+ # @example Projects can be filtered using the `filter` option:
99
93
  # require "gcloud"
100
94
  #
101
95
  # gcloud = Gcloud.new
@@ -105,9 +99,7 @@ module Gcloud
105
99
  # puts project.project_id
106
100
  # end
107
101
  #
108
- # If you have a significant number of projects, you may need to paginate
109
- # through them: (See Gcloud::ResourceManager::Project::List)
110
- #
102
+ # @example With pagination: (See {Gcloud::ResourceManager::Project::List})
111
103
  # require "gcloud"
112
104
  #
113
105
  # gcloud = Gcloud.new
@@ -127,19 +119,14 @@ module Gcloud
127
119
  end
128
120
 
129
121
  ##
130
- # Retrieves the project identified by the specified +project_id+.
131
- #
132
- # === Parameters
133
- #
134
- # +project_id+::
135
- # The ID of the project. (+String+)
122
+ # Retrieves the project identified by the specified `project_id`.
136
123
  #
137
- # === Returns
124
+ # @param [String] project_id The ID of the project.
138
125
  #
139
- # Gcloud::ResourceManager::Project, or +nil+ if the project does not exist
140
- #
141
- # === Example
126
+ # @return [Gcloud::ResourceManager::Project, nil] Returns `nil` if the
127
+ # project does not exist
142
128
  #
129
+ # @example
143
130
  # require "gcloud"
144
131
  #
145
132
  # gcloud = Gcloud.new
@@ -166,21 +153,15 @@ module Gcloud
166
153
  # Several APIs are activated automatically for the project, including
167
154
  # Google Cloud Storage.
168
155
  #
169
- # === Parameters
170
- #
171
- # +project_id+::
172
- # The unique, user-assigned ID of the project. It must be 6 to 30
173
- # lowercase letters, digits, or hyphens. It must start with a letter.
174
- # Trailing hyphens are prohibited. (+String+)
175
- # +name+::
176
- # The user-assigned name of the project. This field is optional and can
177
- # remain unset.
156
+ # @param [String] project_id The unique, user-assigned ID of the project.
157
+ # It must be 6 to 30 lowercase letters, digits, or hyphens. It must
158
+ # start with a letter. Trailing hyphens are prohibited.
159
+ # @param [String] name The user-assigned name of the project. This field
160
+ # is optional and can remain unset.
178
161
  #
179
162
  # Allowed characters are: lowercase and uppercase letters, numbers,
180
163
  # hyphen, single-quote, double-quote, space, and exclamation point.
181
- # (+String+)
182
- # +labels+::
183
- # The labels associated with this project.
164
+ # @param [Hash] labels The labels associated with this project.
184
165
  #
185
166
  # Label keys must be between 1 and 63 characters long and must conform
186
167
  # to the following regular expression:
@@ -190,22 +171,17 @@ module Gcloud
190
171
  # to the regular expression <code>([a-z]([-a-z0-9]*[a-z0-9])?)?</code>.
191
172
  #
192
173
  # No more than 256 labels can be associated with a given resource.
193
- # (+Hash+)
194
- #
195
- # === Returns
196
174
  #
197
- # Gcloud::ResourceManager::Project
198
- #
199
- # === Example
175
+ # @return [Gcloud::ResourceManager::Project]
200
176
  #
177
+ # @example
201
178
  # require "gcloud"
202
179
  #
203
180
  # gcloud = Gcloud.new
204
181
  # resource_manager = gcloud.resource_manager
205
182
  # project = resource_manager.create_project "tokyo-rain-123"
206
183
  #
207
- # A project can also be created with a +name+ and +labels+.
208
- #
184
+ # @example A project can also be created with a `name` and `labels`:
209
185
  # require "gcloud"
210
186
  #
211
187
  # gcloud = Gcloud.new
@@ -230,10 +206,10 @@ module Gcloud
230
206
  # if the following criteria are met:
231
207
  #
232
208
  # * The project does not have a billing account associated with it.
233
- # * The project has a lifecycle state of +ACTIVE+.
234
- # * This method changes the project's lifecycle state from +ACTIVE+ to
235
- # +DELETE_REQUESTED+. The deletion starts at an unspecified time, at
236
- # which point the lifecycle state changes to +DELETE_IN_PROGRESS+.
209
+ # * The project has a lifecycle state of `ACTIVE`.
210
+ # * This method changes the project's lifecycle state from `ACTIVE` to
211
+ # `DELETE_REQUESTED`. The deletion starts at an unspecified time, at
212
+ # which point the lifecycle state changes to `DELETE_IN_PROGRESS`.
237
213
  #
238
214
  # Until the deletion completes, you can check the lifecycle state by
239
215
  # retrieving the project with Manager#project. The project remains visible
@@ -244,13 +220,9 @@ module Gcloud
244
220
  #
245
221
  # The caller must have modify permissions for this project.
246
222
  #
247
- # === Parameters
248
- #
249
- # +project_id+::
250
- # The ID of the project. (+String+)
251
- #
252
- # === Example
223
+ # @param [String] project_id The ID of the project.
253
224
  #
225
+ # @example
254
226
  # require "gcloud"
255
227
  #
256
228
  # gcloud = Gcloud.new
@@ -268,19 +240,15 @@ module Gcloud
268
240
 
269
241
  ##
270
242
  # Restores the project. You can only use this method for a project that
271
- # has a lifecycle state of +DELETE_REQUESTED+. After deletion starts, as
272
- # indicated by a lifecycle state of +DELETE_IN_PROGRESS+, the project
243
+ # has a lifecycle state of `DELETE_REQUESTED`. After deletion starts, as
244
+ # indicated by a lifecycle state of `DELETE_IN_PROGRESS`, the project
273
245
  # cannot be restored.
274
246
  #
275
247
  # The caller must have modify permissions for this project.
276
248
  #
277
- # === Parameters
278
- #
279
- # +project_id+::
280
- # The ID of the project. (+String+)
281
- #
282
- # === Example
249
+ # @param [String] project_id The ID of the project.
283
250
  #
251
+ # @example
284
252
  # require "gcloud"
285
253
  #
286
254
  # gcloud = Gcloud.new
@@ -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,6 +12,7 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
15
+
16
16
  require "time"
17
17
  require "gcloud/resource_manager/errors"
18
18
  require "gcloud/resource_manager/project/list"
@@ -21,12 +21,13 @@ require "gcloud/resource_manager/project/updater"
21
21
  module Gcloud
22
22
  module ResourceManager
23
23
  ##
24
- # = Project
24
+ # # Project
25
25
  #
26
26
  # Project is a high-level Google Cloud Platform entity. It is a container
27
27
  # for ACLs, APIs, AppEngine Apps, VMs, and other Google Cloud Platform
28
28
  # resources.
29
29
  #
30
+ # @example
30
31
  # require "gcloud"
31
32
  #
32
33
  # gcloud = Gcloud.new
@@ -39,16 +40,16 @@ module Gcloud
39
40
  #
40
41
  class Project
41
42
  ##
42
- # The Connection object.
43
- attr_accessor :connection #:nodoc:
43
+ # @private The Connection object.
44
+ attr_accessor :connection
44
45
 
45
46
  ##
46
- # The Google API Client object.
47
- attr_accessor :gapi #:nodoc:
47
+ # @private The Google API Client object.
48
+ attr_accessor :gapi
48
49
 
49
50
  ##
50
- # Create an empty Project object.
51
- def initialize #:nodoc:
51
+ # @private Create an empty Project object.
52
+ def initialize
52
53
  @connection = nil
53
54
  @gapi = {}
54
55
  end
@@ -83,8 +84,7 @@ module Gcloud
83
84
  # Allowed characters are: lowercase and uppercase letters, numbers,
84
85
  # hyphen, single-quote, double-quote, space, and exclamation point.
85
86
  #
86
- # === Example
87
- #
87
+ # @example
88
88
  # require "gcloud"
89
89
  #
90
90
  # gcloud = Gcloud.new
@@ -113,12 +113,12 @@ module Gcloud
113
113
  # to the regular expression <code>([a-z]([-a-z0-9]*[a-z0-9])?)?</code>.
114
114
  #
115
115
  # No more than 256 labels can be associated with a given resource.
116
- # (+Hash+)
117
- #
118
- # === Examples
116
+ # (`Hash`)
119
117
  #
120
- # Labels are read-only and cannot be changed by direct assignment.
118
+ # @yield [labels] a block for setting labels
119
+ # @yieldparam [Hash] labels the hash accepting labels
121
120
  #
121
+ # @example Labels are read-only and cannot be changed:
122
122
  # require "gcloud"
123
123
  #
124
124
  # gcloud = Gcloud.new
@@ -127,9 +127,7 @@ module Gcloud
127
127
  # project.labels["env"] #=> "dev" # read only
128
128
  # project.labels["env"] = "production" # raises error
129
129
  #
130
- # Labels can be updated by passing a block, or by calling the #labels=
131
- # method.
132
- #
130
+ # @example Labels can be updated by passing a block, or with {#labels=}:
133
131
  # require "gcloud"
134
132
  #
135
133
  # gcloud = Gcloud.new
@@ -161,10 +159,9 @@ module Gcloud
161
159
  # to the regular expression <code>([a-z]([-a-z0-9]*[a-z0-9])?)?</code>.
162
160
  #
163
161
  # No more than 256 labels can be associated with a given resource.
164
- # (+Hash+)
165
- #
166
- # === Example
162
+ # (`Hash`)
167
163
  #
164
+ # @example
168
165
  # require "gcloud"
169
166
  #
170
167
  # gcloud = Gcloud.new
@@ -196,13 +193,13 @@ module Gcloud
196
193
  # The project lifecycle state.
197
194
  #
198
195
  # Possible values are:
199
- # * +ACTIVE+ - The normal and active state.
200
- # * +LIFECYCLE_STATE_UNSPECIFIED+ - Unspecified state. This is only
196
+ # * `ACTIVE` - The normal and active state.
197
+ # * `LIFECYCLE_STATE_UNSPECIFIED` - Unspecified state. This is only
201
198
  # used/useful for distinguishing unset values.
202
- # * +DELETE_REQUESTED+ - The project has been marked for deletion by the
199
+ # * `DELETE_REQUESTED` - The project has been marked for deletion by the
203
200
  # user (by invoking DeleteProject) or by the system (Google Cloud
204
201
  # Platform). This can generally be reversed by invoking UndeleteProject.
205
- # * +DELETE_IN_PROGRESS+ - The process of deleting the project has begun.
202
+ # * `DELETE_IN_PROGRESS` - The process of deleting the project has begun.
206
203
  # Reversing the deletion is no longer possible.
207
204
  #
208
205
  def state
@@ -210,38 +207,41 @@ module Gcloud
210
207
  end
211
208
 
212
209
  ##
213
- # Checks if the state is +ACTIVE+.
210
+ # Checks if the state is `ACTIVE`.
214
211
  def active?
215
212
  return false if state.nil?
216
213
  "ACTIVE".casecmp(state).zero?
217
214
  end
218
215
 
219
216
  ##
220
- # Checks if the state is +LIFECYCLE_STATE_UNSPECIFIED+.
217
+ # Checks if the state is `LIFECYCLE_STATE_UNSPECIFIED`.
221
218
  def unspecified?
222
219
  return false if state.nil?
223
220
  "LIFECYCLE_STATE_UNSPECIFIED".casecmp(state).zero?
224
221
  end
225
222
 
226
223
  ##
227
- # Checks if the state is +DELETE_REQUESTED+.
224
+ # Checks if the state is `DELETE_REQUESTED`.
228
225
  def delete_requested?
229
226
  return false if state.nil?
230
227
  "DELETE_REQUESTED".casecmp(state).zero?
231
228
  end
232
229
 
233
230
  ##
234
- # Checks if the state is +DELETE_IN_PROGRESS+.
231
+ # Checks if the state is `DELETE_IN_PROGRESS`.
235
232
  def delete_in_progress?
236
233
  return false if state.nil?
237
234
  "DELETE_IN_PROGRESS".casecmp(state).zero?
238
235
  end
239
236
 
240
237
  ##
241
- # Updates the project in a single API call. See Project::Updater
238
+ # Updates the project in a single API call. See {Project::Updater}
242
239
  #
243
- # === Example
240
+ # @yield [project] a block yielding a project delegate
241
+ # @yieldparam [Project::Updater] project the delegate object for updating
242
+ # the project
244
243
  #
244
+ # @example
245
245
  # require "gcloud"
246
246
  #
247
247
  # gcloud = Gcloud.new
@@ -267,8 +267,7 @@ module Gcloud
267
267
  # Reloads the project (with updated state) from the Google Cloud Resource
268
268
  # Manager service.
269
269
  #
270
- # === Example
271
- #
270
+ # @example
272
271
  # require "gcloud"
273
272
  #
274
273
  # gcloud = Gcloud.new
@@ -291,10 +290,10 @@ module Gcloud
291
290
  # if the following criteria are met:
292
291
  #
293
292
  # * The project does not have a billing account associated with it.
294
- # * The project has a lifecycle state of +ACTIVE+.
295
- # * This method changes the project's lifecycle state from +ACTIVE+ to
296
- # +DELETE_REQUESTED+. The deletion starts at an unspecified time, at
297
- # which point the lifecycle state changes to +DELETE_IN_PROGRESS+.
293
+ # * The project has a lifecycle state of `ACTIVE`.
294
+ # * This method changes the project's lifecycle state from `ACTIVE` to
295
+ # `DELETE_REQUESTED`. The deletion starts at an unspecified time, at
296
+ # which point the lifecycle state changes to `DELETE_IN_PROGRESS`.
298
297
  #
299
298
  # Until the deletion completes, you can check the lifecycle state by
300
299
  # calling #reload!, or by retrieving the project with Manager#project. The
@@ -306,8 +305,7 @@ module Gcloud
306
305
  #
307
306
  # The caller must have modify permissions for this project.
308
307
  #
309
- # === Example
310
- #
308
+ # @example
311
309
  # require "gcloud"
312
310
  #
313
311
  # gcloud = Gcloud.new
@@ -330,14 +328,13 @@ module Gcloud
330
328
 
331
329
  ##
332
330
  # Restores the project. You can only use this method for a project that
333
- # has a lifecycle state of +DELETE_REQUESTED+. After deletion starts, as
334
- # indicated by a lifecycle state of +DELETE_IN_PROGRESS+, the project
331
+ # has a lifecycle state of `DELETE_REQUESTED`. After deletion starts, as
332
+ # indicated by a lifecycle state of `DELETE_IN_PROGRESS`, the project
335
333
  # cannot be restored.
336
334
  #
337
335
  # The caller must have modify permissions for this project.
338
336
  #
339
- # === Example
340
- #
337
+ # @example
341
338
  # require "gcloud"
342
339
  #
343
340
  # gcloud = Gcloud.new
@@ -359,21 +356,8 @@ module Gcloud
359
356
  end
360
357
 
361
358
  ##
362
- # Gets the {Cloud IAM}[https://cloud.google.com/iam/] access control
363
- # policy. See {Managing
364
- # Policies}[https://cloud.google.com/iam/docs/managing-policies]
365
- # for more information.
366
- #
367
- # === Parameters
368
- #
369
- # +force+::
370
- # Force load the latest policy when +true+. Otherwise the policy will be
371
- # memoized to reduce the number of API calls made. The default is
372
- # +false+. (+Boolean+)
373
- #
374
- # === Returns
375
- #
376
- # A hash that conforms to the following structure:
359
+ # Gets the [Cloud IAM](https://cloud.google.com/iam/) access control
360
+ # policy. Returns a hash that conforms to the following structure:
377
361
  #
378
362
  # {
379
363
  # "bindings" => [{
@@ -384,11 +368,16 @@ module Gcloud
384
368
  # "etag" => "CAE="
385
369
  # }
386
370
  #
387
- # === Examples
371
+ # @see https://cloud.google.com/iam/docs/managing-policies Managing
372
+ # Policies
373
+ #
374
+ # @param [Boolean] force Force load the latest policy when `true`.
375
+ # Otherwise the policy will be memoized to reduce the number of API
376
+ # calls made. The default is `false`.
388
377
  #
389
- # By default the policy values are memoized to reduce the number of API
390
- # calls made.
378
+ # @return [Hash] See description
391
379
  #
380
+ # @example Policy values are memoized by default:
392
381
  # require "gcloud"
393
382
  #
394
383
  # gcloud = Gcloud.new
@@ -400,8 +389,7 @@ module Gcloud
400
389
  # puts policy["version"]
401
390
  # puts policy["etag"]
402
391
  #
403
- # Use the +force+ option to retrieve the latest policy from the service.
404
- #
392
+ # @example Use the `force` option to retrieve the latest policy:
405
393
  # require "gcloud"
406
394
  #
407
395
  # gcloud = Gcloud.new
@@ -409,7 +397,7 @@ module Gcloud
409
397
  # project = resource_manager.project "tokyo-rain-123"
410
398
  # policy = project.policy force: true
411
399
  #
412
- def policy force: nil
400
+ def policy force: false
413
401
  @policy = nil if force
414
402
  @policy ||= begin
415
403
  ensure_connection!
@@ -422,15 +410,14 @@ module Gcloud
422
410
  end
423
411
 
424
412
  ##
425
- # Sets the {Cloud IAM}[https://cloud.google.com/iam/] access control
426
- # policy. See {Managing
427
- # Policies}[https://cloud.google.com/iam/docs/managing-policies]
428
- # for more information.
413
+ # Sets the [Cloud IAM](https://cloud.google.com/iam/) access control
414
+ # policy.
429
415
  #
430
- # === Parameters
416
+ # @see https://cloud.google.com/iam/docs/managing-policies Managing
417
+ # Policies
431
418
  #
432
- # +new_policy+::
433
- # A hash that conforms to the following structure:
419
+ # @param [String] new_policy A hash that conforms to the following
420
+ # structure:
434
421
  #
435
422
  # {
436
423
  # "bindings" => [{
@@ -439,8 +426,7 @@ module Gcloud
439
426
  # }]
440
427
  # }
441
428
  #
442
- # === Example
443
- #
429
+ # @example
444
430
  # require "gcloud"
445
431
  #
446
432
  # gcloud = Gcloud.new
@@ -467,24 +453,19 @@ module Gcloud
467
453
  end
468
454
 
469
455
  ##
470
- # Tests the specified permissions against the {Cloud
471
- # IAM}[https://cloud.google.com/iam/] access control policy. See
472
- # {Managing Policies}[https://cloud.google.com/iam/docs/managing-policies]
473
- # for more information.
474
- #
475
- # === Parameters
476
- #
477
- # +permissions+::
478
- # The set of permissions to check access for. Permissions with wildcards
479
- # (such as +*+ or +storage.*+) are not allowed.
480
- # (String or Array of Strings)
456
+ # Tests the specified permissions against the [Cloud
457
+ # IAM](https://cloud.google.com/iam/) access control policy.
481
458
  #
482
- # === Returns
459
+ # @see https://cloud.google.com/iam/docs/managing-policies Managing
460
+ # Policies
483
461
  #
484
- # The permissions that have access. (Array of Strings)
462
+ # @param [String, Array<String>] permissions The set of permissions to
463
+ # check access for. Permissions with wildcards (such as `*` or
464
+ # `storage.*`) are not allowed.
485
465
  #
486
- # === Example
466
+ # @return [Array<String>] The permissions that have access
487
467
  #
468
+ # @example
488
469
  # require "gcloud"
489
470
  #
490
471
  # gcloud = Gcloud.new
@@ -507,8 +488,8 @@ module Gcloud
507
488
  end
508
489
 
509
490
  ##
510
- # New Change from a Google API Client object.
511
- def self.from_gapi gapi, connection #:nodoc:
491
+ # @private New Change from a Google API Client object.
492
+ def self.from_gapi gapi, connection
512
493
  new.tap do |p|
513
494
  p.gapi = gapi
514
495
  p.connection = connection