github.com/safedep/dry@v0.0.0-20241016050132-a15651f0548b/apiguard/policies.go (about)

     1  package apiguard
     2  
     3  import "fmt"
     4  
     5  type policyInfo struct {
     6  	name string
     7  }
     8  
     9  func (p *policyInfo) Name() string {
    10  	return p.name
    11  }
    12  
    13  // Policy map generated from API Guard service
    14  // Must be kept in sync with the API Guard service
    15  var PolicyMap = map[string]policyInfo{
    16  	"developer": {
    17  		name: "developer",
    18  	},
    19  	"basic": {
    20  		name: "basic-user-group",
    21  	},
    22  	"standard": {
    23  		name: "standard",
    24  	},
    25  	"enterprise": {
    26  		name: "enterprise",
    27  	},
    28  }
    29  
    30  // This probably needs a revamp when we look at subscription
    31  // based policy mapping
    32  func GetBasicPolicyInfo() (policyInfo, error) {
    33  	if policy, ok := PolicyMap["basic"]; ok {
    34  		return policy, nil
    35  	}
    36  
    37  	return policyInfo{}, fmt.Errorf("policy not found")
    38  }