Documentation ¶
Overview ¶
qualifiedname.go
qualifiedname.go
Index ¶
- Constants
- Variables
- func AddDependentAnnotation(existingAnnotation map[string]interface{}, ...) (whisk.KeyValue, error)
- func CheckLicense(license string) bool
- func ConvertInterfaceMap(mapIn map[interface{}]interface{}) map[string]interface{}
- func ConvertInterfaceValue(value interface{}) interface{}
- func ConvertMapToJSONString(name string, mapIn interface{}) string
- func FileExists(file string) bool
- func FormatStructAsJsonString(a interface{}) string
- func GenerateManagedAnnotation(projectName string, filePath string) (whisk.KeyValue, error)
- func GetActionFromActionRecords(records []ActionRecord, packageName string, actionName string) *whisk.Action
- func GetDeploymentFilePath(projectPath string) string
- func GetHomeDirectory() string
- func GetJSONFromStrings(content []string, keyValueFormat bool) (interface{}, error)
- func GetManifestFilePath(projectPath string) string
- func IsDirectory(filePath string) bool
- func IsFeedAction(trigger *whisk.Trigger) (string, bool)
- func LicenseLocalValidation(license string) bool
- func LicenseRemoteValidation(license string) bool
- func LimitsLogsizeValidation(logsize *int) bool
- func LimitsMemoryValidation(memory *int) bool
- func LimitsTimeoutValidation(timeout *int) bool
- func MayExists(file string) bool
- func NotSupportLimits(value *int, name string)
- func PrettyJSON(rawData interface{}) (string, error)
- func Read(url string) ([]byte, error)
- func ReadProps(path string) (map[string]string, error)
- func WriteFile(filename string, content string) error
- func WriteProps(path string, props map[string]string) error
- type ActionRecord
- type Comparable
- type ContentReader
- type Include
- type LicenseItem
- type LicenseJSON
- type LocalReader
- type ManagedAnnotation
- type QualifiedName
- type RuleRecord
- type TriggerRecord
- type URLReader
- type WskDeployFlags
- type ZipWriter
Constants ¶
const ( MANAGED = "whisk-managed" OPENWHISK = "OpenWhisk" NULL = "golang\000" OW_PROJECT_NAME = "projectName" OW_PROJECT_HASH = "projectHash" OW_PROJECT_DEPS = "projectDeps" OW_File = "file" )
const ( DEFAULT_HTTP_TIMEOUT = 60 DEFAULT_PROJECT_PATH = "." HTTP_FILE_EXTENSION = "http" // name of manifest and deployment files ManifestFileNameYaml = "manifest.yaml" ManifestFileNameYml = "manifest.yml" DeploymentFileNameYaml = "deployment.yaml" DeploymentFileNameYml = "deployment.yml" )
const ONE_DIR_UP = "../"
const PATH_WILDCARD = "*"
Variables ¶
var LocalLicenseRecords = map[string][]string{
"APACHE": {"1.0", "1.1", "2.0"},
"LGPL": {"2.0", "2.1", "3.0"},
"GPL": {"1.0", "2.0", "3.0"},
"MPL": {"1.0", "1.1", "2.0", "2.0-no-copyleft-exception"},
"BSD": {"2-Clause", "2-Clause-FreeBSD", "2-Clause-NetBSD", "3-Clause", "3-Clause-Clear", "3-Clause-No-Nuclear-License", "3-Clause-No-Nuclear-License-2014", "3-Clause-No-Nuclear-Warranty", "3-Clause-Attribution", "4-Clause", "Protection", "Source-Code", "4-Clause-UC", "3-Clause-LBNL"},
"0BSD": {""},
"GFDL": {"1.0", "1.2", "1.3"},
"AGPL": {"3.0"},
"MIT": {"", "feh", "enna", "advertising", "CMU"},
"AFL": {"1.1", "1.2", "2.0", "2.1", "3.0"},
"APSL": {"1.0", "1.1", "1.2", "2.0"},
"EPL": {"1.0"},
"OSL": {"1.0", "1.1", "2.0", "2.1", "3.0"},
"PHP": {"3.0", "3.01"},
}
var RemoteLicenseURL = "https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json"
Functions ¶
func AddDependentAnnotation ¶
func CheckLicense ¶
Check if the license is valid Check local data record at first Then check remote json data
func ConvertInterfaceMap ¶
func ConvertInterfaceMap(mapIn map[interface{}]interface{}) map[string]interface{}
func ConvertInterfaceValue ¶
func ConvertInterfaceValue(value interface{}) interface{}
func ConvertMapToJSONString ¶
TODO() add a Print function to wskprint that calls this and adds the label
func FileExists ¶
func FormatStructAsJsonString ¶
func FormatStructAsJsonString(a interface{}) string
func GetActionFromActionRecords ¶
func GetActionFromActionRecords(records []ActionRecord, packageName string, actionName string) *whisk.Action
func GetDeploymentFilePath ¶
func GetHomeDirectory ¶
func GetHomeDirectory() string
func GetJSONFromStrings ¶
TODO make generic and put into a separate JSON utils source file
func GetManifestFilePath ¶
func IsDirectory ¶
func LicenseLocalValidation ¶
Check if the license is in local license record If it is, return ture If it is not, return false
func LicenseRemoteValidation ¶
Check if license is one of validate license in https://github.com/spdx/license-list-data/blob/master/json/licenses.json If it is, return ture If it is not, return false
func LimitsLogsizeValidation ¶
if valid or nil, true or else, false
func LimitsMemoryValidation ¶
if valid or nil, true or else, false
func LimitsTimeoutValidation ¶
if valid or nil, true or else, false
func NotSupportLimits ¶
func PrettyJSON ¶
Types ¶
type ActionRecord ¶
ActionRecord is a container to keep track of a whisk action struct and a location filepath we use to map files and manifest declared actions
type Comparable ¶
Potentially complex structures(such as DeploymentProject, DeploymentPackage) could implement those interface which is convenient for put, get subtract in containers etc.
type ContentReader ¶
type ContentReader struct { URLReader LocalReader }
agnostic util reader to fetch content from web or local path or potentially other places.
type LicenseItem ¶
type LicenseJSON ¶
type LicenseJSON struct { Description string `json:"licenseListVersion"` Licenses []LicenseItem `json:"licenses"` ReleaseDate string `json:"releaseDate"` }
type LocalReader ¶
type LocalReader struct { }
type ManagedAnnotation ¶
type ManagedAnnotation struct { ProjectName string `json:"projectName"` ProjectHash string `json:"projectHash"` File string `json:"file"` Deps whisk.KeyValueArr `json:"projectDeps"` }
type QualifiedName ¶
func ParseQualifiedName ¶
func ParseQualifiedName(name string, defaultNamespace string) (QualifiedName, error)
from go whisk cli
Parse a (possibly fully qualified) resource name into namespace and name components. If the given qualified name isNone, then this is a default qualified name and it is resolved from properties. If the namespace is missing from the qualified name, the namespace is also resolved from the property file.
Return a qualifiedName struct ¶
Examples:
foo => qName {namespace: "_", entityName: foo} pkg/foo => qName {namespace: "_", entityName: pkg/foo} /ns/foo => qName {namespace: ns, entityName: foo} /ns/pkg/foo => qName {namespace: ns, entityName: pkg/foo}
type RuleRecord ¶
type TriggerRecord ¶
type WskDeployFlags ¶
type WskDeployFlags struct { ApiHost string // OpenWhisk API host Auth string // OpenWhisk API key Namespace string ApiVersion string // OpenWhisk version CfgFile string CliVersion string CliGitCommit string CliBuildDate string ProjectPath string DeploymentPath string ManifestPath string Preview bool Strict bool // strict flag to support user defined runtime version. Key string Cert string Managed bool // OpenWhisk Managed Deployments ProjectName string // Project name ApigwAccessToken string //ApigwTenantId string // APIGW_TENANT_ID (IAM namespace resource identifier); not avail. as CLI flag yet Verbose bool Trace bool Sync bool Report bool Param []string ParamFile string }
var Flags WskDeployFlags
func (*WskDeployFlags) Format ¶
func (flags *WskDeployFlags) Format() string
TODO turn this into a generic utility for formatting any struct