{
  "description": "redacted-commands",
  "schemaVersion": "1.5",
  "runOnRequirements": [
    {
      "minServerVersion": "5.0",
      "auth": false
    }
  ],
  "createEntities": [
    {
      "client": {
        "id": "client",
        "observeEvents": [
          "commandStartedEvent"
        ],
        "observeSensitiveCommands": true
      }
    },
    {
      "database": {
        "id": "database",
        "client": "client",
        "databaseName": "command-monitoring-tests"
      }
    }
  ],
  "tests": [
    {
      "description": "authenticate",
      "operations": [
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "authenticate",
            "command": {
              "authenticate": "private"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "authenticate",
                "command": {
                  "authenticate": {
                    "$$exists": false
                  }
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "saslStart",
      "operations": [
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "saslStart",
            "command": {
              "saslStart": "private"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "saslStart",
                "command": {
                  "saslStart": {
                    "$$exists": false
                  }
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "saslContinue",
      "operations": [
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "saslContinue",
            "command": {
              "saslContinue": "private"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "saslContinue",
                "command": {
                  "saslContinue": {
                    "$$exists": false
                  }
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "getnonce",
      "operations": [
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "getnonce",
            "command": {
              "getnonce": "private"
            }
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "getnonce",
                "command": {
                  "getnonce": {
                    "$$exists": false
                  }
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "createUser",
      "operations": [
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "createUser",
            "command": {
              "createUser": "private"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "createUser",
                "command": {
                  "createUser": {
                    "$$exists": false
                  }
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "updateUser",
      "operations": [
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "updateUser",
            "command": {
              "updateUser": "private"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "updateUser",
                "command": {
                  "updateUser": {
                    "$$exists": false
                  }
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "copydbgetnonce",
      "operations": [
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "copydbgetnonce",
            "command": {
              "copydbgetnonce": "private"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "copydbgetnonce",
                "command": {
                  "copydbgetnonce": {
                    "$$exists": false
                  }
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "copydbsaslstart",
      "operations": [
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "copydbsaslstart",
            "command": {
              "copydbsaslstart": "private"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "copydbsaslstart",
                "command": {
                  "copydbsaslstart": {
                    "$$exists": false
                  }
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "copydb",
      "operations": [
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "copydb",
            "command": {
              "copydb": "private"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "copydb",
                "command": {
                  "copydb": {
                    "$$exists": false
                  }
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "hello with speculative authenticate",
      "operations": [
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "hello",
            "command": {
              "hello": "private",
              "speculativeAuthenticate": "foo"
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ismaster",
            "command": {
              "ismaster": "private",
              "speculativeAuthenticate": "foo"
            }
          },
          "expectError": {
            "isError": true
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "isMaster",
            "command": {
              "isMaster": "private",
              "speculativeAuthenticate": "foo"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "hello",
                "command": {
                  "hello": {
                    "$$exists": false
                  }
                }
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "ismaster",
                "command": {
                  "ismaster": {
                    "$$exists": false
                  }
                }
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "isMaster",
                "command": {
                  "isMaster": {
                    "$$exists": false
                  }
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "hello without speculative authenticate is not redacted",
      "operations": [
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "hello",
            "command": {
              "hello": "public"
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "ismaster",
            "command": {
              "ismaster": "public"
            }
          }
        },
        {
          "name": "runCommand",
          "object": "database",
          "arguments": {
            "commandName": "isMaster",
            "command": {
              "isMaster": "public"
            }
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "hello",
                "command": {
                  "hello": "public"
                }
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "ismaster",
                "command": {
                  "ismaster": "public"
                }
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "isMaster",
                "command": {
                  "isMaster": "public"
                }
              }
            }
          ]
        }
      ]
    }
  ]
}
