-
Notifications
You must be signed in to change notification settings - Fork 0
/
metadata.cr
35 lines (30 loc) · 996 Bytes
/
metadata.cr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require "../endpoint"
require "../../metadata"
class Pdns::API
module Endpoints
class Metadata < Endpoint
# Get all the Metadata associated with the zone.
def list : Array(Pdns::Metadata)
get("/", Array(Pdns::Metadata))
end
# Creates a set of metadata entries
def create(metadata : Pdns::Metadata) : Void
post("/", Nil, metadata, Nil)
end
# Get the content of a single kind of domain metadata as a Metadata object.
def get(kind : String) : Pdns::Metadata
get("/#{kind}", Pdns::Metadata)
end
# Replace the content of a single kind of domain metadata.
def edit(kind : String, &block : Pdns::Metadata ->) : Pdns::Metadata
metadata = get(kind)
yield metadata
put("/#{kind}", Pdns::Metadata, metadata)
end
# Delete all items of a single kind of domain metadata.
def delete(kind : String) : Void
delete("/#{kind}", String)
end
end
end
end