cmd/alzlibtool/command/convert/policysetdefinition.go (24 lines of code) (raw):

// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package convert import ( "os" "github.com/Azure/alzlib/internal/tools/checker" "github.com/Azure/alzlib/internal/tools/checks" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armpolicy" "github.com/spf13/cobra" ) // policysetdefinitionCmd represents the policysetdefinition command. var policysetdefinitionCmd = cobra.Command{ Use: "policysetdefinition [flags] sourceDir destDir", Short: "Convert policy set definitions to the format required by alzlib.", Long: `Reads policy set definitions from the Enterprise-Scale repo and converts to the format required by alzlib.`, Args: cobra.MatchAll( cobra.ExactArgs(2), ), Run: func(cmd *cobra.Command, args []string) { valid := checker.NewValidator(checks.CheckResourceTypeIsCorrect) err := convertFiles[armpolicy.SetDefinition](args[0], args[1], cmd, valid) if err != nil { cmd.PrintErrf("%s policy definintion conversion error: %v\n", cmd.ErrPrefix(), err) os.Exit(1) } }, }