Documentation ¶
Overview ¶
* Copyright (C) 2011-2020 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Constants
- func AlterUploadPath(rawPath, storeKey, newReleaseNumber string) string
- func ByteCountSI(b int64) string
- func ConcurrentRun(numWorkers int, artifacts map[string][]string, ...) bool
- func Contains(s []string, str string) bool
- func DefaultAuthenticator(request *http.Request) error
- func DeleteFoloRecord(indyURL, foloRecordId string) bool
- func DownloadFile(url, storeFileName string) (bool, int)
- func DownloadFileByProxy(url, storeFileName, indyProxyUrl, user, pass string) bool
- func DownloadRepo(gitURL string) string
- func DownloadUploadFileForCache(url, cacheFileName string) bool
- func FileOrDirExists(name string) bool
- func FileSize(fileLoc string) int64
- func GenerateRandomBuildName() string
- func GetAlignLog(pncBaseUrl, buildId string) string
- func GetFileContentType(out *os.File) (string, error)
- func GetFoloRecordAsString(indyURL, foloRecordId string) string
- func GetHost(URLString string) string
- func GetIndyContentUrl(indyBaseUrl, packageType, repoType, repoName, aPath string) string
- func GetPort(URLString string) string
- func GetRespAsJSONType(url string, jsonType interface{}) error
- func GetRespAsPlaintext(url string) (string, error)
- func HTTPRequest(url, method string, auth Authenticate, needResult bool, dataPayload io.Reader, ...) (string, int, bool)
- func HttpExists(url string) bool
- func IsEmptyString(str string) bool
- func IsMetadata(path, storeKey string) bool
- func IsRegularFile(fileLoc string) bool
- func KeycloakAuthenticator(request *http.Request) error
- func Md5Check(fileLoc, md5str string) bool
- func RePanic(e error)
- func ReadByteFromFile(fileLoc string) []byte
- func SealFoloRecord(indyURL, foloRecordId string) bool
- func StoreKeyToPath(storeKey string) string
- func UploadFile(uploadUrl, cacheFile string) bool
- func ValidateTargetIndy(targetIndy string) (string, bool)
- func ValidateTargetIndyOrExit(targetIndy string) (string, bool)
- type AccessToken
- type Authenticate
- type HTTPError
- type MultiError
- type ProxyConfig
- type TrackedContent
- type TrackedContentEntry
- type TrackingKey
Constants ¶
const ( ContentTypePlain = "text/plain" ContentTypeHTML = "text/html" ContentTypeJSON = "application/json" ContentTypeXML = "application/xml" ContentTypeZip = "application/zip" ContentTypeStream = "application/octet-stream" CottentTypeJar = "application/java-archive" )
ContentType for RFC http content type (parts)
const ( StatusOK = http.StatusOK StatusCreated = http.StatusCreated StatusAccepted = http.StatusAccepted StatusNoContent = http.StatusNoContent StatusMultipleChoices = http.StatusMultipleChoices StatusMovedPermanently = http.StatusMovedPermanently StatusFound = http.StatusFound StatusSeeOther = http.StatusSeeOther StatusNotModified = http.StatusNotModified StatusUseProxy = http.StatusUseProxy StatusBadRequest = http.StatusBadRequest StatusForbidden = http.StatusForbidden StatusNotFound = http.StatusNotFound StatusMethodNotAllowed = http.StatusMethodNotAllowed StatusNotAcceptable = http.StatusNotAcceptable StatusProxyAuthRequired = http.StatusProxyAuthRequired StatusRequestTimeout = http.StatusRequestTimeout StatusConflict = http.StatusConflict StatusInternalServerError = http.StatusInternalServerError StatusNotImplemented = http.StatusNotImplemented StatusBadGateway = http.StatusBadGateway StatusGatewayTimeout = http.StatusGatewayTimeout StatusUnknown = -1 )
Status code for RFC http response status code (parts)
const ( MethodGet = http.MethodGet MethodHead = http.MethodHead MethodPost = http.MethodPost MethodPut = http.MethodPut MethodPatch = http.MethodPatch MethodDelete = http.MethodDelete MethodOptions = http.MethodOptions )
Methods for RFC http methods
const ( KeycloakServer = "KEYCLOAK_SERVER_URL" KeycloakRealm = "KEYCLOAK_REALM" KeycloakResource = "KEYCLOAK_CLIENT_ID" KeycloakCredential = "KEYCLOAK_CLIENT_CREDENTIAL" )
const ( BUILD_TEST_ = "build-test-" ENVAR_TEST_MOUNT_PATH = "TEST_MOUNT_PATH" MAVEN_METADATA_XML = "maven-metadata.xml" REDHAT_ = "redhat-" )
const DATA_TIME = "2006-01-02 15:04:05"
const NotStoreFile = ""
const (
TRACKING_SUFFIX = "+tracking"
)
Variables ¶
This section is empty.
Functions ¶
func AlterUploadPath ¶
func ByteCountSI ¶
func ConcurrentRun ¶
func DefaultAuthenticator ¶
func DeleteFoloRecord ¶
func DownloadFile ¶
func DownloadFileByProxy ¶
func DownloadRepo ¶
func FileOrDirExists ¶
func GenerateRandomBuildName ¶
func GenerateRandomBuildName() string
generate a random 5 digit number for a build repo like "build-test-9xxxx"
func GetAlignLog ¶
func GetFoloRecordAsString ¶
func GetIndyContentUrl ¶
func GetRespAsJSONType ¶
func GetRespAsPlaintext ¶
func HTTPRequest ¶
func HTTPRequest(url, method string, auth Authenticate, needResult bool, dataPayload io.Reader, headers map[string]string, filename string, verbose bool) (string, int, bool)
HTTPRequest do raw http request with method, input data and headers. If url is trying to access bin content(like file), can use filename parameter to specify where to store this file as. Parameters: request url; request method; authentication method; if need response content; data payload to send(POST or PUT); headers to send; the file location to store if response is a binary download; if print verbose log message for debugging Returns: content as string, response status code as int, if succeeded as bool
func HttpExists ¶
func IsMetadata ¶
func IsRegularFile ¶
func KeycloakAuthenticator ¶
func ReadByteFromFile ¶
func SealFoloRecord ¶
func StoreKeyToPath ¶
func UploadFile ¶
func ValidateTargetIndy ¶
Types ¶
type AccessToken ¶
type Authenticate ¶
func DecideAuthenticator ¶
func DecideAuthenticator() Authenticate
type MultiError ¶
type MultiError struct {
// contains filtered or unexported fields
}
func (*MultiError) Append ¶
func (e *MultiError) Append(err string)
func (*MultiError) Error ¶
func (e *MultiError) Error() string
type ProxyConfig ¶
type ProxyConfig struct {
ProxyUrl, User, Pass string
}
type TrackedContent ¶
type TrackedContent struct { Uploads []TrackedContentEntry `json:"uploads"` Downloads []TrackedContentEntry `json:"downloads"` TrackingKey TrackingKey `json:"key"` }
func GetFoloRecord ¶
func GetFoloRecord(indyURL, foloRecordId string) TrackedContent
func GetFoloRecordFromFile ¶
func GetFoloRecordFromFile(fileLoc string) TrackedContent
type TrackedContentEntry ¶
type TrackedContentEntry struct { AccessChannel string `json:"accessChannel"` Path string `json:"path"` OriginUrl string `json:"originUrl"` LocalUrl string `json:"localUrl"` Effect string `json:"effect"` Md5 string `json:"md5"` Sha256 string `json:"sha256"` Sha1 string `json:"sha1"` Size int64 `json:"size"` Timestamps []int64 `json:"timestamps"` StoreKey string `json:"storeKey"` }
type TrackingKey ¶
type TrackingKey struct {
Id string `json:"id"`
}