fix cloud ibm softlayer api (#1273)
This commit is contained in:
parent
4135847a2a
commit
412f0a19f5
|
@ -186,9 +186,16 @@ sub get_endpoint {
|
|||
|
||||
my $response = $self->{http}->request(url_path => $self->{url_path} . '/' . $options{service}, method => 'POST', query_form_post => $content);
|
||||
|
||||
my $xml_hash = XMLin($response);
|
||||
my $xml_hash = XMLin($response, ForceArray => ['item']);
|
||||
|
||||
if (defined($xml_hash->{'SOAP-ENV:Body'}->{'SOAP-ENV:Fault'})) {
|
||||
$self->{output}->output_add(long_msg => "Returned message: " . $response, debug => 1);
|
||||
$self->{output}->add_option_msg(short_msg => "API returned error code '" . $xml_hash->{'SOAP-ENV:Body'}->{'SOAP-ENV:Fault'}->{faultcode} .
|
||||
"' with message '" . $xml_hash->{'SOAP-ENV:Body'}->{'SOAP-ENV:Fault'}->{faultstring} . "'");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
return $xml_hash->{'SOAP-ENV:Header'}, $xml_hash->{'SOAP-ENV:Body'};
|
||||
return $xml_hash->{'SOAP-ENV:Body'};
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -179,7 +179,7 @@ sub manage_selection {
|
|||
my $current_time = time();
|
||||
|
||||
my %status_hash;
|
||||
my (undef, $events) = $options{custom}->get_endpoint(service => 'SoftLayer_Notification_Occurrence_Event', method => 'getAllObjects', extra_content => '');
|
||||
my $events = $options{custom}->get_endpoint(service => 'SoftLayer_Notification_Occurrence_Event', method => 'getAllObjects', extra_content => '');
|
||||
foreach my $event (@{$events->{'ns1:getAllObjectsResponse'}->{'getAllObjectsReturn'}->{'item'}}) {
|
||||
my $status;
|
||||
$status = $event->{statusCode}->{name}->{content} if (defined($event->{statusCode}->{name}->{content}));
|
||||
|
@ -192,7 +192,7 @@ sub manage_selection {
|
|||
<id>' . $event->{id}->{content} . '</id>
|
||||
</slapi:SoftLayer_Notification_Occurrence_EventInitParameters>';
|
||||
|
||||
my (undef, $ressources) = $options{custom}->get_endpoint(service => 'SoftLayer_Notification_Occurrence_Event', method => 'getImpactedResources', extra_content => $extra_content);
|
||||
my $ressources = $options{custom}->get_endpoint(service => 'SoftLayer_Notification_Occurrence_Event', method => 'getImpactedResources', extra_content => $extra_content);
|
||||
my $items = 0;
|
||||
if (defined($ressources->{'ns1:getImpactedResourcesResponse'}->{'getImpactedResourcesReturn'}->{'item'})) {
|
||||
$items = 1;
|
||||
|
|
|
@ -156,7 +156,7 @@ sub manage_selection {
|
|||
|
||||
my $group_id = '';
|
||||
my %groups_hash;
|
||||
my (undef, $groups) = $options{custom}->get_endpoint(service => 'SoftLayer_Ticket', method => 'getAllTicketGroups', extra_content => '');
|
||||
my $groups = $options{custom}->get_endpoint(service => 'SoftLayer_Ticket', method => 'getAllTicketGroups', extra_content => '');
|
||||
foreach my $group (@{$groups->{'ns1:getAllTicketGroupsResponse'}->{'getAllTicketGroupsReturn'}->{'item'}}) {
|
||||
$groups_hash{$group->{id}->{content}} = $group->{name}->{content};
|
||||
|
||||
|
@ -173,7 +173,7 @@ sub manage_selection {
|
|||
|
||||
my $current_time = time();
|
||||
|
||||
my (undef, $tickets) = $options{custom}->get_endpoint(service => 'SoftLayer_Account', method => 'getOpenTickets', extra_content => '');
|
||||
my $tickets = $options{custom}->get_endpoint(service => 'SoftLayer_Account', method => 'getOpenTickets', extra_content => '');
|
||||
foreach my $ticket (@{$tickets->{'ns1:getOpenTicketsResponse'}->{'getOpenTicketsReturn'}->{'item'}}) {
|
||||
next if (defined($group_id) && $group_id ne '' && $ticket->{groupId}->{content} ne $group_id);
|
||||
|
||||
|
|
Loading…
Reference in New Issue