github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/providers/provider.go (about) 1 package providers 2 3 import ( 4 "strings" 5 6 "golang.org/x/text/cases" 7 "golang.org/x/text/language" 8 ) 9 10 // Provider is the provider that the check applies to 11 type Provider string 12 13 const ( 14 UnknownProvider Provider = "" 15 AWSProvider Provider = "aws" 16 AzureProvider Provider = "azure" 17 CustomProvider Provider = "custom" 18 DigitalOceanProvider Provider = "digitalocean" 19 GeneralProvider Provider = "general" 20 GitHubProvider Provider = "github" 21 GoogleProvider Provider = "google" 22 KubernetesProvider Provider = "kubernetes" 23 OracleProvider Provider = "oracle" 24 OpenStackProvider Provider = "openstack" 25 NifcloudProvider Provider = "nifcloud" 26 CloudStackProvider Provider = "cloudstack" 27 ) 28 29 func RuleProviderToString(provider Provider) string { 30 return strings.ToUpper(string(provider)) 31 } 32 33 func (p Provider) DisplayName() string { 34 switch p { 35 case "aws": 36 return strings.ToUpper(string(p)) 37 case "digitalocean": 38 return "Digital Ocean" 39 case "github": 40 return "GitHub" 41 case "openstack": 42 return "OpenStack" 43 case "cloudstack": 44 return "Cloudstack" 45 default: 46 return cases.Title(language.English).String(strings.ToLower(string(p))) 47 } 48 } 49 func (p Provider) ConstName() string { 50 return strings.ReplaceAll(p.DisplayName(), " ", "") 51 }