github.com/grailbio/base@v0.0.11/cmd/grail-role-group/description.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  )
     7  
     8  // description generates a standard description for the group. It assumes the
     9  // group name for <account>/<role> is <account>-<role>-<type>@grailbio.com.
    10  func description(group string) string {
    11  	if strings.HasSuffix(group, "-aws-role@grailbio.com") {
    12  		v := strings.SplitN(strings.TrimSuffix(group, "-aws-role@grailbio.com"), "-", 2)
    13  		if len(v) != 2 {
    14  			return ""
    15  		}
    16  		return fmt.Sprintf("Please request access to this group if you need access to the %s/%s role account.", v[0], v[1])
    17  	} else if strings.HasSuffix(group, "-ticket@grailbio.com") {
    18  		v := strings.TrimSuffix(group, "-ticket@grailbio.com")
    19  		return fmt.Sprintf("Please request access to this group if you need access to the ticket %s.", v)
    20  	} else {
    21  		return ""
    22  	}
    23  }