summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorHugh Tong <hugh.tong@mongodb.com>2022-07-26 19:20:58 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-26 21:00:49 +0000
commit044d2f734e0dba40b9dfb02cc49c2bff8f575cd5 (patch)
treeeb2d17564a0c99d2ee9ea3d2f95c81c46bcfcee1 /src/mongo/shell
parent921bba175902f9b9f29751a466383c3d7e80df7b (diff)
downloadmongo-044d2f734e0dba40b9dfb02cc49c2bff8f575cd5.tar.gz
SERVER-67824 Rename IDLParserErrorContext to IDLParserContext
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/bench.cpp5
-rw-r--r--src/mongo/shell/encrypted_dbclient_base.cpp6
-rw-r--r--src/mongo/shell/kms.cpp4
-rw-r--r--src/mongo/shell/kms_aws.cpp12
-rw-r--r--src/mongo/shell/kms_azure.cpp11
-rw-r--r--src/mongo/shell/kms_gcp.cpp16
-rw-r--r--src/mongo/shell/kms_local.cpp2
-rw-r--r--src/mongo/shell/kms_network.cpp5
-rw-r--r--src/mongo/shell/kms_test.cpp2
9 files changed, 30 insertions, 33 deletions
diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp
index e1a0616b9fd..2ca618d4e5f 100644
--- a/src/mongo/shell/bench.cpp
+++ b/src/mongo/shell/bench.cpp
@@ -630,7 +630,7 @@ BenchRunOp opFromBson(const BSONObj& op) {
ReadPreference mode;
try {
- mode = ReadPreference_parse(IDLParserErrorContext("mode"), arg.str());
+ mode = ReadPreference_parse(IDLParserContext("mode"), arg.str());
} catch (DBException& e) {
e.addContext("benchRun(): Could not parse readPrefMode argument");
throw;
@@ -900,8 +900,7 @@ void BenchRunWorker::generateLoadOnConnection(DBClientBase* conn) {
str::stream() << "Unable to create session due to error " << result,
conn->runCommand("admin", BSON("startSession" << 1), result));
- lsid.emplace(
- LogicalSessionIdToClient::parse(IDLParserErrorContext("lsid"), result["id"].Obj()));
+ lsid.emplace(LogicalSessionIdToClient::parse(IDLParserContext("lsid"), result["id"].Obj()));
}
BenchRunOp::State opState(&_rng, &bsonTemplateEvaluator, &_statsBlackHole);
diff --git a/src/mongo/shell/encrypted_dbclient_base.cpp b/src/mongo/shell/encrypted_dbclient_base.cpp
index 115df4940cf..3c90565d355 100644
--- a/src/mongo/shell/encrypted_dbclient_base.cpp
+++ b/src/mongo/shell/encrypted_dbclient_base.cpp
@@ -527,7 +527,7 @@ boost::optional<EncryptedFieldConfig> EncryptedDBClientBase::getEncryptedFieldCo
if (efc.eoo() || !efc.isABSONObj()) {
return boost::none;
}
- return EncryptedFieldConfig::parse(IDLParserErrorContext("encryptedFields"), efc.Obj());
+ return EncryptedFieldConfig::parse(IDLParserContext("encryptedFields"), efc.Obj());
}
void EncryptedDBClientBase::compact(JSContext* cx, JS::CallArgs args) {
@@ -674,7 +674,7 @@ SecureVector<uint8_t> EncryptedDBClientBase::getKeyMaterialFromDisk(const UUID&
uasserted(ErrorCodes::BadValue, "Invalid keyID.");
}
- auto keyStoreRecord = KeyStoreRecord::parse(IDLParserErrorContext("root"), dataKeyObj);
+ auto keyStoreRecord = KeyStoreRecord::parse(IDLParserContext("root"), dataKeyObj);
if (dataKeyObj.hasField("version"_sd)) {
uassert(ErrorCodes::BadValue,
"Invalid version, must be either 0 or undefined",
@@ -813,7 +813,7 @@ std::unique_ptr<DBClientBase> createEncryptedDBClientBase(std::unique_ptr<DBClie
arg.isObject());
const BSONObj obj = mozjs::ValueWriter(cx, arg).toBSON();
- encryptionOptions = encryptionOptions.parse(IDLParserErrorContext("root"), obj);
+ encryptionOptions = encryptionOptions.parse(IDLParserContext("root"), obj);
// IDL does not perform a deep copy of BSONObjs when parsing, so we must get an
// owned copy of the schemaMap.
diff --git a/src/mongo/shell/kms.cpp b/src/mongo/shell/kms.cpp
index 4bea437a267..792be3ab1f3 100644
--- a/src/mongo/shell/kms.cpp
+++ b/src/mongo/shell/kms.cpp
@@ -75,7 +75,7 @@ void KMSServiceController::registerFactory(KMSProviderEnum provider,
std::unique_ptr<KMSService> KMSServiceController::createFromClient(StringData kmsProvider,
const BSONObj& config) {
KMSProviderEnum provider =
- KMSProvider_parse(IDLParserErrorContext("client fle options"), kmsProvider);
+ KMSProvider_parse(IDLParserContext("client fle options"), kmsProvider);
auto service = _factories.at(provider)->create(config);
uassert(51192, str::stream() << "Cannot find client kms provider " << kmsProvider, service);
@@ -85,7 +85,7 @@ std::unique_ptr<KMSService> KMSServiceController::createFromClient(StringData km
std::unique_ptr<KMSService> KMSServiceController::createFromDisk(const BSONObj& config,
const BSONObj& masterKey) {
auto providerObj = masterKey.getStringField("provider"_sd);
- auto provider = KMSProvider_parse(IDLParserErrorContext("root"), providerObj);
+ auto provider = KMSProvider_parse(IDLParserContext("root"), providerObj);
auto service = _factories.at(provider)->create(config);
uassert(51193, str::stream() << "Cannot find disk kms provider " << providerObj, service);
return service;
diff --git a/src/mongo/shell/kms_aws.cpp b/src/mongo/shell/kms_aws.cpp
index 493fc482d1c..f0a7850cbfa 100644
--- a/src/mongo/shell/kms_aws.cpp
+++ b/src/mongo/shell/kms_aws.cpp
@@ -182,7 +182,7 @@ std::vector<uint8_t> AWSKMSService::encrypt(ConstDataRange cdr, StringData kmsKe
if (!field.eoo()) {
AwsKMSError awsResponse;
try {
- awsResponse = AwsKMSError::parse(IDLParserErrorContext("awsEncryptError"), obj);
+ awsResponse = AwsKMSError::parse(IDLParserContext("awsEncryptError"), obj);
} catch (DBException& dbe) {
uasserted(51274,
str::stream() << "AWS KMS failed to parse error message: " << dbe.toString()
@@ -194,7 +194,7 @@ std::vector<uint8_t> AWSKMSService::encrypt(ConstDataRange cdr, StringData kmsKe
<< awsResponse.getMessage());
}
- auto awsResponse = AwsEncryptResponse::parse(IDLParserErrorContext("awsEncryptResponse"), obj);
+ auto awsResponse = AwsEncryptResponse::parse(IDLParserContext("awsEncryptResponse"), obj);
auto blobStr = base64::decode(awsResponse.getCiphertextBlob().toString());
@@ -218,7 +218,7 @@ BSONObj AWSKMSService::encryptDataKeyByString(ConstDataRange cdr, StringData key
}
SecureVector<uint8_t> AWSKMSService::decrypt(ConstDataRange cdr, BSONObj masterKey) {
- auto awsMasterKey = AwsMasterKey::parse(IDLParserErrorContext("awsMasterKey"), masterKey);
+ auto awsMasterKey = AwsMasterKey::parse(IDLParserContext("awsMasterKey"), masterKey);
auto request = UniqueKmsRequest(kms_decrypt_request_new(
reinterpret_cast<const uint8_t*>(cdr.data()), cdr.length(), nullptr));
@@ -243,7 +243,7 @@ SecureVector<uint8_t> AWSKMSService::decrypt(ConstDataRange cdr, BSONObj masterK
if (!field.eoo()) {
AwsKMSError awsResponse;
try {
- awsResponse = AwsKMSError::parse(IDLParserErrorContext("awsDecryptError"), obj);
+ awsResponse = AwsKMSError::parse(IDLParserContext("awsDecryptError"), obj);
} catch (DBException& dbe) {
uasserted(51275,
str::stream() << "AWS KMS failed to parse error message: " << dbe.toString()
@@ -255,7 +255,7 @@ SecureVector<uint8_t> AWSKMSService::decrypt(ConstDataRange cdr, BSONObj masterK
<< awsResponse.getMessage());
}
- auto awsResponse = AwsDecryptResponse::parse(IDLParserErrorContext("awsDecryptResponse"), obj);
+ auto awsResponse = AwsDecryptResponse::parse(IDLParserContext("awsDecryptResponse"), obj);
auto blobStr = base64::decode(awsResponse.getPlaintext().toString());
@@ -307,7 +307,7 @@ public:
return nullptr;
}
auto obj = field.Obj();
- return AWSKMSService::create(AwsKMS::parse(IDLParserErrorContext("root"), obj));
+ return AWSKMSService::create(AwsKMS::parse(IDLParserContext("root"), obj));
}
};
diff --git a/src/mongo/shell/kms_azure.cpp b/src/mongo/shell/kms_azure.cpp
index 410961deb86..1673f966396 100644
--- a/src/mongo/shell/kms_azure.cpp
+++ b/src/mongo/shell/kms_azure.cpp
@@ -194,7 +194,7 @@ std::unique_ptr<uint8_t, decltype(std::free)*> AzureKMSService::makeRequest(
AzureKMSError azureResponse;
try {
azureResponse =
- AzureKMSError::parse(IDLParserErrorContext("azureError"), obj["error"].Obj());
+ AzureKMSError::parse(IDLParserContext("azureError"), obj["error"].Obj());
} catch (DBException& dbe) {
uasserted(5265102,
"Azure KMS failed to parse error message: {}, Response : {}"_format(
@@ -206,7 +206,7 @@ std::unique_ptr<uint8_t, decltype(std::free)*> AzureKMSService::makeRequest(
azureResponse.getMessage()));
}
- auto azureResponse = AzureResponseT::parse(IDLParserErrorContext("azureResponse"), obj);
+ auto azureResponse = AzureResponseT::parse(IDLParserContext("azureResponse"), obj);
auto b64Url = azureResponse.getValue().toString();
std::unique_ptr<uint8_t, decltype(std::free)*> raw_str(
@@ -218,7 +218,7 @@ std::unique_ptr<uint8_t, decltype(std::free)*> AzureKMSService::makeRequest(
SecureVector<uint8_t> AzureKMSService::decrypt(ConstDataRange cdr, BSONObj masterKey) {
- auto azureMasterKey = AzureMasterKey::parse(IDLParserErrorContext("azureMasterKey"), masterKey);
+ auto azureMasterKey = AzureMasterKey::parse(IDLParserContext("azureMasterKey"), masterKey);
StringData bearerToken = _oauthService->getBearerToken();
HostAndPort keyVaultEndpoint = parseEndpoint(azureMasterKey.getKeyVaultEndpoint());
@@ -241,8 +241,7 @@ SecureVector<uint8_t> AzureKMSService::decrypt(ConstDataRange cdr, BSONObj maste
BSONObj AzureKMSService::encryptDataKeyByBSONObj(ConstDataRange cdr, BSONObj keyId) {
StringData bearerToken = _oauthService->getBearerToken();
- AzureMasterKey masterKey =
- AzureMasterKey::parse(IDLParserErrorContext("azureMasterKey"), keyId);
+ AzureMasterKey masterKey = AzureMasterKey::parse(IDLParserContext("azureMasterKey"), keyId);
HostAndPort keyVaultEndpoint = parseEndpoint(masterKey.getKeyVaultEndpoint());
@@ -287,7 +286,7 @@ public:
field.type() == BSONType::Object);
auto obj = field.Obj();
- return AzureKMSService::create(AzureKMS::parse(IDLParserErrorContext("root"), obj));
+ return AzureKMSService::create(AzureKMS::parse(IDLParserContext("root"), obj));
}
};
diff --git a/src/mongo/shell/kms_gcp.cpp b/src/mongo/shell/kms_gcp.cpp
index beb06ae9c89..dfe439bd85e 100644
--- a/src/mongo/shell/kms_gcp.cpp
+++ b/src/mongo/shell/kms_gcp.cpp
@@ -166,7 +166,7 @@ private:
std::vector<uint8_t> GCPKMSService::encrypt(ConstDataRange cdr, const BSONObj& kmsKeyId) {
StringData bearerToken = _oauthService->getBearerToken();
- GcpMasterKey masterKey = GcpMasterKey::parse(IDLParserErrorContext("gcpMasterKey"), kmsKeyId);
+ GcpMasterKey masterKey = GcpMasterKey::parse(IDLParserContext("gcpMasterKey"), kmsKeyId);
auto request = UniqueKmsRequest(kms_gcp_request_encrypt_new(
_server.host().c_str(),
@@ -195,7 +195,7 @@ std::vector<uint8_t> GCPKMSService::encrypt(ConstDataRange cdr, const BSONObj& k
GcpKMSError gcpResponse;
try {
gcpResponse =
- GcpKMSError::parse(IDLParserErrorContext("gcpEncryptError"), obj["error"].Obj());
+ GcpKMSError::parse(IDLParserContext("gcpEncryptError"), obj["error"].Obj());
} catch (DBException& dbe) {
uasserted(5265005,
str::stream() << "GCP KMS failed to parse error message: " << dbe.toString()
@@ -207,7 +207,7 @@ std::vector<uint8_t> GCPKMSService::encrypt(ConstDataRange cdr, const BSONObj& k
<< gcpResponse.getStatus() << " : " << gcpResponse.getMessage());
}
- auto gcpResponce = GcpEncryptResponse::parse(IDLParserErrorContext("gcpEncryptResponse"), obj);
+ auto gcpResponce = GcpEncryptResponse::parse(IDLParserContext("gcpEncryptResponse"), obj);
auto blobStr = base64::decode(gcpResponce.getCiphertext());
@@ -215,7 +215,7 @@ std::vector<uint8_t> GCPKMSService::encrypt(ConstDataRange cdr, const BSONObj& k
}
SecureVector<uint8_t> GCPKMSService::decrypt(ConstDataRange cdr, BSONObj masterKey) {
- auto gcpMasterKey = GcpMasterKey::parse(IDLParserErrorContext("gcpMasterKey"), masterKey);
+ auto gcpMasterKey = GcpMasterKey::parse(IDLParserContext("gcpMasterKey"), masterKey);
StringData bearerToken = _oauthService->getBearerToken();
auto request =
@@ -242,7 +242,7 @@ SecureVector<uint8_t> GCPKMSService::decrypt(ConstDataRange cdr, BSONObj masterK
GcpKMSError gcpResponse;
try {
gcpResponse =
- GcpKMSError::parse(IDLParserErrorContext("gcpDecryptError"), obj["error"].Obj());
+ GcpKMSError::parse(IDLParserContext("gcpDecryptError"), obj["error"].Obj());
} catch (DBException& dbe) {
uasserted(5265007,
str::stream() << "GCP KMS failed to parse error message: " << dbe.toString()
@@ -254,7 +254,7 @@ SecureVector<uint8_t> GCPKMSService::decrypt(ConstDataRange cdr, BSONObj masterK
<< gcpResponse.getStatus() << " : " << gcpResponse.getMessage());
}
- auto gcpResponce = GcpDecryptResponse::parse(IDLParserErrorContext("gcpDecryptResponse"), obj);
+ auto gcpResponce = GcpDecryptResponse::parse(IDLParserContext("gcpDecryptResponse"), obj);
auto blobStr = base64::decode(gcpResponce.getPlaintext());
@@ -264,7 +264,7 @@ SecureVector<uint8_t> GCPKMSService::decrypt(ConstDataRange cdr, BSONObj masterK
BSONObj GCPKMSService::encryptDataKeyByBSONObj(ConstDataRange cdr, BSONObj keyId) {
auto dataKey = encrypt(cdr, keyId);
- GcpMasterKey masterKey = GcpMasterKey::parse(IDLParserErrorContext("gcpMasterKey"), keyId);
+ GcpMasterKey masterKey = GcpMasterKey::parse(IDLParserContext("gcpMasterKey"), keyId);
GcpMasterKeyAndMaterial keyAndMaterial;
keyAndMaterial.setKeyMaterial(std::move(dataKey));
@@ -324,7 +324,7 @@ public:
"Misconfigured GCP KMS Config: {}"_format(field.toString()),
field.type() == BSONType::Object);
auto obj = field.Obj();
- return GCPKMSService::create(GcpKMS::parse(IDLParserErrorContext("root"), obj));
+ return GCPKMSService::create(GcpKMS::parse(IDLParserContext("root"), obj));
}
};
diff --git a/src/mongo/shell/kms_local.cpp b/src/mongo/shell/kms_local.cpp
index 9e9d1952311..f67230ed45f 100644
--- a/src/mongo/shell/kms_local.cpp
+++ b/src/mongo/shell/kms_local.cpp
@@ -130,7 +130,7 @@ public:
}
auto obj = field.Obj();
- return LocalKMSService::create(LocalKMS::parse(IDLParserErrorContext("root"), obj));
+ return LocalKMSService::create(LocalKMS::parse(IDLParserContext("root"), obj));
}
};
diff --git a/src/mongo/shell/kms_network.cpp b/src/mongo/shell/kms_network.cpp
index 6ff51892313..686b66ceaeb 100644
--- a/src/mongo/shell/kms_network.cpp
+++ b/src/mongo/shell/kms_network.cpp
@@ -177,8 +177,7 @@ void KMSOAuthService::makeBearerTokenRequest() {
if (!field.eoo()) {
OAuthErrorResponse oAuthErrorResponse;
try {
- oAuthErrorResponse =
- OAuthErrorResponse::parse(IDLParserErrorContext("oauthError"), obj);
+ oAuthErrorResponse = OAuthErrorResponse::parse(IDLParserContext("oauthError"), obj);
} catch (DBException& dbe) {
uasserted(ErrorCodes::FailedToParse,
str::stream() << "Failed to parse error message: " << dbe.toString()
@@ -195,7 +194,7 @@ void KMSOAuthService::makeBearerTokenRequest() {
<< description);
}
- auto kmsResponse = OAuthResponse::parse(IDLParserErrorContext("OAuthResponse"), obj);
+ auto kmsResponse = OAuthResponse::parse(IDLParserContext("OAuthResponse"), obj);
_cachedToken = kmsResponse.getAccess_token().toString();
diff --git a/src/mongo/shell/kms_test.cpp b/src/mongo/shell/kms_test.cpp
index d0323a25f48..f8e7d2f9f2b 100644
--- a/src/mongo/shell/kms_test.cpp
+++ b/src/mongo/shell/kms_test.cpp
@@ -76,7 +76,7 @@ TEST(KmsTest, TestGoodKey) {
service->encryptDataKeyByString(ConstDataRange(myKey.rawData(), myKey.size()), "");
LocalMasterKeyAndMaterial glob =
- LocalMasterKeyAndMaterial::parse(IDLParserErrorContext("root"), material);
+ LocalMasterKeyAndMaterial::parse(IDLParserContext("root"), material);
auto keyMaterial = glob.getKeyMaterial();