src/server/enterprise/cmds/cmds.go
func GetStateCmd(noMetrics, noPortForwarding *bool) *cobra.Command {
	getState := &cobra.Command{
		Short: "Check whether the Pachyderm cluster has enterprise features " +
			"activated",
		Long: "Check whether the Pachyderm cluster has enterprise features " +
			"activated",
		Run: cmdutil.Run(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()
			resp, err := c.Enterprise.GetState(c.Ctx(), &enterprise.GetStateRequest{})
			if err != nil {
				return err
			}
			if resp.State == enterprise.State_NONE {
				fmt.Println("No Pachyderm Enterprise token was found")
				return nil
			}
			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("Pachyderm Enterprise token state: %s\nExpiration: %s\n",
				resp.State.String(), ts.String())
			return nil
		}),
	}
	return cmdutil.CreateAlias(getState, "enterprise get-state")
}
func GetStateCmd(noMetrics, noPortForwarding *bool) *cobra.Command {
	getState := &cobra.Command{
		Short: "Check whether the Pachyderm cluster has enterprise features " +
			"activated",
		Long: "Check whether the Pachyderm cluster has enterprise features " +
			"activated",
		Run: cmdutil.Run(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()
			resp, err := c.Enterprise.GetState(c.Ctx(), &enterprise.GetStateRequest{})
			if err != nil {
				return err
			}
			if resp.State == enterprise.State_NONE {
				fmt.Println("No Pachyderm Enterprise token was found")
				return nil
			}
			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("Pachyderm Enterprise token state: %s\nExpiration: %s\n",
				resp.State.String(), ts.String())
			return nil
		}),
	}
	return cmdutil.CreateAlias(getState, "enterprise get-state")
}
func GetStateCmd ( noMetrics , noPortForwarding * bool ) * cobra . Command { getState := & cobra . Command { Short : " " + " " , Long : " " + " " , Run : cmdutil . Run ( func ( args [ ] string ) error { c , err := client . NewOnUserMachine ( ! * noMetrics , ! * noPortForwarding , " " ) if err != nil { return fmt . Errorf ( " " , err . Error ( ) ) } defer c . Close ( ) resp , err := c . Enterprise . GetState ( c . Ctx ( ) , & enterprise . GetStateRequest { } ) if err != nil { return err } if resp . State == enterprise . State_NONE { fmt . Println ( " " ) return nil } ts , err := types . TimestampFromProto ( resp . Info . Expires ) if err != nil { return fmt . Errorf ( " " + " " , err . Error ( ) ) } fmt . Printf ( " \n \n " , resp . State . String ( ) , ts . String ( ) ) return nil } ) , } return cmdutil . CreateAlias ( getState , " " ) }
// GetStateCmd 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
GetStateCmd 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