Skip to content

Commit e5f78fd

Browse files
committed
Add manifest fetch, creation check
1 parent 197a46b commit e5f78fd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/beanie/registry_api.ex

+19
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,23 @@ defmodule Beanie.RegistryAPI do
88
def tag_list(registry, repository) do
99
Registry.get(registry, [repository, "tags", "list"])
1010
end
11+
12+
def manifest(registry, repository, tag) do
13+
Registry.get(registry, [repository, "manifests", tag])
14+
end
15+
16+
def created_at_from_manifest(manifest) do
17+
manifest["history"]
18+
|> Enum.map(fn(h) ->
19+
h["v1Compatibility"]
20+
|> Poison.decode!
21+
|> Map.get("created")
22+
|> NaiveDateTime.from_iso8601!
23+
|> NaiveDateTime.to_erl
24+
end
25+
)
26+
|> Enum.sort
27+
|> List.last
28+
|> NaiveDateTime.from_erl!
29+
end
1130
end

0 commit comments

Comments
 (0)