Class: Rafflesia::ObjectArtifacts

Inherits:
Object
  • Object
show all
Defined in:
lib/rafflesia/object_artifacts.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ObjectArtifacts

Returns a new instance of ObjectArtifacts.



9
10
11
# File 'lib/rafflesia/object_artifacts.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#contract(request_options: {}) ⇒ Rafflesia::EnvelopeObjectArtifactContractData

GET /v1/object-artifacts/contract

Parameters:

  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rafflesia/object_artifacts.rb', line 16

def contract(request_options: {})
  response = @client.request(
    method: :get,
    path: '/v1/object-artifacts/contract',
    auth: true,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeObjectArtifactContractData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#evict(dry_run: nil, manifest_object_id: nil, manifest_path: nil, max_bytes: nil, policy: nil, shards: nil, target_dir: nil, request_options: {}) ⇒ Rafflesia::EnvelopeObjectArtifactCacheEvictData

POST /v1/object-artifacts/evict

Parameters:

  • dry_run (Boolean, nil) (defaults to: nil)

    List cache files without deleting them

  • manifest_object_id (String, nil) (defaults to: nil)

    Neutral object-artifact manifest object id

  • manifest_path (String, nil) (defaults to: nil)

    Local neutral object-artifact manifest path

  • max_bytes (Integer, nil) (defaults to: nil)

    If positive, evict oldest selected cache files until selected cache bytes are less than or equal to this limit. Zero evicts every selected file.

  • policy (Rafflesia::CacheEvictionPolicy, nil) (defaults to: nil)

    Optional cache policy for TTL and pinned-path eviction controls.

  • shards (Array<String>, nil) (defaults to: nil)

    Optional shard ids to evict; empty evicts every shard

  • target_dir (String, nil) (defaults to: nil)

    Local object-artifact cache root

  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/rafflesia/object_artifacts.rb', line 38

def evict(
  dry_run: nil,
  manifest_object_id: nil,
  manifest_path: nil,
  max_bytes: nil,
  policy: nil,
  shards: nil,
  target_dir: nil,
  request_options: {}
)
  body = {
    'dry_run' => dry_run,
    'manifest_object_id' => manifest_object_id,
    'manifest_path' => manifest_path,
    'max_bytes' => max_bytes,
    'policy' => policy,
    'shards' => shards,
    'target_dir' => target_dir
  }.compact
  response = @client.request(
    method: :post,
    path: '/v1/object-artifacts/evict',
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeObjectArtifactCacheEvictData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#inspect(manifest_object_id: nil, manifest_path: nil, shards: nil, target_dir: nil, request_options: {}) ⇒ Rafflesia::EnvelopeObjectArtifactCacheInspectData

POST /v1/object-artifacts/inspect

Parameters:

  • manifest_object_id (String, nil) (defaults to: nil)

    Neutral object-artifact manifest object id

  • manifest_path (String, nil) (defaults to: nil)

    Local neutral object-artifact manifest path

  • shards (Array<String>, nil) (defaults to: nil)

    Optional shard ids to inspect; empty inspects every shard

  • target_dir (String, nil) (defaults to: nil)

    Local object-artifact cache root

  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/rafflesia/object_artifacts.rb', line 76

def inspect(
  manifest_object_id: nil,
  manifest_path: nil,
  shards: nil,
  target_dir: nil,
  request_options: {}
)
  body = {
    'manifest_object_id' => manifest_object_id,
    'manifest_path' => manifest_path,
    'shards' => shards,
    'target_dir' => target_dir
  }.compact
  response = @client.request(
    method: :post,
    path: '/v1/object-artifacts/inspect',
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeObjectArtifactCacheInspectData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#materialize(manifest_object_id: nil, manifest_path: nil, shards: nil, target_dir: nil, verify: nil, request_options: {}) ⇒ Rafflesia::EnvelopeObjectArtifactMaterializeData

POST /v1/object-artifacts/materialize

Parameters:

  • manifest_object_id (String, nil) (defaults to: nil)

    Neutral object-artifact manifest object id

  • manifest_path (String, nil) (defaults to: nil)

    Local neutral object-artifact manifest path

  • shards (Array<String>, nil) (defaults to: nil)

    Optional shard ids to materialize; empty materializes every shard

  • target_dir (String, nil) (defaults to: nil)

    Local object-artifact cache root

  • verify (Boolean, nil) (defaults to: nil)

    Verify materialized files by SHA-256

  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/rafflesia/object_artifacts.rb', line 109

def materialize(
  manifest_object_id: nil,
  manifest_path: nil,
  shards: nil,
  target_dir: nil,
  verify: nil,
  request_options: {}
)
  body = {
    'manifest_object_id' => manifest_object_id,
    'manifest_path' => manifest_path,
    'shards' => shards,
    'target_dir' => target_dir,
    'verify' => verify
  }.compact
  response = @client.request(
    method: :post,
    path: '/v1/object-artifacts/materialize',
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeObjectArtifactMaterializeData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end