(plugin) cloud::talend::tmc - fix tasks id endpoint method (#4136)
This commit is contained in:
parent
37c265fa0f
commit
e6b77888b8
|
@ -324,7 +324,7 @@ sub get_tasks_execution {
|
|||
if (defined($self->{option_results}->{cache_use}) && !defined($options{disable_cache})
|
||||
&& !(defined($options{taskId}) && $options{taskId} ne ''));
|
||||
return $self->request_api(
|
||||
method => 'POST',
|
||||
method => (defined($options{taskId}) && $options{taskId} ne '') ? 'GET' : 'POST',
|
||||
endpoint => (defined($options{taskId}) && $options{taskId} ne '') ?
|
||||
'/processing/executables/tasks/' . $options{taskId} . '/executions' : '/processing/executables/tasks/executions',
|
||||
body => {
|
||||
|
|
|
@ -145,7 +145,7 @@ sub request {
|
|||
$self->{output}->add_option_msg(short_msg => "API returns empty content [code: '" . $self->{http}->get_code() . "'] [message: '" . $self->{http}->get_message() . "']");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
|
||||
my $decoded;
|
||||
eval {
|
||||
$decoded = JSON::XS->new->utf8->decode($content);
|
||||
|
@ -174,11 +174,11 @@ sub query {
|
|||
post_param => ['q=' . $query]
|
||||
);
|
||||
|
||||
if (defined($results->{results}[0]->{error})) {
|
||||
$self->{output}->add_option_msg(short_msg => "API returns error '" . $results->{results}[0]->{error} . "'");
|
||||
if (defined($results->{results}->[0]->{error})) {
|
||||
$self->{output}->add_option_msg(short_msg => "API returns error '" . $results->{results}->[0]->{error} . "'");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
push @{$data}, @{$results->{results}[0]->{series}} if (defined($results->{results}[0]->{series}));
|
||||
push @$data, @{$results->{results}->[0]->{series}} if (defined($results->{results}->[0]->{series}));
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
|
|
@ -125,11 +125,11 @@ sub check_options {
|
|||
foreach my $query (@{$self->{option_results}->{query}}) {
|
||||
next if ($query !~ /^(.*?),(.*)$/);
|
||||
$self->{queries}->{$1} = $2;
|
||||
push @{$self->{maps_counters}->{queries_results}[0]->{set}->{key_values}}, { name => $1 };
|
||||
push @{$self->{maps_counters}->{queries_results}->[0]->{set}->{key_values}}, { name => $1 };
|
||||
push @{$self->{custom_keys}}, $1;
|
||||
}
|
||||
|
||||
$self->{maps_counters_type}[0]->{message_multiple} = $self->{option_results}->{multiple_output} if (defined($self->{option_results}->{multiple_output}));
|
||||
$self->{maps_counters_type}->[0]->{message_multiple} = $self->{option_results}->{multiple_output} if (defined($self->{option_results}->{multiple_output}));
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
@ -145,14 +145,15 @@ sub manage_selection {
|
|||
push @queries, $self->{queries}->{$label};
|
||||
|
||||
my $queries_results = $options{custom}->query(queries => \@queries);
|
||||
|
||||
foreach my $result (@$queries_results) {
|
||||
next if (!defined($result->{tags}->{ $self->{option_results}->{instance} }));
|
||||
|
||||
foreach my $result (@{$queries_results}) {
|
||||
next if (!defined($result->{tags}->{$self->{option_results}->{instance}}));
|
||||
my ($column_index) = grep { $result->{columns}[$_] eq $self->{custom_keys}[$query_index] } (0 .. @{$result->{columns}} - 1);
|
||||
my ($column_index) = grep { $result->{columns}->[$_] eq $self->{custom_keys}->[$query_index] } (0 .. @{$result->{columns}} - 1);
|
||||
my $value;
|
||||
$value = $options{custom}->compute(aggregation => $self->{option_results}->{aggregation}, values => $result->{values}, column => $column_index) if (defined($result->{values}));
|
||||
$self->{queries_results}->{$result->{tags}->{$self->{option_results}->{instance}}}->{instance} = $result->{tags}->{$self->{option_results}->{instance}};
|
||||
$self->{queries_results}->{$result->{tags}->{$self->{option_results}->{instance}}}->{$result->{columns}[$column_index]} = $value;
|
||||
$self->{queries_results}->{ $result->{tags}->{ $self->{option_results}->{instance} } }->{instance} = $result->{tags}->{ $self->{option_results}->{instance} };
|
||||
$self->{queries_results}->{ $result->{tags}->{ $self->{option_results}->{instance} } }->{ $result->{columns}->[$column_index] } = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue