Documentation ¶
Index ¶
- Variables
- func Expand(ctx context.Context, key MessageKey, inserts ...interface{}) string
- func ExpandWithCode(ctx context.Context, key MessageKey, inserts ...interface{}) string
- func GetFieldType(code string) (string, bool)
- func GetStatusHint(code string) (int, bool)
- func NewError(ctx context.Context, msg ErrorMessageKey, inserts ...interface{}) error
- func RegisterPrefix(prefix, description string)
- func SetLang(lang string)
- func WithLang(ctx context.Context, lang language.Tag) context.Context
- func WrapError(ctx context.Context, err error, msg ErrorMessageKey, inserts ...interface{}) error
- type ConfigMessageKey
- type ErrorMessageKey
- type FFError
- type MessageKey
Constants ¶
This section is empty.
Variables ¶
var ( ConfigGlobalConnectionTimeout = ffc("config.global.connectionTimeout", "The maximum amount of time that a connection is allowed to remain with no data transmitted", TimeDurationType) ConfigGlobalRequestTimeout = ffc("config.global.requestTimeout", "The maximum amount of time that a request is allowed to remain open", TimeDurationType) ConfigGlobalRetryEnabled = ffc("config.global.retry.enabled", "Enables retries", BooleanType) ConfigGlobalRetryFactor = ffc("config.global.retry.factor", "The retry backoff factor", FloatType) ConfigGlobalRetryInitDelay = ffc("config.global.retry.initDelay", "The initial retry delay", TimeDurationType) ConfigGlobalRetryInitialDelay = ffc("config.global.retry.initialDelay", "The initial retry delay", TimeDurationType) ConfigGlobalRetryMaxDelay = ffc("config.global.retry.maxDelay", "The maximum retry delay", TimeDurationType) ConfigGlobalRetryMaxAttempts = ffc("config.global.retry.maxAttempts", "The maximum number attempts", IntType) ConfigGlobalRetryCount = ffc("config.global.retry.count", "The maximum number of times to retry", IntType) ConfigGlobalInitWaitTime = ffc("config.global.retry.initWaitTime", "The initial retry delay", TimeDurationType) ConfigGlobalMaxWaitTime = ffc("config.global.retry.maxWaitTime", "The maximum retry delay", TimeDurationType) ConfigGlobalErrorStatusCodeRegex = ffc("config.global.retry.errorStatusCodeRegex", "The regex that the error response status code must match to trigger retry", StringType) ConfigGlobalUsername = ffc("config.global.auth.username", "Username", StringType) ConfigGlobalPassword = ffc("config.global.auth.password", "Password", StringType) ConfigGlobalProxyURL = ffc("config.global.proxy.url", "Optional HTTP proxy server to connect through", StringType) ConfigGlobalSize = ffc("config.global.cache.size", "The size of the cache", ByteSizeType) ConfigGlobalTTL = ffc("config.global.cache.ttl", "The time to live (TTL) for the cache", TimeDurationType) ConfigGlobalWsConnectionTimeout = ffc("config.global.ws.connectionTimeout", "The amount of time to wait while establishing a connection (or auto-reconnection)", TimeDurationType) ConfigGlobalWsHeartbeatInterval = ffc("config.global.ws.heartbeatInterval", "The amount of time to wait between heartbeat signals on the WebSocket connection", TimeDurationType) ConfigGlobalWsInitialConnectAttempts = ffc("config.global.ws.initialConnectAttempts", "The number of attempts FireFly will make to connect to the WebSocket when starting up, before failing", IntType) ConfigGlobalWsPath = ffc("config.global.ws.path", "The WebSocket sever URL to which FireFly should connect", "WebSocket URL "+StringType) ConfigGlobalWsReadBufferSize = ffc("config.global.ws.readBufferSize", "The size in bytes of the read buffer for the WebSocket connection", ByteSizeType) ConfigGlobalWsWriteBufferSize = ffc("config.global.ws.writeBufferSize", "The size in bytes of the write buffer for the WebSocket connection", ByteSizeType) ConfigGlobalWsURL = ffc("config.global.ws.url", "URL to use for WebSocket - overrides url one level up (in the HTTP config)", StringType) ConfigGlobalTLSCA = ffc("config.global.tls.ca", "The TLS certificate authority in PEM format (this option is ignored if caFile is also set)", StringType) ConfigGlobalTLSCaFile = ffc("config.global.tls.caFile", "The path to the CA file for TLS on this API", StringType) ConfigGlobalTLSCert = ffc("config.global.tls.cert", "The TLS certificate in PEM format (this option is ignored if certFile is also set)", StringType) ConfigGlobalTLSCertFile = ffc("config.global.tls.certFile", "The path to the certificate file for TLS on this API", StringType) ConfigGlobalTLSClientAuth = ffc("config.global.tls.clientAuth", "Enables or disables client auth for TLS on this API", StringType) ConfigGlobalTLSEnabled = ffc("config.global.tls.enabled", "Enables or disables TLS on this API", BooleanType) ConfigGlobalTLSKey = ffc("config.global.tls.key", "The TLS certificate key in PEM format (this option is ignored if keyFile is also set)", StringType) ConfigGlobalTLSKeyFile = ffc("config.global.tls.keyFile", "The path to the private key file for TLS on this API", StringType) ConfigGlobalTLSRequiredDNAttributes = ffc("config.global.tls.requiredDNAttributes", "A set of required subject DN attributes. Each entry is a regular expression, and the subject certificate must have a matching attribute of the specified type (CN, C, O, OU, ST, L, STREET, POSTALCODE, SERIALNUMBER are valid attributes)", MapStringStringType) ConfigGlobalTLSInsecureSkipHostVerify = ffc("config.global.tls.insecureSkipHostVerify", "When to true in unit test development environments to disable TLS verification. Use with extreme caution", BooleanType) ConfigGlobalTLSHandshakeTimeout = ffc("config.global.tlsHandshakeTimeout", "The maximum amount of time to wait for a successful TLS handshake", TimeDurationType) ConfigGlobalBodyTemplate = ffc("config.global.bodyTemplate", "The body go template string to use when making HTTP requests", GoTemplateType) ConfigGlobalCustomClient = ffc("config.global.customClient", "Used for testing purposes only", IgnoredType) ConfigGlobalExpectContinueTimeout = ffc("config.global.expectContinueTimeout", "See [ExpectContinueTimeout in the Go docs](https://pkg.go.dev/net/http#Transport)", TimeDurationType) ConfigGlobalHeaders = ffc("config.global.headers", "Adds custom headers to HTTP requests", MapStringStringType) ConfigGlobalIdleTimeout = ffc("config.global.idleTimeout", "The max duration to hold a HTTP keepalive connection between calls", TimeDurationType) ConfigGlobalThrottleRPS = ffc("config.global.throttle.requestsPerSecond", "The average rate at which requests are allowed to pass through over time.", IntType) ConfigGlobalThrottleBurst = ffc("config.global.throttle.burst", "The maximum number of requests that can be made in a short period of time before the throttling kicks in.", IntType) ConfigGlobalMaxIdleConns = ffc("config.global.maxIdleConns", "The max number of idle connections to hold pooled", IntType) ConfigGlobalMaxConnsPerHost = ffc("config.global.maxConnsPerHost", "The max number of connections, per unique hostname. Zero means no limit", IntType) ConfigGlobalMaxIdleConnsPerHost = ffc("config.global.maxIdleConnsPerHost", "The max number of idle connections, per unique hostname. Zero means net/http uses the default of only 2.", IntType) ConfigGlobalMethod = ffc("config.global.method", "The HTTP method to use when making requests to the Address Resolver", StringType) ConfigGlobalAuthType = ffc("config.global.auth.type", "The auth plugin to use for server side authentication of requests", StringType) ConfigGlobalPassthroughHeadersEnabled = ffc("config.global.passthroughHeadersEnabled", "Enable passing through the set of allowed HTTP request headers", BooleanType) ConfigLang = ffc("config.lang", "Default language for translation (API calls may support language override using headers)", StringType) ConfigLogCompress = ffc("config.log.compress", "Determines if the rotated log files should be compressed using gzip", BooleanType) ConfigLogFilename = ffc("config.log.filename", "Filename is the file to write logs to. Backup log files will be retained in the same directory", StringType) ConfigLogFilesize = ffc("config.log.filesize", "MaxSize is the maximum size the log file before it gets rotated", ByteSizeType) ConfigLogForceColor = ffc("config.log.forceColor", "Force color to be enabled, even when a non-TTY output is detected", BooleanType) ConfigLogLevel = ffc("config.log.level", "The log level - error, warn, info, debug, trace", StringType) ConfigLogMaxAge = ffc("config.log.maxAge", "The maximum time to retain old log files based on the timestamp encoded in their filename.", TimeDurationType) ConfigLogMaxBackups = ffc("config.log.maxBackups", "Maximum number of old log files to retain", IntType) ConfigLogNoColor = ffc("config.log.noColor", "Force color to be disabled, event when TTY output is detected", BooleanType) ConfigLogTimeFormat = ffc("config.log.timeFormat", "Custom time format for logs", TimeFormatType) ConfigLogUtc = ffc("config.log.utc", "Use UTC timestamps for logs", BooleanType) ConfigLogIncludeCodeInfo = ffc("config.log.includeCodeInfo", "Enables the report caller for including the calling file and line number, and the calling function. If using text logs, it uses the logrus text format rather than the default prefix format.", BooleanType) ConfigLogJSONEnabled = ffc("config.log.json.enabled", "Enables JSON formatted logs rather than text. All log color settings are ignored when enabled.", BooleanType) ConfigLogJSONTimestampField = ffc("config.log.json.fields.timestamp", "Configures the JSON key containing the timestamp of the log", StringType) ConfigLogJSONLevelField = ffc("config.log.json.fields.level", "Configures the JSON key containing the log level", StringType) ConfigLogJSONMessageField = ffc("config.log.json.fields.message", "Configures the JSON key containing the log message", StringType) ConfigLogJSONFuncField = ffc("config.log.json.fields.func", "Configures the JSON key containing the calling function", StringType) ConfigLogJSONFileField = ffc("config.log.json.fields.file", "configures the JSON key containing the calling file", StringType) ConfigCorsCredentials = ffc("config.cors.credentials", "CORS setting to control whether a browser allows credentials to be sent to this API", BooleanType) ConfigCorsDebug = ffc("config.global.cors.debug", "Whether debug is enabled for the CORS implementation", BooleanType) ConfigCorsEnabled = ffc("config.global.cors.enabled", "Whether CORS is enabled", BooleanType) ConfigCorsHeaders = ffc("config.global.cors.headers", "CORS setting to control the allowed headers", ArrayStringType) ConfigCorsMaxAge = ffc("config.global.cors.maxAge", "The maximum age a browser should rely on CORS checks", TimeDurationType) ConfigCorsMethods = ffc("config.global.cors.methods", " CORS setting to control the allowed methods", ArrayStringType) ConfigCorsOrigins = ffc("config.global.cors.origins", "CORS setting to control the allowed origins", ArrayStringType) ConfigGlobalAuthBasicPasswordFile = ffc("config.global.basic.passwordfile", "The path to a .htpasswd file to use for authenticating requests. Passwords should be hashed with bcrypt.", StringType) ConfigGlobalDebugEnabled = ffc("config.debug.enabled", "Whether the debug HTTP endpoint is enabled", BooleanType) ConfigGlobalPort = ffc("config.global.port", "Listener port", IntType) ConfigGlobalAddress = ffc("config.global.address", "Listener address", IntType) ConfigGlobalPublicURL = ffc("config.global.publicURL", "Externally available URL for the HTTP endpoint", StringType) ConfigGlobalReadTimeout = ffc("config.global.readTimeout", "HTTP server read timeout", TimeDurationType) ConfigGlobalWriteTimeout = ffc("config.global.writeTimeout", "HTTP server write timeout", TimeDurationType) ConfigGlobalShutdownTimeout = ffc("config.global.shutdownTimeout", "HTTP server shutdown timeout", TimeDurationType) ConfigDynamicPublicURLHeaders = ffc("config.global.dynamicPublicURLHeader", "Dynamic header that informs the backend the base public URL for the request, in order to build URL links in OpenAPI/SwaggerUI", StringType) )
var ( MsgConfigFailed = ffe("FF00101", "Failed to read config", 500) MsgBigIntTooLarge = ffe("FF00103", "Byte length of serialized integer is too large %d (max=%d)") MsgBigIntParseFailed = ffe("FF00104", "Failed to parse JSON value '%s' into BigInt") MsgTypeRestoreFailed = ffe("FF00105", "Failed to restore type '%T' into '%T'") MsgInvalidHex = ffe("FF00106", "Invalid hex supplied", 400) MsgInvalidWrongLenB32 = ffe("FF00107", "Byte length must be 32 (64 hex characters)", 400) MsgUnknownValidatorType = ffe("FF00108", "Unknown validator type: '%s'", 400) MsgDataValueIsNull = ffe("FF00109", "Data value is null", 400) MsgBlobMismatchSealingData = ffe("FF00110", "Blob mismatch when sealing data") MsgUnknownFieldValue = ffe("FF00111", "Unknown %s '%v'", 400) MsgMissingRequiredField = ffe("FF00112", "Field '%s' is required", 400) MsgDataInvalidHash = ffe("FF00113", "Invalid data: hashes do not match Hash=%s Expected=%s", 400) MsgNilID = ffe("FF00114", "ID is nil") MsgGroupMustHaveMembers = ffe("FF00115", "Group must have at least one member", 400) MsgEmptyMemberIdentity = ffe("FF00116", "Identity is blank in member %d") MsgEmptyMemberNode = ffe("FF00117", "Node is blank in member %d") MsgDuplicateMember = ffe("FF00118", "Member %d is a duplicate org+node combination: %s", 400) MsgGroupInvalidHash = ffe("FF00119", "Invalid group: hashes do not match Hash=%s Expected=%s", 400) MsgInvalidDIDForType = ffe("FF00120", "Invalid FireFly DID '%s' for type='%s' namespace='%s' name='%s'", 400) MsgCustomIdentitySystemNS = ffe("FF00121", "Custom identities cannot be defined in the '%s' namespace", 400) MsgSystemIdentityCustomNS = ffe("FF00122", "System identities must be defined in the '%s' namespace", 400) MsgNilParentIdentity = ffe("FF00124", "Identity of type '%s' must have a valid parent", 400) MsgNilOrNullObject = ffe("FF00125", "Object is null") MsgUnknownIdentityType = ffe("FF00126", "Unknown identity type: %s", 400) MsgJSONObjectParseFailed = ffe("FF00127", "Failed to parse '%s' as JSON") MsgNilDataReferenceSealFail = ffe("FF00128", "Invalid message: nil data reference at index %d", 400) MsgDupDataReferenceSealFail = ffe("FF00129", "Invalid message: duplicate data reference at index %d", 400) MsgInvalidTXTypeForMessage = ffe("FF00130", "Invalid transaction type for sending a message: %s", 400) MsgVerifyFailedNilHashes = ffe("FF00131", "Invalid message: nil hashes", 400) MsgVerifyFailedInvalidHashes = ffe("FF00132", "Invalid message: hashes do not match Hash=%s Expected=%s DataHash=%s DataHashExpected=%s", 400) MsgDuplicateArrayEntry = ffe("FF00133", "Duplicate %s at index %d: '%s'", 400) MsgTooManyItems = ffe("FF00134", "Maximum number of %s items is %d (supplied=%d)", 400) MsgFieldTooLong = ffe("FF00135", "Field '%s' maximum length is %d", 400) MsgTimeParseFail = ffe("FF00136", "Cannot parse time as RFC3339, Unix, or UnixNano: '%s'", 400) MsgDurationParseFail = ffe("FF00137", "Unable to parse '%s' as duration string, or millisecond number", 400) MsgInvalidUUID = ffe("FF00138", "Invalid UUID supplied", 400) MsgSafeCharsOnly = ffe("FF00139", "Field '%s' must include only alphanumerics (a-zA-Z0-9), dot (.), dash (-) and underscore (_)", 400) MsgInvalidName = ffe("FF00140", "Field '%s' must be 1-64 characters, including alphanumerics (a-zA-Z0-9), dot (.), dash (-) and underscore (_), and must start/end in an alphanumeric", 400) MsgNoUUID = ffe("FF00141", "Field '%s' must not be a UUID", 400) MsgInvalidFilterField = ffe("FF00142", "Unknown filter '%s'", 400) MsgInvalidValueForFilterField = ffe("FF00143", "Unable to parse value for filter '%s'", 400) MsgFieldMatchNoNull = ffe("FF00144", "Comparison operator for field '%s' cannot accept a null value", 400) MsgFieldTypeNoStringMatching = ffe("FF00145", "Field '%s' of type '%s' does not support partial or case-insensitive string matching", 400) MsgWSSendTimedOut = ffe("FF00146", "Websocket send timed out") MsgWSClosing = ffe("FF00147", "Websocket closing") MsgWSConnectFailed = ffe("FF00148", "Websocket connect failed") MsgInvalidURL = ffe("FF00149", "Invalid URL: '%s'") MsgWSHeartbeatTimeout = ffe("FF00150", "Websocket heartbeat timed out after %.2fms", 500) MsgAPIServerStartFailed = ffe("FF00151", "Unable to start listener on %s") MsgInvalidCAFile = ffe("FF00152", "Invalid CA certificates file") MsgTLSConfigFailed = ffe("FF00153", "Failed to initialize TLS configuration") MsgContextCanceled = ffe("FF00154", "Context canceled") MsgConnectorFailInvoke = ffe("FF00155", "Connector request failed. requestId=%s failed to call connector API") MsgConnectorInvalidContentType = ffe("FF00156", "Connector request failed. requestId=%s invalid response content type: %s") MsgConnectorError = ffe("FF00157", "Connector request failed. requestId=%s reason=%s error: %s") MsgFieldDescriptionMissing = ffe("FF00158", "Field description missing for '%s' on route '%s'") MsgRouteDescriptionMissing = ffe("FF00159", "API route description missing for route '%s'") MsgFFStructTagMissing = ffe("FF00160", "ffstruct tag is missing for '%s' on route '%s'") MsgMultiPartFormReadError = ffe("FF00161", "Error reading multi-part form input", 400) MsgInvalidContentType = ffe("FF00162", "Invalid content type '%s'", 415) MsgFieldsAfterFile = ffe("FF00163", "Additional form field sent after file in multi-part form (ignored): '%s'", 400) Msg404NoResult = ffe("FF00164", "No result found", 404) MsgResponseMarshalError = ffe("FF00165", "Failed to serialize response data", 400) MsgRequestTimeout = ffe("FF00166", "The request with id '%s' timed out after %.2fms", 408) Msg404NotFound = ffe("FF00167", "Not found", 404) MsgUnknownAuthPlugin = ffe("FF00168", "Unknown auth plugin: '%s'") MsgForbidden = ffe("FF00170", "Forbidden", 403) MsgInvalidEnum = ffe("FF00171", "'%s' is not a valid enum type", 400) MsgInvalidEnumValue = ffe("FF00172", "'%s' is not a valid enum value for enum type '%s'. Valid options are: %v", 400) MsgDBInitFailed = ffe("FF00173", "Database initialization failed") MsgDBQueryBuildFailed = ffe("FF00174", "Database query builder failed") MsgDBBeginFailed = ffe("FF00175", "Database begin transaction failed") MsgDBQueryFailed = ffe("FF00176", "Database query failed") MsgDBInsertFailed = ffe("FF00177", "Database insert failed") MsgDBUpdateFailed = ffe("FF00178", "Database update failed") MsgDBDeleteFailed = ffe("FF00179", "Database delete failed") MsgDBCommitFailed = ffe("FF00180", "Database commit failed") MsgDBMissingJoin = ffe("FF00181", "Database missing expected join entry in table '%s' for id '%s'") MsgDBReadErr = ffe("FF00182", "Database resultset read error from table '%s'") MsgMissingConfig = ffe("FF00183", "Missing configuration '%s' for %s") MsgDBMigrationFailed = ffe("FF00184", "Database migration failed") MsgDBNoSequence = ffe("FF00185", "Failed to retrieve sequence for insert row %d (could mean duplicate insert)", 500) MsgDBMultiRowConfigError = ffe("FF00186", "Database invalid configuration - using multi-row insert on DB plugin that does not support query syntax for input") MsgDBLockFailed = ffe("FF00187", "Database lock failed") MsgHashMismatch = ffe("FF00188", "Hash mismatch") MsgIDMismatch = ffe("FF00189", "ID mismatch") MsgUnsupportedSQLOpInFilter = ffe("FF00190", "No SQL mapping implemented for filter operator '%s'", 400) MsgMaxFilterSkip = ffe("FF00191", "You have reached the maximum pagination limit for this query (%d)", 400) MsgMaxFilterLimit = ffe("FF00192", "Your query exceeds the maximum filter limit (%d)", 400) MsgQueryOpUnsupportedMod = ffe("FF00193", "Operation '%s' on '%s' does not support modifiers", 400) MsgFailedToStartListener = ffe("FF00194", "Failed to start filesystem listener: %s") MsgMetricsInvalidSubsystemName = ffe("FF00195", "Subsystem name can only contain lowercase letters and underscore: %s") MsgMetricsDuplicateSubsystemName = ffe("FF00196", "Subsystem with name '%s' already exist") MsgMetricsInvalidName = ffe("FF00197", "Metric name can only contain lowercase letters and underscore: %s") MsgMetricsHelpTextMissing = ffe("FF00198", "Metric help text must be provided") MsgMetricsDuplicateName = ffe("FF00199", "Metric with name '%s' already exist") MsgMetricsEmptyRegistry = ffe("FF00200", "Metrics registry has no subsystem registered") MsgMetricsSubsystemHTTPInstrumentationNotFound = ffe("FF00201", "No HTTP metrics instrumentation found for subsystem %s") MsgMetricsInvalidLabel = ffe("FF00202", "Label with name '%s' is invalid due to clashing with system prefix '%s'") MsgInvalidNamespaceUUID = ffe("FF00203", "Expected 'namespace:' prefix on ID '%s'", 400) MsgInvalidOutputOption = ffe("FF00204", "Invalid output option '%s'") MsgDBNoRowsAffected = ffe("FF00205", "Specified resource not found for update", 404) MsgInvalidKeyPairFiles = ffe("FF00206", "Invalid certificate and key pair files") MsgInvalidTLSDnMatcherType = ffe("FF00207", "Expected string value for '%s' field of requiredDNAttributes (found %T)") MsgInvalidTLSDnMatcherRegexp = ffe("FF00208", "Invalid regexp '%s' for requiredDNAttributes[%s]: %s") MsgInvalidTLSDnMatcherAttr = ffe("FF00209", "Unknown DN attribute '%s'") MsgInvalidTLSDnChain = ffe("FF00210", "Cannot match subject distinguished name as cert chain is not verified") MsgInvalidTLSDnMismatch = ffe("FF00211", "Certificate subject does not meet requirements") MsgDBUnknownGetOption = ffe("FF00212", "Unknown get option (%d)", 400) MsgDBPatchNotSupportedForCollection = ffe("FF00213", "Patch not supported for collection '%s'", 405) MsgCollectionNotConfiguredWithName = ffe("FF00214", "Name based queries not supported for collection '%s'", 405) MsgScanTypeMismatch = ffe("FF00215", "Unexpected type found when scanning value: %T") MsgMissingWebhookURL = ffe("FF00216", "'url' is required for webhook configuration", http.StatusBadRequest) MsgESInvalidType = ffe("FF00217", "Event stream type is invalid '%s'") MsgInvalidHost = ffe("FF00218", "Cannot send Webhook POST to host '%s'") MsgWebhookErr = ffe("FF00219", "Webhook request failed: %s") MsgBlockWebhookAddress = ffe("FF00220", "Cannot send Webhook POST to address '%s' for host '%s'") MsgWebhookFailedStatus = ffe("FF00221", "Webhook request failed with status %d") MsgInvalidDistributionMode = ffe("FF00222", "Invalid distribution mode for WebSocket: %s", http.StatusBadRequest) MsgUnknownTLSConfiguration = ffe("FF00223", "Unknown TLS configuration: %s", http.StatusBadRequest) MsgConfigurationNotValidated = ffe("FF00224", "Configuration not validated", http.StatusInternalServerError) MsgWebSocketInterruptedSend = ffe("FF00225", "Interrupted waiting for WebSocket connection to send event") MsgWebSocketInterruptedReceive = ffe("FF00226", "Interrupted waiting for WebSocket acknowledgment") MsgWSErrorFromClient = ffe("FF00227", "Error received from WebSocket client: %s") MsgWebSocketClosed = ffe("FF00228", "WebSocket '%s' closed") MsgESContextCancelledWaitingStop = ffe("FF00229", "Context cancelled waiting for event stream to stop") MsgESStopping = ffe("FF00230", "Event stream is stopping") MsgESDeleting = ffe("FF00231", "Event stream is deleting") MsgESInvalidPersistedStatus = ffe("FF00233", "Event stream has unexpected persisted status") MsgInvalidValue = ffe("FF00234", "Value '%v' is invalid for field '%s'") MsgESInvalidTopicFilterRegexp = ffe("FF00235", "Invalid topic filter regular expression '%s': %s") MsgESStartedOrStopped = ffe("FF00236", "Event stream status must be 'started' or 'stopped' when creating/updating", http.StatusBadRequest) MsgESConfigNotInitialized = ffe("FF00237", "Event stream manager configuration not initialized") MsgInvalidWebSocketURL = ffe("FF00238", "Invalid WebSocket URL (must have ws: or wss: proto, otherwise use httpUrl option): '%s'") MsgRequestYAMLInvalid = ffe("FF00239", "Unable to process input as YAML: %s", 400) MsgJSONQueryOpUnsupportedMod = ffe("FF00240", "Operation '%s' does not support modifiers: %v", 400) MsgJSONQueryValueUnsupported = ffe("FF00241", "Field value not supported (must be string, number, or boolean): %s", 400) MsgJSONQuerySortUnsupported = ffe("FF00242", "Invalid 'order' for sort (must be 'asc', 'ascending', 'desc' or 'descending'): %s", 400) MsgWebSocketBatchInflight = ffe("FF00243", "Stream '%s' already has batch '%d' inflight on websocket connection '%s'") MsgWebSocketRoundTripTimeout = ffe("FF00244", "Timed out or cancelled waiting for acknowledgement") MsgDBExecFailed = ffe("FF00245", "Database update failed") MsgDBErrorBuildingStatement = ffe("FF00247", "Error building statement: %s") MsgDBReadInsertTSFailed = ffe("FF00248", "Failed to read timestamp from database optimized upsert: %s") MsgUnmarshalToFloat64NotSupported = ffe("FF00249", "Unmarshalling to a float64 is not supported due to possible precision loss. Consider unmarshalling to an interface, json.Number or fftypes.JSONAny instead") )
var ( FilterJSONCaseInsensitive = ffm("FilterJSON.caseInsensitive", "Configures whether the comparison is case sensitive - not supported for all operators") FilterJSONNot = ffm("FilterJSON.not", "Negates the comparison operation, so 'equal' becomes 'not equal' for example - not supported for all operators") FilterJSONField = ffm("FilterJSON.field", "Name of the field for the comparison operation") FilterJSONValue = ffm("FilterJSON.value", "A JSON simple value to use in the comparison - must be a string, number or boolean and be parsable for the type of the filter field") FilterJSONValues = ffm("FilterJSON.values", "Array of values to use in the comparison") FilterJSONContains = ffm("FilterJSON.contains", "Array of field + value combinations to apply as string-contains filters - all filters must match") FilterJSONEqual = ffm("FilterJSON.equal", "Array of field + value combinations to apply as equal filters - all must match") FilterJSONEq = ffm("FilterJSON.eq", "Shortname for equal") FilterJSONNEq = ffm("FilterJSON.neq", "Shortcut for equal with all conditions negated (the not property of all children is overridden)") FilterJSONStartsWith = ffm("FilterJSON.startsWith", "Array of field + value combinations to apply as starts-with filters - all filters must match") FilterJSONGreaterThan = ffm("FilterJSON.greaterThan", "Array of field + value combinations to apply as greater-than filters - all filters must match") FilterJSONGT = ffm("FilterJSON.gt", "Short name for greaterThan") FilterJSONGreaterThanOrEqual = ffm("FilterJSON.greaterThanOrEqual", "Array of field + value combinations to apply as greater-than filters - all filters must match") FilterJSONGTE = ffm("FilterJSON.gte", "Short name for greaterThanOrEqual") FilterJSONLessThan = ffm("FilterJSON.lessThan", "Array of field + value combinations to apply as less-than-or-equal filters - all filters must match") FilterJSONLT = ffm("FilterJSON.lt", "Short name for lessThan") FilterJSONLessThanOrEqual = ffm("FilterJSON.lessThanOrEqual", "Array of field + value combinations to apply as less-than-or-equal filters - all filters must match") FilterJSONLTE = ffm("FilterJSON.lte", "Short name for lessThanOrEqual") FilterJSONIn = ffm("FilterJSON.in", "Array of field + values-array combinations to apply as 'in' filters (matching one of a set of values) - all filters must match") FilterJSONNIn = ffm("FilterJSON.nin", "Shortcut for in with all conditions negated (the not property of all children is overridden)") FilterJSONNull = ffm("FilterJSON.null", "Tests if the specified field is null (unset)") FilterJSONLimit = ffm("FilterJSON.limit", "Limit on the results to return") FilterJSONSkip = ffm("FilterJSON.skip", "Number of results to skip before returning entries, for skip+limit based pagination") FilterJSONSort = ffm("FilterJSON.sort", "Array of fields to sort by. A '-' prefix on a field requests that field is sorted in descending order") FilterJSONCount = ffm("FilterJSON.count", "If true, the total number of entries that could be returned from the database will be calculated and returned as a 'total' (has a performance cost)") FilterJSONOr = ffm("FilterJSON.or", "Array of sub-queries where any sub-query can match to return results (OR combined). Note that within each sub-query all filters must match (AND combined)") EventStreamBatchSize = ffm("eventstream.batchSize", "Maximum number of events to deliver in each batch") EventStreamBatchTimeout = ffm("eventstream.batchTimeout", "Amount of time to wait for events to arrive before delivering an incomplete batch") EventStreamBlockedRetryDelay = ffm("eventstream.blockedRetryDelay", "Amount of time to wait between retries, when a stream is blocked") EventStreamConfig = ffm("eventstream.config", "Additional configuration for the event stream") EventStreamCreated = ffm("eventstream.created", "Time the event stream was created") EventStreamUpdated = ffm("eventstream.updated", "Time the event stream was last updated") EventStreamErrorHandling = ffm("eventstream.errorHandling", "When an error is encountered, and short retries are exhausted, whether to skip the event or block the stream (default=block)") EventStreamID = ffm("eventstream.id", "ID of the event stream") EventStreamInitialSequenceID = ffm("eventstream.initialSequenceId", "Initial sequence ID to begin event delivery from") EventStreamName = ffm("eventstream.name", "Unique name for the event stream") EventStreamRetryTimeout = ffm("eventstream.retryTimeout", "Short retry timeout before error handling, in case of webhook based delivery") EventStreamStatus = ffm("eventstream.status", "Status information for the event stream") EventStreamTopicFilter = ffm("eventstream.topicFilter", "Regular expression to apply to the topic of each event for server-side filtering") EventStreamType = ffm("eventstream.type", "Delivery type for the event stream") EventStreamWebHook = ffm("eventstream.webhook", "Webhook configuration options") EventStreamWebSocket = ffm("eventstream.websocket", "WebSocket configuration options") EventStreamStatistics = ffm("EventStream.statistics", "Information about the status and operation of the event stream") EventStreamStatusExt = ffm("EventStream.status", "Status of the event stream") EventStreamWHConfigHeaders = ffm("whconfig.headers", "Headers to add to the HTTP call") EventStreamWHConfigHTTP = ffm("whconfig.http", "Base client config for the Webhook HTTP requests") EventStreamWHConfigMethod = ffm("whconfig.method", "HTTP method to use for the HTTP requests") EventStreamWHTLSConfigName = ffm("whconfig.tlsConfigName", "Name of a TLS configuration to use for this Webhook") EventStreamWHURL = ffm("whconfig.url", "URL to invoke") EventStreamWSDistributionMode = ffm("wsconfig.distributionMode", "Whether to 'broadcast' messages (at most once), or 'load_balance' requests between connections with acknowledgement (at least once)") EventStreamStatisticsStartTime = ffm("EventStreamStatistics.startTime", "Time the stream started") EventStreamStatisticsLastDispatchTime = ffm("EventStreamStatistics.lastDispatchTime", "Time the stream last dispatched a message") EventStreamStatisticsLastDispatchBatch = ffm("EventStreamStatistics.lastDispatchBatch", "Batch number of the last dispatched batch") EventStreamStatisticsLastDispatchAttempts = ffm("EventStreamStatistics.lastDispatchAttempts", "Number of attempts to dispatch the current batch") EventStreamStatisticsLastDispatchFailure = ffm("EventStreamStatistics.lastDispatchFailure", "Error message for the last failure that occurred") EventStreamStatisticsLastDispatchComplete = ffm("EventStreamStatistics.lastDispatchComplete", "Completion status of the last batch") EventStreamStatisticsHighestDetected = ffm("EventStreamStatistics.highestDetected", "Highest sequence ID detected") EventStreamStatisticsHighestDispatched = ffm("EventStreamStatistics.highestDispatched", "Highest sequence ID dispatched") EventStreamStatisticsCheckpoint = ffm("EventStreamStatistics.checkpoint", "Current checkpoint sequence ID") RESTConfigAuthPassword = ffm("RESTConfig.authPassword", "Password for the HTTP/HTTPS Basic Auth header") RESTConfigAuthUsername = ffm("RESTConfig.authUsername", "Username for the HTTP/HTTPS Basic Auth header") RESTConfigConnectionTimeout = ffm("RESTConfig.connectionTimeout", "HTTP connection timeout") RESTConfigExpectContinueTimeout = ffm("RESTConfig.expectContinueTimeout", "Time to wait for the first response from the server after connecting") RESTConfigExpectHeaders = ffm("RESTConfig.headers", "Headers to add to the HTTP call") RESTConfigHTTPPassthroughHeadersEnabled = ffm("RESTConfig.httpPassthroughHeadersEnabled", "Proxy request ID or other configured headers from an upstream microservice connection") RESTConfigIdleTimeout = ffm("RESTConfig.idleTimeout", "Time to leave idle connections in the connection pool") RESTConfigThrottleRequestsPerSecond = ffm("RESTConfig.requestsPerSecond", "Requests per second") RESTConfigThrottleBurst = ffm("RESTConfig.burst", "Burst") RESTConfigMaxConnsPerHost = ffm("RESTConfig.maxConnsPerHost", "Maximum connections per host") RESTConfigMaxIdleConnsPerHost = ffm("RESTConfig.maxIdleConnsPerHost", "Maximum idle connections per host") RESTConfigMaxIdleConns = ffm("RESTConfig.maxIdleConns", "Maximum idle connections to leave in the connection pool") RESTConfigMaxIdleTimeout = ffm("RESTConfig.maxIdleTimeout", "Maximum time to leave idle connections in the connection pool") RESTConfigProxyURL = ffm("RESTConfig.proxyURL", "URL of a proxy server to use for connections") RESTConfigRequestTimeout = ffm("RESTConfig.requestTimeout", "Maximum time any individual request can take") RESTConfigRetry = ffm("RESTConfig.retry", "Whether to automatically retry failed HTTP requests") RESTConfigRetryCount = ffm("RESTConfig.retryCount", "Maximum number of times to retry") RESTConfigRetryErrorStatusCodeRegex = ffm("RESTConfig.retryErrorStatusCodeRegex", "Regular expression to apply to the status codes of failed request to determine whether to retry") RESTConfigRetryInitialDelay = ffm("RESTConfig.retryInitialDelay", "Time to wait before the first retry") RESTConfigRetryMaximumDelay = ffm("RESTConfig.retryMaximumDelay", "Maximum time to wait between retries") RESTConfigTLSHandshakeTimeout = ffm("RESTConfig.tlsHandshakeTimeout", "Maximum time to wait for the TLS handshake to complete") CollectionResultsCount = ffm("CollectionResults.count", "Number of items returned from this call") CollectionResultsTotal = ffm("CollectionResults.total", "Number of items total that could be returned, if a count was requested") CollectionResultsItems = ffm("CollectionResults.items", "The array of items") )
var ( APISuccessResponse = ffm("api.success", "Success") APIRequestTimeoutDesc = ffm("api.requestTimeout", "Server-side request timeout (milliseconds, or set a custom suffix like 10s)") APIFilterParamDesc = ffm("api.filterParam", "Data filter field. Prefixes supported: > >= < <= @ ^ ! !@ !^") APIFilterSortDesc = ffm("api.filterSort", "Sort field. For multi-field sort use comma separated values (or multiple query values) with '-' prefix for descending") APIFilterAscendingDesc = ffm("api.filterAscending", "Ascending sort order (overrides all fields in a multi-field sort)") APIFilterDescendingDesc = ffm("api.filterDescending", "Descending sort order (overrides all fields in a multi-field sort)") APIFilterSkipDesc = ffm("api.filterSkip", "The number of records to skip (max: %d). Unsuitable for bulk operations") APIFilterLimitDesc = ffm("api.filterLimit", "The maximum number of records to return (max: %d)") APIFilterCountDesc = ffm("api.filterCount", "Return a total count as well as items (adds extra database processing)") APIFilterFieldsDesc = ffm("api.filterFields", "Comma separated list of fields to return") ResourceBaseID = ffm("ResourceBase.id", "The UUID of the resource") ResourceBaseCreated = ffm("ResourceBase.created", "The time the resource was created") ResourceBaseUpdated = ffm("ResourceBase.updated", "The time the resource was last updated") )
var ArrayStringType = "`[]string`"
var BooleanType = "`boolean`"
var ByteSizeType = "[`BytesSize`](https://pkg.go.dev/github.com/docker/go-units#BytesSize)"
var FloatType = "`float32`"
var GoTemplateType = "[Go Template](https://pkg.go.dev/text/template) `string`"
var IgnoredType = "IGNORE"
var IntType = "`int`"
var MapStringStringType = "`map[string]string`"
var StringType = "`string`"
var TimeDurationType = "[`time.Duration`](https://pkg.go.dev/time#Duration)"
var TimeFormatType = "[Time format](https://pkg.go.dev/time#pkg-constants) `string`"
Functions ¶
func Expand ¶
func Expand(ctx context.Context, key MessageKey, inserts ...interface{}) string
Expand for use in docs and logging - returns a translated message, translated the language of the context If a translation is not found for the language of the context, the default language text will be returned instead
func ExpandWithCode ¶
func ExpandWithCode(ctx context.Context, key MessageKey, inserts ...interface{}) string
ExpandWithCode for use in error scenarios - returns a translated message with a "MSG012345:" prefix, translated the language of the context
func GetFieldType ¶
func GetStatusHint ¶
func NewError ¶
func NewError(ctx context.Context, msg ErrorMessageKey, inserts ...interface{}) error
NewError creates a new error
func RegisterPrefix ¶ added in v1.2.2
func RegisterPrefix(prefix, description string)
RegisterPrefix allows components to register a message prefix that is not known to the core Hyperledger FireFly codebase. The firefly-common repo does not provide the clash-protection for these prefixes - so if you're writing a new component within the FF OSS community then you should instead submit a PR to update the registeredPrefixes constant.
If you're writing a proprietary extension, or just using the Microservice framework for your own purposes, then you can register your own prefix with this function dynamically.
It must conform to being two upper case characters, then two numbers. You cannot use the `FF` prefix characters, as they are reserved for FireFly components
Types ¶
type ConfigMessageKey ¶
type ConfigMessageKey MessageKey
ConfigMessageKey is a special lookup string conforming to FireFly's rules for configuration descriptions and types
type ErrorMessageKey ¶
type ErrorMessageKey MessageKey
ErrorMessageKey is a special lookup string conforming to FireFly's rules for error message registration
type FFError ¶ added in v1.3.0
type FFError interface { error MessageKey() ErrorMessageKey HTTPStatus() int StackTrace() string }