You are here

public function LockrAdmin::getUsageSummary in Lockr 7.3

Gets a summary of secret usage.

Parameters

DateTime $start:

DateTime $end:

Return value

array

File

vendor/lockr/lockr/src/LockrAdmin.php, line 136

Class

LockrAdmin

Namespace

Lockr

Code

public function getUsageSummary(DateTime $start, DateTime $end) {
  $query = <<<'EOQ'
query Usage($from: DateTime!, $to: DateTime!) {
    admin {
        usageSummary(from: $from, to: $to) {
            month
            usage
            version {
                env
                secret {
                    id
                    name
                    label
                    keyring {
                        id
                    }
                }
            }
        }
    }
}
EOQ;
  $data = $this->client
    ->query([
    'query' => $query,
    'variables' => [
      'from' => $start
        ->format(DateTime::RFC3339),
      'to' => $end
        ->format(DateTime::RFC3339),
    ],
  ]);
  return $data['admin']['usageSummary'];
}