Documentation ¶
Index ¶
- Constants
- func ConvertNonRFC3339Date(dt string) (time.Time, error)
- func ConvertRFC3339Date(dt *string) (time.Time, error)
- func ConvertToOldIndexFormat(schemaList []indexSchema.Schema) []indexSchema.Schema
- func EncodeIndexIconToBase64(indexPath string, base64IndexPath string) ([]byte, error)
- func FilterDevfileDeprecated(index *[]indexSchema.Schema, deprecated, v1Index bool)
- func FilterDevfileSchemaVersion(index []indexSchema.Schema, minSchemaVersion, maxSchemaVersion *string) ([]indexSchema.Schema, error)
- func FilterDevfileVersion(index []indexSchema.Schema, minVersion, maxVersion *string) ([]indexSchema.Schema, error)
- func FilterLastModifiedDate(index []indexSchema.Schema, minLastModified *string, maxLastModified *string) ([]indexSchema.Schema, error)
- func GetClient(c *gin.Context) string
- func GetOptionalEnv(key string, defaultValue interface{}) interface{}
- func GetUser(c *gin.Context) string
- func IsArrayParameter(name string) bool
- func IsDateGreaterOrEqual(bound time.Time, current time.Time) bool
- func IsDateLowerOrEqual(bound time.Time, current time.Time) bool
- func IsEnabled(key string, defaultValue bool) bool
- func IsFieldParameter(name string) bool
- func IsHtmlRequested(acceptHeader []string) bool
- func IsIndirectCall(c *gin.Context) bool
- func IsInvalidLastModifiedDate(lastModifiedDate *string) bool
- func IsTelemetryEnabled() bool
- func IsWebClient(c *gin.Context) bool
- func MakeVersionMap(devfileIndex indexSchema.Schema) (map[string]indexSchema.Version, error)
- func ReadIndexPath(indexPath string) ([]indexSchema.Schema, error)
- func SetContext(c *gin.Context) *analytics.Context
- func StrPtrIsSet(ptr *string) bool
- func StructToMap[T any](s T) map[string]any
- func TrackEvent(event analytics.Message) error
- type FilterOptions
- type FilterResult
Constants ¶
const ( // Filters out entries with empty field ArrayFilterIfEmpty = iota // Omits entries from filtering with empty field (leaves entries in result) ArraySkipIfEmpty = iota // Parameter 'name' ParamName = "name" // Parameter 'displayName' ParamDisplayName = "displayName" // Parameter 'description' ParamDescription = "description" // Parameter 'icon' ParamIcon = "iconUri" // Parameter 'projectType' ParamProjectType = "projectType" // Parameter 'language' ParamLanguage = "language" // Parameter 'version' ParamVersion = "version" // Parameter 'schemaVersion' ParamSchemaVersion = "schemaVersion" // Parameter 'default' ParamDefault = "default" // Parameter 'git.url' ParamGitUrl = "gitUrl" // Parameter 'git.remoteName' ParamGitRemoteName = "gitRemoteName" // Parameter 'git.subDir' ParamGitSubDir = "gitSubDir" // Parameter 'git.revision' ParamGitRevision = "gitRevision" // Parameter 'provider' ParamProvider = "provider" // Parameter 'supportUrl' ParamSupportUrl = "supportUrl" // Parameter 'lastModified' ParamLastModified = "lastModified" // Parameter 'attributeNames' ArrayParamAttributeNames = "attributeNames" // Parameter 'tags' ArrayParamTags = "tags" // Parameter 'architectures' ArrayParamArchitectures = "arch" // Parameter 'resources' ArrayParamResources = "resources" // Parameter 'starterProjects' ArrayParamStarterProjects = "starterProjects" // Parameter 'links' ArrayParamLinks = "links" // Parameter 'commandGroups' ArrayParamCommandGroups = "commandGroups" // Parameter 'deploymentScopes' ArrayParamDeploymentScopes = "deploymentScopes" // Parameter 'gitRemoteNames' ArrayParamGitRemoteNames = "gitRemoteNames" // Parameter 'gitRemotes' ArrayParamGitRemotes = "gitRemotes" )
Variables ¶
This section is empty.
Functions ¶
func ConvertToOldIndexFormat ¶
func ConvertToOldIndexFormat(schemaList []indexSchema.Schema) []indexSchema.Schema
func EncodeIndexIconToBase64 ¶
EncodeIndexIconToBase64 encodes all index icons to base64 format given the index file path
func FilterDevfileDeprecated ¶
func FilterDevfileDeprecated(index *[]indexSchema.Schema, deprecated, v1Index bool)
FilterDevfileDeprecated inplace filters devfiles based on stack deprecation
func FilterDevfileSchemaVersion ¶
func FilterDevfileSchemaVersion(index []indexSchema.Schema, minSchemaVersion, maxSchemaVersion *string) ([]indexSchema.Schema, error)
FilterDevfileSchemaVersion filters devfiles based on schema version
func FilterDevfileVersion ¶
func FilterDevfileVersion(index []indexSchema.Schema, minVersion, maxVersion *string) ([]indexSchema.Schema, error)
FilterDevfileVersion filters devfiles based on stack version
func FilterLastModifiedDate ¶
func FilterLastModifiedDate(index []indexSchema.Schema, minLastModified *string, maxLastModified *string) ([]indexSchema.Schema, error)
FilterLastModifiedDate filters based on the last modified date of a stack or sample
func GetOptionalEnv ¶
func GetOptionalEnv(key string, defaultValue interface{}) interface{}
GetOptionalEnv gets the optional environment variable
func IsArrayParameter ¶
func IsEnabled ¶
IsEnabled return value of a boolean environment variable, if environment variable has non-boolean typed value returns default value
func IsFieldParameter ¶
func IsHtmlRequested ¶
IsHtmlRequested checks the accept header if html has been requested
func IsIndirectCall ¶
IsIndirectCall determines if a request is made from an internal client
func IsTelemetryEnabled ¶
func IsTelemetryEnabled() bool
func IsWebClient ¶
IsWebClient determines if the event is coming from the registry viewer or DevConsole client.
func MakeVersionMap ¶
func MakeVersionMap(devfileIndex indexSchema.Schema) (map[string]indexSchema.Version, error)
MakeVersionMap creates a map of versions for a given devfile index schema.
func ReadIndexPath ¶
func ReadIndexPath(indexPath string) ([]indexSchema.Schema, error)
ReadIndexPath reads the index from the path and unmarshalls it into the index
func SetContext ¶
SetContext suppresses the collection of IP addresses in Segment but infers the country code from the HTTP `Accept-Language` header
func StrPtrIsSet ¶
StrPtrIsSet checks if string pointer is set to a value
func StructToMap ¶
StructToMap converts any struct into a map
func TrackEvent ¶
func TrackEvent(event analytics.Message) error
TrackEvent tracks event for telemetry
Types ¶
type FilterOptions ¶
type FilterOptions[T any] struct { GetFromIndexField func(*indexSchema.Schema) T GetFromVersionField func(*indexSchema.Version) T FilterOutEmpty bool V1Index bool }
FilterOptions provides filtering options to filters operations
type FilterResult ¶
type FilterResult struct { // Name of filter Name string // Index schema result Index []indexSchema.Schema // First error returned in result Error error }
FilterResult result entity of filtering the index schema
func AndFilter ¶
func AndFilter(results ...*FilterResult) FilterResult
AndFilter filters results of given filters to only overlapping results
func FilterDevfileStrArrayField ¶
func FilterDevfileStrArrayField(index []indexSchema.Schema, paramName string, requestedValues []string, v1Index bool) FilterResult
FilterDevfileStrArrayField filters devfiles based on an array field
func FilterDevfileStrField ¶
func FilterDevfileStrField(index []indexSchema.Schema, paramName, requestedValue string, v1Index bool) FilterResult
FilterDevfileStrField filters by given string field, returns unchanged index if given parameter name is unrecognized