Documentation
¶
Index ¶
- Constants
- func GetClaimFile(w http.ResponseWriter, r *http.Request) multipart.File
- func GetCollectorTablesByPartner(db *sql.DB, partnerName string) (claimRows, claimResultsRows *sql.Rows)
- func GetDatabaseEnvVars() (user, password, dbURL, port string)
- func GetEntireCollectorTable(db *sql.DB) (claimRows, claimResultsRows *sql.Rows)
- func GetS3ConnectEnvVars() (s3BucketName, region, accessKey, secretAccessKey string)
- func GetServerEnvVars() (readTimeOutInt, writeTimeOutInt int, addr, err string)
- func HandleTransactionRollback(tx *sql.Tx)
- func ReadClaimFile(w http.ResponseWriter, r *http.Request) ([]byte, error)
- func StoreClaimFileInDatabase(db *sql.DB, claimResult []types.ClaimResult, ...) error
- func WriteMsg(w http.ResponseWriter, err string)
Constants ¶
View Source
const AdminUserName = "admin"
View Source
const AuthError = "Error found while authenticating partner's password: %s"
View Source
const BeginTxErr = "Error found while beginning transaction: %s"
View Source
const ClaimFieldMissingErr = "claim field is missing"
View Source
const ClaimFileError = "Error while storing the claim file in the database: %s"
View Source
const ClaimFileInputName = "claimFile"
View Source
const ClaimTag = "claim"
View Source
const CommitTxErr = "Error found while committing transaction: %s"
View Source
const DedcodedPasswordInputName = "decoded_password"
View Source
const EmptyClaimFileErr = "claim file is empty"
View Source
const EncodingPasswordError = "Failed encoding password" // #nosec
View Source
const ExecQueryErr = "Error found while executing a mysql query: %s"
View Source
const ExecutedByInputName = "executed_by"
View Source
const ExecutedByMissingErr = "executed by value is missing"
View Source
const ExtractLastClaimID = `SELECT id FROM cnf.claim ORDER BY id DESC LIMIT 1;`
View Source
const ExtractPartnerAndPasswordCmd = `SELECT encoded_password FROM cnf.authenticator WHERE partner_name = ?`
View Source
const FailedToDeleteFileFromS3Err = "Error found while trying to delete file from s3: %s"
View Source
const FailedToUploadFileToS3Err = "Error found while trying to upload claim file to bucket: %s"
View Source
const FileHasBeenDeletedFromBucket = `Claim file has been deleted from bucket %s`
View Source
const FileStoredIntoClaimResultTableSuccessfully = `Claim is stored into table CLAIM_RESULT successfully.`
View Source
const FileStoredIntoClaimTableSuccessfully = `Claim is stored into table successfully.`
View Source
const FileUploadedSuccessfullyToBucket = `Claim file is successfully uploaded to bucket %s`
View Source
const FormFileErr = "Error found while forming file: %s"
View Source
const InsertPartnerToAuthSQLCmd = `INSERT INTO cnf.authenticator (partner_name, encoded_password) VALUES (?, ?)`
View Source
const InsertToClaimResSQLCmd = `INSERT INTO claim_result
(claim_id, suite_name, test_id, test_status)
VALUES (?, ?, ?, ?);`
View Source
const InsertToClaimSQLCmd = `INSERT INTO claim
(cnf_version, executed_by, upload_time, partner_name, s3_file_key)
VALUES (?, ?, ?, ?, ?);`
View Source
const InvalidPasswordErr = "wrong password"
View Source
const InvalidRequestErr = "Invalid request."
View Source
const InvalidUsernameErr = "partner is not found"
View Source
const MalformedClaimFileErr = "Malformed claim file: %s"
View Source
const MarshalErr = "Error found while marshaling claim file: %s"
View Source
const OcpFieldMissingErr = "ocp subfield of versions field is missing"
View Source
const ParseLowerBound = 10
View Source
const ParseUpperBound = 20
View Source
const PartnerNameInputName = "partner_name"
View Source
const PartnerOrPasswordArgsMissingErr = "partner name or Password are not given"
View Source
const PostRequestIsNotValidErr = "Post request isn't valid: %s"
View Source
const RequestContentTypeErr = "Error found while Parsing multipart form: %s"
View Source
const ResultsFieldMissingErr = "results field is missing"
View Source
const ResultsTag = "results"
View Source
const RollbackErr = "Error found while Rollbacking transaction: %s"
View Source
const ScanDBFieldErr = "Error found while scanning db field: %s"
View Source
const SelectAllClaimIDsByPartner = "SELECT id FROM cnf.claim WHERE partner_name = ?"
View Source
const SelectAllFromClaim = "SELECT * FROM cnf.claim"
View Source
const SelectAllFromClaimByPartner = "SELECT * FROM cnf.claim WHERE partner_name = ?"
View Source
const SelectAllFromClaimResult = "SELECT * FROM cnf.claim_result"
View Source
const SelectAllFromClaimResultByClaimIDs = "SELECT * FROM cnf.claim_result WHERE claim_id IN (%s)"
View Source
const ServerAddrEnvVarErr = "SERVER_ADDR environment variable must be set"
View Source
const ServerEnvVarsError = "Error found while extracting environment variables related to the server: %s"
View Source
const ServerIsUpMsg = "Server is up"
View Source
const ServerReadTimeOutEnvVarErr = "SERVER_READ_TIMEOUT environment variable must be set"
View Source
const ServerWriteTimeOutEnvVarErr = "SERVER_WRITE_TIMEOUT environment variable must be set"
View Source
const SuccessUploadingFileMSG = "File was uploaded successfully!"
View Source
const TestIDIDMissingErr = "id subfield of %s's testID field is missing"
View Source
const TestIDSuiteMissingErr = "suite subfield of %s's testID field is missing"
View Source
const TestStateMissingErr = "state subfield of %s test is missing"
View Source
const TestTestIDMissingErr = "testID subfield of %s test is missing"
View Source
const UnmarshalErr = "Error found while trying to unmarshal claim file: %s"
View Source
const UseCollectorSQLCmd = `USE cnf; `
View Source
const VersionsFieldMissingErr = "versions field is missing"
View Source
const VersionsTag = "versions"
View Source
const WritingResponseErr = "Error found while writing response: %s"
Variables ¶
This section is empty.
Functions ¶
func GetClaimFile ¶
func GetDatabaseEnvVars ¶
func GetDatabaseEnvVars() (user, password, dbURL, port string)
func GetEntireCollectorTable ¶
func GetS3ConnectEnvVars ¶
func GetS3ConnectEnvVars() (s3BucketName, region, accessKey, secretAccessKey string)
func GetServerEnvVars ¶
func ReadClaimFile ¶
func StoreClaimFileInDatabase ¶
func StoreClaimFileInDatabase(db *sql.DB, claimResult []types.ClaimResult, partnerName, executedBy, ocpVersion, s3FileKey string) error
This function stores the claim and claim result into the database in a transaction
func WriteMsg ¶
func WriteMsg(w http.ResponseWriter, err string)
Writes Error or Msg using http response writer.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.