td-client 1.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/data/ca-bundle.crt +3448 -0
- data/lib/td-client.rb +1 -0
- data/lib/td/client.rb +606 -0
- data/lib/td/client/api.rb +707 -0
- data/lib/td/client/api/access_control.rb +74 -0
- data/lib/td/client/api/account.rb +45 -0
- data/lib/td/client/api/bulk_import.rb +184 -0
- data/lib/td/client/api/bulk_load.rb +172 -0
- data/lib/td/client/api/database.rb +50 -0
- data/lib/td/client/api/export.rb +38 -0
- data/lib/td/client/api/import.rb +38 -0
- data/lib/td/client/api/job.rb +390 -0
- data/lib/td/client/api/partial_delete.rb +27 -0
- data/lib/td/client/api/result.rb +46 -0
- data/lib/td/client/api/schedule.rb +120 -0
- data/lib/td/client/api/server_status.rb +21 -0
- data/lib/td/client/api/table.rb +132 -0
- data/lib/td/client/api/user.rb +134 -0
- data/lib/td/client/api_error.rb +37 -0
- data/lib/td/client/compat_gzip_reader.rb +22 -0
- data/lib/td/client/model.rb +816 -0
- data/lib/td/client/version.rb +5 -0
- data/lib/td/core_ext/openssl/ssl/sslcontext/set_params.rb +18 -0
- data/spec/spec_helper.rb +63 -0
- data/spec/td/client/access_control_api_spec.rb +37 -0
- data/spec/td/client/account_api_spec.rb +34 -0
- data/spec/td/client/api_error_spec.rb +77 -0
- data/spec/td/client/api_spec.rb +269 -0
- data/spec/td/client/api_ssl_connection_spec.rb +109 -0
- data/spec/td/client/bulk_import_spec.rb +199 -0
- data/spec/td/client/bulk_load_spec.rb +401 -0
- data/spec/td/client/db_api_spec.rb +123 -0
- data/spec/td/client/export_api_spec.rb +51 -0
- data/spec/td/client/import_api_spec.rb +148 -0
- data/spec/td/client/job_api_spec.rb +833 -0
- data/spec/td/client/model_job_spec.rb +136 -0
- data/spec/td/client/model_schedule_spec.rb +26 -0
- data/spec/td/client/model_schema_spec.rb +134 -0
- data/spec/td/client/partial_delete_api_spec.rb +58 -0
- data/spec/td/client/result_api_spec.rb +77 -0
- data/spec/td/client/sched_api_spec.rb +109 -0
- data/spec/td/client/server_status_api_spec.rb +25 -0
- data/spec/td/client/spec_resources.rb +99 -0
- data/spec/td/client/table_api_spec.rb +226 -0
- data/spec/td/client/user_api_spec.rb +118 -0
- data/spec/td/client_sched_spec.rb +79 -0
- data/spec/td/client_spec.rb +46 -0
- metadata +271 -0
data/lib/td-client.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'td', 'client')
|
data/lib/td/client.rb
ADDED
@@ -0,0 +1,606 @@
|
|
1
|
+
module TreasureData
|
2
|
+
|
3
|
+
require 'td/client/api'
|
4
|
+
require 'td/client/model'
|
5
|
+
|
6
|
+
|
7
|
+
class Client
|
8
|
+
# @param [String] user TreasureData username
|
9
|
+
# @param [String] password TreasureData password
|
10
|
+
# @param [Hash] opts options for API
|
11
|
+
# @return [Client] instance of this class
|
12
|
+
def self.authenticate(user, password, opts={})
|
13
|
+
api = API.new(nil, opts)
|
14
|
+
apikey = api.authenticate(user, password)
|
15
|
+
new(apikey)
|
16
|
+
end
|
17
|
+
|
18
|
+
# @param [Hash] opts options for API
|
19
|
+
# @return [String] HTTP status code of server returns
|
20
|
+
def self.server_status(opts={})
|
21
|
+
api = API.new(nil, opts)
|
22
|
+
api.server_status
|
23
|
+
end
|
24
|
+
|
25
|
+
# @param [String] apikey TreasureData API key
|
26
|
+
# @param [Hash] opts options for API
|
27
|
+
def initialize(apikey, opts={})
|
28
|
+
@api = API.new(apikey, opts)
|
29
|
+
end
|
30
|
+
|
31
|
+
# @!attribute [r] api
|
32
|
+
attr_reader :api
|
33
|
+
|
34
|
+
# @return [String] API key
|
35
|
+
def apikey
|
36
|
+
@api.apikey
|
37
|
+
end
|
38
|
+
|
39
|
+
# @return [String] HTTP status code of server returns
|
40
|
+
def server_status
|
41
|
+
@api.server_status
|
42
|
+
end
|
43
|
+
|
44
|
+
# @param [String] db_name
|
45
|
+
# @param [Hash] opts
|
46
|
+
# @return [true]
|
47
|
+
def create_database(db_name, opts={})
|
48
|
+
@api.create_database(db_name, opts)
|
49
|
+
end
|
50
|
+
|
51
|
+
# @param [String] db_name
|
52
|
+
# @return [Symbol]
|
53
|
+
def delete_database(db_name)
|
54
|
+
@api.delete_database(db_name)
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return [Account]
|
58
|
+
def account
|
59
|
+
account_id, plan, storage, guaranteed_cores, maximum_cores, created_at = @api.show_account
|
60
|
+
return Account.new(self, account_id, plan, storage, guaranteed_cores, maximum_cores, created_at)
|
61
|
+
end
|
62
|
+
|
63
|
+
# @param [Fixnum] from
|
64
|
+
# @param [Fixnum] to
|
65
|
+
# @return [Array] from, to, interval, history
|
66
|
+
def core_utilization(from, to)
|
67
|
+
from, to, interval, history = @api.account_core_utilization(from, to)
|
68
|
+
return from, to, interval, history
|
69
|
+
end
|
70
|
+
|
71
|
+
# @return [Array] databases
|
72
|
+
def databases
|
73
|
+
m = @api.list_databases
|
74
|
+
m.map {|db_name,(count, created_at, updated_at, org, permission)|
|
75
|
+
Database.new(self, db_name, nil, count, created_at, updated_at, org, permission)
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
# @param [String] db_name
|
80
|
+
# @return [Database]
|
81
|
+
def database(db_name)
|
82
|
+
m = @api.list_databases
|
83
|
+
m.each {|name,(count, created_at, updated_at, org, permission)|
|
84
|
+
if name == db_name
|
85
|
+
return Database.new(self, name, nil, count, created_at, updated_at, org, permission)
|
86
|
+
end
|
87
|
+
}
|
88
|
+
raise NotFoundError, "Database '#{db_name}' does not exist"
|
89
|
+
end
|
90
|
+
|
91
|
+
# @return [true]
|
92
|
+
def create_log_table(db_name, table_name)
|
93
|
+
@api.create_log_table(db_name, table_name)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Swap table names
|
97
|
+
#
|
98
|
+
# @param [String] db_name
|
99
|
+
# @param [String] table_name1
|
100
|
+
# @param [String] table_name2
|
101
|
+
# @return [true]
|
102
|
+
def swap_table(db_name, table_name1, table_name2)
|
103
|
+
@api.swap_table(db_name, table_name1, table_name2)
|
104
|
+
end
|
105
|
+
|
106
|
+
# @param [String] db_name
|
107
|
+
# @param [String] table_name
|
108
|
+
# @param [String] schema
|
109
|
+
# @return [true]
|
110
|
+
def update_schema(db_name, table_name, schema)
|
111
|
+
@api.update_schema(db_name, table_name, schema.to_json)
|
112
|
+
end
|
113
|
+
|
114
|
+
# @param [String] db_name
|
115
|
+
# @param [String] table_name
|
116
|
+
# @param [Fixnum] expire_days
|
117
|
+
# @return [true]
|
118
|
+
def update_expire(db_name, table_name, expire_days)
|
119
|
+
@api.update_expire(db_name, table_name, expire_days)
|
120
|
+
end
|
121
|
+
|
122
|
+
# @param [String] db_name
|
123
|
+
# @param [String] table_name
|
124
|
+
# @return [Symbol]
|
125
|
+
def delete_table(db_name, table_name)
|
126
|
+
@api.delete_table(db_name, table_name)
|
127
|
+
end
|
128
|
+
|
129
|
+
# @param [String] db_name
|
130
|
+
# @return [Array] Tables
|
131
|
+
def tables(db_name)
|
132
|
+
m = @api.list_tables(db_name)
|
133
|
+
m.map {|table_name, (type, schema, count, created_at, updated_at, estimated_storage_size, last_import, last_log_timestamp, expire_days)|
|
134
|
+
schema = Schema.new.from_json(schema)
|
135
|
+
Table.new(self, db_name, table_name, type, schema, count, created_at, updated_at,
|
136
|
+
estimated_storage_size, last_import, last_log_timestamp, expire_days)
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
140
|
+
# @param [String] db_name
|
141
|
+
# @param [String] table_name
|
142
|
+
# @return [Table]
|
143
|
+
def table(db_name, table_name)
|
144
|
+
tables(db_name).each {|t|
|
145
|
+
if t.name == table_name
|
146
|
+
return t
|
147
|
+
end
|
148
|
+
}
|
149
|
+
raise NotFoundError, "Table '#{db_name}.#{table_name}' does not exist"
|
150
|
+
end
|
151
|
+
|
152
|
+
# @param [String] db_name
|
153
|
+
# @param [String] table_name
|
154
|
+
# @param [Fixnum] count
|
155
|
+
# @param [Proc] block
|
156
|
+
# @return [Array, nil]
|
157
|
+
def tail(db_name, table_name, count, to = nil, from = nil, &block)
|
158
|
+
@api.tail(db_name, table_name, count, to, from, &block)
|
159
|
+
end
|
160
|
+
|
161
|
+
# @param [String] db_name
|
162
|
+
# @param [String] q
|
163
|
+
# @param [String] result_url
|
164
|
+
# @param [Fixnum] priority
|
165
|
+
# @param [Fixnum] retry_limit
|
166
|
+
# @param [Hash] opts
|
167
|
+
# @return [Job]
|
168
|
+
def query(db_name, q, result_url=nil, priority=nil, retry_limit=nil, opts={})
|
169
|
+
# for compatibility, assume type is hive unless specifically specified
|
170
|
+
type = opts[:type] || opts['type'] || :hive
|
171
|
+
raise ArgumentError, "The specified query type is not supported: #{type}" unless [:hive, :pig, :impala, :presto].include?(type)
|
172
|
+
job_id = @api.query(q, type, db_name, result_url, priority, retry_limit, opts)
|
173
|
+
Job.new(self, job_id, type, q)
|
174
|
+
end
|
175
|
+
|
176
|
+
# @param [Fixnum] from
|
177
|
+
# @param [Fixnum] to
|
178
|
+
# @param [String] status
|
179
|
+
# @param [Hash] conditions
|
180
|
+
# @return [Job]
|
181
|
+
def jobs(from=nil, to=nil, status=nil, conditions=nil)
|
182
|
+
results = @api.list_jobs(from, to, status, conditions)
|
183
|
+
results.map {|job_id, type, status, query, start_at, end_at, cpu_time,
|
184
|
+
result_size, result_url, priority, retry_limit, org, db,
|
185
|
+
duration, num_records|
|
186
|
+
Job.new(self, job_id, type, query, status, nil, nil, start_at, end_at, cpu_time,
|
187
|
+
result_size, nil, result_url, nil, priority, retry_limit, org, db,
|
188
|
+
duration, num_records)
|
189
|
+
}
|
190
|
+
end
|
191
|
+
|
192
|
+
# @param [String] job_id
|
193
|
+
# @return [Job]
|
194
|
+
def job(job_id)
|
195
|
+
job_id = job_id.to_s
|
196
|
+
type, query, status, url, debug, start_at, end_at, cpu_time,
|
197
|
+
result_size, result_url, hive_result_schema, priority, retry_limit, org, db, duration, num_records = @api.show_job(job_id)
|
198
|
+
Job.new(self, job_id, type, query, status, url, debug, start_at, end_at, cpu_time,
|
199
|
+
result_size, nil, result_url, hive_result_schema, priority, retry_limit, org, db, duration, num_records)
|
200
|
+
end
|
201
|
+
|
202
|
+
# @param [String] job_id
|
203
|
+
# @return [String] HTTP status code
|
204
|
+
def job_status(job_id)
|
205
|
+
return @api.job_status(job_id)
|
206
|
+
end
|
207
|
+
|
208
|
+
# @param [String] job_id
|
209
|
+
# @return [Object]
|
210
|
+
def job_result(job_id)
|
211
|
+
@api.job_result(job_id)
|
212
|
+
end
|
213
|
+
|
214
|
+
# @param [String] job_id
|
215
|
+
# @param [String] format
|
216
|
+
# @param [IO] io
|
217
|
+
# @param [Proc] block
|
218
|
+
# @return [String]
|
219
|
+
def job_result_format(job_id, format, io=nil, &block)
|
220
|
+
@api.job_result_format(job_id, format, io, &block)
|
221
|
+
end
|
222
|
+
|
223
|
+
def job_result_raw(job_id, format, io=nil, &block)
|
224
|
+
@api.job_result_raw(job_id, format, io, &block)
|
225
|
+
end
|
226
|
+
|
227
|
+
# @param [String] job_id
|
228
|
+
# @param [Proc] block
|
229
|
+
# @return [nil]
|
230
|
+
def job_result_each(job_id, &block)
|
231
|
+
@api.job_result_each(job_id, &block)
|
232
|
+
end
|
233
|
+
|
234
|
+
# @param [String] job_id
|
235
|
+
# @param [Proc] block
|
236
|
+
# @return [nil]
|
237
|
+
def job_result_each_with_compr_size(job_id, &block)
|
238
|
+
@api.job_result_each_with_compr_size(job_id, &block)
|
239
|
+
end
|
240
|
+
|
241
|
+
# @param [String] job_id
|
242
|
+
# @return [String] former_status
|
243
|
+
def kill(job_id)
|
244
|
+
@api.kill(job_id)
|
245
|
+
end
|
246
|
+
|
247
|
+
# @param [String] db_name
|
248
|
+
# @param [String] table_name
|
249
|
+
# @param [String] storage_type
|
250
|
+
# @param [Hash] opts
|
251
|
+
# @return [Job]
|
252
|
+
def export(db_name, table_name, storage_type, opts={})
|
253
|
+
job_id = @api.export(db_name, table_name, storage_type, opts)
|
254
|
+
Job.new(self, job_id, :export, nil)
|
255
|
+
end
|
256
|
+
|
257
|
+
# @param [String] target_job_id
|
258
|
+
# @param [Hash] opts
|
259
|
+
# @return [Job]
|
260
|
+
def result_export(target_job_id, opts={})
|
261
|
+
job_id = @api.result_export(target_job_id, opts)
|
262
|
+
Job.new(self, job_id, :result_export, nil)
|
263
|
+
end
|
264
|
+
|
265
|
+
# @param [String] db_name
|
266
|
+
# @param [String] table_name
|
267
|
+
# @param [Fixnum] to
|
268
|
+
# @param [Fixnum] from
|
269
|
+
# @param [Hash] opts
|
270
|
+
# @return [Job]
|
271
|
+
def partial_delete(db_name, table_name, to, from, opts={})
|
272
|
+
job_id = @api.partial_delete(db_name, table_name, to, from, opts)
|
273
|
+
Job.new(self, job_id, :partialdelete, nil)
|
274
|
+
end
|
275
|
+
|
276
|
+
# @param [String] name
|
277
|
+
# @param [String] database
|
278
|
+
# @param [String] table
|
279
|
+
# @param [Hash] opts
|
280
|
+
# @return [nil]
|
281
|
+
def create_bulk_import(name, database, table, opts={})
|
282
|
+
@api.create_bulk_import(name, database, table, opts)
|
283
|
+
end
|
284
|
+
|
285
|
+
# @param [String] name
|
286
|
+
# @return [nil]
|
287
|
+
def delete_bulk_import(name)
|
288
|
+
@api.delete_bulk_import(name)
|
289
|
+
end
|
290
|
+
|
291
|
+
# @param [String] name
|
292
|
+
# @return [nil]
|
293
|
+
def freeze_bulk_import(name)
|
294
|
+
@api.freeze_bulk_import(name)
|
295
|
+
end
|
296
|
+
|
297
|
+
# @param [String] name
|
298
|
+
# @return [nil]
|
299
|
+
def unfreeze_bulk_import(name)
|
300
|
+
@api.unfreeze_bulk_import(name)
|
301
|
+
end
|
302
|
+
|
303
|
+
# @param [String] name
|
304
|
+
# @param [Hash] opts options for API
|
305
|
+
# @return [Job]
|
306
|
+
def perform_bulk_import(name, opts={})
|
307
|
+
job_id = @api.perform_bulk_import(name, opts)
|
308
|
+
Job.new(self, job_id, :bulk_import, nil)
|
309
|
+
end
|
310
|
+
|
311
|
+
# @param [String] name
|
312
|
+
# @return [nil]
|
313
|
+
def commit_bulk_import(name)
|
314
|
+
@api.commit_bulk_import(name)
|
315
|
+
end
|
316
|
+
|
317
|
+
# @param [String] name
|
318
|
+
# @param [Proc] block
|
319
|
+
# @return [Hash]
|
320
|
+
def bulk_import_error_records(name, &block)
|
321
|
+
@api.bulk_import_error_records(name, &block)
|
322
|
+
end
|
323
|
+
|
324
|
+
# @param [String] name
|
325
|
+
# @return [BulkImport]
|
326
|
+
def bulk_import(name)
|
327
|
+
data = @api.show_bulk_import(name)
|
328
|
+
BulkImport.new(self, data)
|
329
|
+
end
|
330
|
+
|
331
|
+
# @return [Array<BulkImport>]
|
332
|
+
def bulk_imports
|
333
|
+
@api.list_bulk_imports.map {|data|
|
334
|
+
BulkImport.new(self, data)
|
335
|
+
}
|
336
|
+
end
|
337
|
+
|
338
|
+
# @param [String] name
|
339
|
+
# @param [String] part_name
|
340
|
+
# @param [String, StringIO] stream
|
341
|
+
# @param [Fixnum] size
|
342
|
+
# @return [nil]
|
343
|
+
def bulk_import_upload_part(name, part_name, stream, size)
|
344
|
+
@api.bulk_import_upload_part(name, part_name, stream, size)
|
345
|
+
end
|
346
|
+
|
347
|
+
# @param [String] name
|
348
|
+
# @param [String] part_name
|
349
|
+
# @return [nil]
|
350
|
+
def bulk_import_delete_part(name, part_name)
|
351
|
+
@api.bulk_import_delete_part(name, part_name)
|
352
|
+
end
|
353
|
+
|
354
|
+
# @param [String] name
|
355
|
+
# @return [Array]
|
356
|
+
def list_bulk_import_parts(name)
|
357
|
+
@api.list_bulk_import_parts(name)
|
358
|
+
end
|
359
|
+
|
360
|
+
# @param [String] name
|
361
|
+
# @param [Hash] opts
|
362
|
+
# @return [Time]
|
363
|
+
def create_schedule(name, opts)
|
364
|
+
raise ArgumentError, "'cron' option is required" unless opts[:cron] || opts['cron']
|
365
|
+
raise ArgumentError, "'query' option is required" unless opts[:query] || opts['query']
|
366
|
+
start = @api.create_schedule(name, opts)
|
367
|
+
return start && Time.parse(start)
|
368
|
+
end
|
369
|
+
|
370
|
+
# @param [String] name
|
371
|
+
# @return [Array]
|
372
|
+
def delete_schedule(name)
|
373
|
+
@api.delete_schedule(name)
|
374
|
+
end
|
375
|
+
|
376
|
+
# @return [Array<Schedule>]
|
377
|
+
def schedules
|
378
|
+
result = @api.list_schedules
|
379
|
+
result.map {|name,cron,query,database,result_url,timezone,delay,next_time,priority,retry_limit,org_name|
|
380
|
+
Schedule.new(self, name, cron, query, database, result_url, timezone, delay, next_time, priority, retry_limit, org_name)
|
381
|
+
}
|
382
|
+
end
|
383
|
+
|
384
|
+
# @param [String] name
|
385
|
+
# @param [Hash] params
|
386
|
+
# @return [nil]
|
387
|
+
def update_schedule(name, params)
|
388
|
+
@api.update_schedule(name, params)
|
389
|
+
nil
|
390
|
+
end
|
391
|
+
|
392
|
+
# @param [String] name
|
393
|
+
# @param [Fixnum] from
|
394
|
+
# @param [Fixnum] to
|
395
|
+
# @return [Array<ScheduledJob>]
|
396
|
+
def history(name, from=nil, to=nil)
|
397
|
+
result = @api.history(name, from, to)
|
398
|
+
result.map {|scheduled_at,job_id,type,status,query,start_at,end_at,result_url,priority,database|
|
399
|
+
job_param = [job_id, type, query, status,
|
400
|
+
nil, nil, # url, debug
|
401
|
+
start_at, end_at,
|
402
|
+
nil, # cpu_time
|
403
|
+
nil, nil, # result_size, result
|
404
|
+
result_url,
|
405
|
+
nil, # hive_result_schema
|
406
|
+
priority,
|
407
|
+
nil, # retry_limit
|
408
|
+
nil, # TODO org_name
|
409
|
+
database]
|
410
|
+
ScheduledJob.new(self, scheduled_at, *job_param)
|
411
|
+
}
|
412
|
+
end
|
413
|
+
|
414
|
+
# @param [String] name
|
415
|
+
# @param [Fixnum] time UNIX timestamp
|
416
|
+
# @param [Fixnum] num
|
417
|
+
# @return [Array<ScheduledJob>]
|
418
|
+
def run_schedule(name, time, num)
|
419
|
+
results = @api.run_schedule(name, time, num)
|
420
|
+
results.map {|job_id,type,scheduled_at|
|
421
|
+
ScheduledJob.new(self, scheduled_at, job_id, type, nil)
|
422
|
+
}
|
423
|
+
end
|
424
|
+
|
425
|
+
# @param [String] db_name
|
426
|
+
# @param [String] table_name
|
427
|
+
# @param [String] format
|
428
|
+
# @param [String, StringIO] stream
|
429
|
+
# @param [Fixnum] size
|
430
|
+
# @param [String] unique_id
|
431
|
+
# @return [Float]
|
432
|
+
def import(db_name, table_name, format, stream, size, unique_id=nil)
|
433
|
+
@api.import(db_name, table_name, format, stream, size, unique_id)
|
434
|
+
end
|
435
|
+
|
436
|
+
# @return [Array<Result>]
|
437
|
+
def results
|
438
|
+
results = @api.list_result
|
439
|
+
rs = results.map {|name,url,organizations|
|
440
|
+
Result.new(self, name, url, organizations)
|
441
|
+
}
|
442
|
+
return rs
|
443
|
+
end
|
444
|
+
|
445
|
+
# @param [String] name
|
446
|
+
# @param [String] url
|
447
|
+
# @param [Hash] opts
|
448
|
+
# @return [true]
|
449
|
+
def create_result(name, url, opts={})
|
450
|
+
@api.create_result(name, url, opts)
|
451
|
+
end
|
452
|
+
|
453
|
+
# @param [String] name
|
454
|
+
# @return [true]
|
455
|
+
def delete_result(name)
|
456
|
+
@api.delete_result(name)
|
457
|
+
end
|
458
|
+
|
459
|
+
# @return [Array<User>]
|
460
|
+
def users
|
461
|
+
list = @api.list_users
|
462
|
+
list.map {|name,org,roles,email|
|
463
|
+
User.new(self, name, org, roles, email)
|
464
|
+
}
|
465
|
+
end
|
466
|
+
|
467
|
+
# @param [String] name
|
468
|
+
# @param [String] org
|
469
|
+
# @param [String] email
|
470
|
+
# @param [String] password
|
471
|
+
# @return [true]
|
472
|
+
def add_user(name, org, email, password)
|
473
|
+
@api.add_user(name, org, email, password)
|
474
|
+
end
|
475
|
+
|
476
|
+
# @param [String] user
|
477
|
+
# @return [true]
|
478
|
+
def remove_user(user)
|
479
|
+
@api.remove_user(user)
|
480
|
+
end
|
481
|
+
|
482
|
+
# @param [String] user
|
483
|
+
# @param [String] email
|
484
|
+
# @return [true]
|
485
|
+
def change_email(user, email)
|
486
|
+
@api.change_email(user, email)
|
487
|
+
end
|
488
|
+
|
489
|
+
# @param [String] user
|
490
|
+
# @return [Array<String>]
|
491
|
+
def list_apikeys(user)
|
492
|
+
@api.list_apikeys(user)
|
493
|
+
end
|
494
|
+
|
495
|
+
# @param [String] user
|
496
|
+
# @return [true]
|
497
|
+
def add_apikey(user)
|
498
|
+
@api.add_apikey(user)
|
499
|
+
end
|
500
|
+
|
501
|
+
# @param [String] user
|
502
|
+
# @param [String] apikey
|
503
|
+
# @return [true]
|
504
|
+
def remove_apikey(user, apikey)
|
505
|
+
@api.remove_apikey(user, apikey)
|
506
|
+
end
|
507
|
+
|
508
|
+
# @param [String] user
|
509
|
+
# @param [String] password
|
510
|
+
# @return [true]
|
511
|
+
def change_password(user, password)
|
512
|
+
@api.change_password(user, password)
|
513
|
+
end
|
514
|
+
|
515
|
+
# @param [String] old_password
|
516
|
+
# @param [String] password
|
517
|
+
# @return [true]
|
518
|
+
def change_my_password(old_password, password)
|
519
|
+
@api.change_my_password(old_password, password)
|
520
|
+
end
|
521
|
+
|
522
|
+
# @return [Array<AccessControl>]
|
523
|
+
def access_controls
|
524
|
+
list = @api.list_access_controls
|
525
|
+
list.map {|subject,action,scope,grant_option|
|
526
|
+
AccessControl.new(self, subject, action, scope, grant_option)
|
527
|
+
}
|
528
|
+
end
|
529
|
+
|
530
|
+
# @param [String] subject
|
531
|
+
# @param [String] action
|
532
|
+
# @param [String] scope
|
533
|
+
# @param [Array] grant_option
|
534
|
+
# @return [true]
|
535
|
+
def grant_access_control(subject, action, scope, grant_option)
|
536
|
+
@api.grant_access_control(subject, action, scope, grant_option)
|
537
|
+
end
|
538
|
+
|
539
|
+
# @param [String] subject
|
540
|
+
# @param [String] action
|
541
|
+
# @param [String] scope
|
542
|
+
# @return [true]
|
543
|
+
def revoke_access_control(subject, action, scope)
|
544
|
+
@api.revoke_access_control(subject, action, scope)
|
545
|
+
end
|
546
|
+
|
547
|
+
# @param [String] user
|
548
|
+
# @param [String] action
|
549
|
+
# @param [String] scope
|
550
|
+
# @return [Array]
|
551
|
+
def test_access_control(user, action, scope)
|
552
|
+
@api.test_access_control(user, action, scope)
|
553
|
+
end
|
554
|
+
|
555
|
+
# => BulkLoad::Job
|
556
|
+
def bulk_load_guess(job)
|
557
|
+
@api.bulk_load_guess(job)
|
558
|
+
end
|
559
|
+
|
560
|
+
# => BulkLoad::Job
|
561
|
+
def bulk_load_preview(job)
|
562
|
+
@api.bulk_load_preview(job)
|
563
|
+
end
|
564
|
+
|
565
|
+
# => String
|
566
|
+
def bulk_load_issue(database, table, job)
|
567
|
+
@api.bulk_load_issue(database, table, job)
|
568
|
+
end
|
569
|
+
|
570
|
+
# nil -> [BulkLoad]
|
571
|
+
def bulk_load_list
|
572
|
+
@api.bulk_load_list
|
573
|
+
end
|
574
|
+
|
575
|
+
# name: String, database: String, table: String, job: BulkLoad -> BulkLoad
|
576
|
+
def bulk_load_create(name, database, table, job, opts = {})
|
577
|
+
@api.bulk_load_create(name, database, table, job, opts)
|
578
|
+
end
|
579
|
+
|
580
|
+
# name: String -> BulkLoad
|
581
|
+
def bulk_load_show(name)
|
582
|
+
@api.bulk_load_show(name)
|
583
|
+
end
|
584
|
+
|
585
|
+
# name: String, settings: Hash -> BulkLoad
|
586
|
+
def bulk_load_update(name, settings)
|
587
|
+
@api.bulk_load_update(name, settings)
|
588
|
+
end
|
589
|
+
|
590
|
+
# name: String -> BulkLoad
|
591
|
+
def bulk_load_delete(name)
|
592
|
+
@api.bulk_load_delete(name)
|
593
|
+
end
|
594
|
+
|
595
|
+
# name: String -> [Job]
|
596
|
+
def bulk_load_history(name)
|
597
|
+
@api.bulk_load_history(name)
|
598
|
+
end
|
599
|
+
|
600
|
+
def bulk_load_run(name, scheduled_time = nil)
|
601
|
+
@api.bulk_load_run(name, scheduled_time)
|
602
|
+
end
|
603
|
+
|
604
|
+
end
|
605
|
+
|
606
|
+
end # module TreasureData
|