gcloud 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +8 -8
  2. data/AUTHENTICATION.md +3 -3
  3. data/CHANGELOG.md +92 -0
  4. data/OVERVIEW.md +3 -3
  5. data/lib/gcloud.rb +75 -25
  6. data/lib/gcloud/backoff.rb +5 -1
  7. data/lib/gcloud/bigquery.rb +25 -43
  8. data/lib/gcloud/bigquery/copy_job.rb +13 -13
  9. data/lib/gcloud/bigquery/data.rb +20 -16
  10. data/lib/gcloud/bigquery/dataset.rb +202 -177
  11. data/lib/gcloud/bigquery/dataset/access.rb +118 -104
  12. data/lib/gcloud/bigquery/dataset/list.rb +14 -18
  13. data/lib/gcloud/bigquery/extract_job.rb +12 -12
  14. data/lib/gcloud/bigquery/insert_response.rb +12 -14
  15. data/lib/gcloud/bigquery/job.rb +45 -57
  16. data/lib/gcloud/bigquery/job/list.rb +18 -24
  17. data/lib/gcloud/bigquery/load_job.rb +35 -27
  18. data/lib/gcloud/bigquery/project.rb +53 -73
  19. data/lib/gcloud/bigquery/query_data.rb +28 -35
  20. data/lib/gcloud/bigquery/query_job.rb +18 -18
  21. data/lib/gcloud/bigquery/schema.rb +359 -0
  22. data/lib/gcloud/bigquery/service.rb +506 -0
  23. data/lib/gcloud/bigquery/table.rb +185 -266
  24. data/lib/gcloud/bigquery/table/list.rb +15 -19
  25. data/lib/gcloud/bigquery/view.rb +126 -81
  26. data/lib/gcloud/datastore.rb +39 -27
  27. data/lib/gcloud/datastore/commit.rb +2 -2
  28. data/lib/gcloud/datastore/dataset.rb +8 -19
  29. data/lib/gcloud/datastore/dataset/lookup_results.rb +2 -4
  30. data/lib/gcloud/datastore/dataset/query_results.rb +0 -2
  31. data/lib/gcloud/datastore/entity.rb +7 -1
  32. data/lib/gcloud/datastore/errors.rb +5 -27
  33. data/lib/gcloud/datastore/grpc_utils.rb +4 -3
  34. data/lib/gcloud/datastore/key.rb +6 -0
  35. data/lib/gcloud/datastore/service.rb +18 -12
  36. data/lib/gcloud/datastore/transaction.rb +0 -10
  37. data/lib/gcloud/dns.rb +29 -19
  38. data/lib/gcloud/dns/change.rb +10 -15
  39. data/lib/gcloud/dns/change/list.rb +4 -4
  40. data/lib/gcloud/dns/importer.rb +1 -1
  41. data/lib/gcloud/dns/project.rb +32 -49
  42. data/lib/gcloud/dns/record.rb +8 -2
  43. data/lib/gcloud/dns/record/list.rb +4 -4
  44. data/lib/gcloud/dns/service.rb +167 -0
  45. data/lib/gcloud/dns/zone.rb +33 -52
  46. data/lib/gcloud/dns/zone/list.rb +12 -16
  47. data/lib/gcloud/errors.rb +31 -19
  48. data/lib/gcloud/logging.rb +50 -39
  49. data/lib/gcloud/logging/entry.rb +197 -24
  50. data/lib/gcloud/logging/entry/list.rb +0 -2
  51. data/lib/gcloud/logging/logger.rb +1 -1
  52. data/lib/gcloud/logging/metric.rb +3 -9
  53. data/lib/gcloud/logging/metric/list.rb +0 -2
  54. data/lib/gcloud/logging/project.rb +58 -54
  55. data/lib/gcloud/logging/resource_descriptor.rb +2 -2
  56. data/lib/gcloud/logging/resource_descriptor/list.rb +0 -2
  57. data/lib/gcloud/logging/service.rb +32 -23
  58. data/lib/gcloud/logging/sink.rb +8 -14
  59. data/lib/gcloud/logging/sink/list.rb +0 -2
  60. data/lib/gcloud/pubsub.rb +21 -16
  61. data/lib/gcloud/pubsub/policy.rb +204 -0
  62. data/lib/gcloud/pubsub/project.rb +26 -38
  63. data/lib/gcloud/pubsub/service.rb +39 -31
  64. data/lib/gcloud/pubsub/subscription.rb +56 -59
  65. data/lib/gcloud/pubsub/subscription/list.rb +4 -4
  66. data/lib/gcloud/pubsub/topic.rb +69 -66
  67. data/lib/gcloud/pubsub/topic/list.rb +0 -2
  68. data/lib/gcloud/pubsub/topic/{batch.rb → publisher.rb} +15 -2
  69. data/lib/gcloud/resource_manager.rb +27 -26
  70. data/lib/gcloud/resource_manager/manager.rb +19 -39
  71. data/lib/gcloud/resource_manager/policy.rb +211 -0
  72. data/lib/gcloud/resource_manager/project.rb +97 -121
  73. data/lib/gcloud/resource_manager/project/list.rb +7 -7
  74. data/lib/gcloud/resource_manager/project/updater.rb +4 -9
  75. data/lib/gcloud/resource_manager/service.rb +127 -0
  76. data/lib/gcloud/storage.rb +24 -42
  77. data/lib/gcloud/storage/bucket.rb +104 -192
  78. data/lib/gcloud/storage/bucket/acl.rb +47 -143
  79. data/lib/gcloud/storage/bucket/cors.rb +55 -11
  80. data/lib/gcloud/storage/bucket/list.rb +14 -14
  81. data/lib/gcloud/storage/errors.rb +3 -43
  82. data/lib/gcloud/storage/file.rb +114 -111
  83. data/lib/gcloud/storage/file/acl.rb +27 -113
  84. data/lib/gcloud/storage/file/list.rb +21 -21
  85. data/lib/gcloud/storage/project.rb +49 -59
  86. data/lib/gcloud/storage/service.rb +347 -0
  87. data/lib/gcloud/translate.rb +24 -14
  88. data/lib/gcloud/translate/api.rb +12 -21
  89. data/lib/gcloud/translate/detection.rb +5 -5
  90. data/lib/gcloud/translate/language.rb +1 -1
  91. data/lib/gcloud/translate/service.rb +80 -0
  92. data/lib/gcloud/translate/translation.rb +6 -6
  93. data/lib/gcloud/version.rb +1 -1
  94. data/lib/gcloud/vision.rb +24 -15
  95. data/lib/gcloud/vision/annotate.rb +24 -21
  96. data/lib/gcloud/vision/annotation.rb +9 -9
  97. data/lib/gcloud/vision/annotation/entity.rb +11 -11
  98. data/lib/gcloud/vision/annotation/face.rb +25 -25
  99. data/lib/gcloud/vision/annotation/properties.rb +8 -8
  100. data/lib/gcloud/vision/annotation/safe_search.rb +4 -4
  101. data/lib/gcloud/vision/annotation/text.rb +7 -7
  102. data/lib/gcloud/vision/annotation/vertex.rb +1 -1
  103. data/lib/gcloud/vision/image.rb +11 -11
  104. data/lib/gcloud/vision/location.rb +5 -2
  105. data/lib/gcloud/vision/project.rb +14 -16
  106. data/lib/gcloud/vision/service.rb +66 -0
  107. data/lib/google/api_client.rb +0 -0
  108. metadata +27 -24
  109. data/lib/gcloud/bigquery/connection.rb +0 -624
  110. data/lib/gcloud/bigquery/errors.rb +0 -68
  111. data/lib/gcloud/bigquery/table/schema.rb +0 -234
  112. data/lib/gcloud/dns/connection.rb +0 -173
  113. data/lib/gcloud/dns/errors.rb +0 -68
  114. data/lib/gcloud/resource_manager/connection.rb +0 -134
  115. data/lib/gcloud/resource_manager/errors.rb +0 -68
  116. data/lib/gcloud/storage/connection.rb +0 -444
  117. data/lib/gcloud/translate/connection.rb +0 -85
  118. data/lib/gcloud/translate/errors.rb +0 -68
  119. data/lib/gcloud/upload.rb +0 -95
  120. data/lib/gcloud/vision/connection.rb +0 -63
  121. data/lib/gcloud/vision/errors.rb +0 -69
@@ -0,0 +1,167 @@
1
+ # Copyright 2016 Google Inc. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ require "gcloud/version"
17
+ require "gcloud/errors"
18
+ require "google/apis/dns_v1"
19
+
20
+ module Gcloud
21
+ module Dns
22
+ ##
23
+ # @private
24
+ # Represents the service to DNS, exposing the API calls.
25
+ class Service
26
+ ##
27
+ # Alias to the Google Client API module
28
+ API = Google::Apis::DnsV1
29
+
30
+ attr_accessor :project
31
+ attr_accessor :credentials
32
+
33
+ ##
34
+ # Creates a new Service instance.
35
+ def initialize project, credentials, retries: nil, timeout: nil
36
+ @project = project
37
+ @credentials = credentials
38
+ @service = API::DnsService.new
39
+ @service.client_options.application_name = "gcloud-ruby"
40
+ @service.client_options.application_version = Gcloud::VERSION
41
+ @service.request_options.retries = retries || 3
42
+ @service.request_options.timeout_sec = timeout if timeout
43
+ @service.authorization = @credentials.client
44
+ end
45
+
46
+ def service
47
+ return mocked_service if mocked_service
48
+ @service
49
+ end
50
+ attr_accessor :mocked_service
51
+
52
+ ##
53
+ # Returns Google::Apis::DnsV1::Project
54
+ def get_project project_id = @project
55
+ service.get_project project_id
56
+ rescue Google::Apis::Error => e
57
+ raise Gcloud::Error.from_error(e)
58
+ end
59
+
60
+ ##
61
+ # Returns Google::Apis::DnsV1::ManagedZone
62
+ def get_zone zone_id
63
+ service.get_managed_zone @project, zone_id
64
+ rescue Google::Apis::Error => e
65
+ raise Gcloud::Error.from_error(e)
66
+ end
67
+
68
+ ##
69
+ # Returns Google::Apis::DnsV1::ListManagedZonesResponse
70
+ def list_zones token: nil, max: nil
71
+ service.list_managed_zones @project, max_results: max, page_token: token
72
+ rescue Google::Apis::Error => e
73
+ raise Gcloud::Error.from_error(e)
74
+ end
75
+
76
+ ##
77
+ # Returns Google::Apis::DnsV1::ManagedZone
78
+ def create_zone zone_name, zone_dns, description: nil,
79
+ name_server_set: nil
80
+ managed_zone = Google::Apis::DnsV1::ManagedZone.new(
81
+ kind: "dns#managedZone",
82
+ name: zone_name,
83
+ dns_name: zone_dns,
84
+ description: (description || ""),
85
+ name_server_set: name_server_set
86
+ )
87
+ service.create_managed_zone @project, managed_zone
88
+ rescue Google::Apis::Error => e
89
+ raise Gcloud::Error.from_error(e)
90
+ end
91
+
92
+ def delete_zone zone_id
93
+ service.delete_managed_zone @project, zone_id
94
+ rescue Google::Apis::Error => e
95
+ raise Gcloud::Error.from_error(e)
96
+ end
97
+
98
+ ##
99
+ # Returns Google::Apis::DnsV1::Change
100
+ def get_change zone_id, change_id
101
+ service.get_change @project, zone_id, change_id
102
+ rescue Google::Apis::Error => e
103
+ raise Gcloud::Error.from_error(e)
104
+ end
105
+
106
+ ##
107
+ # Returns Google::Apis::DnsV1::ListChangesResponse
108
+ def list_changes zone_id, token: nil, max: nil, order: nil, sort: nil
109
+ service.list_changes @project, zone_id, max_results: max,
110
+ page_token: token,
111
+ sort_by: sort,
112
+ sort_order: order
113
+ rescue Google::Apis::Error => e
114
+ raise Gcloud::Error.from_error(e)
115
+ end
116
+
117
+ ##
118
+ # Returns Google::Apis::DnsV1::Change
119
+ def create_change zone_id, additions, deletions
120
+ change = Google::Apis::DnsV1::Change.new(
121
+ kind: "dns#change",
122
+ additions: Array(additions),
123
+ deletions: Array(deletions)
124
+ )
125
+ service.create_change @project, zone_id, change
126
+ rescue Google::Apis::Error => e
127
+ raise Gcloud::Error.from_error(e)
128
+ end
129
+
130
+ ##
131
+ # Returns Google::Apis::DnsV1::ListResourceRecordSetsResponse
132
+ def list_records zone_id, name = nil, type = nil, token: nil, max: nil
133
+ service.list_resource_record_sets @project, zone_id, max_results: max,
134
+ name: name,
135
+ page_token: token,
136
+ type: type
137
+ rescue Google::Apis::Error => e
138
+ raise Gcloud::Error.from_error(e)
139
+ end
140
+
141
+ ##
142
+ # Fully Qualified Domain Name
143
+ def self.fqdn name, origin_dns
144
+ name = name.to_s.strip
145
+ return name if self.ip_addr? name
146
+ name = origin_dns if name.empty?
147
+ name = origin_dns if name == "@"
148
+ name = "#{name}.#{origin_dns}" unless name.include? "."
149
+ name = "#{name}." unless name.end_with? "."
150
+ name
151
+ end
152
+
153
+ require "ipaddr"
154
+
155
+ def self.ip_addr? name
156
+ IPAddr.new name
157
+ true
158
+ rescue IPAddr::Error
159
+ false
160
+ end
161
+
162
+ def inspect
163
+ "#{self.class}(#{@project})"
164
+ end
165
+ end
166
+ end
167
+ end
@@ -44,8 +44,8 @@ module Gcloud
44
44
  #
45
45
  class Zone
46
46
  ##
47
- # @private The Connection object.
48
- attr_accessor :connection
47
+ # @private The Service object.
48
+ attr_accessor :service
49
49
 
50
50
  ##
51
51
  # @private The Google API Client object.
@@ -54,7 +54,7 @@ module Gcloud
54
54
  ##
55
55
  # @private Create an empty Zone object.
56
56
  def initialize
57
- @connection = nil
57
+ @service = nil
58
58
  @gapi = {}
59
59
  end
60
60
 
@@ -62,7 +62,7 @@ module Gcloud
62
62
  # Unique identifier for the resource; defined by the server.
63
63
  #
64
64
  def id
65
- @gapi["id"]
65
+ @gapi.id
66
66
  end
67
67
 
68
68
  ##
@@ -72,14 +72,14 @@ module Gcloud
72
72
  # dashes.
73
73
  #
74
74
  def name
75
- @gapi["name"]
75
+ @gapi.name
76
76
  end
77
77
 
78
78
  ##
79
79
  # The DNS name of this managed zone, for instance "example.com.".
80
80
  #
81
81
  def dns
82
- @gapi["dnsName"]
82
+ @gapi.dns_name
83
83
  end
84
84
 
85
85
  ##
@@ -87,7 +87,7 @@ module Gcloud
87
87
  # the user's convenience. Has no effect on the managed zone's function.
88
88
  #
89
89
  def description
90
- @gapi["description"]
90
+ @gapi.description
91
91
  end
92
92
 
93
93
  ##
@@ -95,7 +95,7 @@ module Gcloud
95
95
  # server.
96
96
  #
97
97
  def name_servers
98
- Array(@gapi["nameServers"])
98
+ Array(@gapi.name_servers)
99
99
  end
100
100
 
101
101
  ##
@@ -104,14 +104,14 @@ module Gcloud
104
104
  # ManagedZones. Most users will leave this field unset.
105
105
  #
106
106
  def name_server_set
107
- @gapi["nameServerSet"]
107
+ @gapi.name_server_set
108
108
  end
109
109
 
110
110
  ##
111
111
  # The time that this resource was created on the server.
112
112
  #
113
113
  def created_at
114
- Time.parse @gapi["creationTime"]
114
+ Time.parse @gapi.creation_time
115
115
  rescue
116
116
  nil
117
117
  end
@@ -144,13 +144,9 @@ module Gcloud
144
144
  def delete force: false
145
145
  clear! if force
146
146
 
147
- ensure_connection!
148
- resp = connection.delete_zone id
149
- if resp.success?
150
- true
151
- else
152
- fail ApiError.from_response(resp)
153
- end
147
+ ensure_service!
148
+ service.delete_zone id
149
+ true
154
150
  end
155
151
 
156
152
  ##
@@ -191,13 +187,11 @@ module Gcloud
191
187
  # end
192
188
  #
193
189
  def change change_id
194
- ensure_connection!
195
- resp = connection.get_change id, change_id
196
- if resp.success?
197
- Change.from_gapi resp.data, self
198
- else
199
- nil
200
- end
190
+ ensure_service!
191
+ gapi = service.get_change id, change_id
192
+ Change.from_gapi gapi, self
193
+ rescue Gcloud::NotFoundError
194
+ nil
201
195
  end
202
196
  alias_method :find_change, :change
203
197
  alias_method :get_change, :change
@@ -248,18 +242,14 @@ module Gcloud
248
242
  # end
249
243
  #
250
244
  def changes token: nil, max: nil, order: nil
251
- ensure_connection!
245
+ ensure_service!
252
246
  # Fix the sort options
253
247
  order = adjust_change_sort_order order
254
248
  sort = "changeSequence" if order
255
249
  # Continue with the API call
256
- resp = connection.list_changes id, token: token, max: max,
257
- order: order, sort: sort
258
- if resp.success?
259
- Change::List.from_response resp, self, max, order
260
- else
261
- fail ApiError.from_response(resp)
262
- end
250
+ gapi = service.list_changes id, token: token, max: max,
251
+ order: order, sort: sort
252
+ Change::List.from_gapi gapi, self, max, order
263
253
  end
264
254
  alias_method :find_changes, :changes
265
255
 
@@ -313,16 +303,12 @@ module Gcloud
313
303
  # end
314
304
  #
315
305
  def records name = nil, type = nil, token: nil, max: nil
316
- ensure_connection!
306
+ ensure_service!
317
307
 
318
308
  name = fqdn(name) if name
319
309
 
320
- resp = connection.list_records id, name, type, token: token, max: max
321
- if resp.success?
322
- Record::List.from_response resp, self, name, type, max
323
- else
324
- fail ApiError.from_response(resp)
325
- end
310
+ gapi = service.list_records id, name, type, token: token, max: max
311
+ Record::List.from_gapi gapi, self, name, type, max
326
312
  end
327
313
  alias_method :find_records, :records
328
314
 
@@ -707,7 +693,7 @@ module Gcloud
707
693
  # zone.fqdn "mail.example.com." #=> "mail.example.com."
708
694
  #
709
695
  def fqdn domain_name
710
- Connection.fqdn domain_name, dns
696
+ Service.fqdn domain_name, dns
711
697
  end
712
698
 
713
699
  ##
@@ -715,7 +701,7 @@ module Gcloud
715
701
  def self.from_gapi gapi, conn
716
702
  new.tap do |f|
717
703
  f.gapi = gapi
718
- f.connection = conn
704
+ f.service = conn
719
705
  end
720
706
  end
721
707
 
@@ -723,20 +709,15 @@ module Gcloud
723
709
 
724
710
  ##
725
711
  # Raise an error unless an active connection is available.
726
- def ensure_connection!
727
- fail "Must have active connection" unless connection
712
+ def ensure_service!
713
+ fail "Must have active connection" unless service
728
714
  end
729
715
 
730
716
  def create_change additions, deletions
731
- ensure_connection!
732
- resp = connection.create_change id,
733
- additions.map(&:to_gapi),
734
- deletions.map(&:to_gapi)
735
- if resp.success?
736
- Change.from_gapi resp.data, self
737
- else
738
- fail ApiError.from_response(resp)
739
- end
717
+ ensure_service!
718
+ gapi = service.create_change id, additions.map(&:to_gapi),
719
+ deletions.map(&:to_gapi)
720
+ Change.from_gapi gapi, self
740
721
  end
741
722
 
742
723
  def increment_soa to_add, to_remove, soa_serial
@@ -70,13 +70,9 @@ module Gcloud
70
70
  #
71
71
  def next
72
72
  return nil unless next?
73
- ensure_connection!
74
- resp = @connection.list_zones token: token, max: @max
75
- if resp.success?
76
- Zone::List.from_response resp, @connection, @max
77
- else
78
- fail ApiError.from_response(resp)
79
- end
73
+ ensure_service!
74
+ gapi = @service.list_zones token: token, max: @max
75
+ Zone::List.from_gapi gapi, @service, @max
80
76
  end
81
77
 
82
78
  ##
@@ -148,14 +144,14 @@ module Gcloud
148
144
  end
149
145
 
150
146
  ##
151
- # @private New Zones::List from a response object.
152
- def self.from_response resp, conn, max = nil
153
- zones = new(Array(resp.data["managedZones"]).map do |gapi_object|
154
- Zone.from_gapi gapi_object, conn
147
+ # @private New Zones::List from a ListManagedZonesResponse object.
148
+ def self.from_gapi gapi, conn, max = nil
149
+ zones = new(Array(gapi.managed_zones).map do |g|
150
+ Zone.from_gapi g, conn
155
151
  end)
156
- zones.instance_variable_set "@token", resp.data["nextPageToken"]
157
- zones.instance_variable_set "@connection", conn
158
- zones.instance_variable_set "@max", max
152
+ zones.instance_variable_set "@token", gapi.next_page_token
153
+ zones.instance_variable_set "@service", conn
154
+ zones.instance_variable_set "@max", max
159
155
  zones
160
156
  end
161
157
 
@@ -163,8 +159,8 @@ module Gcloud
163
159
 
164
160
  ##
165
161
  # Raise an error unless an active connection is available.
166
- def ensure_connection!
167
- fail "Must have active connection" unless @connection
162
+ def ensure_service!
163
+ fail "Must have active connection" unless @service
168
164
  end
169
165
  end
170
166
  end
data/lib/gcloud/errors.rb CHANGED
@@ -15,35 +15,47 @@
15
15
 
16
16
  module Gcloud
17
17
  ##
18
- # Base Gcloud exception class.
18
+ # Base gcloud-ruby exception class.
19
19
  class Error < StandardError
20
- ##
21
- # The inner error object.
22
- attr_reader :inner
23
-
24
- ##
25
- # Create a new error object.
26
- def initialize message = nil, error = nil
27
- super message
28
- @inner = error
29
- end
30
-
31
- # @private Create a new error object.
20
+ # @private Create a new error object from a client error
32
21
  def self.from_error error
33
- klass_for(error).new error.message, error
22
+ klass = if error.respond_to? :code
23
+ grpc_error_class_for error.code
24
+ elsif error.respond_to? :status_code
25
+ gapi_error_class_for error.status_code
26
+ else
27
+ self
28
+ end
29
+ klass.new error.message
34
30
  end
35
31
 
36
- # @private Identify the subclass for an error
37
- def self.klass_for error
38
- return self.class unless error.is_a? GRPC::BadStatus
32
+ # @private Identify the subclass for a gRPC error
33
+ def self.grpc_error_class_for grpc_error_code
39
34
  # The gRPC status code 0 is for a successful response.
40
35
  # So there is no error subclass for a 0 status code, use current class.
41
- [self.class, CanceledError, UnknownError, InvalidArgumentError,
36
+ [self, CanceledError, UnknownError, InvalidArgumentError,
42
37
  DeadlineExceededError, NotFoundError, AlreadyExistsError,
43
38
  PermissionDeniedError, ResourceExhaustedError, FailedPreconditionError,
44
39
  AbortedError, OutOfRangeError, UnimplementedError, InternalError,
45
40
  UnavailableError, DataLossError, UnauthenticatedError
46
- ][error.code] || self.class
41
+ ][grpc_error_code] || self
42
+ end
43
+
44
+ # @private Identify the subclass for a Google API Client error
45
+ def self.gapi_error_class_for http_status_code
46
+ # The http status codes mapped to their error classes.
47
+ { 400 => InvalidArgumentError, # FailedPreconditionError/OutOfRangeError
48
+ 401 => UnauthenticatedError,
49
+ 403 => PermissionDeniedError,
50
+ 404 => NotFoundError,
51
+ 409 => AlreadyExistsError, # AbortedError
52
+ 429 => ResourceExhaustedError,
53
+ 499 => CanceledError,
54
+ 500 => InternalError, # UnknownError/DataLossError
55
+ 501 => UnimplementedError,
56
+ 503 => UnavailableError,
57
+ 504 => DeadlineExceededError
58
+ }[http_status_code] || self
47
59
  end
48
60
  end
49
61