]>
Commit | Line | Data |
---|---|---|
5460050d WL |
1 | package PVE::ACME::Challenge; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
762af3b1 WL |
6 | use PVE::JSONSchema qw(get_standard_option); |
7 | ||
8 | use base qw(PVE::SectionConfig); | |
9 | ||
10 | my $defaultData = { | |
11 | additionalProperties => 0, | |
12 | propertyList => { | |
13 | id => { | |
14 | description => "ACME Plugin ID name", | |
15 | type => 'string', | |
16 | }, | |
17 | type => { | |
18 | description => "ACME challenge type.", | |
19 | type => 'string', | |
20 | }, | |
21 | disable => { | |
22 | description => "Flag to disable the config.", | |
23 | type => 'boolean', | |
24 | optional => 1, | |
25 | }, | |
26 | nodes => get_standard_option('pve-node-list', { optional => 1 }), | |
27 | }, | |
28 | }; | |
29 | ||
30 | sub private { | |
31 | return $defaultData; | |
32 | } | |
33 | ||
5460050d WL |
34 | sub supported_challenge_types { |
35 | return {}; | |
36 | } | |
37 | ||
762af3b1 WL |
38 | sub extract_challenge { |
39 | my ($self, $challenges, $c_type) = @_; | |
40 | ||
41 | die "no challenges defined\n" if !$challenges; | |
42 | die "no challenge type is defined \n" if !$c_type; | |
43 | ||
44 | my $tmp_challenges = [ grep {$_->{type} eq $c_type} @$challenges ]; | |
45 | die "no $c_type challenge defined in authorization\n" | |
46 | if ! scalar $tmp_challenges; | |
47 | ||
48 | my $challenge = $tmp_challenges->[0]; | |
49 | ||
50 | return $challenge; | |
51 | } | |
52 | ||
53 | sub get_subplugins { | |
54 | return []; | |
55 | } | |
56 | ||
5460050d WL |
57 | sub setup { |
58 | my ($class, $acme, $authorization) = @_; | |
59 | ||
60 | die "implement me\n"; | |
61 | } | |
62 | ||
63 | sub teardown { | |
64 | my ($self) = @_; | |
65 | ||
66 | die "implement me\n"; | |
67 | } | |
68 | ||
69 | 1; |