Add API/CLI for managed groups (#1265)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-06-02 14:05:10 -04:00
1 parent 179a49657e
commit 306d4fb4d3
42 files changed
+1481 -40

No files matched your search

+33
View File
@@ -11,6 +11,7 @@ import (
"github.com/hashicorp/boundary/internal/gen/controller/api/resources/hostcatalogs"
"github.com/hashicorp/boundary/internal/gen/controller/api/resources/hosts"
"github.com/hashicorp/boundary/internal/gen/controller/api/resources/hostsets"
"github.com/hashicorp/boundary/internal/gen/controller/api/resources/managedgroups"
"github.com/hashicorp/boundary/internal/gen/controller/api/resources/roles"
"github.com/hashicorp/boundary/internal/gen/controller/api/resources/scopes"
"github.com/hashicorp/boundary/internal/gen/controller/api/resources/sessions"
@@ -87,6 +88,10 @@ type structInfo struct {
// conveyed within the item itself
extraOptions []fieldInfo
// fieldOverrides allows overriding some field behavior without making them
// "new" fields like with extraOptions
fieldOverrides []fieldInfo
// createResponseTypes controls for which structs response types are created
createResponseTypes bool
@@ -298,6 +303,34 @@ var inputStructs = []*structInfo{
versionEnabled: true,
createResponseTypes: true,
},
// Managed Groups
{
inProto: &managedgroups.OidcManagedGroupAttributes{},
outFile: "managedgroups/oidc_managed_group_attributes.gen.go",
subtypeName: "OidcManagedGroup",
fieldOverrides: []fieldInfo{
{
Name: "Filter",
SkipDefault: true,
},
},
},
{
inProto: &managedgroups.ManagedGroup{},
outFile: "managedgroups/managedgroups.gen.go",
templates: []*template.Template{
clientTemplate,
createTemplate,
readTemplate,
updateTemplate,
deleteTemplate,
listTemplate,
},
pathArgs: []string{"managed-group"},
parentTypeName: "auth-method",
versionEnabled: true,
createResponseTypes: true,
},
// Auth Tokens
{
inProto: &authtokens.AuthToken{},
+13
View File
@@ -123,6 +123,19 @@ func fillTemplates() {
}
optionsMap[input.Package] = optionMap
}
// Override some defined options
if len(in.fieldOverrides) > 0 && optionsMap != nil {
for _, override := range in.fieldOverrides {
inOpts := optionsMap[input.Package]
if inOpts != nil {
if override.SkipDefault {
fieldInfo := inOpts[override.Name]
fieldInfo.SkipDefault = true
inOpts[override.Name] = fieldInfo
}
}
}
}
outFile, err := filepath.Abs(fmt.Sprintf("%s/%s", os.Getenv("API_GEN_BASEPATH"), in.outFile))
if err != nil {