etcdctl/ctlv3/command/lease_command.go
func leaseKeepAliveCommandFunc(cmd *cobra.Command, args []string) {
	if len(args) != 1 {
		ExitWithError(ExitBadArgs, fmt.Errorf("lease keep-alive command needs lease ID as argument"))
	}

	id := leaseFromArgs(args[0])

	if leaseKeepAliveOnce {
		respc, kerr := mustClientFromCmd(cmd).KeepAliveOnce(context.TODO(), id)
		if kerr != nil {
			ExitWithError(ExitBadConnection, kerr)
		}
		display.KeepAlive(*respc)
		return
	}

	respc, kerr := mustClientFromCmd(cmd).KeepAlive(context.TODO(), id)
	if kerr != nil {
		ExitWithError(ExitBadConnection, kerr)
	}
	for resp := range respc {
		display.KeepAlive(*resp)
	}

	if _, ok := (display).(*simplePrinter); ok {
		fmt.Printf("lease %016x expired or revoked.\n", id)
	}
}
func leaseKeepAliveCommandFunc(cmd *cobra.Command, args []string) {
	if len(args) != 1 {
		ExitWithError(ExitBadArgs, fmt.Errorf("lease keep-alive command needs lease ID as argument"))
	}

	id := leaseFromArgs(args[0])

	if leaseKeepAliveOnce {
		respc, kerr := mustClientFromCmd(cmd).KeepAliveOnce(context.TODO(), id)
		if kerr != nil {
			ExitWithError(ExitBadConnection, kerr)
		}
		display.KeepAlive(*respc)
		return
	}

	respc, kerr := mustClientFromCmd(cmd).KeepAlive(context.TODO(), id)
	if kerr != nil {
		ExitWithError(ExitBadConnection, kerr)
	}
	for resp := range respc {
		display.KeepAlive(*resp)
	}

	if _, ok := (display).(*simplePrinter); ok {
		fmt.Printf("lease %016x expired or revoked.\n", id)
	}
}
func leaseKeepAliveCommandFunc ( cmd * cobra . Command , args [ ] string ) { if len ( args ) != 1 { ExitWithError ( ExitBadArgs , fmt . Errorf ( " " ) ) } id := leaseFromArgs ( args [ 0 ] ) if leaseKeepAliveOnce { respc , kerr := mustClientFromCmd ( cmd ) . KeepAliveOnce ( context . TODO ( ) , id ) if kerr != nil { ExitWithError ( ExitBadConnection , kerr ) } display . KeepAlive ( * respc ) return } respc , kerr := mustClientFromCmd ( cmd ) . KeepAlive ( context . TODO ( ) , id ) if kerr != nil { ExitWithError ( ExitBadConnection , kerr ) } for resp := range respc { display . KeepAlive ( * resp ) } if _ , ok := ( display ) . ( * simplePrinter ) ; ok { fmt . Printf ( " \n " , id ) } }
// leaseKeepAliveCommandFunc executes the "lease keep-alive" command.
leaseKeepAliveCommandFunc executes the lease keep - alive command .