Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BlueprintsCmd = &cobra.Command{ Use: "blueprints", Short: "Aperture Blueprints", Long: ` Use this command to pull, list, remove and generate Aperture Policy resources using the Aperture Blueprints.`, PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { userHomeDir, err := os.UserHomeDir() if err != nil { return err } blueprintsCacheRoot = filepath.Join(userHomeDir, ".aperturectl", "blueprints") err = os.MkdirAll(blueprintsCacheRoot, os.ModePerm) if err != nil { return err } if blueprintsURI != "" && blueprintsVersion != defaultBlueprintsVersion { return errors.New("either the URI or version should be set, not both") } if blueprintsURI == "" { if blueprintsVersion == defaultBlueprintsVersion { blueprintsVersion, err = utils.ResolveLatestVersion() if err != nil { return err } } blueprintsURI = fmt.Sprintf("%s@%s", defaultBlueprintsRepo, blueprintsVersion) } else { var blueprintsURL *url.URL blueprintsURL, err = url.Parse(blueprintsURI) if err != nil { blueprintsURI, err = filepath.Abs(blueprintsURI) if err != nil { return err } } else { blueprintsURI = blueprintsURL.String() } } dirName := strings.ReplaceAll(blueprintsURI, "/", "_") blueprintsURIRoot = filepath.Join(blueprintsCacheRoot, dirName) err = os.MkdirAll(blueprintsURIRoot, os.ModePerm) if err != nil { return err } if !skipPull && cmd.Use != "remove" { err = utils.PullSource(blueprintsURIRoot, blueprintsURI) if err != nil { return err } } else { log.Debug().Msg("skipping pulling blueprints") } blueprintsDir = filepath.Join(blueprintsURIRoot, utils.GetRelPath(blueprintsURIRoot)) blueprintsDir, err = filepath.EvalSymlinks(blueprintsDir) if err != nil { return err } return nil }, PersistentPostRun: func(_ *cobra.Command, _ []string) { utils.Unlock(blueprintsURIRoot) }, }
BlueprintsCmd is the root command for blueprints.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.