You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We could do that using the Atlas Search API. We would need to ask users to create an API key in MongoDB Atlas for setting up Dialog, and enter public and private key in input fields. It would be great if Atlas were an OAuth provider where we could just request this access programmatically (much like Atlas CLI does!), but it doesn't seem there is a publicly documented way to do this.
use peer\http\DigestAuthorization;
use util\Secret;
use util\cmd\Console;
use webservices\rest\Endpoint;
// From https://cloud.mongodb.com/v2/622a7a8...b1#access/apiKeys/createconstPUBLIC_KEY = 'djfeabwg';
constPRIVATE_KEY= '...';
// Set up API with DigestAuth$api= newEndpoint('https://cloud.mongodb.com/api/atlas/v1.0');
$api->with(['Authorization' => DigestAuthorization::fromChallenge(
$api->resource('.')->get()->header('WWW-Authenticate'),
PUBLIC_KEY,
newSecret(PRIVATE_KEY)
)]);
// Access clusters. This is where we would perform the setup, creating users, databases, // search indexes etcetera$r= $api->resource('clusters')->get();
Console::writeLine($r->value());
// [// links => [[// href => "https://cloud.mongodb.com/api/atlas/v1.0/clusters"// rel => "self"// ]]// results => [[// clusters => [[// alertCount => 0// authEnabled => true// availability => "available"// backupEnabled => false// clusterId => "631b94f...64"// dataSizeBytes => 0// name => "Dialog"// nodeCount => 3// sslEnabled => true// type => "replica set"// versions => ["5.0.13"]// ]]// groupId => "622a7a8...b1"// groupName => "Dialog"// orgId => "622a7a8...a5"// orgName => "Timm's Org - 2022-03-10"// planType => "Atlas"// tags => []// ]]// totalCount => 1// ]
If freshly installed:
The text was updated successfully, but these errors were encountered: