-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathrsa_key_pair.rb
More file actions
46 lines (36 loc) · 871 Bytes
/
rsa_key_pair.rb
File metadata and controls
46 lines (36 loc) · 871 Bytes
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
36
37
38
39
40
41
42
43
44
45
46
# frozen_string_literal: true
module NetboxClientRuby
module Secrets
class RSAKeyPair
include Communication
PATH = '/api/secrets/generate-rsa-key-pair/'
def public_key
get['public_key']
end
def private_key
get['private_key']
end
def reload
@response = nil
end
private
def get
if authorization_token
@response ||= response connection.get(PATH)
else
raise NetboxClientRuby::Error::LocalError,
"The authorization_token has not been configured, but it's required for get-session-key."
end
end
def authorization_token
auth_config.token
end
def auth_config
netbox_config.auth
end
def netbox_config
NetboxClientRuby.config.netbox
end
end
end
end