src/server/enterprise/cmds/cmds.go
func ActivateCmd(noMetrics, noPortForwarding *bool) *cobra.Command {
	var expires string
	activate := &cobra.Command{
		Use: "{{alias}} <activation-code>",
		Short: "Activate the enterprise features of Pachyderm with an activation " +
			"code",
		Long: "Activate the enterprise features of Pachyderm with an activation " +
			"code",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			c, err := client.NewOnUserMachine(!*noMetrics, !*noPortForwarding, "user")
			if err != nil {
				return fmt.Errorf("could not connect: %s", err.Error())
			}
			defer c.Close()
			req := &enterprise.ActivateRequest{}
			req.ActivationCode = args[0]
			if expires != "" {
				t, err := parseISO8601(expires)
				if err != nil {
					return fmt.Errorf("could not parse the timestamp \"%s\": %s", expires, err.Error())
				}
				req.Expires, err = types.TimestampProto(t)
				if err != nil {
					return fmt.Errorf("error converting expiration time \"%s\"; %s", t.String(), err.Error())
				}
			}
			resp, err := c.Enterprise.Activate(c.Ctx(), req)
			if err != nil {
				return err
			}
			ts, err := types.TimestampFromProto(resp.Info.Expires)
			if err != nil {
				return fmt.Errorf("Activation request succeeded, but could not "+
					"convert token expiration time to a timestamp: %s", err.Error())
			}
			fmt.Printf("Activation succeeded. Your Pachyderm Enterprise token "+
				"expires %s\n", ts.String())
			return nil
		}),
	}
	activate.PersistentFlags().StringVar(&expires, "expires", "", "A timestamp "+
		"indicating when the token provided above should expire (formatted as an "+
		"RFC 3339/ISO 8601 datetime). This is only applied if it's earlier than "+
		"the signed expiration time encoded in 'activation-code', and therefore "+
		"is only useful for testing.")

	return cmdutil.CreateAlias(activate, "enterprise activate")
}
func ActivateCmd(noMetrics, noPortForwarding *bool) *cobra.Command {
	var expires string
	activate := &cobra.Command{
		Use: "{{alias}} <activation-code>",
		Short: "Activate the enterprise features of Pachyderm with an activation " +
			"code",
		Long: "Activate the enterprise features of Pachyderm with an activation " +
			"code",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			c, err := client.NewOnUserMachine(!*noMetrics, !*noPortForwarding, "user")
			if err != nil {
				return fmt.Errorf("could not connect: %s", err.Error())
			}
			defer c.Close()
			req := &enterprise.ActivateRequest{}
			req.ActivationCode = args[0]
			if expires != "" {
				t, err := parseISO8601(expires)
				if err != nil {
					return fmt.Errorf("could not parse the timestamp \"%s\": %s", expires, err.Error())
				}
				req.Expires, err = types.TimestampProto(t)
				if err != nil {
					return fmt.Errorf("error converting expiration time \"%s\"; %s", t.String(), err.Error())
				}
			}
			resp, err := c.Enterprise.Activate(c.Ctx(), req)
			if err != nil {
				return err
			}
			ts, err := types.TimestampFromProto(resp.Info.Expires)
			if err != nil {
				return fmt.Errorf("Activation request succeeded, but could not "+
					"convert token expiration time to a timestamp: %s", err.Error())
			}
			fmt.Printf("Activation succeeded. Your Pachyderm Enterprise token "+
				"expires %s\n", ts.String())
			return nil
		}),
	}
	activate.PersistentFlags().StringVar(&expires, "expires", "", "A timestamp "+
		"indicating when the token provided above should expire (formatted as an "+
		"RFC 3339/ISO 8601 datetime). This is only applied if it's earlier than "+
		"the signed expiration time encoded in 'activation-code', and therefore "+
		"is only useful for testing.")

	return cmdutil.CreateAlias(activate, "enterprise activate")
}
// ActivateCmd returns a cobra.Command to activate the enterprise features of
// Pachyderm within a Pachyderm cluster. All repos will go from
// publicly-accessible to accessible only by the owner, who can subsequently add
// users