use base qw(PVE::RESTHandler);
-#TODO: drop the domain property with PMG 7.0
-
__PACKAGE__->register_method ({
name => 'index',
path => '',
type => 'object',
properties => {
destination => { type => 'string', format => 'transport-domain-or-nexthop'},
- domain => { type => 'string', format => 'transport-domain-or-nexthop'},
policy => { type => 'string', format => 'tls-policy'},
},
},
my $policies = PVE::INotify::read_file('tls_policy');
foreach my $policy (sort keys %$policies) {
- $policies->{$policy}->{domain} = $policies->{$policy}->{destination};
push @$res, $policies->{$policy};
}
parameters => {
additionalProperties => 0,
properties => {
- domain => {
- description => "Deprecated - use 'destination'.",
- type => 'string', format => 'transport-domain-or-nexthop',
- optional => 1,
- },
destination => {
description => "Destination (Domain or next-hop).",
type => 'string', format => 'transport-domain-or-nexthop',
- optional => 1,
},
policy => {
description => "TLS policy",
returns => { type => 'null' },
code => sub {
my ($param) = @_;
- my $domain = $param->{domain};
- warn "Parameter 'domain' is deprecated for DestinationTLSPolicy - use 'destination'\n"
- if defined($domain);
- my $destination = $param->{destination} // $domain;
+ my $destination = $param->{destination};
my $policy = $param->{policy};
- raise_param_exc({ destination => "No destination provided" })
- if !defined($destination);
-
my $code = sub {
my $tls_policy = PVE::INotify::read_file('tls_policy');
raise_param_exc({ destination => "DestinationTLSPolicy entry for '$destination' already exists" })
type => "object",
properties => {
destination => { type => 'string', format => 'transport-domain-or-nexthop'},
- domain => { type => 'string', format => 'transport-domain-or-nexthop'},
policy => { type => 'string', format => 'tls-policy'},
},
},
my $tls_policy = PVE::INotify::read_file('tls_policy');
if (my $entry = $tls_policy->{$destination}) {
- $entry->{domain} = $entry->{destination};
return $entry;
}