mirror of https://github.com/databricks/cli.git
30 lines
818 B
Go
30 lines
818 B
Go
package resources
|
|
|
|
import "fmt"
|
|
|
|
// Permission holds the permission level setting for a single principal.
|
|
// Multiple of these can be defined on any resource.
|
|
type Permission struct {
|
|
Level string `json:"level"`
|
|
|
|
UserName string `json:"user_name,omitempty"`
|
|
ServicePrincipalName string `json:"service_principal_name,omitempty"`
|
|
GroupName string `json:"group_name,omitempty"`
|
|
}
|
|
|
|
func (p Permission) String() string {
|
|
if p.UserName != "" {
|
|
return fmt.Sprintf("level: %s, user_name: %s", p.Level, p.UserName)
|
|
}
|
|
|
|
if p.ServicePrincipalName != "" {
|
|
return fmt.Sprintf("level: %s, service_principal_name: %s", p.Level, p.ServicePrincipalName)
|
|
}
|
|
|
|
if p.GroupName != "" {
|
|
return fmt.Sprintf("level: %s, group_name: %s", p.Level, p.GroupName)
|
|
}
|
|
|
|
return fmt.Sprintf("level: %s", p.Level)
|
|
}
|