Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/Models/LoadBalancers/LoadBalancer.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,23 @@ public function deleteService(int $listenPort): ?APIResponse
return null;
}

/**
* Get Metrics for specified Load Balancer.
* @see https://docs.hetzner.cloud/#load-balancer-actions-delete-service
* @throws APIException|GuzzleException
*/
public function metrics(string $type, string $start, string $end, ?int $step = null): ?APIResponse
{
$response = $this->httpClient->get($this->replaceServerIdInUri('load_balancers/{id}/metrics?') . http_build_query(compact('type', 'start', 'end', 'step')));
if (!HetznerAPIClient::hasError($response)) {
return APIResponse::create([
'metrics' => json_decode((string)$response->getBody())->metrics,
], $response->getHeaders());
}

return null;
}

/**
* Detaches a Load Balancer from a network.
*
Expand Down