oso-cloud 1.4.0.dev.0 → 1.4.0.dev.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bccf4bc9bf1950fba9c250563971c55f3f2be4299677adf9fb1eeadedc5b6e90
4
- data.tar.gz: 56572baaeafefc78940e4c3c688e2d7d8dc71cf81ad91246ab89f237a9925f50
3
+ metadata.gz: 7909947d74e0e8a03b13d9d1741560c6dd6537de2dbb2b3b77ef97b320e3a1a2
4
+ data.tar.gz: bdbdf26e703535dd4fd52a05ac6454a51a7cf204a9c365333c5b9c8246973cc8
5
5
  SHA512:
6
- metadata.gz: 6c3d2b3bcfaff463c156bb2b50341a2350e81d39264d2bcac50fd917f849208f8ba5eb8a5b7335f18bad3604d6d57bb9b12305d10ca4126fa07ecf94e6741a7f
7
- data.tar.gz: d0025b3196aadf1dc3d04ca8a7a8cbce61d31fd6ba18b2dd8ec9ab3b185542c668c985e7ab8545697a86ec9d32c22afacdad97c65dcfcc8b7c738f4b959ab3ea
6
+ metadata.gz: 7966031165d172979505d5f1c513445427b2950ff50fa7eccda9933174e32f4fbf8ea5fdff1d77a70a195124a7c6864136e1819b8ad0fda98da1285aa93dc1ff
7
+ data.tar.gz: 833fcf6b1cb18a83c53b39f3d5f6179b4895d6899189852423574f8f29843f94bdc29f148548c9f3eee6ed8c38fa897c763cbd83d959aaccc355c75c5091dc13
data/lib/oso/api.rb CHANGED
@@ -367,6 +367,12 @@ module OsoCloud
367
367
  results.map { |result| ActionsResult.new(**result.body) }
368
368
  end
369
369
 
370
+ def post_bulk_actions(data)
371
+ url = '/bulk_actions'
372
+ results = POST(url, nil, data, false)
373
+ results.map { |result| ActionsResult.new(**result) }
374
+ end
375
+
370
376
  def post_query(data)
371
377
  url = '/query'
372
378
  result = POST(url, nil, data, false)
data/lib/oso/oso.rb CHANGED
@@ -303,6 +303,38 @@ module OsoCloud
303
303
  end
304
304
  @api.post_actions_batch(data).map { |result| result.results}
305
305
  end
306
+
307
+ ##
308
+ # List authorized actions for a batch of queries
309
+ #
310
+ # Fetches a list of actions which an actor can perform on a particular resource.
311
+ #
312
+ # @param actor [OsoCloud::Value]
313
+ # @param queries [Array<OsoCloud::Value>] | Array<[OsoCloud::Value, Array<fact>]>
314
+ # @return [Array<Array<String>>]
315
+ # @see Oso for more information about facts
316
+ def bulk_actions(actor, queries:)
317
+ actor_typed_id = actor.to_api_value
318
+ data = queries.map do |q|
319
+ context_facts = []
320
+ resource = nil
321
+ if (q.is_a?(Array))
322
+ resource = q[0]
323
+ context_facts = q[1]
324
+ else
325
+ resource = q
326
+ end
327
+ resource_typed_id = resource.to_api_value
328
+ OsoCloud::Core::ActionsQuery.new(
329
+ actor_type: actor_typed_id.type,
330
+ actor_id: actor_typed_id.id,
331
+ resource_type: resource_typed_id.type,
332
+ resource_id: resource_typed_id.id,
333
+ context_facts: OsoCloud::Helpers.params_to_facts(context_facts)
334
+ )
335
+ end
336
+ @api.post_bulk_actions(data).map { |result| result.results}
337
+ end
306
338
  end
307
339
 
308
340
  end
data/lib/oso/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module OsoCloud
2
- VERSION = '1.4.0.dev.0'.freeze
2
+ VERSION = '1.4.0.dev.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oso-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0.dev.0
4
+ version: 1.4.0.dev.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oso Security, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-09 00:00:00.000000000 Z
11
+ date: 2023-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday