-
Notifications
You must be signed in to change notification settings - Fork 1
/
rkServiceAccount.php
37 lines (27 loc) · 1.04 KB
/
rkServiceAccount.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
// Include section
include_once "rkFramework.php";
// Rubrik cluster connection settings
$clusterConnect=array(
"username" => "User:::c72[...]be5a-d365eb6ca2cc",
"password" => "XKZGDdKffffff999999999ffffff99999",
"ip" => "1.2.3.4"
);
// ===========================================
// Main Entry Point
// ===========================================
// Note : authentication for issuing any API call must be done using the "bearer <token>" format rather than using <username> <password> anymore
// Example, retieving cluster upgrade history :
$authToken=rkGetServiceAccountToken($clusterConnect);
if($authToken) $clusterConnect["token"]=$authToken;
else
{
print("Error accessing cluster, check credentials.\n\n");
exit();
}
print("Session started -> ".$authToken."\n");
var_dump(rkGetUpgradeHistory($clusterConnect));
$deleted=rkDelServiceAccountToken($clusterConnect,$clusterConnect["token"]);
if($deleted) print("Session cleaned up.\n\n");
else print("Session was not deleted successfully, please check CDM logs");
?>